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();
}
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(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
if (rowHeight > 0 && characterWidth > 0) {
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
scrolling.computeViewDimension(viewDimension, codeArea.getWidth(), codeArea.getHeight(), layout, structure, characterWidth, rowHeight);
dataView.setMinimumWidth(viewDimension.getWidth());
dataView.setMinimumHeight(viewDimension.getHeight());
if (rowHeight > 0 && characterWidth > 0) {
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
scrolling.computeViewDimension(viewDimension, codeArea.getWidth(), codeArea.getHeight(), layout, structure, characterWidth, rowHeight);
dataView.setMinimumWidth(viewDimension.getWidth());
dataView.setMinimumHeight(viewDimension.getHeight());
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
int documentDataWidth = structure.getCharactersPerRow() * characterWidth;
long rowsPerData = (structure.getDataSize() / structure.getBytesPerRow()) + 1;
int documentDataWidth = structure.getCharactersPerRow() * characterWidth;
long rowsPerData = (structure.getDataSize() / structure.getBytesPerRow()) + 1;
int documentDataHeight;
if (rowsPerData > scrolling.getMaximumScrollBarHeight() / rowHeight) {
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.SCALED);
documentDataHeight = scrolling.getMaximumScrollBarHeight();
} else {
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.NORMAL);
documentDataHeight = (int) (rowsPerData * rowHeight);
int documentDataHeight;
if (rowsPerData > scrolling.getMaximumScrollBarHeight() / rowHeight) {
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.SCALED);
documentDataHeight = scrolling.getMaximumScrollBarHeight();
} else {
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.NORMAL);
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
final Rect scrollPanelRectangle = dimensions.getScrollPanelRectangle();
Activity activity = (Activity) codeArea.getContext();
activity.runOnUiThread(new Runnable() {
@Override
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);
Native.free(lPtr); */
codeArea.setContentData(new JnaBufferEditableData());
codeArea.setEditOperation(EditOperation.INSERT);
undoRedo = new CodeAreaUndoRedo(codeArea);
CodeAreaOperationCommandHandler commandHandler = new CodeAreaOperationCommandHandler(codeArea.getContext(), codeArea, undoRedo);
@@ -15,6 +15,7 @@
*/
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.preference.StatusPreferences;
import org.exbin.bined.component.StatusCursorPositionFormat;
@@ -29,15 +30,9 @@ import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
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 StatusDocumentSizeFormat documentSizeFormat = new StatusDocumentSizeFormat();
private int octalSpaceGroupSize = DEFAULT_OCTAL_SPACE_GROUP_SIZE;
private int decimalSpaceGroupSize = DEFAULT_DECIMAL_SPACE_GROUP_SIZE;
private int hexadecimalSpaceGroupSize = DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE;
private StatusNumericGrouping statusNumericGrouping = new StatusNumericGrouping();
@Nonnull
@Override
@@ -63,32 +58,32 @@ public class StatusOptionsImpl implements StatusOptions {
@Override
public int getOctalSpaceGroupSize() {
return octalSpaceGroupSize;
return statusNumericGrouping.getOctalSpaceGroupSize();
}
@Override
public void setOctalSpaceGroupSize(int octalSpaceGroupSize) {
this.octalSpaceGroupSize = octalSpaceGroupSize;
statusNumericGrouping.setOctalSpaceGroupSize(octalSpaceGroupSize);
}
@Override
public int getDecimalSpaceGroupSize() {
return decimalSpaceGroupSize;
return statusNumericGrouping.getDecimalSpaceGroupSize();
}
@Override
public void setDecimalSpaceGroupSize(int decimalSpaceGroupSize) {
this.decimalSpaceGroupSize = decimalSpaceGroupSize;
statusNumericGrouping.setDecimalSpaceGroupSize(decimalSpaceGroupSize);
}
@Override
public int getHexadecimalSpaceGroupSize() {
return hexadecimalSpaceGroupSize;
return statusNumericGrouping.getHexadecimalSpaceGroupSize();
}
@Override
public void setHexadecimalSpaceGroupSize(int hexadecimalSpaceGroupSize) {
this.hexadecimalSpaceGroupSize = hexadecimalSpaceGroupSize;
statusNumericGrouping.setHexadecimalSpaceGroupSize(hexadecimalSpaceGroupSize);
}
public void loadFromPreferences(StatusPreferences preferences) {
@@ -96,9 +91,9 @@ public class StatusOptionsImpl implements StatusOptions {
cursorPositionFormat.setShowOffset(preferences.isCursorShowOffset());
documentSizeFormat.setCodeType(preferences.getDocumentSizeCodeType());
documentSizeFormat.setShowRelative(preferences.isDocumentSizeShowRelative());
octalSpaceGroupSize = preferences.getOctalSpaceGroupSize();
decimalSpaceGroupSize = preferences.getDecimalSpaceGroupSize();
hexadecimalSpaceGroupSize = preferences.getHexadecimalSpaceGroupSize();
statusNumericGrouping.setOctalSpaceGroupSize(preferences.getOctalSpaceGroupSize());
statusNumericGrouping.setDecimalSpaceGroupSize(preferences.getDecimalSpaceGroupSize());
statusNumericGrouping.setHexadecimalSpaceGroupSize(preferences.getHexadecimalSpaceGroupSize());
}
public void saveToPreferences(StatusPreferences preferences) {
@@ -106,16 +101,14 @@ public class StatusOptionsImpl implements StatusOptions {
preferences.setCursorShowOffset(cursorPositionFormat.isShowOffset());
preferences.setDocumentSizeCodeType(documentSizeFormat.getCodeType());
preferences.setDocumentSizeShowRelative(documentSizeFormat.isShowRelative());
preferences.setOctalSpaceGroupSize(octalSpaceGroupSize);
preferences.setDecimalSpaceGroupSize(decimalSpaceGroupSize);
preferences.setHexadecimalSpaceGroupSize(hexadecimalSpaceGroupSize);
preferences.setOctalSpaceGroupSize(statusNumericGrouping.getOctalSpaceGroupSize());
preferences.setDecimalSpaceGroupSize(statusNumericGrouping.getDecimalSpaceGroupSize());
preferences.setHexadecimalSpaceGroupSize(statusNumericGrouping.getHexadecimalSpaceGroupSize());
}
public void setOptions(StatusOptionsImpl statusOptions) {
cursorPositionFormat = statusOptions.cursorPositionFormat;
documentSizeFormat = statusOptions.documentSizeFormat;
octalSpaceGroupSize = statusOptions.octalSpaceGroupSize;
decimalSpaceGroupSize = statusOptions.decimalSpaceGroupSize;
hexadecimalSpaceGroupSize = statusOptions.hexadecimalSpaceGroupSize;
statusNumericGrouping = statusOptions.statusNumericGrouping;
}
}
@@ -16,6 +16,7 @@
package org.exbin.bined.editor.android.preference;
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.impl.StatusOptionsImpl;
import org.exbin.bined.component.StatusCursorPositionFormat;
@@ -119,7 +120,7 @@ public class StatusPreferences implements StatusOptions {
@Override
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
@@ -129,7 +130,7 @@ public class StatusPreferences implements StatusOptions {
@Override
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
@@ -139,7 +140,7 @@ public class StatusPreferences implements StatusOptions {
@Override
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
@@ -31,7 +31,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDialogFragment;
import androidx.appcompat.widget.SwitchCompat;
@@ -75,8 +74,8 @@ public class SearchDialog extends AppCompatDialogFragment {
keyboardShown = showKeyboard;
codeArea.requestFocus();
codeArea.postDelayed(() -> {
InputMethodManager im = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (showKeyboard) {
InputMethodManager im = (InputMethodManager) codeArea.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
// if (showKeyboard) {
// TODO im.setInputMethodAndSubtype();
im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT);
// if (CompatUtils.isAndroidTV(getContext())) {
@@ -86,9 +85,9 @@ public class SearchDialog extends AppCompatDialogFragment {
if (dialog != null) {
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
} else {
im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0);
}
// } else {
// im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0);
// }
}, 100);
}
};
@@ -133,9 +132,6 @@ public class SearchDialog extends AppCompatDialogFragment {
codeArea.setCodeCharactersCase(templateCodeArea.getCodeCharactersCase());
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(getResources().getString(R.string.search_title));
LayoutInflater inflater = activity.getLayoutInflater();
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.setPositiveButton(R.string.button_search, (dialog, which) -> {
saveSearchParameters();
@@ -237,7 +235,7 @@ public class SearchDialog extends AppCompatDialogFragment {
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
saveSearchParameters();
}
+1 -1
View File
@@ -4,7 +4,7 @@ buildscript {
ext {
// playstore = hasProperty('playstore')
playstore = false
agpVersion = '9.1.1'
agpVersion = '9.2.1'
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
0.2.10
- Bug fixes
- Added Greek translation
- Bug fixes
0.2.9 (2025-10-29)
- Added edit selection dialog
+2 -2
View File
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
distributionSha256Sum=2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME