diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index d991c5d..0d51cc7 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5050d6b..907cd84 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -126,25 +126,18 @@ android:name=".ui.subject.SubjectActivity" android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" android:supportsPictureInPicture="true"> + + - - - - - - - - - - diff --git a/app/src/main/java/soko/ekibun/bangumi/ui/action/ActionActivity.kt b/app/src/main/java/soko/ekibun/bangumi/ui/action/ActionActivity.kt new file mode 100644 index 0000000..dd3ae22 --- /dev/null +++ b/app/src/main/java/soko/ekibun/bangumi/ui/action/ActionActivity.kt @@ -0,0 +1,5 @@ +package soko.ekibun.bangumi.ui.action + +import soko.ekibun.bangumi.ui.view.BaseActivity + +class ActionActivity : BaseActivity() \ No newline at end of file diff --git a/app/src/main/java/soko/ekibun/bangumi/ui/main/MainPresenter.kt b/app/src/main/java/soko/ekibun/bangumi/ui/main/MainPresenter.kt index d4e7c56..23cb2c4 100644 --- a/app/src/main/java/soko/ekibun/bangumi/ui/main/MainPresenter.kt +++ b/app/src/main/java/soko/ekibun/bangumi/ui/main/MainPresenter.kt @@ -8,6 +8,7 @@ import android.os.Bundle import android.util.Log import android.view.View import android.view.ViewGroup +import androidx.annotation.Keep import androidx.appcompat.widget.PopupMenu import androidx.core.view.GravityCompat import kotlinx.android.synthetic.main.activity_main.* @@ -172,6 +173,11 @@ class MainPresenter(private val context: MainActivity) { var collectionList: List = ArrayList() var notify: Pair? = null + @Keep + fun notifyCollectionChange() { + drawerView.homeFragment.collectionFragment.onCollectionChange() + } + /** * θŽ·ε–ζ”Άθ— */ diff --git a/app/src/main/java/soko/ekibun/bangumi/ui/main/fragment/home/fragment/collection/CollectionFragment.kt b/app/src/main/java/soko/ekibun/bangumi/ui/main/fragment/home/fragment/collection/CollectionFragment.kt index 3dd1728..df1f89c 100644 --- a/app/src/main/java/soko/ekibun/bangumi/ui/main/fragment/home/fragment/collection/CollectionFragment.kt +++ b/app/src/main/java/soko/ekibun/bangumi/ui/main/fragment/home/fragment/collection/CollectionFragment.kt @@ -6,6 +6,7 @@ import kotlinx.android.synthetic.main.fragment_collection.* import kotlinx.android.synthetic.main.view_login.* import soko.ekibun.bangumi.R import soko.ekibun.bangumi.model.UserModel +import soko.ekibun.bangumi.ui.main.MainActivity import soko.ekibun.bangumi.ui.main.fragment.home.fragment.HomeTabFragment import soko.ekibun.bangumi.ui.web.WebActivity @@ -71,4 +72,8 @@ class CollectionFragment: HomeTabFragment(R.layout.fragment_collection){ item_tab_container?.visibility = if (hasUser) View.VISIBLE else View.INVISIBLE (item_pager?.adapter as? CollectionPagerAdapter)?.reset() } + + fun onCollectionChange() { + (item_pager?.adapter as? CollectionPagerAdapter)?.updateCollection((activity as? MainActivity)?.mainPresenter?.collectionList) + } } \ No newline at end of file diff --git a/app/src/main/java/soko/ekibun/bangumi/ui/main/fragment/home/fragment/collection/CollectionPagerAdapter.kt b/app/src/main/java/soko/ekibun/bangumi/ui/main/fragment/home/fragment/collection/CollectionPagerAdapter.kt index 746652c..3ddaf75 100644 --- a/app/src/main/java/soko/ekibun/bangumi/ui/main/fragment/home/fragment/collection/CollectionPagerAdapter.kt +++ b/app/src/main/java/soko/ekibun/bangumi/ui/main/fragment/home/fragment/collection/CollectionPagerAdapter.kt @@ -105,7 +105,7 @@ class CollectionPagerAdapter( @SuppressLint("UseSparseArrays") private val pageIndex = HashMap() - private fun updateCollection(list: List?, fromCache: Boolean = false) { + fun updateCollection(list: List?, fromCache: Boolean = false) { items.keys.forEach { position -> if (!useApi(position)) return@forEach val item = items[position] ?: return@forEach diff --git a/app/src/main/java/soko/ekibun/bangumi/ui/view/BaseActivity.kt b/app/src/main/java/soko/ekibun/bangumi/ui/view/BaseActivity.kt index e8c0a38..c694c2d 100644 --- a/app/src/main/java/soko/ekibun/bangumi/ui/view/BaseActivity.kt +++ b/app/src/main/java/soko/ekibun/bangumi/ui/view/BaseActivity.kt @@ -32,15 +32,24 @@ import java.util.concurrent.ConcurrentHashMap * @property onBackListener Function0 * @constructor */ -abstract class BaseActivity(@LayoutRes private val resId: Int) : AppCompatActivity(), CoroutineScope by MainScope() { +abstract class BaseActivity(@LayoutRes private val resId: Int? = null) : AppCompatActivity(), + CoroutineScope by MainScope() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - window.setBackgroundDrawable(ColorDrawable(ResourceUtil.resolveColorAttr(this, R.attr.colorPrimaryBackground))) - setContentView(resId) - - ThemeModel.updateNavigationTheme(this) + resId?.let { + window.setBackgroundDrawable( + ColorDrawable( + ResourceUtil.resolveColorAttr( + this, + R.attr.colorPrimaryBackground + ) + ) + ) + setContentView(it) + ThemeModel.updateNavigationTheme(this) + } PluginsModel.setUpPlugins(this) } diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 399dcd2..19d37c1 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -10,6 +10,15 @@ true + +