Skip to content

Commit 6981f75

Browse files
authored
Merge pull request #13 from CodeDead/release/1.7.5
Release/1.7.5
2 parents c6d05b9 + d9d181e commit 6981f75

File tree

11 files changed

+39
-26
lines changed

11 files changed

+39
-26
lines changed

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ android {
77
applicationId "com.codedead.deadhash"
88
minSdkVersion 24
99
targetSdkVersion 30
10-
versionName '1.7.4'
10+
versionName '1.7.5'
1111
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12-
versionCode 5
12+
versionCode 6
1313
}
1414
buildTypes {
1515
release {
@@ -27,11 +27,11 @@ android {
2727

2828
dependencies {
2929
implementation fileTree(include: ['*.jar'], dir: 'libs')
30-
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
30+
androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0', {
3131
exclude group: 'com.android.support', module: 'support-annotations'
3232
})
33-
implementation 'androidx.appcompat:appcompat:1.2.0'
34-
implementation 'com.google.android.material:material:1.3.0'
33+
implementation 'androidx.appcompat:appcompat:1.3.0'
34+
implementation 'com.google.android.material:material:1.4.0'
3535
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
3636
testImplementation 'junit:junit:4.13.2'
3737
implementation 'androidx.cardview:cardview:1.0.0'

app/src/main/java/com/codedead/deadhash/domain/objects/hashgenerator/HashData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public HashData[] newArray(final int size) {
4646
}
4747

4848
private HashData(final Parcel in) {
49-
if (in == null) throw new NullPointerException("Parcel cannot be null!");
49+
if (in == null)
50+
throw new NullPointerException("Parcel cannot be null!");
5051

5152
hashName = in.readString();
5253
hashData = in.readString();

app/src/main/java/com/codedead/deadhash/domain/objects/hashgenerator/HashGenerator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public HashGenerator(final File data, final List<HashAlgorithm> hashAlgorithms,
5353
* @throws IOException When the File could not be read
5454
*/
5555
private byte[] readFileToBytes(final File file) throws IOException {
56+
if (file == null)
57+
throw new NullPointerException("File cannot be null!");
58+
5659
final int size = (int) file.length();
5760
final byte[] bytes = new byte[size];
5861
final byte[] tmpBuff = new byte[size];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class SettingsContainer {
2222
* Initialize a new SettingsContainer
2323
*/
2424
public SettingsContainer() {
25-
25+
// Default constructor
2626
}
2727

2828
/**

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.content.Context;
66

77
import androidx.annotation.NonNull;
8+
import androidx.core.content.ContextCompat;
89
import androidx.recyclerview.widget.RecyclerView;
910

1011
import android.view.LayoutInflater;
@@ -32,7 +33,6 @@ public DataAdapter(final List<HashData> hashDataList) {
3233
this.hashDataList = hashDataList;
3334
}
3435

35-
3636
@NonNull
3737
@Override
3838
public DataHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
@@ -107,10 +107,12 @@ void bindData(final HashData data) {
107107

108108
if (data.getCompareCheck() != null && data.getCompareCheck().length() != 0) {
109109
originalCompare = data.getCompareCheck();
110-
if (data.getHashData().toLowerCase().equals(data.getCompareCheck().toLowerCase())) {
110+
if (data.getHashData().equalsIgnoreCase(data.getCompareCheck())) {
111111
compareData.setImageResource(R.drawable.ic_compare_check);
112+
compareData.setBackgroundTintList(ContextCompat.getColorStateList(compareData.getContext(), R.color.green));
112113
} else {
113114
compareData.setImageResource(R.drawable.ic_compare_uncheck);
115+
compareData.setBackgroundTintList(ContextCompat.getColorStateList(compareData.getContext(), R.color.red));
114116
}
115117
} else {
116118
compareData.setVisibility(View.INVISIBLE);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public final class HashUtil {
99
* Initialize a new HashUtil
1010
*/
1111
private HashUtil() {
12-
// Empty constructor
12+
// Default constructor
1313
}
1414

1515
/**
@@ -44,7 +44,7 @@ public static String calculateHash(final byte[] bytes, final String kind) {
4444
md.update(bytes, 0, bytes.length);
4545
final byte[] hash = md.digest();
4646
return convertToHex(hash);
47-
} catch (Exception ex) {
47+
} catch (final Exception ex) {
4848
return null;
4949
}
5050
}
@@ -60,7 +60,7 @@ public static String calculateCRC32(final byte[] bytes) {
6060
final CRC32 crc = new CRC32();
6161
crc.update(bytes);
6262
return Long.toHexString(crc.getValue());
63-
} catch (Exception ex) {
63+
} catch (final Exception ex) {
6464
return null;
6565
}
6666
}

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ private IntentUtils() {
2323
* @param site The website that should be opened
2424
*/
2525
public static void openSite(final Context context, final String site) {
26-
if (context == null) throw new NullPointerException("Context cannot be null!");
27-
if (site == null) throw new NullPointerException("Site cannot be null!");
28-
if (site.length() == 0) throw new IllegalArgumentException("Site cannot be empty!");
26+
if (context == null)
27+
throw new NullPointerException("Context cannot be null!");
28+
if (site == null)
29+
throw new NullPointerException("Site cannot be null!");
30+
if (site.length() == 0)
31+
throw new IllegalArgumentException("Site cannot be empty!");
2932

3033
try {
3134
final Uri uriUrl = Uri.parse(site);
3235
final Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
3336
context.startActivity(launchBrowser);
34-
} catch (Exception ex) {
37+
} catch (final Exception ex) {
3538
Toast.makeText(context, context.getString(R.string.error_website), Toast.LENGTH_SHORT).show();
3639
}
3740
}
@@ -42,13 +45,14 @@ public static void openSite(final Context context, final String site) {
4245
* @param context The Context that can be used to open the Play Store
4346
*/
4447
public static void openPlayStore(final Context context) {
45-
if (context == null) throw new NullPointerException("Context cannot be null!");
48+
if (context == null)
49+
throw new NullPointerException("Context cannot be null!");
4650

4751
final Intent intent = new Intent(Intent.ACTION_VIEW);
4852
try {
4953
intent.setData(Uri.parse("market://details?id=com.codedead.deadhash"));
5054
context.startActivity(intent);
51-
} catch (Exception ignored) {
55+
} catch (final Exception ignored) {
5256
Toast.makeText(context, context.getString(R.string.error_playstore), Toast.LENGTH_SHORT).show();
5357
}
5458
}

app/src/main/java/com/codedead/deadhash/gui/MainActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ private void loadFileHashContent(final Bundle savedInstance) {
337337
}));
338338

339339
pgbFile.setVisibility(View.VISIBLE);
340-
} catch (IOException e) {
340+
} catch (final IOException e) {
341341
Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
342342
pgbFile.setVisibility(View.GONE);
343343
}
@@ -690,10 +690,10 @@ protected void onActivityResult(final int requestCode, final int resultCode, @Nu
690690
} else {
691691
Toast.makeText(this, R.string.error_open_file, Toast.LENGTH_SHORT).show();
692692
}
693-
} catch (IOException ex) {
693+
} catch (final IOException ex) {
694694
Toast.makeText(this, R.string.error_copy_file, Toast.LENGTH_SHORT).show();
695695
}
696-
} catch (IOException ex) {
696+
} catch (final IOException ex) {
697697
Toast.makeText(this, R.string.error_open_file, Toast.LENGTH_SHORT).show();
698698
}
699699
} else {

app/src/main/res/values/colors.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
<color name="teal_700">#FF018786</color>
88
<color name="black">#FF000000</color>
99
<color name="white">#FFFFFFFF</color>
10+
<color name="red">#FF0000</color>
11+
<color name="green">#00FF00</color>
1012
</resources>

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
buildscript {
44
repositories {
5-
jcenter()
5+
mavenCentral()
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.2'
9+
classpath 'com.android.tools.build:gradle:4.2.2'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
@@ -15,7 +15,7 @@ buildscript {
1515

1616
allprojects {
1717
repositories {
18-
jcenter()
18+
mavenCentral()
1919
google()
2020
}
2121
}

0 commit comments

Comments
 (0)