mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-24 03:35:50 +01:00
Migrate spoof switch to button
This commit is contained in:
parent
45c29cf0b8
commit
eabf13a564
@ -38,6 +38,7 @@ public abstract class AssistantActivity extends Activity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.login_assistant);
|
||||
formatTitle();
|
||||
findViewById(R.id.spoof_button).setOnClickListener(v -> onSpoofButtonClicked());
|
||||
findViewById(R.id.next_button).setOnClickListener(v -> onNextButtonClicked());
|
||||
findViewById(R.id.back_button).setOnClickListener(v -> onBackButtonClicked());
|
||||
}
|
||||
@ -53,6 +54,19 @@ public abstract class AssistantActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpoofButtonText(@StringRes int res) {
|
||||
setSpoofButtonText(getText(res));
|
||||
}
|
||||
|
||||
public void setSpoofButtonText(CharSequence text) {
|
||||
if (text == null) {
|
||||
findViewById(R.id.spoof_button).setVisibility(View.GONE);
|
||||
} else {
|
||||
findViewById(R.id.spoof_button).setVisibility(View.VISIBLE);
|
||||
((Button) findViewById(R.id.spoof_button)).setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
public void setNextButtonText(@StringRes int res) {
|
||||
setNextButtonText(getText(res));
|
||||
}
|
||||
@ -79,6 +93,10 @@ public abstract class AssistantActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
protected void onSpoofButtonClicked() {
|
||||
|
||||
}
|
||||
|
||||
protected void onNextButtonClicked() {
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ import org.microg.gms.auth.AuthConstants;
|
||||
import org.microg.gms.auth.AuthManager;
|
||||
import org.microg.gms.auth.AuthRequest;
|
||||
import org.microg.gms.auth.AuthResponse;
|
||||
import org.microg.gms.checkin.CheckinClient;
|
||||
import org.microg.gms.checkin.CheckinManager;
|
||||
import org.microg.gms.checkin.LastCheckinInfo;
|
||||
import org.microg.gms.common.HttpFormClient;
|
||||
@ -146,10 +147,19 @@ public class LoginActivity extends AssistantActivity {
|
||||
} else {
|
||||
setMessage(R.string.auth_before_connect);
|
||||
setBackButtonText(android.R.string.cancel);
|
||||
CheckinClient.brandSpoof = false;
|
||||
setNextButtonText(R.string.auth_sign_in);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSpoofButtonClicked() {
|
||||
super.onSpoofButtonClicked();
|
||||
CheckinClient.brandSpoof = true;
|
||||
state = 1;
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNextButtonClicked() {
|
||||
super.onNextButtonClicked();
|
||||
@ -174,6 +184,7 @@ public class LoginActivity extends AssistantActivity {
|
||||
private void init() {
|
||||
setTitle(R.string.just_a_sec);
|
||||
setBackButtonText(null);
|
||||
setSpoofButtonText(null);
|
||||
setNextButtonText(null);
|
||||
View loading = getLayoutInflater().inflate(R.layout.login_assistant_loading, authContent, false);
|
||||
authContent.removeAllViews();
|
||||
@ -267,6 +278,7 @@ public class LoginActivity extends AssistantActivity {
|
||||
}
|
||||
}
|
||||
showError(R.string.auth_general_error_desc);
|
||||
setSpoofButtonText(R.string.brand_spoof_button);
|
||||
}
|
||||
|
||||
private void retrieveRtToken(String oAuthToken) {
|
||||
@ -299,6 +311,7 @@ public class LoginActivity extends AssistantActivity {
|
||||
Log.w(TAG, "Account NOT created!");
|
||||
runOnUiThread(() -> {
|
||||
showError(R.string.auth_general_error_desc);
|
||||
setSpoofButtonText(R.string.brand_spoof_button);
|
||||
setNextButtonText(android.R.string.ok);
|
||||
});
|
||||
state = -2;
|
||||
@ -310,6 +323,7 @@ public class LoginActivity extends AssistantActivity {
|
||||
Log.w(TAG, "onException", exception);
|
||||
runOnUiThread(() -> {
|
||||
showError(R.string.auth_general_error_desc);
|
||||
setSpoofButtonText(R.string.brand_spoof_button);
|
||||
setNextButtonText(android.R.string.ok);
|
||||
});
|
||||
state = -2;
|
||||
@ -340,12 +354,12 @@ public class LoginActivity extends AssistantActivity {
|
||||
checkin(true);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onException(Exception exception) {
|
||||
Log.w(TAG, "onException", exception);
|
||||
runOnUiThread(() -> {
|
||||
showError(R.string.auth_general_error_desc);
|
||||
setSpoofButtonText(R.string.brand_spoof_button);
|
||||
setNextButtonText(android.R.string.ok);
|
||||
});
|
||||
state = -2;
|
||||
|
@ -49,11 +49,6 @@ class SettingsFragment : ResourceSettingsFragment() {
|
||||
PackageManager.DONT_KILL_APP)
|
||||
true
|
||||
}
|
||||
|
||||
findPreference<SwitchPreferenceCompat>(BRAND_SPOOF_FIX_ENABLED)!!.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||
CheckinClient.brandSpoof = newValue as Boolean
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -1,15 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:viewportWidth="58.999"
|
||||
android:viewportHeight="58.999">
|
||||
<path android:fillColor="#FF000000" android:pathData="M29.083,26.038c-0.53,0.154 -0.836,0.708 -0.683,1.239c0.027,0.093 2.697,9.591 1.962,30.687c-0.02,0.553 0.412,1.016 0.964,1.034c0.012,0.001 0.024,0.001 0.036,0.001c0.536,0 0.979,-0.425 0.998,-0.965c0.747,-21.414 -1.925,-30.919 -2.038,-31.313C30.169,26.19 29.616,25.888 29.083,26.038z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M54.228,16.479C49.992,6.469 40.232,0 29.362,0c-3.587,0 -7.085,0.701 -10.396,2.083c-1.834,0.765 -3.567,1.675 -5.151,2.704c-0.463,0.302 -0.595,0.921 -0.294,1.384c0.302,0.463 0.922,0.595 1.384,0.294c1.483,-0.964 3.108,-1.817 4.831,-2.536C22.803,2.648 26.041,2 29.362,2c10.064,0 19.102,5.989 23.023,15.259c1.63,3.854 2.511,10.95 2.891,14.838c0.051,0.517 0.485,0.902 0.994,0.902c0.032,0 0.065,-0.002 0.099,-0.005c0.549,-0.054 0.951,-0.543 0.897,-1.093C56.789,27.015 55.875,20.372 54.228,16.479z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M10.851,9.711c0.394,-0.387 0.397,-1.021 0.01,-1.414c-0.387,-0.393 -1.02,-0.397 -1.414,-0.01C4.069,13.585 -1.288,23.438 3.73,40.284c0.129,0.435 0.526,0.715 0.958,0.715c0.094,0 0.19,-0.014 0.285,-0.042c0.529,-0.157 0.831,-0.714 0.673,-1.243C1.899,27.132 3.698,16.758 10.851,9.711z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M30.13,6.014c-3.06,-0.119 -6.038,0.432 -8.853,1.606C11.471,11.711 6.257,22.494 9.15,32.704c0.289,1.021 0.585,2.107 0.744,3.189c0.358,2.449 0.377,6.956 0.377,14.105c0,0.553 0.447,1 1,1s1,-0.447 1,-1c0,-7.458 -0.019,-11.804 -0.398,-14.396c-0.176,-1.202 -0.491,-2.36 -0.799,-3.444c-2.617,-9.236 2.1,-18.992 10.973,-22.693c2.548,-1.063 5.259,-1.546 8.012,-1.454C37.17,8.267 45.23,14.535 47.661,21.7c2.104,6.199 2.122,16.76 1.861,26.271c-0.015,0.552 0.421,1.012 0.973,1.027c0.542,-0.01 1.012,-0.419 1.027,-0.973c0.265,-9.689 0.238,-20.471 -1.967,-26.969C46.838,13.049 38.124,6.3 30.13,6.014z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M29.362,12c-1.087,0 -2.169,0.117 -3.218,0.349c-0.539,0.119 -0.88,0.652 -0.761,1.192c0.119,0.539 0.646,0.873 1.192,0.761c0.907,-0.2 1.845,-0.302 2.786,-0.302c5.233,0 9.933,3.114 11.972,7.935c2.43,5.74 2.589,14.953 2.028,31.029c-0.02,0.552 0.412,1.016 0.964,1.034c0.012,0.001 0.024,0.001 0.036,0.001c0.536,0 0.979,-0.425 0.998,-0.965c0.584,-16.723 0.406,-25.758 -2.185,-31.879C40.823,15.594 35.401,12 29.362,12z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M21.935,16.337c0.452,-0.317 0.562,-0.941 0.244,-1.393c-0.316,-0.452 -0.941,-0.563 -1.393,-0.244c-5.15,3.616 -7.388,10.563 -5.565,17.295c0.021,0.073 2.051,7.462 2.051,19.004c0,0.553 0.447,1 1,1s1,-0.447 1,-1c0,-11.813 -2.038,-19.232 -2.123,-19.535C15.548,25.55 17.472,19.471 21.935,16.337z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M39.272,48.006c0.004,-0.553 -0.44,-1.003 -0.993,-1.007c-0.002,0 -0.005,0 -0.007,0c-0.549,0 -0.996,0.443 -1,0.993c-0.005,0.752 0.02,1.85 0.047,3.036c0.039,1.725 0.083,3.68 0.04,4.937c-0.02,0.552 0.412,1.015 0.965,1.033c0.012,0.001 0.023,0.001 0.035,0.001c0.536,0 0.979,-0.425 0.998,-0.966c0.046,-1.313 0.001,-3.299 -0.039,-5.051C39.291,49.82 39.267,48.743 39.272,48.006z"/>
|
||||
<path android:fillColor="#FF000000" android:pathData="M29.362,19c-1.062,0 -2.098,0.208 -3.081,0.618c-3.892,1.624 -5.783,6.015 -4.4,10.214c0.754,2.289 1.391,14.272 1.391,26.167c0,0.553 0.447,1 1,1s1,-0.447 1,-1c0,-10.707 -0.57,-23.995 -1.49,-26.792c-1.054,-3.197 0.353,-6.526 3.27,-7.743C27.789,21.156 28.566,21 29.362,21c2.415,0 4.584,1.438 5.529,3.67c1.867,4.419 2.422,12.419 2.558,18.353c0.013,0.544 0.458,0.977 1,0.977c0.007,0 0.016,0 0.023,0c0.552,-0.013 0.989,-0.471 0.977,-1.023c-0.141,-6.106 -0.726,-14.375 -2.72,-19.093C35.475,20.917 32.583,19 29.362,19z"/>
|
||||
</vector>
|
@ -79,6 +79,22 @@
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/spoof_button"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dip"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="90dp"
|
||||
android:layout_marginRight="90dp"
|
||||
android:paddingLeft="38dp"
|
||||
android:paddingRight="38dp"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/next_button"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
|
@ -26,7 +26,7 @@ Ini bisa berlangsung beberapa detik."</string>
|
||||
Ini mungkin hanya masalah sementara atau perangkat Android anda mungkin tidak disediakan untuk layanan data."</string>
|
||||
<string name="auth_general_error_desc">"Ada masalah dengan menghubungkan ke server Google.
|
||||
|
||||
Coba lagi nanti."</string>
|
||||
Coba lagi nanti atau coba login dengan mengklik tombol \'SPOOF\' di bawah ini."</string>
|
||||
<string name="auth_finalize">"Perangkat anda sedang menghubungkan ke Google untuk menyimpan informasi ke akun anda.
|
||||
|
||||
Ini bisa berlangsung beberapa menit."</string>
|
||||
@ -90,8 +90,7 @@ Ini bisa berlangsung beberapa menit."</string>
|
||||
<string name="pref_about_title">Tentang Vanced microG</string>
|
||||
<string name="pref_cast_double_fix">Perbaikan Cast terduplikasi</string>
|
||||
|
||||
<string name="brand_spoof_title">Model topeng</string>
|
||||
<string name="brand_spoof_fix">Gunakan opsi ini pada perangkat yang tidak memasang layanan Google atau tidak dapat masuk</string>
|
||||
<string name="brand_spoof_button">Spoof</string>
|
||||
|
||||
<string name="pref_switcher_title">Registrasi perangkat</string>
|
||||
<string name="pref_checkin_enable_summary">Registrasi perangkat anda ke layanan Google dan buat pengenal perangkat unik. Vanced microG strips mengenal bits selain dari akun Google anda dari data registrasi.</string>
|
||||
|
@ -26,7 +26,7 @@ Questa operazione potrebbe richiedere alcuni secondi."</string>
|
||||
Questo potrebbe essere un problema temporaneo o legato al mancato collegamento del tuo dispositivo Android ad un servizio dati. Riprova quando sarai connesso ad una rete mobile o connettiti ad una rete Wi-Fi."</string>
|
||||
<string name="auth_general_error_desc">"Si è verificato un problema di comunicazione con i server di Google.
|
||||
|
||||
Riprova più tardi."</string>
|
||||
Riprova più tardi o prova ad accedere cliccando sul pulsante \'SPOOF\' in basso."</string>
|
||||
<string name="auth_finalize">"Il tuo dispositivo sta tentando di contattare Google per salvare le informazioni sul tuo account.
|
||||
|
||||
Questo potrà richiedere un paio di minuti"</string>
|
||||
@ -90,8 +90,7 @@ Questo potrà richiedere un paio di minuti"</string>
|
||||
<string name="pref_about_title">Informazioni su Vanced microG</string>
|
||||
<string name="pref_cast_double_fix">Correzione cast duplicato</string>
|
||||
|
||||
<string name="brand_spoof_title">Maschera modello</string>
|
||||
<string name="brand_spoof_fix">Utilizza questa opzione su dispositivi privi di servizi Google installati o non in grado di accedere</string>
|
||||
<string name="brand_spoof_button">Spoof</string>
|
||||
|
||||
<string name="pref_switcher_title">Registra dispositivo</string>
|
||||
<string name="pref_checkin_enable_summary">Registra il tuo dispositivo sui servizi Google e crea un identificatore univoco del dispositivo. Verranno rimossi dai Servizi Vanced microG alcuni bit utili per identificare i dati di registrazione, oltre al nome dell\'account Google.</string>
|
||||
|
@ -40,7 +40,7 @@ This can take a few seconds."</string>
|
||||
This could be a temporary problem or your Android device may not be provisioned for data services. Try again when connected to a mobile network, or connect to a Wi-Fi network."</string>
|
||||
<string name="auth_general_error_desc">"There was a problem communicating with Google servers.
|
||||
|
||||
Try again later."</string>
|
||||
Try again later or try to log in clicking on below \'SPOOF\' button."</string>
|
||||
<string name="auth_finalize">"Your device is contacting Google to save information to your account.
|
||||
|
||||
This can take a couple of minutes."</string>
|
||||
@ -104,8 +104,7 @@ This can take a couple of minutes."</string>
|
||||
<string name="pref_about_title">About Vanced microG</string>
|
||||
<string name="pref_cast_double_fix">Cast duplication fix</string>
|
||||
|
||||
<string name="brand_spoof_title">Brand spoofing</string>
|
||||
<string name="brand_spoof_fix">Use this option on devices without Google services installed or unable to log in</string>
|
||||
<string name="brand_spoof_button">Spoof</string>
|
||||
|
||||
<string name="pref_switcher_title">Register device</string>
|
||||
<string name="pref_checkin_enable_summary">Registers your device to Google services and creates a unique device identifier. Vanced microG strips identifying bits other than your Google account name from registration data.</string>
|
||||
|
@ -48,12 +48,6 @@
|
||||
android:icon="@drawable/ic_cast_black"
|
||||
android:summary="@string/pref_cast_double_fix_summary"
|
||||
android:defaultValue="false"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:key="brand_spoof_fix_enabled"
|
||||
android:title="@string/brand_spoof_title"
|
||||
android:icon="@drawable/ic_brand_spoof"
|
||||
android:summary="@string/brand_spoof_fix"
|
||||
android:defaultValue="false"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:layout="@layout/preference_category_no_label">
|
||||
<Preference
|
||||
|
Loading…
Reference in New Issue
Block a user