Skip to content

Commit

Permalink
Merge pull request #25 from CodeDead/release/v1.7.8
Browse files Browse the repository at this point in the history
Release/v1.7.8
  • Loading branch information
CodeDead authored Apr 19, 2022
2 parents 081c18b + 06becc1 commit e978ab7
Show file tree
Hide file tree
Showing 38 changed files with 437 additions and 721 deletions.
33 changes: 0 additions & 33 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

76 changes: 0 additions & 76 deletions CODE_OF_CONDUCT.md

This file was deleted.

6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ android {
applicationId "com.codedead.deadhash"
minSdkVersion 24
targetSdkVersion 31
versionName '1.7.7'
versionName '1.7.8'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionCode 8
versionCode 9
}
buildTypes {
release {
Expand All @@ -33,7 +33,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.preference:preference:1.2.0"
testImplementation 'junit:junit:4.13.2'
}
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
android:supportsRtl="true"
android:theme="@style/Theme.DeadHash"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".gui.SettingsActivity"
android:exported="false"
android:label="@string/nav_settings"
android:theme="@style/Theme.DeadHash.NoActionBar" />
<activity
android:name=".gui.MainActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.content.Context;
import android.content.SharedPreferences;

import androidx.preference.PreferenceManager;

import com.codedead.deadhash.R;

public class SettingsContainer {
Expand All @@ -16,7 +18,7 @@ public class SettingsContainer {
private boolean calculateSha512;
private boolean calculateCrc32;
private int reviewTimes;
private int theme;
private String theme;

/**
* Initialize a new SettingsContainer
Expand All @@ -34,15 +36,6 @@ public String getLanguageCode() {
return languageCode;
}

/**
* Set the language code
*
* @param languageCode The language code
*/
public void setLanguageCode(final String languageCode) {
this.languageCode = languageCode;
}

/**
* Get whether MD5 hashes should be calculated
*
Expand All @@ -52,15 +45,6 @@ public boolean isCalculateMd5() {
return calculateMd5;
}

/**
* Set whether MD5 hashes should be calculated
*
* @param calculateMd5 True if MD5 hashes should be calculated, otherwise false
*/
public void setCalculateMd5(final boolean calculateMd5) {
this.calculateMd5 = calculateMd5;
}

/**
* Get whether SHA1 hashes should be calculated
*
Expand All @@ -70,15 +54,6 @@ public boolean isCalculateSha1() {
return calculateSha1;
}

/**
* Set whether SHA1 hashes should be calculated
*
* @param calculateSha1 True if SHA1 hashes should be calculated, otherwise false
*/
public void setCalculateSha1(final boolean calculateSha1) {
this.calculateSha1 = calculateSha1;
}

/**
* Get whether SHA224 hashes should be calculated
*
Expand All @@ -88,15 +63,6 @@ public boolean isCalculateSha224() {
return calculateSha224;
}

/**
* Set whether SHA224 hashes should be calculated
*
* @param calculateSha224 True if SHA224 hashes should be calculated, otherwise false
*/
public void setCalculateSha224(final boolean calculateSha224) {
this.calculateSha224 = calculateSha224;
}

/**
* Get whether SHA256 hashes should be calculated
*
Expand All @@ -106,15 +72,6 @@ public boolean isCalculateSha256() {
return calculateSha256;
}

/**
* Set whether SHA256 hashes should be calculated
*
* @param calculateSha256 True if SHA256 hashes should be calculated, otherwise false
*/
public void setCalculateSha256(final boolean calculateSha256) {
this.calculateSha256 = calculateSha256;
}

/**
* Get whether SHA384 hashes should be calculated
*
Expand All @@ -124,15 +81,6 @@ public boolean isCalculateSha384() {
return calculateSha384;
}

/**
* Set whether SHA384 hashes should be calculated
*
* @param calculateSha384 True if SHA384 hashes should be calculated, otherwise false
*/
public void setCalculateSha384(final boolean calculateSha384) {
this.calculateSha384 = calculateSha384;
}

/**
* Get whether SHA512 hashes should be calculated
*
Expand All @@ -142,15 +90,6 @@ public boolean isCalculateSha512() {
return calculateSha512;
}

/**
* Set whether SHA512 hashes should be calculated
*
* @param calculateSha512 True if SHA512 hashes should be calculated, otherwise false
*/
public void setCalculateSha512(final boolean calculateSha512) {
this.calculateSha512 = calculateSha512;
}

/**
* Get whether CRC32 values should be calculated
*
Expand All @@ -160,15 +99,6 @@ public boolean isCalculateCrc32() {
return calculateCrc32;
}

/**
* Set whether CRC32 values should be calculated
*
* @param calculateCrc32 True if CRC32 values should be calculated, otherwise false
*/
public void setCalculateCrc32(final boolean calculateCrc32) {
this.calculateCrc32 = calculateCrc32;
}

/**
* Get the amount of times a user has been asked to review the application
*
Expand All @@ -195,28 +125,20 @@ public void setReviewTimes(final int reviewTimes) {
*
* @return The theme index
*/
public int getTheme() {
public String getTheme() {
return theme;
}

/**
* Set the theme index
*
* @param theme The theme index
*/
public void setTheme(final int theme) {
this.theme = theme;
}

/**
* Load the settings
*
* @param context The Context that can be used to load the settings
*/
public void loadSettings(final Context context) {
if (context == null) throw new NullPointerException("Context cannot be null!");
if (context == null)
throw new NullPointerException("Context cannot be null!");

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

languageCode = sharedPreferences.getString("language", "en");
calculateMd5 = sharedPreferences.getBoolean("md5", true);
Expand All @@ -227,7 +149,7 @@ public void loadSettings(final Context context) {
calculateSha512 = sharedPreferences.getBoolean("sha512", true);
calculateCrc32 = sharedPreferences.getBoolean("crc32", true);
reviewTimes = sharedPreferences.getInt("reviewTimes", 0);
theme = sharedPreferences.getInt("theme", 0);
theme = sharedPreferences.getString("theme", "2");
}

/**
Expand All @@ -250,7 +172,7 @@ public void saveSettings(final Context context) {
edit.putBoolean("sha512", isCalculateSha512());
edit.putBoolean("crc32", isCalculateCrc32());
edit.putInt("reviewTimes", getReviewTimes());
edit.putInt("theme", getTheme());
edit.putString("theme", getTheme());

edit.apply();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import android.net.Uri;
import android.widget.Toast;

import androidx.appcompat.app.AlertDialog;

import com.codedead.deadhash.R;

public final class IntentUtils {
Expand Down Expand Up @@ -56,4 +58,23 @@ public static void openPlayStore(final Context context) {
Toast.makeText(context, context.getString(R.string.error_playstore), Toast.LENGTH_SHORT).show();
}
}

/**
* Display an alert to the user
*
* @param context The context that can be used to display the alert
* @param message The message that needs to be displayed to the user
*/
public static void showAlert(final Context context, final String message) {
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(message);
builder.setCancelable(true);

builder.setPositiveButton(
android.R.string.ok,
(dialog, id) -> dialog.cancel());

final AlertDialog alert = builder.create();
alert.show();
}
}
Loading

0 comments on commit e978ab7

Please sign in to comment.