Skip to content

Commit

Permalink
Merge pull request #13 from CodeDead/release/1.7.5
Browse files Browse the repository at this point in the history
Release/1.7.5
  • Loading branch information
CodeDead authored Jul 6, 2021
2 parents c6d05b9 + d9d181e commit 6981f75
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 26 deletions.
10 changes: 5 additions & 5 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 30
versionName '1.7.4'
versionName '1.7.5'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionCode 5
versionCode 6
}
buildTypes {
release {
Expand All @@ -27,11 +27,11 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.cardview:cardview:1.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public HashData[] newArray(final int size) {
}

private HashData(final Parcel in) {
if (in == null) throw new NullPointerException("Parcel cannot be null!");
if (in == null)
throw new NullPointerException("Parcel cannot be null!");

hashName = in.readString();
hashData = in.readString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public HashGenerator(final File data, final List<HashAlgorithm> hashAlgorithms,
* @throws IOException When the File could not be read
*/
private byte[] readFileToBytes(final File file) throws IOException {
if (file == null)
throw new NullPointerException("File cannot be null!");

final int size = (int) file.length();
final byte[] bytes = new byte[size];
final byte[] tmpBuff = new byte[size];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class SettingsContainer {
* Initialize a new SettingsContainer
*/
public SettingsContainer() {

// Default constructor
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.Context;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;

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


@NonNull
@Override
public DataHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
Expand Down Expand Up @@ -107,10 +107,12 @@ void bindData(final HashData data) {

if (data.getCompareCheck() != null && data.getCompareCheck().length() != 0) {
originalCompare = data.getCompareCheck();
if (data.getHashData().toLowerCase().equals(data.getCompareCheck().toLowerCase())) {
if (data.getHashData().equalsIgnoreCase(data.getCompareCheck())) {
compareData.setImageResource(R.drawable.ic_compare_check);
compareData.setBackgroundTintList(ContextCompat.getColorStateList(compareData.getContext(), R.color.green));
} else {
compareData.setImageResource(R.drawable.ic_compare_uncheck);
compareData.setBackgroundTintList(ContextCompat.getColorStateList(compareData.getContext(), R.color.red));
}
} else {
compareData.setVisibility(View.INVISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public final class HashUtil {
* Initialize a new HashUtil
*/
private HashUtil() {
// Empty constructor
// Default constructor
}

/**
Expand Down Expand Up @@ -44,7 +44,7 @@ public static String calculateHash(final byte[] bytes, final String kind) {
md.update(bytes, 0, bytes.length);
final byte[] hash = md.digest();
return convertToHex(hash);
} catch (Exception ex) {
} catch (final Exception ex) {
return null;
}
}
Expand All @@ -60,7 +60,7 @@ public static String calculateCRC32(final byte[] bytes) {
final CRC32 crc = new CRC32();
crc.update(bytes);
return Long.toHexString(crc.getValue());
} catch (Exception ex) {
} catch (final Exception ex) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ private IntentUtils() {
* @param site The website that should be opened
*/
public static void openSite(final Context context, final String site) {
if (context == null) throw new NullPointerException("Context cannot be null!");
if (site == null) throw new NullPointerException("Site cannot be null!");
if (site.length() == 0) throw new IllegalArgumentException("Site cannot be empty!");
if (context == null)
throw new NullPointerException("Context cannot be null!");
if (site == null)
throw new NullPointerException("Site cannot be null!");
if (site.length() == 0)
throw new IllegalArgumentException("Site cannot be empty!");

try {
final Uri uriUrl = Uri.parse(site);
final Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
context.startActivity(launchBrowser);
} catch (Exception ex) {
} catch (final Exception ex) {
Toast.makeText(context, context.getString(R.string.error_website), Toast.LENGTH_SHORT).show();
}
}
Expand All @@ -42,13 +45,14 @@ public static void openSite(final Context context, final String site) {
* @param context The Context that can be used to open the Play Store
*/
public static void openPlayStore(final Context context) {
if (context == null) throw new NullPointerException("Context cannot be null!");
if (context == null)
throw new NullPointerException("Context cannot be null!");

final Intent intent = new Intent(Intent.ACTION_VIEW);
try {
intent.setData(Uri.parse("market://details?id=com.codedead.deadhash"));
context.startActivity(intent);
} catch (Exception ignored) {
} catch (final Exception ignored) {
Toast.makeText(context, context.getString(R.string.error_playstore), Toast.LENGTH_SHORT).show();
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/codedead/deadhash/gui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private void loadFileHashContent(final Bundle savedInstance) {
}));

pgbFile.setVisibility(View.VISIBLE);
} catch (IOException e) {
} catch (final IOException e) {
Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
pgbFile.setVisibility(View.GONE);
}
Expand Down Expand Up @@ -690,10 +690,10 @@ protected void onActivityResult(final int requestCode, final int resultCode, @Nu
} else {
Toast.makeText(this, R.string.error_open_file, Toast.LENGTH_SHORT).show();
}
} catch (IOException ex) {
} catch (final IOException ex) {
Toast.makeText(this, R.string.error_copy_file, Toast.LENGTH_SHORT).show();
}
} catch (IOException ex) {
} catch (final IOException ex) {
Toast.makeText(this, R.string.error_open_file, Toast.LENGTH_SHORT).show();
}
} else {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#FF0000</color>
<color name="green">#00FF00</color>
</resources>
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:4.2.2'

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

allprojects {
repositories {
jcenter()
mavenCentral()
google()
}
}
Expand Down
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Tue Jul 06 16:47:53 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 6981f75

Please sign in to comment.