Skip to content

Commit ab71db3

Browse files
committed
Update login screen activity design
- Added support screen for tablet view - Added material axis animation in open/close login activity - Enable edge to edge in login activity - Cleanup
1 parent 4e2e112 commit ab71db3

21 files changed

+1123
-214
lines changed

play-services-core/src/main/AndroidManifest.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,9 @@
267267
android:name="org.microg.gms.auth.login.LoginActivity"
268268
android:configChanges="uiMode|keyboardHidden|keyboard|screenSize"
269269
android:exported="true"
270+
android:label="@string/pref_accounts_add_account_title"
270271
android:process=":ui"
271-
android:theme="@style/LoginTheme">
272+
android:theme="@style/AppThemeLauncher">
272273
<intent-filter>
273274
<action android:name="${basePackageName}.android.gms.auth.login.LOGIN" />
274275
<category android:name="android.intent.category.DEFAULT" />
@@ -438,7 +439,8 @@
438439
android:name="org.microg.gms.ui.AccountManagerActivity"
439440
android:label="@string/pref_account_title"
440441
android:process=":ui"
441-
android:taskAffinity="org.microg.gms.settings" />
442+
android:taskAffinity="org.microg.gms.settings"
443+
android:theme="@style/AppThemeLauncher" />
442444

443445
<activity
444446
android:name="org.microg.gms.ui.PrivacySettingsActivity"

play-services-core/src/main/java/org/microg/gms/auth/login/AssistantActivity.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ public abstract class AssistantActivity extends AppCompatActivity {
3838
@Override
3939
protected void onCreate(Bundle savedInstanceState) {
4040
super.onCreate(savedInstanceState);
41-
// enableEdgeToEdgeNoContrast();
41+
enableEdgeToEdgeNoContrast();
4242
setContentView(R.layout.login_assistant);
4343

4444
Toolbar toolbar = findViewById(R.id.toolbar);
4545
setSupportActionBar(toolbar);
46+
//noinspection DataFlowIssue
4647
getSupportActionBar().setDisplayShowTitleEnabled(false);
4748
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
49+
//noinspection deprecation
4850
toolbar.setNavigationOnClickListener(v -> onBackPressed());
4951

5052
findViewById(R.id.spoof_button).setOnClickListener(v -> onHuaweiButtonClicked());
@@ -89,16 +91,17 @@ protected void onTitleChanged(CharSequence title, int color) {
8991
((TextView) findViewById(R.id.title)).setText(title);
9092
}
9193

94+
/** @noinspection unused*/
9295
public int dpToPx(int dp) {
9396
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
9497
return Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
9598
}
9699

97-
// private void enableEdgeToEdgeNoContrast() {
98-
// SystemBarStyle systemBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT);
99-
// EdgeToEdge.enable((ComponentActivity) this, systemBarStyle);
100-
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
101-
// getWindow().setNavigationBarContrastEnforced(false);
102-
// }
103-
// }
100+
private void enableEdgeToEdgeNoContrast() {
101+
SystemBarStyle systemBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT);
102+
EdgeToEdge.enable(this, systemBarStyle);
103+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
104+
getWindow().setNavigationBarContrastEnforced(false);
105+
}
106+
}
104107
}

