Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charset list is not displayed correctly in terminal #39

Open
zongou opened this issue Feb 8, 2023 · 6 comments
Open

Charset list is not displayed correctly in terminal #39

zongou opened this issue Feb 8, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@zongou
Copy link

zongou commented Feb 8, 2023

Screenrecorder-2023-02-08-09-57-03-895.mp4

AnotherTerm version: MkIV-dev36
device: mi8(dipper)
android version: 10

@green-green-avk
Copy link
Owner

I need to find a way how to reproduce it in my environment...
Is it either the original Android 10 from the vendor or something custom?

In which version it worked properly?
It could become broken since MkIIIv65 (with the androidx library update) but it was a long time ago.

@green-green-avk green-green-avk self-assigned this Feb 8, 2023
@green-green-avk green-green-avk added the bug Something isn't working label Feb 8, 2023
@zongou
Copy link
Author

zongou commented Feb 8, 2023

I need to find a way how to reproduce it in my environment... Is it either the original Android 10 from the vendor or something custom?

In which version it worked properly? It could become broken since MkIIIv65 (with the androidx library update) but it was a long time ago.

My cellphone runs on MIUI, yes, heavily customized. But I think it's not relevant to that, I have tested it on nearly original Android os( not totally original) with virtual machine software(VMOS is its name), with it i have tested on android 9 and android 7, the view break on android 9 but works fine on android 7

@zongou
Copy link
Author

zongou commented Feb 8, 2023

Screenrecorder-2023-02-08.mp4

i selected charset GBK cause it seems obvious.
in this video at first i tested it on android 7.1, it does not break, then on android 9, it breaks, i think you can reproduce it on android verion >= 9

@green-green-avk
Copy link
Owner

green-green-avk commented Feb 8, 2023

Let's keep some track of reproducibility:

Affected:

  • Xiaomi Mi 8 / Android 10 MIUI
  • Unknown Android 9 build (MIUI?)

Not affected:

@green-green-avk
Copy link
Owner

green-green-avk commented Feb 14, 2023

Current implementation details

The character set menu is being opened here:

public void onMenuCharset(final View view) {
if (mSession == null)
return;
final int p = C.charsetList.indexOf(mSession.output.getCharset().name());
final ArrayAdapter<String> a = new ArrayAdapter<>(this,
R.layout.dialogmenu_entry, C.charsetList);
DialogUtils.wrapLeakageSafe(new AlertDialog.Builder(this)
.setSingleChoiceItems(a, p, (dialog, which) -> {
if (mSession == null)
return;
final String charsetStr = a.getItem(which);
try {
final Charset charset = Charset.forName(charsetStr);
mSession.input.setCharset(charset);
mSession.output.setCharset(charset);
} catch (final IllegalArgumentException e) {
Log.e("Charset", charsetStr, e);
}
refreshMenuPopup();
dialog.dismiss();
}).setCancelable(true).show(), null);
}

It uses layouts:

  • Android 4.2 and higher
    <?xml version="1.0" encoding="utf-8"?>
    <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/listPreferredItemHeightSmall"
    android:background="@drawable/bg_menu_checkable"
    android:gravity="center_vertical"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:textAppearance="?android:attr/textAppearanceListItemSmall"
    tools:text="Item" />
  • All other (derelict) devices
    <?xml version="1.0" encoding="utf-8"?>
    <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/listPreferredItemHeightSmall"
    android:background="@drawable/bg_menu_checkable"
    android:gravity="center_vertical"
    android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
    android:textAppearance="?android:attr/textAppearanceListItemSmall"
    tools:ignore="RtlHardcoded"
    tools:text="Item" />

The background is just a stateful color:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/colorAccentTr" android:state_checked="true" />
<item android:drawable="@color/colorAccentTr" android:state_activated="true" />
<item android:drawable="@android:color/transparent" />
</selector>

CheckedTextView here is automatically substituted by AppCompatCheckedTextView during inflation.

AlertDialog here is androidx.appcompat.app.AlertDialog

This MIUI behavior looks like a puzzle...

@zongou
Copy link
Author

zongou commented Feb 14, 2023

i have noticed the width of text changes. wish this helps

Screenrecorder-2023-02-14-12.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants