Skip to content

Commit e978ab7

Browse files
authored
Merge pull request #25 from CodeDead/release/v1.7.8
Release/v1.7.8
2 parents 081c18b + 06becc1 commit e978ab7

38 files changed

+437
-721
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

-33
This file was deleted.

.github/ISSUE_TEMPLATE/feature_request.md

-20
This file was deleted.

CODE_OF_CONDUCT.md

-76
This file was deleted.

app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ android {
77
applicationId "com.codedead.deadhash"
88
minSdkVersion 24
99
targetSdkVersion 31
10-
versionName '1.7.7'
10+
versionName '1.7.8'
1111
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12-
versionCode 8
12+
versionCode 9
1313
}
1414
buildTypes {
1515
release {
@@ -33,7 +33,7 @@ dependencies {
3333
implementation 'androidx.appcompat:appcompat:1.4.1'
3434
implementation 'com.google.android.material:material:1.5.0'
3535
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
36-
testImplementation 'junit:junit:4.13.2'
3736
implementation 'androidx.cardview:cardview:1.0.0'
3837
implementation "androidx.preference:preference:1.2.0"
38+
testImplementation 'junit:junit:4.13.2'
3939
}

app/src/main/AndroidManifest.xml

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
android:supportsRtl="true"
1818
android:theme="@style/Theme.DeadHash"
1919
tools:ignore="GoogleAppIndexingWarning">
20+
<activity
21+
android:name=".gui.SettingsActivity"
22+
android:exported="false"
23+
android:label="@string/nav_settings"
24+
android:theme="@style/Theme.DeadHash.NoActionBar" />
2025
<activity
2126
android:name=".gui.MainActivity"
2227
android:exported="true"

app/src/main/java/com/codedead/deadhash/domain/objects/settings/SettingsContainer.java

+9-87
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import android.content.Context;
44
import android.content.SharedPreferences;
55

6+
import androidx.preference.PreferenceManager;
7+
68
import com.codedead.deadhash.R;
79

810
public class SettingsContainer {
@@ -16,7 +18,7 @@ public class SettingsContainer {
1618
private boolean calculateSha512;
1719
private boolean calculateCrc32;
1820
private int reviewTimes;
19-
private int theme;
21+
private String theme;
2022

2123
/**
2224
* Initialize a new SettingsContainer
@@ -34,15 +36,6 @@ public String getLanguageCode() {
3436
return languageCode;
3537
}
3638

37-
/**
38-
* Set the language code
39-
*
40-
* @param languageCode The language code
41-
*/
42-
public void setLanguageCode(final String languageCode) {
43-
this.languageCode = languageCode;
44-
}
45-
4639
/**
4740
* Get whether MD5 hashes should be calculated
4841
*
@@ -52,15 +45,6 @@ public boolean isCalculateMd5() {
5245
return calculateMd5;
5346
}
5447

55-
/**
56-
* Set whether MD5 hashes should be calculated
57-
*
58-
* @param calculateMd5 True if MD5 hashes should be calculated, otherwise false
59-
*/
60-
public void setCalculateMd5(final boolean calculateMd5) {
61-
this.calculateMd5 = calculateMd5;
62-
}
63-
6448
/**
6549
* Get whether SHA1 hashes should be calculated
6650
*
@@ -70,15 +54,6 @@ public boolean isCalculateSha1() {
7054
return calculateSha1;
7155
}
7256

73-
/**
74-
* Set whether SHA1 hashes should be calculated
75-
*
76-
* @param calculateSha1 True if SHA1 hashes should be calculated, otherwise false
77-
*/
78-
public void setCalculateSha1(final boolean calculateSha1) {
79-
this.calculateSha1 = calculateSha1;
80-
}
81-
8257
/**
8358
* Get whether SHA224 hashes should be calculated
8459
*
@@ -88,15 +63,6 @@ public boolean isCalculateSha224() {
8863
return calculateSha224;
8964
}
9065

91-
/**
92-
* Set whether SHA224 hashes should be calculated
93-
*
94-
* @param calculateSha224 True if SHA224 hashes should be calculated, otherwise false
95-
*/
96-
public void setCalculateSha224(final boolean calculateSha224) {
97-
this.calculateSha224 = calculateSha224;
98-
}
99-
10066
/**
10167
* Get whether SHA256 hashes should be calculated
10268
*
@@ -106,15 +72,6 @@ public boolean isCalculateSha256() {
10672
return calculateSha256;
10773
}
10874

109-
/**
110-
* Set whether SHA256 hashes should be calculated
111-
*
112-
* @param calculateSha256 True if SHA256 hashes should be calculated, otherwise false
113-
*/
114-
public void setCalculateSha256(final boolean calculateSha256) {
115-
this.calculateSha256 = calculateSha256;
116-
}
117-
11875
/**
11976
* Get whether SHA384 hashes should be calculated
12077
*
@@ -124,15 +81,6 @@ public boolean isCalculateSha384() {
12481
return calculateSha384;
12582
}
12683

127-
/**
128-
* Set whether SHA384 hashes should be calculated
129-
*
130-
* @param calculateSha384 True if SHA384 hashes should be calculated, otherwise false
131-
*/
132-
public void setCalculateSha384(final boolean calculateSha384) {
133-
this.calculateSha384 = calculateSha384;
134-
}
135-
13684
/**
13785
* Get whether SHA512 hashes should be calculated
13886
*
@@ -142,15 +90,6 @@ public boolean isCalculateSha512() {
14290
return calculateSha512;
14391
}
14492

145-
/**
146-
* Set whether SHA512 hashes should be calculated
147-
*
148-
* @param calculateSha512 True if SHA512 hashes should be calculated, otherwise false
149-
*/
150-
public void setCalculateSha512(final boolean calculateSha512) {
151-
this.calculateSha512 = calculateSha512;
152-
}
153-
15493
/**
15594
* Get whether CRC32 values should be calculated
15695
*
@@ -160,15 +99,6 @@ public boolean isCalculateCrc32() {
16099
return calculateCrc32;
161100
}
162101

163-
/**
164-
* Set whether CRC32 values should be calculated
165-
*
166-
* @param calculateCrc32 True if CRC32 values should be calculated, otherwise false
167-
*/
168-
public void setCalculateCrc32(final boolean calculateCrc32) {
169-
this.calculateCrc32 = calculateCrc32;
170-
}
171-
172102
/**
173103
* Get the amount of times a user has been asked to review the application
174104
*
@@ -195,28 +125,20 @@ public void setReviewTimes(final int reviewTimes) {
195125
*
196126
* @return The theme index
197127
*/
198-
public int getTheme() {
128+
public String getTheme() {
199129
return theme;
200130
}
201131

202-
/**
203-
* Set the theme index
204-
*
205-
* @param theme The theme index
206-
*/
207-
public void setTheme(final int theme) {
208-
this.theme = theme;
209-
}
210-
211132
/**
212133
* Load the settings
213134
*
214135
* @param context The Context that can be used to load the settings
215136
*/
216137
public void loadSettings(final Context context) {
217-
if (context == null) throw new NullPointerException("Context cannot be null!");
138+
if (context == null)
139+
throw new NullPointerException("Context cannot be null!");
218140

219-
final SharedPreferences sharedPreferences = context.getSharedPreferences(context.getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
141+
final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
220142

221143
languageCode = sharedPreferences.getString("language", "en");
222144
calculateMd5 = sharedPreferences.getBoolean("md5", true);
@@ -227,7 +149,7 @@ public void loadSettings(final Context context) {
227149
calculateSha512 = sharedPreferences.getBoolean("sha512", true);
228150
calculateCrc32 = sharedPreferences.getBoolean("crc32", true);
229151
reviewTimes = sharedPreferences.getInt("reviewTimes", 0);
230-
theme = sharedPreferences.getInt("theme", 0);
152+
theme = sharedPreferences.getString("theme", "2");
231153
}
232154

233155
/**
@@ -250,7 +172,7 @@ public void saveSettings(final Context context) {
250172
edit.putBoolean("sha512", isCalculateSha512());
251173
edit.putBoolean("crc32", isCalculateCrc32());
252174
edit.putInt("reviewTimes", getReviewTimes());
253-
edit.putInt("theme", getTheme());
175+
edit.putString("theme", getTheme());
254176

255177
edit.apply();
256178
}

app/src/main/java/com/codedead/deadhash/domain/utils/IntentUtils.java

+21
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import android.net.Uri;
66
import android.widget.Toast;
77

8+
import androidx.appcompat.app.AlertDialog;
9+
810
import com.codedead.deadhash.R;
911

1012
public final class IntentUtils {
@@ -56,4 +58,23 @@ public static void openPlayStore(final Context context) {
5658
Toast.makeText(context, context.getString(R.string.error_playstore), Toast.LENGTH_SHORT).show();
5759
}
5860
}
61+
62+
/**
63+
* Display an alert to the user
64+
*
65+
* @param context The context that can be used to display the alert
66+
* @param message The message that needs to be displayed to the user
67+
*/
68+
public static void showAlert(final Context context, final String message) {
69+
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
70+
builder.setMessage(message);
71+
builder.setCancelable(true);
72+
73+
builder.setPositiveButton(
74+
android.R.string.ok,
75+
(dialog, id) -> dialog.cancel());
76+
77+
final AlertDialog alert = builder.create();
78+
alert.show();
79+
}
5980
}

0 commit comments

Comments
 (0)