Add notification settings
This commit is contained in:
parent
8ed9634adf
commit
e94219c5a3
@ -47,10 +47,10 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
|
||||||
compile 'com.android.support:recyclerview-v7:25.1.1'
|
compile 'com.android.support:recyclerview-v7:25.2.0'
|
||||||
compile 'com.android.support:cardview-v7:25.1.1'
|
compile 'com.android.support:cardview-v7:25.2.0'
|
||||||
compile 'com.android.support:design:25.1.1'
|
compile 'com.android.support:design:25.2.0'
|
||||||
compile 'com.android.support:support-v4:25.1.1'
|
compile 'com.android.support:support-v4:25.2.0'
|
||||||
compile 'com.jakewharton:butterknife:8.5.1'
|
compile 'com.jakewharton:butterknife:8.5.1'
|
||||||
compile 'com.github.clans:fab:1.6.4'
|
compile 'com.github.clans:fab:1.6.4'
|
||||||
compile 'com.thoughtbot:expandablerecyclerview:1.4'
|
compile 'com.thoughtbot:expandablerecyclerview:1.4'
|
||||||
|
@ -63,6 +63,7 @@ public class MagiskManager extends Application {
|
|||||||
|
|
||||||
public boolean magiskHide;
|
public boolean magiskHide;
|
||||||
public boolean isDarkTheme;
|
public boolean isDarkTheme;
|
||||||
|
public boolean updateNotification;
|
||||||
public int suRequestTimeout;
|
public int suRequestTimeout;
|
||||||
public int suLogTimeout = 14;
|
public int suLogTimeout = 14;
|
||||||
public int suAccessState;
|
public int suAccessState;
|
||||||
@ -92,6 +93,7 @@ public class MagiskManager extends Application {
|
|||||||
devLogging = prefs.getBoolean("developer_logging", false);
|
devLogging = prefs.getBoolean("developer_logging", false);
|
||||||
shellLogging = prefs.getBoolean("shell_logging", false);
|
shellLogging = prefs.getBoolean("shell_logging", false);
|
||||||
magiskHide = prefs.getBoolean("magiskhide", false);
|
magiskHide = prefs.getBoolean("magiskhide", false);
|
||||||
|
updateNotification = prefs.getBoolean("notification", true);
|
||||||
// Always start a new root shell manually, just for safety
|
// Always start a new root shell manually, just for safety
|
||||||
Shell.init();
|
Shell.init();
|
||||||
updateMagiskInfo();
|
updateMagiskInfo();
|
||||||
@ -101,6 +103,7 @@ public class MagiskManager extends Application {
|
|||||||
prefs.edit()
|
prefs.edit()
|
||||||
.putBoolean("dark_theme", isDarkTheme)
|
.putBoolean("dark_theme", isDarkTheme)
|
||||||
.putBoolean("magiskhide", magiskHide)
|
.putBoolean("magiskhide", magiskHide)
|
||||||
|
.putBoolean("notification", updateNotification)
|
||||||
.putBoolean("busybox", Utils.commandExists("busybox"))
|
.putBoolean("busybox", Utils.commandExists("busybox"))
|
||||||
.putBoolean("hosts", new File("/magisk/.core/hosts").exists())
|
.putBoolean("hosts", new File("/magisk/.core/hosts").exists())
|
||||||
.putBoolean("disable", Utils.itemExist(MAGISK_DISABLE_FILE))
|
.putBoolean("disable", Utils.itemExist(MAGISK_DISABLE_FILE))
|
||||||
|
@ -2,7 +2,6 @@ package com.topjohnwu.magisk;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -65,13 +64,8 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OnClick(R.id.magisk_status_container)
|
@OnClick(R.id.magisk_status_container)
|
||||||
public void magisk() {
|
public void gotoInstall() {
|
||||||
((MainActivity) getActivity()).navigationView.setCheckedItem(R.id.install);
|
((MainActivity) getActivity()).navigate(R.id.install);
|
||||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
|
||||||
transaction.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);
|
|
||||||
try {
|
|
||||||
transaction.replace(R.id.content_frame, new InstallFragment(), "install").commit();
|
|
||||||
} catch (IllegalStateException ignored) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int defaultColor;
|
private int defaultColor;
|
||||||
@ -110,14 +104,7 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
|
|||||||
.setTitle(R.string.no_magisk_title)
|
.setTitle(R.string.no_magisk_title)
|
||||||
.setMessage(R.string.no_magisk_msg)
|
.setMessage(R.string.no_magisk_msg)
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton(R.string.goto_install, (dialogInterface, i) -> {
|
.setPositiveButton(R.string.goto_install, (d, i) -> gotoInstall())
|
||||||
((MainActivity) getActivity()).navigationView.setCheckedItem(R.id.install);
|
|
||||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
|
||||||
transaction.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);
|
|
||||||
try {
|
|
||||||
transaction.replace(R.id.content_frame, new InstallFragment(), "install").commit();
|
|
||||||
} catch (IllegalStateException ignored) {}
|
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.no_thanks, null)
|
.setNegativeButton(R.string.no_thanks, null)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,8 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void v) {
|
protected void onPostExecute(Void v) {
|
||||||
if (magiskManager.magiskVersion < magiskManager.remoteMagiskVersion && showNotification) {
|
if (magiskManager.magiskVersion < magiskManager.remoteMagiskVersion
|
||||||
|
&& showNotification && magiskManager.updateNotification) {
|
||||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(magiskManager);
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(magiskManager);
|
||||||
builder.setSmallIcon(R.drawable.ic_magisk)
|
builder.setSmallIcon(R.drawable.ic_magisk)
|
||||||
.setContentTitle(magiskManager.getString(R.string.magisk_update_title))
|
.setContentTitle(magiskManager.getString(R.string.magisk_update_title))
|
||||||
|
@ -12,6 +12,7 @@ public class UpdateCheckService extends JobService {
|
|||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
magiskManager.updateMagiskInfo();
|
magiskManager.updateMagiskInfo();
|
||||||
|
magiskManager.updateNotification = magiskManager.prefs.getBoolean("notification", true);
|
||||||
return super.doInBackground(voids);
|
return super.doInBackground(voids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,5 +191,7 @@
|
|||||||
<string name="version_none">(無)</string>
|
<string name="version_none">(無)</string>
|
||||||
<string name="manual_boot_image">請手動選取 boot 映像位置</string>
|
<string name="manual_boot_image">請手動選取 boot 映像位置</string>
|
||||||
<string name="cannot_auto_detect">(無法自動偵測)</string>
|
<string name="cannot_auto_detect">(無法自動偵測)</string>
|
||||||
|
<string name="settings_notification_summary">有更新的時候顯示通知</string>
|
||||||
|
<string name="settings_notification_title">更新通知</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -131,6 +131,8 @@
|
|||||||
<string name="settings_general_category">General</string>
|
<string name="settings_general_category">General</string>
|
||||||
<string name="settings_dark_theme_title">Dark Theme</string>
|
<string name="settings_dark_theme_title">Dark Theme</string>
|
||||||
<string name="settings_dark_theme_summary">Enable dark theme</string>
|
<string name="settings_dark_theme_summary">Enable dark theme</string>
|
||||||
|
<string name="settings_notification_title">Update Notification</string>
|
||||||
|
<string name="settings_notification_summary">Show update notifications when new version is available</string>
|
||||||
<string name="settings_clear_cache_title">Clear Repo Cache</string>
|
<string name="settings_clear_cache_title">Clear Repo Cache</string>
|
||||||
<string name="settings_clear_cache_summary">Clear the cached information for online repos, forces the app to refresh online</string>
|
<string name="settings_clear_cache_summary">Clear the cached information for online repos, forces the app to refresh online</string>
|
||||||
|
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
android:summary="@string/settings_dark_theme_summary"
|
android:summary="@string/settings_dark_theme_summary"
|
||||||
android:key="dark_theme" />
|
android:key="dark_theme" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:title="@string/settings_notification_title"
|
||||||
|
android:summary="@string/settings_notification_summary"
|
||||||
|
android:key="notification" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="clear"
|
android:key="clear"
|
||||||
android:title="@string/settings_clear_cache_title"
|
android:title="@string/settings_clear_cache_title"
|
||||||
|
Loading…
Reference in New Issue
Block a user