pref: 优化平板适配
This commit is contained in:
parent
12612f1956
commit
b67da26b16
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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()}")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<ThreadActivity> {
|
||||
putExtra("url", url)
|
||||
}
|
||||
return
|
||||
}
|
||||
val isTiebaLink =
|
||||
host.contains("tieba.baidu.com") || host.contains("wappass.baidu.com") || host.contains(
|
||||
"ufosdk.baidu.com"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
window:secondaryActivityName="*/*" />
|
||||
<SplitPairFilter
|
||||
window:primaryActivityName=".activities.ThreadActivity"
|
||||
window:secondaryActivityName="*/*" />
|
||||
window:secondaryActivityName=".activities.WebViewActivity" />
|
||||
<SplitPairFilter
|
||||
window:primaryActivityName=".activities.MessageActivity"
|
||||
window:secondaryActivityName=".activities.FloorActivity" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue