Skip to content

Commit 69aa170

Browse files
committed
Test
1 parent ae00dde commit 69aa170

File tree

4 files changed

+85
-5
lines changed

4 files changed

+85
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.gradle
2+
/.resources
23
/.idea
34
/*/build
4-
/build
5+
/build
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright (C) 2022 Ratul Hasan
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package io.github.ratul.topactivity.dialog;
18+
19+
import android.widget.TextView;
20+
import android.app.AlertDialog;
21+
import android.content.Context;
22+
import android.graphics.Typeface;
23+
24+
/**
25+
* Created by Ratul on 09/05/2022.
26+
*/
27+
public class DialogBeautifier {
28+
private String regular_font = "fonts/google_sans_regular.ttf";
29+
private String bold_font = "fonts/google_sans_bold.ttf";
30+
private AlertDialog dialog;
31+
private Context dialogContext;
32+
33+
public DialogBeautifier(AlertDialog alert) {
34+
dialog = alert;
35+
dialogContext = alert.getContext();
36+
}
37+
38+
public boolean beautifyTitle() {
39+
try{
40+
int titleId = dialogContext.getResources().getIdentifier( "alertTitle", "id", "android" );
41+
TextView title = dialog.findViewById(titleId);
42+
Typeface typeface = Typeface.createFromAsset(dialogContext.getAssets(), bold_font);
43+
title.setTypeface(typeface);
44+
return true;
45+
} catch(Exception e) {
46+
return false;
47+
}
48+
}
49+
50+
public void beautifyMessage() {
51+
TextView message = dialog.findViewById(android.R.id.message);
52+
message.setTypeface(Typeface.createFromAsset(dialogContext.getAssets(), regular_font), 0);
53+
}
54+
55+
public void beautifyPositiveButton() {
56+
TextView positiveBtn = dialog.findViewById(android.R.id.button1);
57+
positiveBtn.setTypeface(Typeface.createFromAsset(dialogContext.getAssets(), regular_font), 1);
58+
positiveBtn.setAllCaps(false);
59+
}
60+
61+
public void beautifyNegativeButton() {
62+
TextView negativeBtn = dialog.findViewById(android.R.id.button2);
63+
negativeBtn.setTypeface(Typeface.createFromAsset(dialogContext.getAssets(), regular_font), 1);
64+
negativeBtn.setAllCaps(false);
65+
}
66+
67+
public void beautifyNeutralButton() {
68+
TextView neutralBtn = dialog.findViewById(android.R.id.button3);
69+
neutralBtn.setTypeface(Typeface.createFromAsset(dialogContext.getAssets(), regular_font), 1);
70+
neutralBtn.setAllCaps(false);
71+
}
72+
73+
public void beautify() throws Exception {
74+
beautifyTitle();
75+
beautifyMessage();
76+
beautifyPositiveButton();
77+
beautifyNegativeButton();
78+
beautifyNeutralButton();
79+
}
80+
}

app/src/main/java/io/github/ratul/topactivity/model/CrashHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
/**
3232
* Created by Ratul on 04/05/2022.
3333
*/
34-
3534
public class CrashHandler implements UncaughtExceptionHandler {
3635
private UncaughtExceptionHandler DEFAULT;
3736
private Application mApp;
@@ -69,7 +68,7 @@ public void uncaughtException(Thread main, Throwable mThrowable) {
6968
}
7069

7170
android.os.Process.killProcess(android.os.Process.myPid());
72-
System.exit(1);
71+
System.exit(0);
7372
} else {
7473
DEFAULT.uncaughtException(main, mThrowable);
7574
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ org.gradle.jvmargs=-Xmx1536m
1515
# This option should only be used with decoupled projects. More details, visit
1616
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1717
# org.gradle.parallel=true
18-
#android.useAndroidX=true
18+
android.useAndroidX=true
1919
android.R8=true
20-
#android.enableJetifier=true
20+
android.enableJetifier=true

0 commit comments

Comments
 (0)