tweak some last things

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/267/head v1.1.0
androidacy-user 1 year ago
parent efd5391ef8
commit 08989be2a3

@ -541,6 +541,42 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
Toast.makeText(requireContext(), toastText, Toast.LENGTH_SHORT).show();
return true;
});
// Next, the pref_androidacy_thanks should lead to the androidacy website
linkClickable = findPreference("pref_androidacy_thanks");
linkClickable.setOnPreferenceClickListener(p -> {
IntentHelper.openUrl(p.getContext(), "https://www.androidacy.com?utm_source=FoxMagiskModuleManager&utm_medium=app&utm_campaign=FoxMagiskModuleManager");
return true;
});
linkClickable.setOnPreferenceLongClickListener(p -> {
String toastText = requireContext().getString(R.string.link_copied);
clipboard.setPrimaryClip(ClipData.newPlainText(toastText, "https://www.androidacy.com?utm_source=FoxMagiskModuleManager&utm_medium=app&utm_campaign=FoxMagiskModuleManager"));
Toast.makeText(requireContext(), toastText, Toast.LENGTH_SHORT).show();
return true;
});
// pref_contributors should lead to the contributors page
linkClickable = findPreference("pref_contributors");
linkClickable.setOnPreferenceClickListener(p -> {
// Remove the .git if it exists and add /graphs/contributors
String url = BuildConfig.REMOTE_URL;
if (url.endsWith(".git")) {
url = url.substring(0, url.length() - 4);
}
url += "/graphs/contributors";
IntentHelper.openUrl(p.getContext(), url);
return true;
});
linkClickable.setOnPreferenceLongClickListener(p -> {
String toastText = requireContext().getString(R.string.link_copied);
// Remove the .git if it exists and add /graphs/contributors
String url = BuildConfig.REMOTE_URL;
if (url.endsWith(".git")) {
url = url.substring(0, url.length() - 4);
}
url += "/graphs/contributors";
clipboard.setPrimaryClip(ClipData.newPlainText(toastText, url));
Toast.makeText(requireContext(), toastText, Toast.LENGTH_SHORT).show();
return true;
});
linkClickable = findPreference("pref_support");
linkClickable.setOnPreferenceClickListener(p -> {
devModeStep = 0;

@ -15,6 +15,7 @@ import com.fox2code.mmm.installer.InstallerInitializer;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class ZipFileOpener extends FoxActivity {
@ -30,6 +31,7 @@ public class ZipFileOpener extends FoxActivity {
File zipFile;
Uri uri = getIntent().getData();
if (uri == null) {
Log.e("ZipFileOpener", "onCreate: No data provided");
Toast.makeText(this, R.string.zip_load_failed, Toast.LENGTH_LONG).show();
finish();
return;
@ -63,6 +65,30 @@ public class ZipFileOpener extends FoxActivity {
Toast.makeText(this, R.string.zip_load_failed, Toast.LENGTH_LONG).show();
finishAndRemoveTask();
return;
} else {
if (BuildConfig.DEBUG) {
Log.d("ZipFileOpener", "onCreate: Zip file is " + zipFile.length() + " bytes");
}
}
// Unpack the zip to validate it's a valid magisk module
// It needs to have, at the bare minimum, a module.prop file. Everything else is technically optional.
// First, check if it's a zip file
try (java.util.zip.ZipFile zip = new java.util.zip.ZipFile(zipFile)) {
if (zip.getEntry("module.prop") == null) {
Log.e(TAG, "onCreate: Zip file is not a valid magisk module");
Toast.makeText(this, R.string.invalid_format, Toast.LENGTH_LONG).show();
finishAndRemoveTask();
return;
}
} catch (
IOException e) {
Log.e(TAG, "onCreate: Failed to open zip file", e);
Toast.makeText(this, R.string.zip_load_failed, Toast.LENGTH_LONG).show();
finishAndRemoveTask();
return;
}
if (BuildConfig.DEBUG) {
Log.d("ZipFileOpener", "onCreate: Zip file is valid");
}
// Pass the file to the installer
FoxActivity compatActivity = FoxActivity.getFoxActivity(this);

@ -0,0 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp"
android:height="24dp" android:autoMirrored="true"
android:tint="?attr/colorControlNormal" android:viewportWidth="24" android:viewportHeight="24">
<path
android:fillColor="@android:color/white" android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z" />
</vector>

@ -267,5 +267,7 @@
<string name="androidacy_update_needed">This app is outdated.</string>
<string name="androidacy_update_needed_message">Please update the app to the latest version.</string>
<string name="androidacy_webview_update_required">Your webview is outdated! Please update it.</string><string name="language_cta">Don\'t see your language?</string><string name="language_cta_desc">Help us by translating it! Tap here to find out more.</string>
<string name="source_code_summary"><b>Commit</b> %1$s @ %2$s</string><string name="no_file_provided">No file was provided when trying to open zip.</string><string name="zip_load_failed">Could not load the zip file</string>
<string name="source_code_summary"><b>Commit</b> %1$s @ %2$s</string>
<string name="no_file_provided">No file was provided when trying to open zip.</string>
<string name="zip_load_failed">Could not load the zip file</string><string name="androidacy_thanks">Developed in part by Androidacy</string><string name="androidacy_thanks_desc">Huge shoutout to Androidacy for their integration and contributions to the app.</string><string name="contributors">And of course, thanks to all of our contributors, whether it\'s translations, code, or just being fun to hang out with! We love you all.</string>
</resources>

@ -174,6 +174,21 @@
app:key="pref_show_licenses"
app:singleLineTitle="false"
app:title="@string/show_licenses" />
<!-- Small lil thanks to Androidacy -->
<com.fox2code.mmm.settings.LongClickablePreference
app:icon="@drawable/baseline_favorite_24"
app:key="pref_androidacy_thanks"
app:singleLineTitle="false"
app:summary="@string/androidacy_thanks_desc"
app:title="@string/androidacy_thanks" />
<!-- OKay, so we'll thank all the other contributors too -->
<com.fox2code.mmm.settings.LongClickablePreference
android:textAppearance="?android:attr/textAppearanceSmall"
app:iconSpaceReserved="false"
app:key="pref_contributors"
app:singleLineTitle="false"
app:title="@string/contributors" />
<!-- And the translators -->
<Preference
app:enabled="false"
app:iconSpaceReserved="false"

Loading…
Cancel
Save