Skip to content

Commit b7361cb

Browse files
committed
Minor fixes
1 parent f340758 commit b7361cb

9 files changed

Lines changed: 129 additions & 67 deletions

File tree

app/src/main/java/org/exbin/bined/android/basic/DefaultCodeAreaPainter.java

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,42 +1507,47 @@ public void updateScrollBars() {
15071507
recomputeCharPositions();
15081508
}
15091509

1510-
Rect scrollPanelRect = dimensions.getScrollPanelRectangle();
1510+
final Rect scrollPanelRect = dimensions.getScrollPanelRectangle();
1511+
Activity activity = (Activity) codeArea.getContext();
1512+
activity.runOnUiThread(new Runnable() {
1513+
@Override
1514+
public void run() {
15111515
// dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
1512-
dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
1516+
dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
15131517

1514-
if (rowHeight > 0 && characterWidth > 0) {
1515-
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
1516-
scrolling.computeViewDimension(viewDimension, codeArea.getWidth(), codeArea.getHeight(), layout, structure, characterWidth, rowHeight);
1517-
dataView.setMinimumWidth(viewDimension.getWidth());
1518-
dataView.setMinimumHeight(viewDimension.getHeight());
1518+
if (rowHeight > 0 && characterWidth > 0) {
1519+
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
1520+
scrolling.computeViewDimension(viewDimension, codeArea.getWidth(), codeArea.getHeight(), layout, structure, characterWidth, rowHeight);
1521+
dataView.setMinimumWidth(viewDimension.getWidth());
1522+
dataView.setMinimumHeight(viewDimension.getHeight());
15191523

1520-
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
1524+
scrolling.updateCache(codeArea, getHorizontalScrollBarSize(), getVerticalScrollBarSize());
15211525

1522-
int documentDataWidth = structure.getCharactersPerRow() * characterWidth;
1523-
long rowsPerData = (structure.getDataSize() / structure.getBytesPerRow()) + 1;
1526+
int documentDataWidth = structure.getCharactersPerRow() * characterWidth;
1527+
long rowsPerData = (structure.getDataSize() / structure.getBytesPerRow()) + 1;
15241528

1525-
int documentDataHeight;
1526-
if (rowsPerData > scrolling.getMaximumScrollBarHeight() / rowHeight) {
1527-
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.SCALED);
1528-
documentDataHeight = scrolling.getMaximumScrollBarHeight();
1529-
} else {
1530-
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.NORMAL);
1531-
documentDataHeight = (int) (rowsPerData * rowHeight);
1532-
}
1529+
int documentDataHeight;
1530+
if (rowsPerData > scrolling.getMaximumScrollBarHeight() / rowHeight) {
1531+
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.SCALED);
1532+
documentDataHeight = scrolling.getMaximumScrollBarHeight();
1533+
} else {
1534+
scrolling.setScrollBarVerticalScale(ScrollBarVerticalScale.NORMAL);
1535+
documentDataHeight = (int) (rowsPerData * rowHeight);
1536+
}
15331537

1534-
recomputeDimensions();
1535-
scrollPanelRect = dimensions.getScrollPanelRectangle();
1536-
// dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
1537-
// dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
1538-
dataView.layout(0, 0, documentDataWidth, documentDataHeight);
1539-
dataView.setMinimumWidth(documentDataWidth);
1540-
dataView.setMinimumHeight(documentDataHeight);
1541-
}
1538+
recomputeDimensions();
1539+
// scrollPanelRect = dimensions.getScrollPanelRectangle();
1540+
// dataView.layout(scrollPanelRect.left, scrollPanelRect.top, scrollPanelRect.right, scrollPanelRect.bottom);
1541+
// dataView.layout(0, 0, scrollPanelRect.width(), scrollPanelRect.height());
1542+
dataView.layout(0, 0, documentDataWidth, documentDataHeight);
1543+
dataView.setMinimumWidth(documentDataWidth);
1544+
dataView.setMinimumHeight(documentDataHeight);
1545+
}
1546+
}
1547+
});
15421548

15431549
// TODO on resize only
15441550
final Rect scrollPanelRectangle = dimensions.getScrollPanelRectangle();
1545-
Activity activity = (Activity) codeArea.getContext();
15461551
activity.runOnUiThread(new Runnable() {
15471552
@Override
15481553
public void run() {
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (C) ExBin Project, https://exbin.org
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.exbin.bined.component;
17+
18+
import javax.annotation.ParametersAreNonnullByDefault;
19+
20+
/**
21+
* Numeric grouping for binary status.
22+
*/
23+
@ParametersAreNonnullByDefault
24+
public class StatusNumericGrouping {
25+
26+
public static final int DEFAULT_OCTAL_SPACE_GROUP_SIZE = 4;
27+
public static final int DEFAULT_DECIMAL_SPACE_GROUP_SIZE = 3;
28+
public static final int DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE = 4;
29+
30+
protected int octalSpaceGroupSize = DEFAULT_OCTAL_SPACE_GROUP_SIZE;
31+
protected int decimalSpaceGroupSize = DEFAULT_DECIMAL_SPACE_GROUP_SIZE;
32+
protected int hexadecimalSpaceGroupSize = DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE;
33+
34+
public StatusNumericGrouping() {
35+
}
36+
37+
public StatusNumericGrouping(int octalSpaceGroupSize, int decimalSpaceGroupSize, int hexadecimalSpaceGroupSize) {
38+
this.octalSpaceGroupSize = octalSpaceGroupSize;
39+
this.decimalSpaceGroupSize = decimalSpaceGroupSize;
40+
this.hexadecimalSpaceGroupSize = hexadecimalSpaceGroupSize;
41+
}
42+
43+
public int getOctalSpaceGroupSize() {
44+
return octalSpaceGroupSize;
45+
}
46+
47+
public void setOctalSpaceGroupSize(int octalSpaceGroupSize) {
48+
this.octalSpaceGroupSize = octalSpaceGroupSize;
49+
}
50+
51+
public int getDecimalSpaceGroupSize() {
52+
return decimalSpaceGroupSize;
53+
}
54+
55+
public void setDecimalSpaceGroupSize(int decimalSpaceGroupSize) {
56+
this.decimalSpaceGroupSize = decimalSpaceGroupSize;
57+
}
58+
59+
public int getHexadecimalSpaceGroupSize() {
60+
return hexadecimalSpaceGroupSize;
61+
}
62+
63+
public void setHexadecimalSpaceGroupSize(int hexadecimalSpaceGroupSize) {
64+
this.hexadecimalSpaceGroupSize = hexadecimalSpaceGroupSize;
65+
}
66+
}

app/src/main/java/org/exbin/bined/editor/android/BinEdFileHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public BinEdFileHandler(CodeArea codeArea) {
7979
long lPtr = Pointer.nativeValue(javaPointer);
8080
Native.free(lPtr); */
8181
codeArea.setContentData(new JnaBufferEditableData());
82-
codeArea.setEditOperation(EditOperation.INSERT);
8382
undoRedo = new CodeAreaUndoRedo(codeArea);
8483

8584
CodeAreaOperationCommandHandler commandHandler = new CodeAreaOperationCommandHandler(codeArea.getContext(), codeArea, undoRedo);

app/src/main/java/org/exbin/bined/editor/android/options/impl/StatusOptionsImpl.java

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.exbin.bined.editor.android.options.impl;
1717

18+
import org.exbin.bined.component.StatusNumericGrouping;
1819
import org.exbin.bined.editor.android.options.StatusOptions;
1920
import org.exbin.bined.editor.android.preference.StatusPreferences;
2021
import org.exbin.bined.component.StatusCursorPositionFormat;
@@ -29,15 +30,9 @@
2930
@ParametersAreNonnullByDefault
3031
public class StatusOptionsImpl implements StatusOptions {
3132

32-
public static int DEFAULT_OCTAL_SPACE_GROUP_SIZE = 4;
33-
public static int DEFAULT_DECIMAL_SPACE_GROUP_SIZE = 3;
34-
public static int DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE = 4;
35-
3633
private StatusCursorPositionFormat cursorPositionFormat = new StatusCursorPositionFormat();
3734
private StatusDocumentSizeFormat documentSizeFormat = new StatusDocumentSizeFormat();
38-
private int octalSpaceGroupSize = DEFAULT_OCTAL_SPACE_GROUP_SIZE;
39-
private int decimalSpaceGroupSize = DEFAULT_DECIMAL_SPACE_GROUP_SIZE;
40-
private int hexadecimalSpaceGroupSize = DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE;
35+
private StatusNumericGrouping statusNumericGrouping = new StatusNumericGrouping();
4136

4237
@Nonnull
4338
@Override
@@ -63,59 +58,57 @@ public void setDocumentSizeFormat(StatusDocumentSizeFormat documentSizeFormat) {
6358

6459
@Override
6560
public int getOctalSpaceGroupSize() {
66-
return octalSpaceGroupSize;
61+
return statusNumericGrouping.getOctalSpaceGroupSize();
6762
}
6863

6964
@Override
7065
public void setOctalSpaceGroupSize(int octalSpaceGroupSize) {
71-
this.octalSpaceGroupSize = octalSpaceGroupSize;
66+
statusNumericGrouping.setOctalSpaceGroupSize(octalSpaceGroupSize);
7267
}
7368

7469
@Override
7570
public int getDecimalSpaceGroupSize() {
76-
return decimalSpaceGroupSize;
71+
return statusNumericGrouping.getDecimalSpaceGroupSize();
7772
}
7873

7974
@Override
8075
public void setDecimalSpaceGroupSize(int decimalSpaceGroupSize) {
81-
this.decimalSpaceGroupSize = decimalSpaceGroupSize;
76+
statusNumericGrouping.setDecimalSpaceGroupSize(decimalSpaceGroupSize);
8277
}
8378

8479
@Override
8580
public int getHexadecimalSpaceGroupSize() {
86-
return hexadecimalSpaceGroupSize;
81+
return statusNumericGrouping.getHexadecimalSpaceGroupSize();
8782
}
8883

8984
@Override
9085
public void setHexadecimalSpaceGroupSize(int hexadecimalSpaceGroupSize) {
91-
this.hexadecimalSpaceGroupSize = hexadecimalSpaceGroupSize;
86+
statusNumericGrouping.setHexadecimalSpaceGroupSize(hexadecimalSpaceGroupSize);
9287
}
9388

9489
public void loadFromPreferences(StatusPreferences preferences) {
9590
cursorPositionFormat.setCodeType(preferences.getCursorPositionCodeType());
9691
cursorPositionFormat.setShowOffset(preferences.isCursorShowOffset());
9792
documentSizeFormat.setCodeType(preferences.getDocumentSizeCodeType());
9893
documentSizeFormat.setShowRelative(preferences.isDocumentSizeShowRelative());
99-
octalSpaceGroupSize = preferences.getOctalSpaceGroupSize();
100-
decimalSpaceGroupSize = preferences.getDecimalSpaceGroupSize();
101-
hexadecimalSpaceGroupSize = preferences.getHexadecimalSpaceGroupSize();
94+
statusNumericGrouping.setOctalSpaceGroupSize(preferences.getOctalSpaceGroupSize());
95+
statusNumericGrouping.setDecimalSpaceGroupSize(preferences.getDecimalSpaceGroupSize());
96+
statusNumericGrouping.setHexadecimalSpaceGroupSize(preferences.getHexadecimalSpaceGroupSize());
10297
}
10398

10499
public void saveToPreferences(StatusPreferences preferences) {
105100
preferences.setCursorPositionCodeType(cursorPositionFormat.getCodeType());
106101
preferences.setCursorShowOffset(cursorPositionFormat.isShowOffset());
107102
preferences.setDocumentSizeCodeType(documentSizeFormat.getCodeType());
108103
preferences.setDocumentSizeShowRelative(documentSizeFormat.isShowRelative());
109-
preferences.setOctalSpaceGroupSize(octalSpaceGroupSize);
110-
preferences.setDecimalSpaceGroupSize(decimalSpaceGroupSize);
111-
preferences.setHexadecimalSpaceGroupSize(hexadecimalSpaceGroupSize);
104+
preferences.setOctalSpaceGroupSize(statusNumericGrouping.getOctalSpaceGroupSize());
105+
preferences.setDecimalSpaceGroupSize(statusNumericGrouping.getDecimalSpaceGroupSize());
106+
preferences.setHexadecimalSpaceGroupSize(statusNumericGrouping.getHexadecimalSpaceGroupSize());
112107
}
113108

114109
public void setOptions(StatusOptionsImpl statusOptions) {
115110
cursorPositionFormat = statusOptions.cursorPositionFormat;
116111
documentSizeFormat = statusOptions.documentSizeFormat;
117-
octalSpaceGroupSize = statusOptions.octalSpaceGroupSize;
118-
decimalSpaceGroupSize = statusOptions.decimalSpaceGroupSize;
119-
hexadecimalSpaceGroupSize = statusOptions.hexadecimalSpaceGroupSize;
112+
statusNumericGrouping = statusOptions.statusNumericGrouping;
120113
}
121114
}

app/src/main/java/org/exbin/bined/editor/android/preference/StatusPreferences.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.exbin.bined.editor.android.preference;
1717

1818
import org.exbin.bined.PositionCodeType;
19+
import org.exbin.bined.component.StatusNumericGrouping;
1920
import org.exbin.bined.editor.android.options.StatusOptions;
2021
import org.exbin.bined.editor.android.options.impl.StatusOptionsImpl;
2122
import org.exbin.bined.component.StatusCursorPositionFormat;
@@ -119,7 +120,7 @@ public void setDocumentSizeFormat(StatusDocumentSizeFormat documentSizeFormat) {
119120

120121
@Override
121122
public int getOctalSpaceGroupSize() {
122-
return preferences.getInt(PREFERENCES_OCTAL_SPACE_GROUP_SIZE, StatusOptionsImpl.DEFAULT_OCTAL_SPACE_GROUP_SIZE);
123+
return preferences.getInt(PREFERENCES_OCTAL_SPACE_GROUP_SIZE, StatusNumericGrouping.DEFAULT_OCTAL_SPACE_GROUP_SIZE);
123124
}
124125

125126
@Override
@@ -129,7 +130,7 @@ public void setOctalSpaceGroupSize(int octalSpaceSize) {
129130

130131
@Override
131132
public int getDecimalSpaceGroupSize() {
132-
return preferences.getInt(PREFERENCES_DECIMAL_SPACE_GROUP_SIZE, StatusOptionsImpl.DEFAULT_DECIMAL_SPACE_GROUP_SIZE);
133+
return preferences.getInt(PREFERENCES_DECIMAL_SPACE_GROUP_SIZE, StatusNumericGrouping.DEFAULT_DECIMAL_SPACE_GROUP_SIZE);
133134
}
134135

135136
@Override
@@ -139,7 +140,7 @@ public void setDecimalSpaceGroupSize(int decimalSpaceSize) {
139140

140141
@Override
141142
public int getHexadecimalSpaceGroupSize() {
142-
return preferences.getInt(PREFERENCES_HEXADECIMAL_SPACE_GROUP_SIZE, StatusOptionsImpl.DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE);
143+
return preferences.getInt(PREFERENCES_HEXADECIMAL_SPACE_GROUP_SIZE, StatusNumericGrouping.DEFAULT_HEXADECIMAL_SPACE_GROUP_SIZE);
143144
}
144145

145146
@Override

app/src/main/java/org/exbin/bined/editor/android/search/SearchDialog.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import android.widget.EditText;
3232
import android.widget.FrameLayout;
3333

34-
import androidx.annotation.NonNull;
3534
import androidx.appcompat.app.AppCompatDialogFragment;
3635
import androidx.appcompat.widget.SwitchCompat;
3736

@@ -75,8 +74,8 @@ public class SearchDialog extends AppCompatDialogFragment {
7574
keyboardShown = showKeyboard;
7675
codeArea.requestFocus();
7776
codeArea.postDelayed(() -> {
78-
InputMethodManager im = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
79-
if (showKeyboard) {
77+
InputMethodManager im = (InputMethodManager) codeArea.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
78+
// if (showKeyboard) {
8079
// TODO im.setInputMethodAndSubtype();
8180
im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT);
8281
// if (CompatUtils.isAndroidTV(getContext())) {
@@ -86,9 +85,9 @@ public class SearchDialog extends AppCompatDialogFragment {
8685
if (dialog != null) {
8786
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
8887
}
89-
} else {
90-
im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0);
91-
}
88+
// } else {
89+
// im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0);
90+
// }
9291
}, 100);
9392
}
9493
};
@@ -133,9 +132,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
133132
codeArea.setCodeCharactersCase(templateCodeArea.getCodeCharactersCase());
134133
}
135134

136-
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
137-
builder.setTitle(getResources().getString(R.string.search_title));
138-
139135
LayoutInflater inflater = activity.getLayoutInflater();
140136
searchView = inflater.inflate(R.layout.search_view, null);
141137

@@ -163,6 +159,8 @@ public void onTabReselected(TabLayout.Tab tab) {
163159
}
164160
});
165161

162+
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
163+
builder.setTitle(getResources().getString(R.string.search_title));
166164
builder.setView(searchView);
167165
builder.setPositiveButton(R.string.button_search, (dialog, which) -> {
168166
saveSearchParameters();
@@ -237,7 +235,7 @@ private void saveSearchParameters() {
237235
}
238236

239237
@Override
240-
public void onSaveInstanceState(@NonNull Bundle outState) {
238+
public void onSaveInstanceState(Bundle outState) {
241239
super.onSaveInstanceState(outState);
242240
saveSearchParameters();
243241
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
ext {
55
// playstore = hasProperty('playstore')
66
playstore = false
7-
agpVersion = '9.1.1'
7+
agpVersion = '9.2.1'
88
}
99
}
1010

changes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
0.2.10
2-
- Bug fixes
32
- Added Greek translation
3+
- Bug fixes
44

55
0.2.9 (2025-10-29)
66
- Added edit selection dialog

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
3+
distributionSha256Sum=2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)