Additional notice for Module updates

This commit is contained in:
topjohnwu 2016-09-29 03:37:57 +08:00
parent 35e3a479cd
commit 692b993eee
7 changed files with 21 additions and 14 deletions

View File

@ -99,11 +99,17 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
updateDeleteButton(holder, module);
});
updateDeleteButton(holder, module);
if (module.isUpdated()) {
holder.notice.setVisibility(View.VISIBLE);
holder.notice.setText(R.string.update_file_created);
holder.delete.setEnabled(false);
} else {
updateDeleteButton(holder, module);
}
}
private void updateDeleteButton(ViewHolder holder, Module module) {
holder.warning.setVisibility(module.willBeRemoved() ? View.VISIBLE : View.GONE);
holder.notice.setVisibility(module.willBeRemoved() ? View.VISIBLE : View.GONE);
if (module.willBeRemoved()) {
holder.delete.setImageResource(R.drawable.ic_undelete);
@ -122,10 +128,9 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@BindView(R.id.title) TextView title;
@BindView(R.id.version_name) TextView versionName;
@BindView(R.id.description) TextView description;
@BindView(R.id.warning) TextView warning;
@BindView(R.id.notice) TextView notice;
@BindView(R.id.checkbox) CheckBox checkBox;
@BindView(R.id.author) TextView author;
// @BindView(R.id.updateStatus) TextView updateStatus;
@BindView(R.id.delete) ImageView delete;
public ViewHolder(View itemView) {

View File

@ -25,12 +25,8 @@ public class SplashActivity extends AppCompatActivity {
if (defaultPrefs.getString("theme","").equals("Dark")) {
setTheme(R.style.AppTheme_dh);
}
//setups go here
// Set up default preferences,make sure we add "extra" blacklist entries.
if (!defaultPrefs.contains("auto_blacklist")) {
Logger.dev("SplashActivity: Setting default preferences for application");
SharedPreferences.Editor editor = defaultPrefs.edit();

View File

@ -6,9 +6,8 @@ import com.topjohnwu.magisk.utils.Utils;
public class Module extends BaseModule {
private String mRemoveFile;
private String mDisableFile;
private boolean mEnable, mRemove;
private String mRemoveFile, mDisableFile, mUpdateFile;
private boolean mEnable, mRemove, mUpdated;
public Module(String path) {
@ -16,6 +15,7 @@ public class Module extends BaseModule {
mRemoveFile = path + "/remove";
mDisableFile = path + "/disable";
mUpdateFile = path + "/update";
if (mId == null) {
int sep = path.lastIndexOf('/');
@ -29,6 +29,7 @@ public class Module extends BaseModule {
mEnable = !Utils.itemExist(mDisableFile);
mRemove = Utils.itemExist(mRemoveFile);
mUpdated = Utils.itemExist(mUpdateFile);
}
@ -56,4 +57,8 @@ public class Module extends BaseModule {
return mRemove;
}
public boolean isUpdated() {
return mUpdated;
}
}

View File

@ -42,7 +42,7 @@ public class Async {
@Override
protected Void doInBackground(Void... voids) {
String toolPath = mContext.getApplicationInfo().dataDir + "/busybox";
String toolPath = mContext.getApplicationInfo().dataDir + "/tools";
String busybox = mContext.getApplicationInfo().dataDir + "/lib/libbusybox.so";
String zip = mContext.getApplicationInfo().dataDir + "/lib/libzip.so";
if (Shell.rootAccess()) {

View File

@ -62,7 +62,7 @@ public class Utils {
} else {
MagiskFragment.magiskVersion = Integer.parseInt(ret.get(0));
}
String toolPath = context.getApplicationInfo().dataDir + "/busybox";
String toolPath = context.getApplicationInfo().dataDir + "/tools";
Shell.su("PATH=$PATH:" + toolPath);
}

View File

@ -70,7 +70,7 @@
android:textIsSelectable="false"/>
<TextView
android:id="@+id/warning"
android:id="@+id/notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/description"

View File

@ -49,6 +49,7 @@
<string name="no_info_provided">(No info provided)</string>
<string name="no_modules_found">No modules found</string>
<string name="module_not_installed">Module is not installed</string>
<string name="update_file_created">Module will be updated at next reboot</string>
<string name="remove_file_created">Module will be removed at next reboot</string>
<string name="remove_file_deleted">Module will not be removed at next reboot</string>
<string name="disable_file_created">Module will be disabled at next reboot</string>