Skip to content

Commit cc314f9

Browse files
committed
feat: dependency upgrades, allow sharing of files between other apps and DeadHash
1 parent 844dbb6 commit cc314f9

File tree

23 files changed

+81
-33
lines changed

23 files changed

+81
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ This library is maintained by CodeDead. You can find more about us using the fol
3636
* [Twitter](https://twitter.com/C0DEDEAD)
3737
* [Facebook](https://facebook.com/deadlinecodedead)
3838

39-
Copyright © 2024 CodeDead
39+
Copyright © 2025 CodeDead

app/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdk 34
4+
compileSdk 35
55
defaultConfig {
66
applicationId "com.codedead.deadhash"
7-
minSdk 28
8-
targetSdk 34
7+
minSdk 30
8+
targetSdk 35
99
versionName '1.8.2'
1010
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1111
versionCode 12
@@ -27,12 +27,12 @@ android {
2727

2828
dependencies {
2929
implementation fileTree(include: ['*.jar'], dir: 'libs')
30-
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1', {
30+
androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1', {
3131
exclude group: 'com.android.support', module: 'support-annotations'
3232
})
33-
implementation 'androidx.appcompat:appcompat:1.6.1'
34-
implementation 'com.google.android.material:material:1.11.0'
35-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
33+
implementation 'androidx.appcompat:appcompat:1.7.0'
34+
implementation 'com.google.android.material:material:1.12.0'
35+
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
3636
implementation 'androidx.cardview:cardview:1.0.0'
3737
implementation 'androidx.preference:preference:1.2.1'
3838
testImplementation 'junit:junit:4.13.2'

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@
3333
android:theme="@style/Theme.DeadHash.NoActionBar">
3434
<intent-filter>
3535
<action android:name="android.intent.action.MAIN" />
36-
3736
<category android:name="android.intent.category.LAUNCHER" />
3837
</intent-filter>
38+
39+
<intent-filter>
40+
<action android:name="android.intent.action.SEND" />
41+
<category android:name="android.intent.category.DEFAULT" />
42+
<data android:mimeType="*/*" />
43+
</intent-filter>
3944
</activity>
4045
</application>
4146
</manifest>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public HashData[] newArray(final int size) {
3434
throw new NullPointerException("Hash name cannot be null!");
3535
if (hashData == null)
3636
throw new NullPointerException("Hash data cannot be null!");
37-
if (hashName.length() == 0)
37+
if (hashName.isEmpty())
3838
throw new IllegalArgumentException("Hash name cannot be empty!");
39-
if (hashData.length() == 0)
39+
if (hashData.isEmpty())
4040
throw new IllegalArgumentException("Hash data cannot be empty!");
4141

4242
this.hashName = hashName;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static class DataHolder extends RecyclerView.ViewHolder implements View.OnClickL
7575

7676
copyData.setOnClickListener(this);
7777
compareData.setOnClickListener(v1 -> {
78-
if (originalCompare == null || originalCompare.length() == 0) return;
78+
if (originalCompare == null || originalCompare.isEmpty()) return;
7979
if (originalCompare.equals(encryptionData.getText().toString())) {
8080
Toast.makeText(v1.getContext(), R.string.toast_hash_match, Toast.LENGTH_SHORT).show();
8181
} else {
@@ -105,7 +105,7 @@ void bindData(final HashData data) {
105105
encryptionName.setText(data.getHashName());
106106
encryptionData.setText(data.getHashData());
107107

108-
if (data.getCompareCheck() != null && data.getCompareCheck().length() != 0) {
108+
if (data.getCompareCheck() != null && !data.getCompareCheck().isEmpty()) {
109109
originalCompare = data.getCompareCheck();
110110
if (data.getHashData().equalsIgnoreCase(data.getCompareCheck())) {
111111
compareData.setImageResource(R.drawable.ic_compare_check);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static void openSite(final Context context, final String site) {
2929
throw new NullPointerException("Context cannot be null!");
3030
if (site == null)
3131
throw new NullPointerException("Site cannot be null!");
32-
if (site.length() == 0)
32+
if (site.isEmpty())
3333
throw new IllegalArgumentException("Site cannot be empty!");
3434

3535
try {

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

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ protected void onCreate(final Bundle savedInstanceState) {
167167
}
168168
}
169169
});
170+
171+
final Intent intent = getIntent();
172+
final String action = intent.getAction();
173+
final String type = intent.getType();
174+
175+
if (Intent.ACTION_SEND.equals(action) && type != null) {
176+
handleSendFile(intent);
177+
}
170178
}
171179

172180
/**
@@ -181,13 +189,43 @@ private void loadTheme() {
181189
}
182190
}
183191

192+
/**
193+
* Handle the sending of a file
194+
*
195+
* @param intent The {@link Intent} object
196+
*/
197+
private void handleSendFile(final Intent intent) {
198+
final Uri intentFileUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
199+
if (intentFileUri != null) {
200+
fileUri = intentFileUri;
201+
try (final Cursor cursor = this.getContentResolver()
202+
.query(intentFileUri, null, null, null, null, null)) {
203+
if (cursor != null && cursor.moveToFirst()) {
204+
@SuppressLint("Range") final String displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
205+
edtFilePath.setText(displayName);
206+
207+
fileDataArrayList.clear();
208+
mAdapterFile.notifyDataSetChanged();
209+
}
210+
}
211+
} else {
212+
Toast.makeText(getApplicationContext(), R.string.error_open_file, Toast.LENGTH_SHORT).show();
213+
}
214+
}
215+
184216
@Override
185217
public boolean onCreateOptionsMenu(final Menu menu) {
186218
final MenuInflater inflater = getMenuInflater();
187219
inflater.inflate(R.menu.top_menu, menu);
188220
return true;
189221
}
190222

223+
@Override
224+
protected void onNewIntent(final Intent intent) {
225+
super.onNewIntent(intent);
226+
handleSendFile(intent);
227+
}
228+
191229
@Override
192230
public boolean onOptionsItemSelected(final MenuItem item) {
193231
final int itemId = item.getItemId();
@@ -406,7 +444,7 @@ private void loadTextHashContent(final Bundle savedInstance) {
406444
fileDataArrayList.clear();
407445
mAdapterText.notifyDataSetChanged();
408446

409-
if (edtTextData.getText() == null || edtTextData.getText().toString().length() == 0) {
447+
if (edtTextData.getText() == null || edtTextData.getText().toString().isEmpty()) {
410448
Toast.makeText(MainActivity.this, R.string.toast_error_notext, Toast.LENGTH_SHORT).show();
411449
return;
412450
}
@@ -483,13 +521,13 @@ private void loadHelpContent() {
483521
*/
484522
private void loadAboutContent() {
485523
final ImageButton btnFacebook = findViewById(R.id.BtnFacebook);
486-
final ImageButton btnTwitter = findViewById(R.id.BtnTwitter);
524+
final ImageButton btnBluesky = findViewById(R.id.BtnBluesky);
487525
final ImageButton btnWebsite = findViewById(R.id.BtnWebsiteAbout);
488526
final TextView txtAbout = findViewById(R.id.TxtAbout);
489527

490528
btnWebsite.setOnClickListener(v -> IntentUtils.openSite(v.getContext(), "http://codedead.com/"));
491529
btnFacebook.setOnClickListener(v -> IntentUtils.openSite(v.getContext(), "https://facebook.com/deadlinecodedead"));
492-
btnTwitter.setOnClickListener(v -> IntentUtils.openSite(v.getContext(), "https://twitter.com/C0DEDEAD"));
530+
btnBluesky.setOnClickListener(v -> IntentUtils.openSite(v.getContext(), "https://bsky.app/profile/codedead.com"));
493531
txtAbout.setMovementMethod(LinkMovementMethod.getInstance());
494532
}
495533

-755 Bytes
Binary file not shown.
-527 Bytes
Binary file not shown.
-971 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)