Minor fixes

This commit is contained in:
hajdam
2026-05-31 23:15:24 +02:00
parent f340758d89
commit b7361cb475
9 changed files with 129 additions and 67 deletions
@@ -1507,42 +1507,47 @@ public class DefaultCodeAreaPainter implements CodeAreaPainter, BasicColorsCapab
recomputeCharPositions(); recomputeCharPositions();
} }
Rect scrollPanelRect = dimensions.getScrollPanelRectangle(); final Rect scrollPanelRect = dimensions.getScrollPanelRectangle();
Activity activity = (Activity) codeArea.getContext();
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
// dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom); // dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height()); dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
if (rowHeight > 0 && characterWidth > 0) { if (rowHeight > 0 && characterWidth > 0) {
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize()); scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
scrolling.computeViewDimension(viewDimension, codeArea.getWidth(), codeArea.getHeight(), layout, structure, characterWidth, rowHeight); scrolling.computeViewDimension(viewDimension, codeArea.getWidth(), codeArea.getHeight(), layout, structure, characterWidth, rowHeight);
dataView.setMinimumWidth(viewDimension.getWidth()); dataView.setMinimumWidth(viewDimension.getWidth());
dataView.setMinimumHeight(viewDimension.getHeight()); dataView.setMinimumHeight(viewDimension.getHeight());
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize()); scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
int documentDataWidth = structure.getCharactersPerRow() * characterWidth; int documentDataWidth = structure.getCharactersPerRow() * characterWidth;
long rowsPerData = (structure.getDataSize() / structure.getBytesPerRow()) + 1; long rowsPerData = (structure.getDataSize() / structure.getBytesPerRow()) + 1;
int documentDataHeight; int documentDataHeight;
if (rowsPerData > scrolling.getMaximumScrollBarHeight() / rowHeight) { if (rowsPerData > scrolling.getMaximumScrollBarHeight() / rowHeight) {
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.SCALED); scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.SCALED);
documentDataHeight = scrolling.getMaximumScrollBarHeight(); documentDataHeight = scrolling.getMaximumScrollBarHeight();
} else { } else {
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.NORMAL); scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.NORMAL);
documentDataHeight = (int) (rowsPerData * rowHeight); documentDataHeight = (int) (rowsPerData * rowHeight);
}
recomputeDimensions();
// scrollPanelRect = dimensions.getScrollPanelRectangle();
// dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
// dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
dataView.layout(0, 0, documentDataWidth, documentDataHeight);
dataView.setMinimumWidth(documentDataWidth);
dataView.setMinimumHeight(documentDataHeight);
}
} }
});
recomputeDimensions();
scrollPanelRect = dimensions.getScrollPanelRectangle();
// dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
// dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
dataView.layout(0, 0, documentDataWidth, documentDataHeight);
dataView.setMinimumWidth(documentDataWidth);
dataView.setMinimumHeight(documentDataHeight);
}
// TODO on resize only // TODO on resize only
final Rect scrollPanelRectangle = dimensions.getScrollPanelRectangle(); final Rect scrollPanelRectangle = dimensions.getScrollPanelRectangle();
Activity activity = (Activity) codeArea.getContext();
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -0,0 +1,66 @@
/*
* Copyright (C) ExBin Project, https://exbin.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.exbin.bined.component;
import javax.annotation.ParametersAreNonnullByDefault;
/**
* Numeric grouping for binary status.
*/
@ParametersAreNonnullByDefault
public class StatusNumericGrouping {
public static final int DEFAULT_OCTAL_SPACE_GROUP_SIZE = 4;
public static final int DEFAULT_DECIMAL_SPACE_GROUP_SIZE = 3;
public static final int DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE = 4;
protected int octalSpaceGroupSize = DEFAULT_OCTAL_SPACE_GROUP_SIZE;
protected int decimalSpaceGroupSize = DEFAULT_DECIMAL_SPACE_GROUP_SIZE;
protected int hexadecimalSpaceGroupSize = DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE;
public StatusNumericGrouping() {
}
public StatusNumericGrouping(int octalSpaceGroupSize, int decimalSpaceGroupSize, int hexadecimalSpaceGroupSize) {
this.octalSpaceGroupSize = octalSpaceGroupSize;
this.decimalSpaceGroupSize = decimalSpaceGroupSize;
this.hexadecimalSpaceGroupSize = hexadecimalSpaceGroupSize;
}
public int getOctalSpaceGroupSize() {
return octalSpaceGroupSize;
}
public void setOctalSpaceGroupSize(int octalSpaceGroupSize) {
this.octalSpaceGroupSize = octalSpaceGroupSize;
}
public int getDecimalSpaceGroupSize() {
return decimalSpaceGroupSize;
}
public void setDecimalSpaceGroupSize(int decimalSpaceGroupSize) {
this.decimalSpaceGroupSize = decimalSpaceGroupSize;
}
public int getHexadecimalSpaceGroupSize() {
return hexadecimalSpaceGroupSize;
}
public void setHexadecimalSpaceGroupSize(int hexadecimalSpaceGroupSize) {
this.hexadecimalSpaceGroupSize = hexadecimalSpaceGroupSize;
}
}
@@ -79,7 +79,6 @@ public class BinEdFileHandler {
long lPtr = Pointer.nativeValue(javaPointer); long lPtr = Pointer.nativeValue(javaPointer);
Native.free(lPtr); */ Native.free(lPtr); */
codeArea.setContentData(new JnaBufferEditableData()); codeArea.setContentData(new JnaBufferEditableData());
codeArea.setEditOperation(EditOperation.INSERT);
undoRedo = new CodeAreaUndoRedo(codeArea); undoRedo = new CodeAreaUndoRedo(codeArea);
CodeAreaOperationCommandHandler commandHandler = new CodeAreaOperationCommandHandler(codeArea.getContext(), codeArea, undoRedo); CodeAreaOperationCommandHandler commandHandler = new CodeAreaOperationCommandHandler(codeArea.getContext(), codeArea, undoRedo);
@@ -15,6 +15,7 @@
*/ */
package org.exbin.bined.editor.android.options.impl; package org.exbin.bined.editor.android.options.impl;
import org.exbin.bined.component.StatusNumericGrouping;
import org.exbin.bined.editor.android.options.StatusOptions; import org.exbin.bined.editor.android.options.StatusOptions;
import org.exbin.bined.editor.android.preference.StatusPreferences; import org.exbin.bined.editor.android.preference.StatusPreferences;
import org.exbin.bined.component.StatusCursorPositionFormat; import org.exbin.bined.component.StatusCursorPositionFormat;
@@ -29,15 +30,9 @@ import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
public class StatusOptionsImpl implements StatusOptions { public class StatusOptionsImpl implements StatusOptions {
public static int DEFAULT_OCTAL_SPACE_GROUP_SIZE = 4;
public static int DEFAULT_DECIMAL_SPACE_GROUP_SIZE = 3;
public static int DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE = 4;
private StatusCursorPositionFormat cursorPositionFormat = new StatusCursorPositionFormat(); private StatusCursorPositionFormat cursorPositionFormat = new StatusCursorPositionFormat();
private StatusDocumentSizeFormat documentSizeFormat = new StatusDocumentSizeFormat(); private StatusDocumentSizeFormat documentSizeFormat = new StatusDocumentSizeFormat();
private int octalSpaceGroupSize = DEFAULT_OCTAL_SPACE_GROUP_SIZE; private StatusNumericGrouping statusNumericGrouping = new StatusNumericGrouping();
private int decimalSpaceGroupSize = DEFAULT_DECIMAL_SPACE_GROUP_SIZE;
private int hexadecimalSpaceGroupSize = DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE;
@Nonnull @Nonnull
@Override @Override
@@ -63,32 +58,32 @@ public class StatusOptionsImpl implements StatusOptions {
@Override @Override
public int getOctalSpaceGroupSize() { public int getOctalSpaceGroupSize() {
return octalSpaceGroupSize; return statusNumericGrouping.getOctalSpaceGroupSize();
} }
@Override @Override
public void setOctalSpaceGroupSize(int octalSpaceGroupSize) { public void setOctalSpaceGroupSize(int octalSpaceGroupSize) {
this.octalSpaceGroupSize = octalSpaceGroupSize; statusNumericGrouping.setOctalSpaceGroupSize(octalSpaceGroupSize);
} }
@Override @Override
public int getDecimalSpaceGroupSize() { public int getDecimalSpaceGroupSize() {
return decimalSpaceGroupSize; return statusNumericGrouping.getDecimalSpaceGroupSize();
} }
@Override @Override
public void setDecimalSpaceGroupSize(int decimalSpaceGroupSize) { public void setDecimalSpaceGroupSize(int decimalSpaceGroupSize) {
this.decimalSpaceGroupSize = decimalSpaceGroupSize; statusNumericGrouping.setDecimalSpaceGroupSize(decimalSpaceGroupSize);
} }
@Override @Override
public int getHexadecimalSpaceGroupSize() { public int getHexadecimalSpaceGroupSize() {
return hexadecimalSpaceGroupSize; return statusNumericGrouping.getHexadecimalSpaceGroupSize();
} }
@Override @Override
public void setHexadecimalSpaceGroupSize(int hexadecimalSpaceGroupSize) { public void setHexadecimalSpaceGroupSize(int hexadecimalSpaceGroupSize) {
this.hexadecimalSpaceGroupSize = hexadecimalSpaceGroupSize; statusNumericGrouping.setHexadecimalSpaceGroupSize(hexadecimalSpaceGroupSize);
} }
public void loadFromPreferences(StatusPreferences preferences) { public void loadFromPreferences(StatusPreferences preferences) {
@@ -96,9 +91,9 @@ public class StatusOptionsImpl implements StatusOptions {
cursorPositionFormat.setShowOffset(preferences.isCursorShowOffset()); cursorPositionFormat.setShowOffset(preferences.isCursorShowOffset());
documentSizeFormat.setCodeType(preferences.getDocumentSizeCodeType()); documentSizeFormat.setCodeType(preferences.getDocumentSizeCodeType());
documentSizeFormat.setShowRelative(preferences.isDocumentSizeShowRelative()); documentSizeFormat.setShowRelative(preferences.isDocumentSizeShowRelative());
octalSpaceGroupSize = preferences.getOctalSpaceGroupSize(); statusNumericGrouping.setOctalSpaceGroupSize(preferences.getOctalSpaceGroupSize());
decimalSpaceGroupSize = preferences.getDecimalSpaceGroupSize(); statusNumericGrouping.setDecimalSpaceGroupSize(preferences.getDecimalSpaceGroupSize());
hexadecimalSpaceGroupSize = preferences.getHexadecimalSpaceGroupSize(); statusNumericGrouping.setHexadecimalSpaceGroupSize(preferences.getHexadecimalSpaceGroupSize());
} }
public void saveToPreferences(StatusPreferences preferences) { public void saveToPreferences(StatusPreferences preferences) {
@@ -106,16 +101,14 @@ public class StatusOptionsImpl implements StatusOptions {
preferences.setCursorShowOffset(cursorPositionFormat.isShowOffset()); preferences.setCursorShowOffset(cursorPositionFormat.isShowOffset());
preferences.setDocumentSizeCodeType(documentSizeFormat.getCodeType()); preferences.setDocumentSizeCodeType(documentSizeFormat.getCodeType());
preferences.setDocumentSizeShowRelative(documentSizeFormat.isShowRelative()); preferences.setDocumentSizeShowRelative(documentSizeFormat.isShowRelative());
preferences.setOctalSpaceGroupSize(octalSpaceGroupSize); preferences.setOctalSpaceGroupSize(statusNumericGrouping.getOctalSpaceGroupSize());
preferences.setDecimalSpaceGroupSize(decimalSpaceGroupSize); preferences.setDecimalSpaceGroupSize(statusNumericGrouping.getDecimalSpaceGroupSize());
preferences.setHexadecimalSpaceGroupSize(hexadecimalSpaceGroupSize); preferences.setHexadecimalSpaceGroupSize(statusNumericGrouping.getHexadecimalSpaceGroupSize());
} }
public void setOptions(StatusOptionsImpl statusOptions) { public void setOptions(StatusOptionsImpl statusOptions) {
cursorPositionFormat = statusOptions.cursorPositionFormat; cursorPositionFormat = statusOptions.cursorPositionFormat;
documentSizeFormat = statusOptions.documentSizeFormat; documentSizeFormat = statusOptions.documentSizeFormat;
octalSpaceGroupSize = statusOptions.octalSpaceGroupSize; statusNumericGrouping = statusOptions.statusNumericGrouping;
decimalSpaceGroupSize = statusOptions.decimalSpaceGroupSize;
hexadecimalSpaceGroupSize = statusOptions.hexadecimalSpaceGroupSize;
} }
} }
@@ -16,6 +16,7 @@
package org.exbin.bined.editor.android.preference; package org.exbin.bined.editor.android.preference;
import org.exbin.bined.PositionCodeType; import org.exbin.bined.PositionCodeType;
import org.exbin.bined.component.StatusNumericGrouping;
import org.exbin.bined.editor.android.options.StatusOptions; import org.exbin.bined.editor.android.options.StatusOptions;
import org.exbin.bined.editor.android.options.impl.StatusOptionsImpl; import org.exbin.bined.editor.android.options.impl.StatusOptionsImpl;
import org.exbin.bined.component.StatusCursorPositionFormat; import org.exbin.bined.component.StatusCursorPositionFormat;
@@ -119,7 +120,7 @@ public class StatusPreferences implements StatusOptions {
@Override @Override
public int getOctalSpaceGroupSize() { public int getOctalSpaceGroupSize() {
return preferences.getInt(PREFERENCES_OCTAL_SPACE_GROUP_SIZE, StatusOptionsImpl.DEFAULT_OCTAL_SPACE_GROUP_SIZE); return preferences.getInt(PREFERENCES_OCTAL_SPACE_GROUP_SIZE, StatusNumericGrouping.DEFAULT_OCTAL_SPACE_GROUP_SIZE);
} }
@Override @Override
@@ -129,7 +130,7 @@ public class StatusPreferences implements StatusOptions {
@Override @Override
public int getDecimalSpaceGroupSize() { public int getDecimalSpaceGroupSize() {
return preferences.getInt(PREFERENCES_DECIMAL_SPACE_GROUP_SIZE, StatusOptionsImpl.DEFAULT_DECIMAL_SPACE_GROUP_SIZE); return preferences.getInt(PREFERENCES_DECIMAL_SPACE_GROUP_SIZE, StatusNumericGrouping.DEFAULT_DECIMAL_SPACE_GROUP_SIZE);
} }
@Override @Override
@@ -139,7 +140,7 @@ public class StatusPreferences implements StatusOptions {
@Override @Override
public int getHexadecimalSpaceGroupSize() { public int getHexadecimalSpaceGroupSize() {
return preferences.getInt(PREFERENCES_HEXADECIMAL_SPACE_GROUP_SIZE, StatusOptionsImpl.DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE); return preferences.getInt(PREFERENCES_HEXADECIMAL_SPACE_GROUP_SIZE, StatusNumericGrouping.DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE);
} }
@Override @Override
@@ -31,7 +31,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDialogFragment; import androidx.appcompat.app.AppCompatDialogFragment;
import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.SwitchCompat;
@@ -75,8 +74,8 @@ public class SearchDialog extends AppCompatDialogFragment {
keyboardShown = showKeyboard; keyboardShown = showKeyboard;
codeArea.requestFocus(); codeArea.requestFocus();
codeArea.postDelayed(() -> { codeArea.postDelayed(() -> {
InputMethodManager im = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager im = (InputMethodManager) codeArea.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (showKeyboard) { // if (showKeyboard) {
// TODO im.setInputMethodAndSubtype(); // TODO im.setInputMethodAndSubtype();
im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT); im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT);
// if (CompatUtils.isAndroidTV(getContext())) { // if (CompatUtils.isAndroidTV(getContext())) {
@@ -86,9 +85,9 @@ public class SearchDialog extends AppCompatDialogFragment {
if (dialog != null) { if (dialog != null) {
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
} }
} else { // } else {
im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0); // im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0);
} // }
}, 100); }, 100);
} }
}; };
@@ -133,9 +132,6 @@ public class SearchDialog extends AppCompatDialogFragment {
codeArea.setCodeCharactersCase(templateCodeArea.getCodeCharactersCase()); codeArea.setCodeCharactersCase(templateCodeArea.getCodeCharactersCase());
} }
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(getResources().getString(R.string.search_title));
LayoutInflater inflater = activity.getLayoutInflater(); LayoutInflater inflater = activity.getLayoutInflater();
searchView = inflater.inflate(R.layout.search_view, null); searchView = inflater.inflate(R.layout.search_view, null);
@@ -163,6 +159,8 @@ public class SearchDialog extends AppCompatDialogFragment {
} }
}); });
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(getResources().getString(R.string.search_title));
builder.setView(searchView); builder.setView(searchView);
builder.setPositiveButton(R.string.button_search, (dialog, which) -> { builder.setPositiveButton(R.string.button_search, (dialog, which) -> {
saveSearchParameters(); saveSearchParameters();
@@ -237,7 +235,7 @@ public class SearchDialog extends AppCompatDialogFragment {
} }
@Override @Override
public void onSaveInstanceState(@NonNull Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
saveSearchParameters(); saveSearchParameters();
} }
+1 -1
View File
@@ -4,7 +4,7 @@ buildscript {
ext { ext {
// playstore = hasProperty('playstore') // playstore = hasProperty('playstore')
playstore = false playstore = false
agpVersion = '9.1.1' agpVersion = '9.2.1'
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
0.2.10 0.2.10
- Bug fixes
- Added Greek translation - Added Greek translation
- Bug fixes
0.2.9 (2025-10-29) 0.2.9 (2025-10-29)
- Added edit selection dialog - Added edit selection dialog
+2 -2
View File
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionSha256Sum=b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06 distributionSha256Sum=2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME