Skip to content

Commit

Permalink
Fix code quality and crashes, bump version to v3.40
Browse files Browse the repository at this point in the history
  • Loading branch information
frknkrc44 committed Jan 12, 2024
1 parent 31f24bb commit fe84274
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 45 deletions.
7 changes: 7 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ android {

buildFeatures {
aidl true
buildConfig false
compose false
prefab false
renderScript false
resValues false
shaders false
viewBinding false
}

defaultConfig {
Expand Down
19 changes: 9 additions & 10 deletions app/src/main/java/org/blinksd/board/SuperBoardApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,17 @@ public void onCreate() {
super.onCreate();
appContext = this;
settingMap = new SettingMap();
appDB = SuperDBHelper.getDefault(this);

fontPath = getApplication().getExternalCacheDir() + "/font.ttf";
getCustomFont();
reloadLanguageCache();

appDB = SuperDBHelper.getDefaultAsync(this, () -> {
fontPath = getApplication().getExternalCacheDir() + "/font.ttf";
getCustomFont();

dictDB = new DictionaryDB(this);
icons = new IconThemeUtils();
spaceBars = new SpaceBarThemeUtils();
emojiUtils = new TextUtilsCompat();
reloadThemeCache();
});
dictDB = new DictionaryDB(this);
icons = new IconThemeUtils();
spaceBars = new SpaceBarThemeUtils();
emojiUtils = new TextUtilsCompat();
reloadThemeCache();
}

public static void reloadLanguageCache() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ public ColorSelectorLayout(Context ctx, int colorValue) {
host.addView(holder);
addView(host);

final String[] stra = {
final String[] tabTitles = {
"color_selector_rgb",
"color_selector_hsv",
"color_selector_hex"
};

for (int i = 0; i < stra.length; i++) {
stra[i] = SettingsCategorizedListAdapter.getTranslation(ctx, stra[i]);
for (int i = 0; i < tabTitles.length; i++) {
tabTitles[i] = SettingsCategorizedListAdapter.getTranslation(ctx, tabTitles[i]);
}

host.setOnTabChangedListener(p1 -> {
a.setVisibility(p1.equals(stra[2]) ? View.GONE : View.VISIBLE);
a.setVisibility(p1.equals(tabTitles[2]) ? View.GONE : View.VISIBLE);
switch (host.getCurrentTab()) {
case 0:
r.setProgress(Color.red(colorValue));
Expand All @@ -106,13 +106,13 @@ public ColorSelectorLayout(Context ctx, int colorValue) {

host.setup();

for (int i = 0; i < stra.length; i++) {
TabSpec ts = host.newTabSpec(stra[i]);
for (int i = 0; i < tabTitles.length; i++) {
TabSpec ts = host.newTabSpec(tabTitles[i]);
TextView tv = (TextView) LayoutInflater.from(ctx).inflate(android.R.layout.simple_list_item_1, widget, false);
LinearLayout.LayoutParams pr = (LinearLayout.LayoutParams) LayoutCreator.createLayoutParams(LinearLayout.class, -1, DensityUtils.dpInt(48));
pr.weight = 0.33f;
tv.setLayoutParams(pr);
tv.setText(stra[i]);
tv.setText(tabTitles[i]);
tv.setBackgroundResource(R.drawable.tab_indicator_material);
tv.getBackground().setColorFilter(0xFFDEDEDE, PorterDuff.Mode.SRC_ATOP);
tv.setGravity(Gravity.CENTER);
Expand Down
24 changes: 12 additions & 12 deletions app/src/main/java/org/blinksd/board/views/EmojiView.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class EmojiView extends LinearLayout {

private static String[][] emojis;
private final Drawable emptyDrawable = new ColorDrawable();
private float txtsze;
private int keyclr;
private float textSize;
private int keyTextColor;
private Drawable drw;
private TabWidget tw;
private TabHost th;
Expand Down Expand Up @@ -97,8 +97,8 @@ private void getEmojis(SuperBoard sb) {
}

public void applyTheme(SuperBoard sb) {
txtsze = sb.getKeysTextSize();
keyclr = sb.getKeysTextColor();
textSize = sb.getKeysTextSize();
keyTextColor = sb.getKeysTextColor();
drw = sb.keybg;
if (drw == null) {
drw = new ColorDrawable(0);
Expand Down Expand Up @@ -145,10 +145,10 @@ private void apply() {
TextView tv = (TextView) LayoutInflater.from(getContext()).inflate(android.R.layout.simple_list_item_1, tw, false);
tv.setLayoutParams(new LayoutParams(-1, l, 1));
tv.setText(emojis[i][0].trim());
tv.setTextColor(keyclr);
tv.setTextColor(keyTextColor);
tv.setGravity(Gravity.CENTER);
tv.setPadding(0, 0, 0, 0);
tv.setTextSize(txtsze);
tv.setTextSize(textSize);
ts.setIndicator(tv);
tv.setBackgroundDrawable(Objects.requireNonNull(drw.getConstantState()).newDrawable());
final int x = i;
Expand All @@ -163,12 +163,12 @@ private View categoryItem(int num, int size, View.OnClickListener ocl) {
if (num == -1) {
Button tv = new Button(getContext());
tv.setLayoutParams(new LayoutParams(size, -1, 0));
tv.setTextColor(keyclr);
tv.setTextColor(keyTextColor);
tv.setBackgroundDrawable(Objects.requireNonNull(drw.getConstantState()).newDrawable());
tv.setGravity(Gravity.CENTER);
tv.setText("A");
tv.setTag(num);
tv.setTextSize(txtsze);
tv.setTextSize(textSize);
tv.setOnClickListener(ocl);
return tv;
} else {
Expand All @@ -180,7 +180,7 @@ private View categoryItem(int num, int size, View.OnClickListener ocl) {
int p = size / 4;
iv.setPadding(p, p, p, p);
iv.setImageResource(R.drawable.sym_keyboard_delete);
iv.setColorFilter(keyclr, PorterDuff.Mode.SRC_ATOP);
iv.setColorFilter(keyTextColor, PorterDuff.Mode.SRC_ATOP);
iv.setTag(num);
iv.setOnClickListener(ocl);
return iv;
Expand All @@ -192,7 +192,7 @@ private GridView emojiList(final int index) {
gv.setOverScrollMode(GridView.OVER_SCROLL_NEVER);
gv.setLayoutParams(new LayoutParams(-1, -1));
int columns = SuperBoardApplication.getTextUtils()
.getTextBounds(txtsze, emojis[0][0]).width() / 2;
.getTextBounds(textSize, emojis[0][0]).width() / 2;
gv.setNumColumns(columns);
gv.setGravity(Gravity.CENTER);
gv.setSelector(emptyDrawable);
Expand Down Expand Up @@ -231,12 +231,12 @@ public long getItemId(int position) {
public View getView(int position, View convertView, ViewGroup parent) {
TextView v = new TextView(EmojiView.this.getContext());
v.setBackgroundDrawable(Objects.requireNonNull(drw.getConstantState()).newDrawable());
v.setTextColor(keyclr);
v.setTextColor(keyTextColor);
v.setGravity(Gravity.CENTER);
v.setSingleLine();
v.setWidth(getResources().getDisplayMetrics().widthPixels / columns);
v.setHeight(getResources().getDisplayMetrics().widthPixels / columns);
v.setTextSize(txtsze);
v.setTextSize(textSize);
v.setText(getItem(position).trim());
return v;
}
Expand Down
23 changes: 13 additions & 10 deletions app/src/main/java/org/blinksd/board/views/ImageSelectorLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ImageSelectorLayout extends LinearLayout {
public void onClick(final View p1) {
Context ctx = p1.getContext();
int tag = (int) p1.getTag();
final View px = new ColorSelectorLayout(ctx, tag);
final ColorSelectorLayout px = new ColorSelectorLayout(ctx, tag);
px.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
AlertDialog.Builder build = new AlertDialog.Builder(p1.getContext());
build.setTitle(((TextView) p1.findViewById(android.R.id.text1)).getText());
Expand All @@ -69,7 +69,7 @@ public void onClick(final View p1) {
});
build.setNegativeButton(android.R.string.cancel, (p112, p2) -> p112.dismiss());
build.setPositiveButton(android.R.string.ok, (p0, p2) -> {
p1.setTag(px.findViewById(android.R.id.tabs).getTag());
p1.setTag(px.colorValue);
prev.setImageBitmap(convertGradientToBitmap());
System.gc();
p0.dismiss();
Expand Down Expand Up @@ -161,24 +161,27 @@ public void setImageBitmap(Bitmap b) {
});
addView(host);

final String[] stra = {
final String[] tabTitles = {
"image_selector_photo",
"image_selector_gradient"
};

for (int i = 0; i < stra.length; i++) {
stra[i] = SettingsCategorizedListAdapter.getTranslation(win.getContext(), stra[i]);
for (int i = 0; i < tabTitles.length; i++) {
tabTitles[i] = SettingsCategorizedListAdapter.getTranslation(win.getContext(), tabTitles[i]);
}

host.setup();

for (int i = 0; i < stra.length; i++) {
TabSpec ts = host.newTabSpec(stra[i]);
TextView tv = (TextView) LayoutInflater.from(win.getContext()).inflate(android.R.layout.simple_list_item_1, widget, false);
LinearLayout.LayoutParams pr = (LinearLayout.LayoutParams) LayoutCreator.createLayoutParams(LinearLayout.class, -1, DensityUtils.dpInt(48));
for (int i = 0; i < tabTitles.length; i++) {
TabSpec ts = host.newTabSpec(tabTitles[i]);
TextView tv = (TextView) LayoutInflater.from(win.getContext())
.inflate(android.R.layout.simple_list_item_1, widget, false);
LinearLayout.LayoutParams pr = (LinearLayout.LayoutParams)
LayoutCreator.createLayoutParams(LinearLayout.class, -1, DensityUtils.dpInt(48));
pr.weight = 0.33f;
tv.setLayoutParams(pr);
tv.setText(stra[i]);
tv.setText(tabTitles[i]);
tv.setText(tabTitles[i]);
tv.setBackgroundResource(R.drawable.tab_indicator_material);
tv.getBackground().setColorFilter(0xFFDEDEDE, PorterDuff.Mode.SRC_ATOP);
tv.setGravity(Gravity.CENTER);
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'com.android.application' version '8.2.1' apply false
id 'com.android.library' version '8.2.1' apply false
}

tasks.register('clean', Delete) {
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
Expand All @@ -21,5 +21,4 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=true
4 changes: 2 additions & 2 deletions keystore.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ KEYFILE=../key.jks
KEYALIAS=Alias
STOREPASS=123456
KEYPASS=123456
VERCODE=47
VERNAME=3.39
VERCODE=48
VERNAME=3.40
MINSDK=9
TARGETSDK=34

0 comments on commit fe84274

Please sign in to comment.