From b67da26b16c58146307224efadf4d4e6ccd40cae Mon Sep 17 00:00:00 2001 From: HuanCheng65 <22636177+HuanCheng65@users.noreply.github.com> Date: Wed, 24 Aug 2022 14:28:53 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E4=BC=98=E5=8C=96=E5=B9=B3=E6=9D=BF?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tieba/post/components/dividers/ForumDivider.java | 7 +------ .../huanchengfly/tieba/post/fragments/MyInfoFragment.kt | 2 +- .../main/java/com/huanchengfly/tieba/post/utils/utils.kt | 9 +++++++++ app/src/main/res/xml/main_split_config.xml | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/huanchengfly/tieba/post/components/dividers/ForumDivider.java b/app/src/main/java/com/huanchengfly/tieba/post/components/dividers/ForumDivider.java index 66b832d9..39d3d27c 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/components/dividers/ForumDivider.java +++ b/app/src/main/java/com/huanchengfly/tieba/post/components/dividers/ForumDivider.java @@ -38,13 +38,8 @@ public class ForumDivider extends RecyclerView.ItemDecoration implements Tintabl @Override public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); - int position = parent.getChildAdapterPosition(view) - 1; if (ExtensionsKt.isTablet(parent.getContext())) { - if (position % 2 == 0) { - outRect.set(0, 0, mDividerHeight / 2, mDividerHeight); - } else { - outRect.set(mDividerHeight / 2, 0, 0, mDividerHeight); - } + outRect.set(mDividerHeight / 2, 0, mDividerHeight / 2, mDividerHeight); } else if (mOrientation == LinearLayoutManager.VERTICAL) { outRect.set(0, 0, 0, mDividerHeight); } else { diff --git a/app/src/main/java/com/huanchengfly/tieba/post/fragments/MyInfoFragment.kt b/app/src/main/java/com/huanchengfly/tieba/post/fragments/MyInfoFragment.kt index 8741e33a..b5a77000 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/fragments/MyInfoFragment.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/fragments/MyInfoFragment.kt @@ -158,7 +158,7 @@ class MyInfoFragment : BaseFragment(), View.OnClickListener, CompoundButton.OnCh e.printStackTrace() mRefreshView.isRefreshing = false if (e !is TiebaException) { - Util.showNetworkErrorSnackbar(mRefreshView) { refresh(needLogin) } + showErrorSnackBar(mRefreshView, e) } else { attachContext.toastShort("错误 ${e.getErrorMessage()}") } diff --git a/app/src/main/java/com/huanchengfly/tieba/post/utils/utils.kt b/app/src/main/java/com/huanchengfly/tieba/post/utils/utils.kt index 5741b9ad..6d594a08 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/utils/utils.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/utils/utils.kt @@ -9,12 +9,14 @@ import android.graphics.drawable.Drawable import android.graphics.drawable.GradientDrawable import android.graphics.drawable.RippleDrawable import android.net.Uri +import android.util.Log import android.view.View import androidx.annotation.ColorInt import androidx.browser.customtabs.CustomTabColorSchemeParams import androidx.browser.customtabs.CustomTabsIntent import com.google.android.material.snackbar.Snackbar import com.huanchengfly.tieba.post.* +import com.huanchengfly.tieba.post.activities.ThreadActivity import com.huanchengfly.tieba.post.activities.WebViewActivity import com.huanchengfly.tieba.post.api.retrofit.exception.TiebaException import com.huanchengfly.tieba.post.ui.common.theme.utils.ColorStateListUtils @@ -132,6 +134,7 @@ fun getIntermixedColorBackground( } fun launchUrl(context: Context, url: String) { + Log.i("launchUrl", url) val uri = Uri.parse(url) val host = uri.host val path = uri.path @@ -156,6 +159,12 @@ fun launchUrl(context: Context, url: String) { return } if (!path.contains("android_asset")) { + if (host == "tieba.baidu.com" && path.startsWith("/p/")) { + context.goToActivity { + putExtra("url", url) + } + return + } val isTiebaLink = host.contains("tieba.baidu.com") || host.contains("wappass.baidu.com") || host.contains( "ufosdk.baidu.com" diff --git a/app/src/main/res/xml/main_split_config.xml b/app/src/main/res/xml/main_split_config.xml index 31e53570..8bf2ed23 100644 --- a/app/src/main/res/xml/main_split_config.xml +++ b/app/src/main/res/xml/main_split_config.xml @@ -16,7 +16,7 @@ window:secondaryActivityName="*/*" /> + window:secondaryActivityName=".activities.WebViewActivity" />