Show Manager updates in dialogs

This commit is contained in:
topjohnwu 2017-09-03 14:58:21 +08:00
parent a07ca5ff50
commit 4998ad6c7e
14 changed files with 53 additions and 23 deletions

View File

@ -32,6 +32,7 @@ import com.topjohnwu.magisk.components.ExpandableView;
import com.topjohnwu.magisk.components.Fragment;
import com.topjohnwu.magisk.components.SnackbarMaker;
import com.topjohnwu.magisk.receivers.DownloadReceiver;
import com.topjohnwu.magisk.receivers.ManagerUpdate;
import com.topjohnwu.magisk.utils.Shell;
import com.topjohnwu.magisk.utils.Topic;
import com.topjohnwu.magisk.utils.Utils;
@ -112,6 +113,26 @@ public class MagiskFragment extends Fragment
@OnClick(R.id.install_button)
public void install() {
shownDialog = true;
// Show Manager update first
if (magiskManager.remoteManagerVersionCode > BuildConfig.VERSION_CODE) {
new AlertDialogBuilder(getActivity())
.setTitle(getString(R.string.repo_install_title, getString(R.string.app_name)))
.setMessage(getString(R.string.repo_install_msg,
Utils.getLegalFilename("MagiskManager-v" +
magiskManager.remoteManagerVersionString + ".apk")))
.setCancelable(true)
.setPositiveButton(R.string.install, (d, i) -> {
Intent intent = new Intent(magiskManager, ManagerUpdate.class);
intent.putExtra(MagiskManager.INTENT_LINK, magiskManager.managerLink);
intent.putExtra(MagiskManager.INTENT_VERSION, magiskManager.remoteManagerVersionString);
getActivity().sendBroadcast(intent);
})
.setNegativeButton(R.string.no_thanks, null)
.show();
return;
}
String bootImage = null;
if (Shell.rootAccess()) {
if (magiskManager.bootBlock != null) {
@ -427,21 +448,25 @@ public class MagiskFragment extends Fragment
magiskUpdateText.setText(getString(R.string.install_magisk_title, "v" + magiskManager.remoteMagiskVersionString));
}
if (magiskManager.remoteMagiskVersionCode > magiskManager.magiskVersionCode) {
installText.setText(R.string.update);
if (magiskManager.remoteManagerVersionCode > BuildConfig.VERSION_CODE) {
installText.setText(getString(R.string.update, getString(R.string.app_name)));
} else if (magiskManager.magiskVersionCode > 0 && magiskManager.remoteMagiskVersionCode > magiskManager.magiskVersionCode) {
installText.setText(getString(R.string.update, getString(R.string.magisk)));
} else {
installText.setText(R.string.install);
}
if (!shownDialog && (magiskManager.remoteMagiskVersionCode > magiskManager.magiskVersionCode
|| magiskManager.remoteManagerVersionCode > BuildConfig.VERSION_CODE)) {
install();
}
magiskUpdateIcon.setImageResource(image);
magiskUpdateIcon.setColorFilter(color);
magiskUpdateIcon.setVisibility(View.VISIBLE);
magiskUpdateProgress.setVisibility(View.GONE);
mSwipeRefreshLayout.setRefreshing(false);
if (magiskManager.remoteMagiskVersionCode > magiskManager.magiskVersionCode && !shownDialog)
install();
}
private void updateSafetyNetUI() {

View File

@ -51,7 +51,7 @@
<string name="uninstall_magisk_msg">Αυτό θα αφαιρέσει όλες τις ενότητες, το MagiskSU και πιθανόν να κρυπτογραφήσει τα δεδομένα σας αν δεν είναι κρυπτογραφυμένα\nΕίστε σίγουρος/η ότι θέλετε να συνεχίσετε;</string>
<string name="version_none">(Καμία)</string>
<string name="reinstall">Επανεγκατάσταση</string>
<string name="update">Ενημέρωση</string>
<string name="update">Ενημέρωση %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(Δεν δόθηκαν πληροφορίες)</string>

View File

@ -53,7 +53,7 @@
<string name="uninstall_magisk_msg">Esto eliminará todos los módulos, MagiskSU, y potencialmente puede cifrar sus datos si no está encriptada\nEstas seguro de continuar?</string>
<string name="version_none">(Ninguno)</string>
<string name="reinstall">Re-Instalar</string>
<string name="update">Actualización</string>
<string name="update">Actualización %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(No hay información)</string>

View File

@ -53,7 +53,7 @@
<string name="uninstall_magisk_msg">Questo rimuoverà tutti i moduli, MagiskSU, e potenzialmente crittograferà i dati, se non crittografati/nVuoi continuare?</string>
<string name="version_none">(nessuna)</string>
<string name="reinstall">Reinstalla</string>
<string name="update">Aggiorna</string>
<string name="update">Aggiorna %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(nessuna informazione)</string>

View File

@ -53,7 +53,7 @@
<string name="uninstall_magisk_msg">Dit verwijdert alle modules, MagiskSU, en versleutelt mogelijk alle niet-versleutelde data\nZeker weten voortzetten?</string>
<string name="version_none">(Geen)</string>
<string name="reinstall">Herinstalleren</string>
<string name="update">Bijwerken</string>
<string name="update">Bijwerken %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(Geen info verstrekt)</string>

View File

@ -50,10 +50,11 @@
<string name="uninstall">Desinstalar</string>
<string name="reboot_countdown">A reiniciar em %1$d</string>
<string name="uninstall_magisk_title">Desinstalar Magisk</string>
<string name="uninstall_magisk_msg">Isso irá remover todos os módulos, MagiskSU, e Potencialmente encriptar seus dados se estiverem encriptados \nDeseja continuar?</string>
<string name="uninstall_magisk_msg">Isso irá remover todos os módulos, MagiskSU, e Potencialmente encriptar seus dados se estiverem encriptados
\nDeseja continuar?</string>
<string name="version_none">(Nenhum)</string>
<string name="reinstall">Reinstalar</string>
<string name="update">Atualizar</string>
<string name="update">Atualizar %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(Nenhuma informação fornecida)</string>
@ -119,13 +120,16 @@
<string name="settings_reboot_toast">Reinicie para aplicar definições</string>
<string name="release_notes">Notas da atualização</string>
<string name="repo_cache_cleared">Cache do repositório apagado</string>
<string name="safetyNet_hide_notice">Esta aplicação usa SafetyNet \nJá manipulado pelo MagiskHide por padrão</string>
<string name="safetyNet_hide_notice">Esta aplicação usa SafetyNet
\nJá manipulado pelo MagiskHide por padrão</string>
<string name="start_magiskhide">A iniciar MagiskHide …</string>
<string name="no_magisksu_title">Não está a usar MagiskSU!</string>
<string name="no_magisksu_msg">Não está root instalado com MagiskSU, Usar somente MagiskHide pode não ser suficiente! \nNão é oficialmente suportado, E precisaria de ferramentas adicionais (ex: suhide) para passar pelo SafetyNet.</string>
<string name="no_magisksu_msg">Não está root instalado com MagiskSU, Usar somente MagiskHide pode não ser suficiente!
\nNão é oficialmente suportado, E precisaria de ferramentas adicionais (ex: suhide) para passar pelo SafetyNet.</string>
<string name="understand">Eu entendo</string>
<string name="process_error">Erro no processo</string>
<string name="internal_storage">O zip foi guardado em: \n[Armazenamento interno]%1$s</string>
<string name="internal_storage">O zip foi guardado em:
\n[Armazenamento interno]%1$s</string>
<string name="zip_process_title">A processar</string>
<string name="manual_boot_image">Por Favor, selecione manualmente a imagem de Arranque</string>
<string name="manager_update_title">Nova atualização do Magisk Manager disponível!</string>
@ -197,7 +201,8 @@
<string name="deny">Negar</string>
<string name="prompt">Perguntar</string>
<string name="grant">Permitir</string>
<string name="su_warning">Concede acesso total ao seu dispositivo. \nNegue se não tiver certeza!</string>
<string name="su_warning">Concede acesso total ao seu dispositivo.
\nNegue se não tiver certeza!</string>
<string name="forever">Sempre</string>
<string name="once">Uma vez</string>
<string name="tenmin">10 minutos</string>

View File

@ -47,7 +47,7 @@
<string name="uninstall_magisk_msg">Aceasta va elimina toate modulele, MagiskSU, şi potențial să cripteze datele, dacă nu sunt criptate\nContinuaţi?</string>
<string name="version_none">(Niciuna)</string>
<string name="reinstall">Re-Instalare</string>
<string name="update">Actualizare</string>
<string name="update">Actualizare %1$s</string>
<!--Module Fragment-->

View File

@ -53,7 +53,7 @@
<string name="uninstall_magisk_msg">Данное действие приведет к удалению всех модулей, MagiskSU, и может зашифровать данные, если они не зашифрованы.\nУверены, что желаете продолжить?</string>
<string name="version_none">(Нет данных)</string>
<string name="reinstall">Переустановить</string>
<string name="update">Обновить</string>
<string name="update">Обновить %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(Нет предоставленной информации)</string>

View File

@ -53,7 +53,7 @@
<string name="uninstall_magisk_msg">Detta kommer att ta bort alla moduler, MagiskSU, och potentiellt kryptera din data om inte krypterad\nÄr det säker du vill fortsätta?</string>
<string name="version_none">(Inga)</string>
<string name="reinstall">Installera om</string>
<string name="update">Uppdatera</string>
<string name="update">Uppdatera %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(Ingen information tillhandahållen)</string>

View File

@ -52,7 +52,7 @@
<string name="uninstall_magisk_msg">"Bu, tüm modülleri, MagiskSU\'yu kaldıracak ve şifrelenmemişse verilerinizi potansiyel olarak şifreleyecektir\nDevam etmek istediğinize emin misiniz?"</string>
<string name="version_none">(Hiçbiri)</string>
<string name="reinstall">Yeniden Yükle</string>
<string name="update">Güncelle</string>
<string name="update">Güncelle %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(Hiçbir açıklama sağlanmadı)</string>

View File

@ -52,7 +52,7 @@
<string name="uninstall_magisk_msg">Ця дія призведе до видалення всіх модулів, MagiskSU, і може зашифрувати дані, якщо вони не зашифровані.\nВпевнені, що бажаєте продовжити?</string>
<string name="version_none">(Немає даних)</string>
<string name="reinstall">Перевстановити</string>
<string name="update">Оновити</string>
<string name="update">Оновити %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(Немає наданої інформації)</string>

View File

@ -53,7 +53,7 @@
<string name="uninstall_magisk_msg">将会删除所有模块及 MagiskSU并有可能在目前未加密的情况下加密你的数据\n你确定要继续吗</string>
<string name="version_none">(无)</string>
<string name="reinstall">重新安装</string>
<string name="update">更新</string>
<string name="update">更新 %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(未提供信息)</string>

View File

@ -217,7 +217,7 @@
<string name="settings_ns_isolate">獨立 Namespace</string>
<string name="settings_ns_requester">繼承 Namespace</string>
<string name="reinstall">重新安裝</string>
<string name="update">更新</string>
<string name="update">更新 %1$s</string>
<string name="magisk_updates">Magisk 更新</string>
<string name="system_default">(系統預設)</string>
<string name="language">語言</string>

View File

@ -56,7 +56,7 @@
<string name="uninstall_magisk_msg">This will remove all modules, MagiskSU, and potentially encrypt your data if not encrypted\nAre you sure to continue?</string>
<string name="version_none">(None)</string>
<string name="reinstall">Re-Install</string>
<string name="update">Update</string>
<string name="update">Update %1$s</string>
<!--Module Fragment-->
<string name="no_info_provided">(No info provided)</string>