play-services-core/src/main/java/org/microg/gms/auth/login/LoginActivity.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@
7171
import static android.accounts.AccountManager.PACKAGE_NAME_KEY_LEGACY_NOT_VISIBLE;
7272
import static android.accounts.AccountManager.VISIBILITY_USER_MANAGED_VISIBLE;
7373
import static android.os.Build.VERSION.SDK_INT;
74-
import static android.os.Build.VERSION_CODES.GINGERBREAD_MR1;
75-
import static android.os.Build.VERSION_CODES.HONEYCOMB;
76-
import static android.os.Build.VERSION_CODES.LOLLIPOP;
7774
import static android.telephony.TelephonyManager.SIM_STATE_UNKNOWN;
7875
import static android.view.KeyEvent.KEYCODE_BACK;
7976
import static android.view.View.INVISIBLE;
@@ -127,6 +124,7 @@ public void onPageFinished(WebView view, String url) {
127124

128125
// Begin login.
129126
// Only required if client code does not invoke showView() via JSBridge
127+
//noinspection DataFlowIssue
130128
if ("identifier".equals(uri.getFragment()) || uri.getPath().endsWith("/identifier"))
131129
runOnUiThread(() -> webView.setVisibility(VISIBLE));
132130

@@ -144,6 +142,7 @@ public void onPageFinished(WebView view, String url) {
144142
}
145143
});
146144
if(getIntent().hasExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE)){
145+
//noinspection DataFlowIssue
147146
Object tempObject = getIntent().getExtras().get("accountAuthenticatorResponse");
148147
if (tempObject instanceof AccountAuthenticatorResponse) {
149148
response = (AccountAuthenticatorResponse) tempObject;
@@ -161,8 +160,6 @@ public void onPageFinished(WebView view, String url) {
161160
} else {
162161
retrieveRtToken(getIntent().getStringExtra(EXTRA_TOKEN));
163162
}
164-
} else if (android.os.Build.VERSION.SDK_INT < 21) {
165-
init();
166163
} else {
167164
setMessage(R.string.auth_before_connect);
168165
setSpoofButtonText(R.string.brand_spoof_button);
@@ -175,6 +172,7 @@ protected void onNextButtonClicked() {
175172
super.onNextButtonClicked();
176173
state++;
177174
if (state == 1) {
175+
//noinspection DataFlowIssue
178176
if (isSpoofingEnabled(this)) {
179177
LastCheckinInfo.clear(this);
180178
setSpoofingEnabled(this, false);
@@ -192,6 +190,7 @@ protected void onHuaweiButtonClicked() {
192190
super.onHuaweiButtonClicked();
193191
state++;
194192
if (state == 1) {
193+
//noinspection DataFlowIssue
195194
if (!isSpoofingEnabled(this)) {
196195
LastCheckinInfo.clear(this);
197196
setSpoofingEnabled(this, true);
@@ -203,6 +202,7 @@ protected void onHuaweiButtonClicked() {
203202
}
204203
}
205204

205+
/** @noinspection deprecation*/
206206
@Override
207207
public void onBackPressed() {
208208
super.onBackPressed();
@@ -220,13 +220,7 @@ private void init() {
220220
authContent.addView(loading);
221221
setMessage(R.string.auth_connecting);
222222
CookieManager.getInstance().setAcceptCookie(true);
223-
if (SDK_INT >= LOLLIPOP) {
224-
CookieManager.getInstance().removeAllCookies(value -> start());
225-
} else {
226-
//noinspection deprecation
227-
CookieManager.getInstance().removeAllCookie();
228-
start();
229-
}
223+
CookieManager.getInstance().removeAllCookies(value -> start());
230224
}
231225

232226
private static boolean isSystemDarkTheme(Context context) {
@@ -245,6 +239,7 @@ private static WebView createWebView(Context context) {
245239
// Apply dark theme to WebView based on system state
246240
if (Build.VERSION.SDK_INT >= 29) {
247241
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
242+
//noinspection deprecation
248243
WebSettingsCompat.setForceDark(webView.getSettings(), systemIsDark ? WebSettingsCompat.FORCE_DARK_ON : WebSettingsCompat.FORCE_DARK_OFF);
249244
}
250245
}
@@ -272,6 +267,7 @@ private static void prepareWebViewSettings(Context context, WebSettings settings
272267
private void start() {
273268
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
274269
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
270+
//noinspection deprecation
275271
if (networkInfo != null && networkInfo.isConnected()) {
276272
if (LastCheckinInfo.read(this).getAndroidId() == 0) {
277273
new Thread(() -> {
@@ -430,6 +426,7 @@ private boolean checkin(boolean force) {
430426
return false;
431427
}
432428

429+
@SuppressLint("GestureBackNavigation")
433430
@Override
434431
public boolean onKeyDown(int keyCode, KeyEvent event) {
435432
if ((keyCode == KEYCODE_BACK) && webView.canGoBack() && (webView.getVisibility() == VISIBLE)) {
@@ -612,10 +609,8 @@ public void setAllActionsEnabled(boolean z) {
612609
Log.d(TAG, "JSBridge: setAllActionsEnabled");
613610
}
614611

615-
@TargetApi(HONEYCOMB)
616612
@JavascriptInterface
617613
public final void setBackButtonEnabled(boolean backButtonEnabled) {
618-
if (SDK_INT <= GINGERBREAD_MR1) return;
619614
int visibility = getWindow().getDecorView().getSystemUiVisibility();
620615
if (backButtonEnabled)
621616
visibility &= -STATUS_BAR_DISABLE_BACK;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<set xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:shareInterpolator="false"
4+
android:showBackdrop="true">
5+
<alpha
6+
android:duration="@integer/m3_sys_motion_duration_long1"
7+
android:fillAfter="true"
8+
android:fillBefore="true"
9+
android:fillEnabled="true"
10+
android:fromAlpha="0.0"
11+
android:interpolator="@interpolator/m3_sys_motion_easing_standard_decelerate"
12+
android:startOffset="100"
13+
android:toAlpha="1.0"
14+
tools:ignore="PrivateResource" />
15+
<translate
16+
android:duration="@integer/m3_sys_motion_duration_long1"
17+
android:fillAfter="true"
18+
android:fillBefore="true"
19+
android:fillEnabled="true"
20+
android:fromXDelta="-25.0%"
21+
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized"
22+
android:startOffset="0"
23+
android:toXDelta="0.0"
24+
tools:ignore="PrivateResource" />
25+
</set>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<set xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:shareInterpolator="false">
4+
<alpha
5+
android:duration="@integer/m3_sys_motion_duration_short2"
6+
android:fillAfter="true"
7+
android:fillBefore="true"
8+
android:fillEnabled="true"
9+
android:fromAlpha="1.0"
10+
android:interpolator="@interpolator/m3_sys_motion_easing_standard_accelerate"
11+
android:startOffset="0"
12+
android:toAlpha="0.0"
13+
tools:ignore="PrivateResource" />
14+
<translate
15+
android:duration="@integer/m3_sys_motion_duration_long1"
16+
android:fillAfter="true"
17+
android:fillBefore="true"
18+
android:fillEnabled="true"
19+
android:fromXDelta="0.0"
20+
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized"
21+
android:startOffset="0"
22+
android:toXDelta="25.0%"
23+
tools:ignore="PrivateResource" />
24+
</set>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<set xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:shareInterpolator="false"
4+
android:showBackdrop="true">
5+
<alpha
6+
android:duration="@integer/m3_sys_motion_duration_long1"
7+
android:fillAfter="true"
8+
android:fillBefore="true"
9+
android:fillEnabled="true"
10+
android:fromAlpha="0.0"
11+
android:interpolator="@interpolator/m3_sys_motion_easing_standard_decelerate"
12+
android:startOffset="100"
13+
android:toAlpha="1.0"
14+
tools:ignore="PrivateResource" />
15+
<translate
16+
android:duration="@integer/m3_sys_motion_duration_long1"
17+
android:fillAfter="true"
18+
android:fillBefore="true"
19+
android:fillEnabled="true"
20+
android:fromXDelta="25.0%"
21+
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized"
22+
android:startOffset="0"
23+
android:toXDelta="0.0"
24+
tools:ignore="PrivateResource" />
25+
</set>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<set xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:shareInterpolator="false">
4+
<alpha
5+
android:duration="@integer/m3_sys_motion_duration_short2"
6+
android:fillAfter="true"
7+
android:fillBefore="true"
8+
android:fillEnabled="true"
9+
android:fromAlpha="1.0"
10+
android:interpolator="@interpolator/m3_sys_motion_easing_standard_accelerate"
11+
android:startOffset="0"
12+
android:toAlpha="0.0"
13+
tools:ignore="PrivateResource" />
14+
<translate
15+
android:duration="@integer/m3_sys_motion_duration_long1"
16+
android:fillAfter="true"
17+
android:fillBefore="true"
18+
android:fillEnabled="true"
19+
android:fromXDelta="0.0"
20+
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized"
21+
android:startOffset="0"
22+
android:toXDelta="-25.0%"
23+
tools:ignore="PrivateResource" />
24+
</set>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<set xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:shareInterpolator="false"
4+
android:showBackdrop="true">
5+
<alpha
6+
android:duration="@integer/m3_sys_motion_duration_long1"
7+
android:fillAfter="true"
8+
android:fillBefore="true"
9+
android:fillEnabled="true"
10+
android:fromAlpha="0.0"
11+
android:interpolator="@interpolator/m3_sys_motion_easing_standard_decelerate"
12+
android:startOffset="100"
13+
android:toAlpha="1.0"
14+
tools:ignore="PrivateResource" />
15+
<translate
16+
android:duration="@integer/m3_sys_motion_duration_long1"
17+
android:fillAfter="true"
18+
android:fillBefore="true"
19+
android:fillEnabled="true"
20+
android:fromYDelta="-25.0%"
21+
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized"
22+
android:startOffset="0"
23+
android:toYDelta="0.0"
24+
tools:ignore="PrivateResource" />
25+
</set>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<set xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:shareInterpolator="false">
4+
<alpha
5+
android:duration="@integer/m3_sys_motion_duration_short2"
6+
android:fillAfter="true"
7+
android:fillBefore="true"
8+
android:fillEnabled="true"
9+
android:fromAlpha="1.0"
10+
android:interpolator="@interpolator/m3_sys_motion_easing_standard_accelerate"
11+
android:startOffset="0"
12+
android:toAlpha="0.0"
13+
tools:ignore="PrivateResource" />
14+
<translate
15+
android:duration="@integer/m3_sys_motion_duration_long1"
16+
android:fillAfter="true"
17+
android:fillBefore="true"
18+
android:fillEnabled="true"
19+
android:fromYDelta="0.0"
20+
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized"
21+
android:startOffset="0"
22+
android:toYDelta="25.0%"
23+
tools:ignore="PrivateResource" />
24+
</set>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<set xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:shareInterpolator="false"
4+
android:showBackdrop="true">
5+
<alpha
6+
android:duration="@integer/m3_sys_motion_duration_long1"
7+
android:fillAfter="true"
8+
android:fillBefore="true"
9+
android:fillEnabled="true"
10+
android:fromAlpha="0.0"
11+
android:interpolator="@interpolator/m3_sys_motion_easing_standard_decelerate"
12+
android:startOffset="100"
13+
android:toAlpha="1.0"
14+
tools:ignore="PrivateResource" />
15+
<translate
16+
android:duration="@integer/m3_sys_motion_duration_long1"
17+
android:fillAfter="true"
18+
android:fillBefore="true"
19+
android:fillEnabled="true"
20+
android:fromYDelta="25.0%"
21+
android:interpolator="@interpolator/m3_sys_motion_easing_emphasized"
22+
android:startOffset="0"
23+
android:toYDelta="0.0"
24+
tools:ignore="PrivateResource" />
25+
</set>

0 commit comments

Comments
 (0)