Release 0.2.9
This commit is contained in:
+2
-1
@@ -3,6 +3,7 @@ plugins {
|
||||
}
|
||||
|
||||
def playStore = rootProject.ext.playstore
|
||||
// For support of SDK 14, newer material versions requests fails to build
|
||||
def materialVersion = '1.6.1'
|
||||
|
||||
android {
|
||||
@@ -28,7 +29,7 @@ android {
|
||||
|
||||
targetSdk 35
|
||||
versionCode 18
|
||||
versionName "0.2.9-SNAPSHOT"
|
||||
versionName "0.2.9"
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
vectorDrawables.generatedDensities = []
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
@@ -92,10 +93,12 @@ public abstract class CodeAreaCore extends ViewGroup implements CodeAreaControl
|
||||
|
||||
private void init() {
|
||||
setContentDescription("Code area");
|
||||
setFocusable(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
setSystemUiVisibility(getSystemUiVisibility() | View.FOCUSABLE);
|
||||
}
|
||||
// TODO: Use swing color instead
|
||||
// setBackgroundColor(ColorUtils.WHITE);
|
||||
// setFocusable(true);
|
||||
// setSystemUiVisibility(getSystemUiVisibility() | View.FOCUSABLE);
|
||||
// setFocusTraversalKeysEnabled(false);
|
||||
}
|
||||
|
||||
@@ -248,16 +251,17 @@ public abstract class CodeAreaCore extends ViewGroup implements CodeAreaControl
|
||||
|
||||
public PrimaryView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setFocusable(true);
|
||||
setContentDescription("Code area scroll view");
|
||||
// setFocusTraversalKeysEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(@Nullable Canvas g) {
|
||||
super.onDraw(g);
|
||||
if (g == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.onDraw(g);
|
||||
paintView(g);
|
||||
}
|
||||
|
||||
@@ -288,7 +292,9 @@ public abstract class CodeAreaCore extends ViewGroup implements CodeAreaControl
|
||||
@Override
|
||||
protected void onFocusChanged(boolean gainFocus, int direction, @androidx.annotation.Nullable Rect previouslyFocusedRect) {
|
||||
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
|
||||
repaint();
|
||||
if (gainFocus) {
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -311,8 +317,6 @@ public abstract class CodeAreaCore extends ViewGroup implements CodeAreaControl
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
|
||||
outAttrs.inputType = EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
|
||||
|
||||
return new CodeAreaInputConnection(this, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.exbin.bined.editor.android;
|
||||
|
||||
import android.app.LocaleManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.LocaleList;
|
||||
|
||||
@@ -79,9 +80,14 @@ public class CompatUtils {
|
||||
try {
|
||||
Class<?> edgeClass = Class.forName("androidx.activity.EdgeToEdge");
|
||||
Method getApplicationLocalesMethod = edgeClass.getMethod("enable", ComponentActivity.class);
|
||||
Object result = getApplicationLocalesMethod.invoke(null, activity);
|
||||
getApplicationLocalesMethod.invoke(null, activity);
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | ClassNotFoundException e) {
|
||||
// No switching available
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAndroidTV(Context context) {
|
||||
final PackageManager pm = context.getPackageManager();
|
||||
return pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,6 +214,9 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
InputMethodManager im = (InputMethodManager) getApplication().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (showKeyboard) {
|
||||
im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT);
|
||||
// if (CompatUtils.isAndroidTV(this)) {
|
||||
// im.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
|
||||
// }
|
||||
} else {
|
||||
im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0);
|
||||
}
|
||||
@@ -603,7 +606,7 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
this.menu = menu;
|
||||
|
||||
// Currently on Google TV access to app bar icons doesn't seem to work
|
||||
if (isAndroidTV(this)) {
|
||||
if (CompatUtils.isAndroidTV(this)) {
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
MenuItem menuItem = menu.getItem(i);
|
||||
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
@@ -623,7 +626,7 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
Resources resources = getResources();
|
||||
int order = 0;
|
||||
if (isAndroidTV(codeArea.getContext())) {
|
||||
if (CompatUtils.isAndroidTV(this)) {
|
||||
menu.add(0, GO_TO_SIDE_PANEL_POPUP_ID, order, resources.getString(R.string.action_go_to_side_panel));
|
||||
order++;
|
||||
menu.add(0, OPEN_MAIN_MENU_POPUP_ID, order, resources.getString(R.string.action_open_main_menu));
|
||||
@@ -677,10 +680,13 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
}
|
||||
case SHOW_KEYBOARD_MENU_POPUP_ID: {
|
||||
// For some reason it keeps closing if invoked immediately
|
||||
codeArea.requestFocus();
|
||||
codeArea.postDelayed(() -> {
|
||||
codeArea.requestFocus();
|
||||
InputMethodManager im = (InputMethodManager) getApplication().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT);
|
||||
// if (CompatUtils.isAndroidTV(this)) {
|
||||
// im.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
|
||||
// }
|
||||
}, 100);
|
||||
break;
|
||||
}
|
||||
@@ -1069,7 +1075,7 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
}
|
||||
|
||||
public void openFile() {
|
||||
if (MainActivity.isAndroidTV(this) || Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
if (CompatUtils.isAndroidTV(this) || Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
fallBackOpenFile(FallbackFileType.FILE);
|
||||
return;
|
||||
}
|
||||
@@ -1094,7 +1100,7 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
}
|
||||
|
||||
public void openTableFile() {
|
||||
if (MainActivity.isAndroidTV(this) || Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
if (CompatUtils.isAndroidTV(this) || Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
fallBackOpenFile(FallbackFileType.TABLE_FILE);
|
||||
return;
|
||||
}
|
||||
@@ -1133,7 +1139,7 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
public void saveAs(@Nullable Runnable postSaveAsAction) {
|
||||
this.postSaveAsAction = postSaveAsAction;
|
||||
|
||||
if (MainActivity.isAndroidTV(this) || Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
if (CompatUtils.isAndroidTV(this) || Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
fallBackSaveAs();
|
||||
return;
|
||||
}
|
||||
@@ -1553,11 +1559,6 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
return codeArea;
|
||||
}
|
||||
|
||||
public static boolean isAndroidTV(Context context) {
|
||||
final PackageManager pm = context.getPackageManager();
|
||||
return pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||
}
|
||||
|
||||
private void requestWriteExternalStoragePermission() {
|
||||
final String[] permissions = new String[]{
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
@@ -1600,7 +1601,7 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile
|
||||
public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
|
||||
if (!codeArea.isFocused()) {
|
||||
if (keyEvent.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && isAndroidTV(codeArea.getContext())) {
|
||||
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && CompatUtils.isAndroidTV(MainActivity.this)) {
|
||||
codeArea.post(codeArea::requestFocus);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.exbin.bined.editor.android;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
@@ -66,6 +65,12 @@ public class SettingsActivity extends AppCompatActivity implements
|
||||
appPreferences = getAppPreferences();
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.settings_activity, null);
|
||||
|
||||
// Fix for legacy variant, comment out for playstore release
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
||||
view.findViewById(R.id.settings).setPadding(0, getStatusBarHeight(), 0, 0);
|
||||
}
|
||||
|
||||
setContentView(view);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
@@ -155,6 +160,15 @@ public class SettingsActivity extends AppCompatActivity implements
|
||||
super.finish();
|
||||
}
|
||||
|
||||
private int getStatusBarHeight() {
|
||||
Resources resources = getResources();
|
||||
int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
return resources.getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int getNavigationBarHeight() {
|
||||
Resources resources = getResources();
|
||||
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.exbin.bined.EditOperation;
|
||||
import org.exbin.bined.RowWrappingMode;
|
||||
import org.exbin.bined.android.basic.CodeArea;
|
||||
import org.exbin.bined.android.basic.color.BasicCodeAreaColorsProfile;
|
||||
import org.exbin.bined.editor.android.CompatUtils;
|
||||
import org.exbin.bined.editor.android.MainActivity;
|
||||
import org.exbin.bined.editor.android.R;
|
||||
|
||||
@@ -74,12 +75,15 @@ public class SearchDialog extends AppCompatDialogFragment {
|
||||
if (showKeyboard != keyboardShown) {
|
||||
|
||||
keyboardShown = showKeyboard;
|
||||
InputMethodManager im = (InputMethodManager) codeArea.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
codeArea.requestFocus();
|
||||
codeArea.postDelayed(() -> {
|
||||
InputMethodManager im = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (showKeyboard) {
|
||||
// TODO im.setInputMethodAndSubtype();
|
||||
im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT);
|
||||
// if (CompatUtils.isAndroidTV(getContext())) {
|
||||
// im.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
|
||||
// }
|
||||
Dialog dialog = SearchDialog.this.getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
@@ -262,7 +266,7 @@ public class SearchDialog extends AppCompatDialogFragment {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (MainActivity.isAndroidTV(codeArea.getContext())) {
|
||||
if (CompatUtils.isAndroidTV(codeArea.getContext())) {
|
||||
if (keyboardShown && keyEvent.getKeyCode() == KeyEvent.KEYCODE_FORWARD_DEL) {
|
||||
return false;
|
||||
}
|
||||
@@ -271,8 +275,10 @@ public class SearchDialog extends AppCompatDialogFragment {
|
||||
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) {
|
||||
codeArea.postDelayed(() -> {
|
||||
InputMethodManager im = (InputMethodManager) codeArea.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT);
|
||||
im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT, null);
|
||||
// im.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
|
||||
}, 100);
|
||||
|
||||
return true;
|
||||
} else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK) {
|
||||
View fromCursorView = searchView.findViewById(R.id.from_cursor);
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/settings"
|
||||
android:id="@+id/settings_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,2 @@
|
||||
- Added edit selection dialog
|
||||
- Bug fixes
|
||||
Reference in New Issue
Block a user