bookmark button on preview

This commit is contained in:
firelight 2023-12-19 15:59:24 +01:00 committed by GitHub
parent 2a4ce89452
commit 3d90af29eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 11 deletions

View File

@ -77,6 +77,7 @@ import com.lagradost.cloudstream3.databinding.BottomResultviewPreviewBinding
import com.lagradost.cloudstream3.mvvm.Resource
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import com.lagradost.cloudstream3.mvvm.observe
import com.lagradost.cloudstream3.mvvm.observeNullable
import com.lagradost.cloudstream3.network.initClient
import com.lagradost.cloudstream3.plugins.PluginManager
@ -1234,6 +1235,13 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
builder.show().setDefaultFocus()
}
observe(viewModel.watchStatus) { state ->
bottomPreviewBinding?.resultviewPreviewBookmark?.apply {
setIconResource(state.iconRes)
setText(state.stringRes)
}
}
observeNullable(viewModel.page) { resource ->
if (resource == null) {
hidePreviewPopupDialog()
@ -1273,7 +1281,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
d.posterImage ?: d.posterBackgroundImage
)
resultviewPreviewPoster.setOnClickListener {
resultviewPreviewBookmark.setOnClickListener {
//viewModel.updateWatchStatus(WatchType.PLANTOWATCH)
val value = viewModel.watchStatus.value ?: WatchType.NONE

View File

@ -0,0 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp"
android:tint="?attr/white" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?attr/white" android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z"/>
</vector>

View File

@ -114,17 +114,38 @@
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/resultview_preview_more_info"
<LinearLayout
android:padding="7dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:gravity="start|center_vertical"
android:padding="12dp"
android:text="@string/home_more_info"
android:textColor="?attr/textColor"
app:drawableRightCompat="@drawable/ic_baseline_arrow_forward_24"
app:drawableTint="?attr/white" />
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/resultview_preview_bookmark"
android:layout_weight="1"
android:nextFocusRight="@id/resultview_preview_more_info"
tools:visibility="visible"
app:icon="@drawable/ic_baseline_bookmark_24"
tools:text="Bookmark"
style="@style/BlackButton"
android:layout_width="50dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/resultview_preview_more_info"
android:layout_weight="1"
android:nextFocusLeft="@id/resultview_preview_bookmark"
tools:visibility="visible"
app:icon="@drawable/ic_baseline_open_in_new_24"
android:text="@string/home_more_info"
style="@style/WhiteButton"
android:layout_width="50dp" />
</LinearLayout>
</LinearLayout>
<FrameLayout