About activity improvements

This commit is contained in:
tehcneko 2021-01-30 14:57:56 +08:00
parent 9e16ce5ede
commit 9379ffbca5
2 changed files with 33 additions and 47 deletions

View File

@ -1,19 +1,14 @@
package io.github.lsposed.manager.util;
import android.content.Context;
import android.net.Uri;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.URLSpan;
import android.text.util.Linkify;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.browser.customtabs.CustomTabColorSchemeParams;
import androidx.browser.customtabs.CustomTabsIntent;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import io.github.lsposed.manager.App;
import io.github.lsposed.manager.R;
import io.github.lsposed.manager.ui.activity.BaseActivity;
@ -33,20 +28,18 @@ public final class NavUtil {
public static void startURL(BaseActivity activity, Uri uri) {
CustomTabsIntent.Builder customTabsIntent = new CustomTabsIntent.Builder();
customTabsIntent.setShowTitle(true);
customTabsIntent.setToolbarColor(activity.getThemedColor(R.attr.colorActionBar));
CustomTabColorSchemeParams params = new CustomTabColorSchemeParams.Builder()
.setToolbarColor(activity.getThemedColor(R.attr.colorActionBar))
.setNavigationBarColor(activity.getThemedColor(android.R.attr.navigationBarColor))
.setNavigationBarDividerColor(0)
.build();
customTabsIntent.setDefaultColorSchemeParams(params);
boolean night = BaseActivity.isNightMode(activity.getResources().getConfiguration());
customTabsIntent.setColorScheme(night ? CustomTabsIntent.COLOR_SCHEME_DARK : CustomTabsIntent.COLOR_SCHEME_LIGHT);
customTabsIntent.build().launchUrl(activity, uri);
}
public static void startURL(BaseActivity activity, String url) {
startURL(activity, parseURL(url));
}
@AnyThread
public static void showMessage(final @NonNull Context context, final CharSequence message) {
App.runOnUiThread(() -> new MaterialAlertDialogBuilder(context)
.setMessage(message)
.setPositiveButton(android.R.string.ok, null)
.show());
}
}

View File

@ -34,45 +34,38 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="#000"
app:cardCornerRadius="0dp">
android:layout_height="match_parent"
android:gravity="center"
android:padding="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="20dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="48sp"
android:paddingHorizontal="10dp"
android:textStyle="bold"
android:text="LS" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="5dp"
android:background="@drawable/ph_drawable"
android:paddingVertical="7dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textColor="#000"
android:textSize="48sp"
android:paddingHorizontal="10dp"
android:textStyle="bold"
android:text="LS" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="5dp"
android:background="@drawable/ph_drawable"
android:paddingVertical="7dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="48sp"
android:textStyle="bold"
android:text="Posed" />
</FrameLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
android:text="Posed" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"