Dialog fix and trivial stuffs
This commit is contained in:
parent
c7e64f40f9
commit
b064c124e7
@ -14,6 +14,8 @@ import android.widget.Spinner;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.receivers.MagiskDlReceiver;
|
import com.topjohnwu.magisk.receivers.MagiskDlReceiver;
|
||||||
|
import com.topjohnwu.magisk.receivers.RepoDlReceiver;
|
||||||
|
import com.topjohnwu.magisk.utils.Async;
|
||||||
import com.topjohnwu.magisk.utils.CallbackHandler;
|
import com.topjohnwu.magisk.utils.CallbackHandler;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
@ -49,11 +51,19 @@ public class InstallFragment extends Fragment implements CallbackHandler.EventLi
|
|||||||
if (bootImage == null) {
|
if (bootImage == null) {
|
||||||
bootImage = blockList.get(spinner.getSelectedItemPosition() - 1);
|
bootImage = blockList.get(spinner.getSelectedItemPosition() - 1);
|
||||||
}
|
}
|
||||||
Utils.dlAndReceive(
|
String filename = "Magisk-v" + String.valueOf(StatusFragment.remoteMagiskVersion) + ".zip";
|
||||||
getActivity(),
|
String finalBootImage = bootImage;
|
||||||
new MagiskDlReceiver(bootImage, keepEncChkbox.isChecked(), keepVerityChkbox.isChecked()),
|
MainActivity.alertBuilder
|
||||||
StatusFragment.magiskLink,
|
.setTitle(getString(R.string.repo_install_title, getString(R.string.magisk)))
|
||||||
"Magisk-v" + String.valueOf(StatusFragment.remoteMagiskVersion) + ".zip");
|
.setMessage(getString(R.string.repo_install_msg, filename))
|
||||||
|
.setCancelable(true)
|
||||||
|
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> Utils.dlAndReceive(
|
||||||
|
getActivity(),
|
||||||
|
new MagiskDlReceiver(finalBootImage, keepEncChkbox.isChecked(), keepVerityChkbox.isChecked()),
|
||||||
|
StatusFragment.magiskLink,
|
||||||
|
Utils.getLegalFilename(filename)))
|
||||||
|
.setNegativeButton(R.string.no_thanks, null)
|
||||||
|
.show();
|
||||||
});
|
});
|
||||||
if (blockDetectionDone.isTriggered) {
|
if (blockDetectionDone.isTriggered) {
|
||||||
updateUI();
|
updateUI();
|
||||||
|
@ -94,12 +94,12 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
|
|||||||
updateSafetyNetUI();
|
updateSafetyNetUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (magiskVersion < 0) {
|
if (magiskVersion < 0 && Shell.rootAccess()) {
|
||||||
MainActivity.alertBuilder
|
MainActivity.alertBuilder
|
||||||
.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.download_install, (dialogInterface, i) -> {
|
.setPositiveButton(R.string.goto_install, (dialogInterface, i) -> {
|
||||||
((MainActivity) getActivity()).navigationView.setCheckedItem(R.id.install);
|
((MainActivity) getActivity()).navigationView.setCheckedItem(R.id.install);
|
||||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||||
transaction.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);
|
transaction.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);
|
||||||
|
@ -6,8 +6,6 @@ import android.animation.ValueAnimator;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -19,6 +17,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.topjohnwu.magisk.MainActivity;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.module.Repo;
|
import com.topjohnwu.magisk.module.Repo;
|
||||||
import com.topjohnwu.magisk.receivers.RepoDlReceiver;
|
import com.topjohnwu.magisk.receivers.RepoDlReceiver;
|
||||||
@ -34,8 +33,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
|
|
||||||
private List<Repo> mUpdateRepos, mInstalledRepos, mOthersRepos;
|
private List<Repo> mUpdateRepos, mInstalledRepos, mOthersRepos;
|
||||||
private View mView;
|
private View mView;
|
||||||
private Context context;
|
private Context mContext;
|
||||||
private AlertDialog.Builder builder;
|
|
||||||
|
|
||||||
public ReposAdapter(List<Repo> update, List<Repo> installed, List<Repo> others) {
|
public ReposAdapter(List<Repo> update, List<Repo> installed, List<Repo> others) {
|
||||||
mUpdateRepos = update;
|
mUpdateRepos = update;
|
||||||
@ -47,14 +45,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
mView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_repo, parent, false);
|
mView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_repo, parent, false);
|
||||||
ButterKnife.bind(this, mView);
|
ButterKnife.bind(this, mView);
|
||||||
context = parent.getContext();
|
mContext = parent.getContext();
|
||||||
|
|
||||||
String theme = PreferenceManager.getDefaultSharedPreferences(context).getString("theme", "");
|
|
||||||
if (theme.equals("Dark")) {
|
|
||||||
builder = new AlertDialog.Builder(context, R.style.AlertDialog_dh);
|
|
||||||
} else {
|
|
||||||
builder = new AlertDialog.Builder(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ViewHolder(mView);
|
return new ViewHolder(mView);
|
||||||
}
|
}
|
||||||
@ -81,7 +72,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
holder.versionName.setText(versionName);
|
holder.versionName.setText(versionName);
|
||||||
}
|
}
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
holder.author.setText(context.getString(R.string.author, author));
|
holder.author.setText(mContext.getString(R.string.author, author));
|
||||||
}
|
}
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
holder.description.setText(description);
|
holder.description.setText(description);
|
||||||
@ -90,12 +81,12 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
View.OnClickListener listener = view -> {
|
View.OnClickListener listener = view -> {
|
||||||
if (view.getId() == holder.updateImage.getId()) {
|
if (view.getId() == holder.updateImage.getId()) {
|
||||||
String filename = repo.getName() + "-" + repo.getVersion() + ".zip";
|
String filename = repo.getName() + "-" + repo.getVersion() + ".zip";
|
||||||
builder
|
MainActivity.alertBuilder
|
||||||
.setTitle(context.getString(R.string.repo_install_title, repo.getName()))
|
.setTitle(mContext.getString(R.string.repo_install_title, repo.getName()))
|
||||||
.setMessage(context.getString(R.string.repo_install_msg, filename))
|
.setMessage(mContext.getString(R.string.repo_install_msg, filename))
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> Utils.dlAndReceive(
|
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> Utils.dlAndReceive(
|
||||||
context,
|
mContext,
|
||||||
new RepoDlReceiver(),
|
new RepoDlReceiver(),
|
||||||
repo.getZipUrl(),
|
repo.getZipUrl(),
|
||||||
Utils.getLegalFilename(filename)))
|
Utils.getLegalFilename(filename)))
|
||||||
@ -103,13 +94,13 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
if ((view.getId() == holder.changeLog.getId()) && (!repo.getLogUrl().equals(""))) {
|
if ((view.getId() == holder.changeLog.getId()) && (!repo.getLogUrl().equals(""))) {
|
||||||
new WebWindow(context.getString(R.string.changelog), repo.getLogUrl(), context);
|
new WebWindow(mContext.getString(R.string.changelog), repo.getLogUrl(), mContext);
|
||||||
}
|
}
|
||||||
if ((view.getId() == holder.authorLink.getId()) && (!repo.getSupportUrl().equals(""))) {
|
if ((view.getId() == holder.authorLink.getId()) && (!repo.getSupportUrl().equals(""))) {
|
||||||
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getDonateUrl())));
|
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getDonateUrl())));
|
||||||
}
|
}
|
||||||
if ((view.getId() == holder.supportLink.getId()) && (!repo.getSupportUrl().equals(""))) {
|
if ((view.getId() == holder.supportLink.getId()) && (!repo.getSupportUrl().equals(""))) {
|
||||||
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getSupportUrl())));
|
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(repo.getSupportUrl())));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -145,7 +136,7 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
|
|||||||
|
|
||||||
public ViewHolder(View itemView) {
|
public ViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
WindowManager windowmanager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
WindowManager windowmanager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||||
ButterKnife.bind(this, itemView);
|
ButterKnife.bind(this, itemView);
|
||||||
DisplayMetrics dimension = new DisplayMetrics();
|
DisplayMetrics dimension = new DisplayMetrics();
|
||||||
windowmanager.getDefaultDisplay().getMetrics(dimension);
|
windowmanager.getDefaultDisplay().getMetrics(dimension);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<string name="magisk_version">المثبت Magisk v%1$s</string>
|
<string name="magisk_version">المثبت Magisk v%1$s</string>
|
||||||
<string name="magisk_version_error">هل قمت بتثبيت Magisk؟</string>
|
<string name="magisk_version_error">هل قمت بتثبيت Magisk؟</string>
|
||||||
|
|
||||||
<string name="magisk_update_available">Magisk v%1$s تحديث!</string>
|
<string name="magisk_update_available">Magisk v%1$.1f تحديث!</string>
|
||||||
<string name="cannot_check_updates">لا يمكن التحقق من التحديثات</string>
|
<string name="cannot_check_updates">لا يمكن التحقق من التحديثات</string>
|
||||||
<string name="up_to_date">أحدث إصدار من %1$s مثبت</string>
|
<string name="up_to_date">أحدث إصدار من %1$s مثبت</string>
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<string name="magisk_version">已安装 Magisk v%1$s</string>
|
<string name="magisk_version">已安装 Magisk v%1$s</string>
|
||||||
<string name="magisk_version_error">你是否已安装 Magisk?</string>
|
<string name="magisk_version_error">你是否已安装 Magisk?</string>
|
||||||
|
|
||||||
<string name="magisk_update_available">Magisk 可更新到 v%1$s!</string>
|
<string name="magisk_update_available">Magisk 可更新到 v%1$.1f!</string>
|
||||||
<string name="cannot_check_updates">无法检查更新</string>
|
<string name="cannot_check_updates">无法检查更新</string>
|
||||||
<string name="up_to_date">已安装最新版本的 %1$s</string>
|
<string name="up_to_date">已安装最新版本的 %1$s</string>
|
||||||
|
|
||||||
|
@ -85,7 +85,8 @@
|
|||||||
<string name="no_thanks">No thanks</string>
|
<string name="no_thanks">No thanks</string>
|
||||||
<string name="repo_install_title">Install %1$s</string>
|
<string name="repo_install_title">Install %1$s</string>
|
||||||
<string name="repo_install_msg">Do you want to install %1$s ?</string>
|
<string name="repo_install_msg">Do you want to install %1$s ?</string>
|
||||||
<string name="download_install">Go to \"Install\" section</string>
|
<string name="download_install">Download and install</string>
|
||||||
|
<string name="goto_install">Go to \"Install\" section</string>
|
||||||
<string name="download_file_error">Error downloading file</string>
|
<string name="download_file_error">Error downloading file</string>
|
||||||
<string name="install_error">Installation error!</string>
|
<string name="install_error">Installation error!</string>
|
||||||
<string name="manual_install_1">Zip file placed in %1$s</string>
|
<string name="manual_install_1">Zip file placed in %1$s</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user