feat: 增加本吧信息入口

This commit is contained in:
HuanChengFly 2021-05-01 21:07:06 +08:00
parent b91c8ab99a
commit ef17d8c675
9 changed files with 98 additions and 5 deletions

View File

@ -230,7 +230,15 @@
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
android:theme="@style/AppTheme.Intro"
android:windowSoftInputMode="adjustResize" />
<activity android:name=".activities.TranslucentThemeActivity" />
<activity
android:name=".activities.TranslucentThemeActivity"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".activities.ForumInfoActivity"
android:label="@string/title_forum_info"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"

View File

@ -308,6 +308,9 @@ class ForumActivity : BaseActivity(), View.OnClickListener, OnRefreshedListener,
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_forum_info -> {
ForumInfoActivity.launch(this, forumName ?: "")
}
R.id.menu_unfollow -> {
if (mDataBean != null) {
DialogUtil.build(this@ForumActivity)

View File

@ -0,0 +1,54 @@
package com.huanchengfly.tieba.post.activities
import android.content.Context
import android.os.Bundle
import androidx.appcompat.widget.Toolbar
import butterknife.BindView
import com.google.android.material.appbar.CollapsingToolbarLayout
import com.huanchengfly.tieba.post.R
import com.huanchengfly.tieba.post.fragments.ForumInfoFragment
import com.huanchengfly.tieba.post.goToActivity
import com.huanchengfly.tieba.post.utils.ThemeUtil
class ForumInfoActivity : BaseActivity() {
@BindView(R.id.toolbar)
lateinit var toolbar: Toolbar
@BindView(R.id.collapsing_toolbar)
lateinit var collapsingToolbar: CollapsingToolbarLayout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeUtil.setTranslucentThemeBackground(findViewById(R.id.background))
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.title = title
collapsingToolbar.title = title
val forumName = intent.getStringExtra(EXTRA_FORUM_NAME)
if (forumName.isNullOrEmpty()) {
finish()
} else {
supportFragmentManager.beginTransaction()
.replace(R.id.container, ForumInfoFragment.newInstance(forumName), "ForumInfoFragment")
.commit()
}
}
override fun getLayoutId(): Int {
return R.layout.activity_forum_info
}
companion object {
const val EXTRA_FORUM_NAME = "forum_name"
fun launch(
context: Context,
forumName: String
) {
context.goToActivity<ForumInfoActivity> {
putExtra(EXTRA_FORUM_NAME, forumName)
}
}
}
}

View File

@ -67,10 +67,12 @@ public class ForumInfoFragment extends BaseFragment implements Refreshable, Scro
View mManagersView;
@BindView(R.id.friend_forums_view)
RecyclerView friendForumsRecyclerView;
@BindView(R.id.refresh)
SwipeRefreshLayout mRefreshLayout;
private String forumName;
private ForumPageBean mDataBean;
private View content;
private SwipeRefreshLayout mRefreshLayout;
public ForumInfoFragment() {
}
@ -114,7 +116,6 @@ public class ForumInfoFragment extends BaseFragment implements Refreshable, Scro
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRefreshLayout = (SwipeRefreshLayout) view;
ThemeUtil.setThemeForSwipeRefreshLayout(mRefreshLayout);
mRefreshLayout.setOnRefreshListener(this::refresh);
content = view.findViewById(R.id.content);

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<com.huanchengfly.tieba.post.widgets.theme.TintCoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:backgroundTint="@color/default_color_window_background"
android:id="@+id/background"
tools:context=".activities.ForumInfoActivity">
<include layout="@layout/layout_new_appbar" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</com.huanchengfly.tieba.post.widgets.theme.TintCoordinatorLayout>

View File

@ -2,6 +2,7 @@
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView

View File

@ -8,4 +8,5 @@
android:stateListAnimator="@animator/appbar_elevation">
<include layout="@layout/layout_new_toolbar" />
</com.huanchengfly.tieba.post.widgets.theme.TintAppBarLayout>

View File

@ -25,13 +25,18 @@
android:title="@string/title_unfollow"
app:showAsAction="never" />
<item
android:id="@+id/menu_refresh"
android:id="@+id/menu_forum_info"
android:orderInCategory="4"
android:title="@string/title_forum_info"
app:showAsAction="never" />
<item
android:id="@+id/menu_refresh"
android:orderInCategory="5"
android:title="@string/title_refresh"
app:showAsAction="never" />
<item
android:id="@+id/menu_exit"
android:orderInCategory="5"
android:orderInCategory="6"
android:title="@string/sidebar_exit"
app:showAsAction="never" />
</menu>

View File

@ -445,4 +445,5 @@
<string name="text_please_wait">请稍候……</string>
<string name="title_fetching_forum_list">正在获取吧列表</string>
<string name="text_oksign_no_signable">没有可签到的吧</string>
<string name="title_forum_info">关于本吧</string>
</resources>