some fix, dri3, wps, readme, ...

This commit is contained in:
Caten
2024-09-21 11:43:14 +08:00
parent a117050fde
commit 49c2377e46
14 changed files with 347 additions and 160 deletions

View File

@@ -37,7 +37,7 @@ import com.example.tiny_computer.BuildConfig;
@Keep @SuppressLint({"StaticFieldLeak", "UnsafeDynamicallyLoadedCode"})
public class CmdEntryPoint extends ICmdEntryInterface.Stub {
public static final String ACTION_START = "com.termux.x11.CmdEntryPoint.ACTION_START";
public static final int PORT = 7892;
public static final int PORT = 7897;
public static final byte[] MAGIC = "0xDEADBEEF".getBytes();
private static final Handler handler;
public static Context ctx;

View File

@@ -736,9 +736,28 @@ public class LoriePreferences extends AppCompatActivity implements PreferenceFra
return getArrayItems(values, ctx.getResources());
}
// private String[] getArrayItems(int resourceId, Resources resources) {
// ArrayList<String> itemList = new ArrayList<>();
// try(TypedArray typedArray = resources.obtainTypedArray(resourceId)) {
// for (int i = 0; i < typedArray.length(); i++) {
// int type = typedArray.getType(i);
// if (type == TypedValue.TYPE_STRING) {
// itemList.add(typedArray.getString(i));
// } else if (type == TypedValue.TYPE_REFERENCE) {
// int resIdOfArray = typedArray.getResourceId(i, 0);
// itemList.addAll(Arrays.asList(resources.getStringArray(resIdOfArray)));
// }
// }
// }
// Object[] objectArray = itemList.toArray();
// return Arrays.copyOf(objectArray, objectArray.length, String[].class);
// }
private String[] getArrayItems(int resourceId, Resources resources) {
ArrayList<String> itemList = new ArrayList<>();
try(TypedArray typedArray = resources.obtainTypedArray(resourceId)) {
TypedArray typedArray = resources.obtainTypedArray(resourceId);
try {
for (int i = 0; i < typedArray.length(); i++) {
int type = typedArray.getType(i);
if (type == TypedValue.TYPE_STRING) {
@@ -748,11 +767,12 @@ public class LoriePreferences extends AppCompatActivity implements PreferenceFra
itemList.addAll(Arrays.asList(resources.getStringArray(resIdOfArray)));
}
}
} finally {
typedArray.recycle();
}
Object[] objectArray = itemList.toArray();
return Arrays.copyOf(objectArray, objectArray.length, String[].class);
return itemList.toArray(new String[0]);
}
}

View File

@@ -85,7 +85,7 @@ public class MainActivity extends AppCompatActivity implements View.OnApplyWindo
protected ICmdEntryInterface service = null;
public TermuxX11ExtraKeys mExtraKeys;
private Notification mNotification;
private final int mNotificationId = 7892;
private final int mNotificationId = 7897;
NotificationManager mNotificationManager;
static InputMethodManager inputMethodManager;
private static boolean showIMEWhileExternalConnected = true;

View File

@@ -38,7 +38,7 @@
<PreferenceScreen app:key="kbd">
<SwitchPreferenceCompat app:key="showAdditionalKbd" app:defaultValue="true" />
<!-- this preference should be a part of `Prefs` but should not appear in PreferenceScreen -->
<SwitchPreferenceCompat app:key="additionalKbdVisible" app:defaultValue="true" app:isPreferenceVisible="false" />
<SwitchPreferenceCompat app:key="additionalKbdVisible" app:defaultValue="false" app:isPreferenceVisible="false" />
<SwitchPreferenceCompat app:key="showIMEWhileExternalConnected" app:defaultValue="true" />
<SwitchPreferenceCompat app:key="preferScancodes" app:defaultValue="false" />
<SwitchPreferenceCompat app:key="hardwareKbdScancodesWorkaround" app:defaultValue="true" />