mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Move button out of settings and into an 'X' button on Homepage
This commit is contained in:
parent
f0bea10a2a
commit
6942362366
5 changed files with 43 additions and 42 deletions
|
@ -49,18 +49,17 @@ import com.lagradost.cloudstream3.ui.search.*
|
||||||
import com.lagradost.cloudstream3.ui.search.SearchHelper.handleSearchClickCallback
|
import com.lagradost.cloudstream3.ui.search.SearchHelper.handleSearchClickCallback
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
|
||||||
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.isRecyclerScrollable
|
import com.lagradost.cloudstream3.utils.AppUtils.isRecyclerScrollable
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.loadSearchResult
|
import com.lagradost.cloudstream3.utils.AppUtils.loadSearchResult
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.setMaxViewPoolSize
|
import com.lagradost.cloudstream3.utils.AppUtils.setMaxViewPoolSize
|
||||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||||
import com.lagradost.cloudstream3.utils.DataStore.getKey
|
import com.lagradost.cloudstream3.utils.DataStore.getKey
|
||||||
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
import com.lagradost.cloudstream3.utils.DataStore.setKey
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper
|
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.deleteAllBookmarkedData
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.deleteAllBookmarkedData
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.deleteAllResumeStateIds
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.deleteAllResumeStateIds
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.removeLastWatched
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.removeLastWatched
|
||||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.setResultWatchState
|
import com.lagradost.cloudstream3.utils.DataStoreHelper.setResultWatchState
|
||||||
import com.lagradost.cloudstream3.utils.Event
|
|
||||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showOptionSelectStringRes
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showOptionSelectStringRes
|
||||||
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||||
|
@ -70,7 +69,6 @@ import com.lagradost.cloudstream3.utils.UIHelper.getSpanCount
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes
|
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.setImageBlur
|
import com.lagradost.cloudstream3.utils.UIHelper.setImageBlur
|
||||||
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
|
|
||||||
import com.lagradost.cloudstream3.widget.CenterZoomLayoutManager
|
import com.lagradost.cloudstream3.widget.CenterZoomLayoutManager
|
||||||
import kotlinx.android.synthetic.main.fragment_home.*
|
import kotlinx.android.synthetic.main.fragment_home.*
|
||||||
import kotlinx.android.synthetic.main.fragment_home.home_api_fab
|
import kotlinx.android.synthetic.main.fragment_home.home_api_fab
|
||||||
|
@ -522,6 +520,38 @@ class HomeFragment : Fragment() {
|
||||||
activity.loadSearchResult(listHomepageItems.random())
|
activity.loadSearchResult(listHomepageItems.random())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
home_clear_watching?.setOnClickListener {
|
||||||
|
val builder: AlertDialog.Builder =
|
||||||
|
AlertDialog.Builder(it.context, R.style.AlertDialogCustom)
|
||||||
|
builder.setTitle(R.string.clear_watching_pref)
|
||||||
|
builder.setMessage(R.string.clear_watching_prompt)
|
||||||
|
builder.setPositiveButton(getString(R.string.yes)
|
||||||
|
) { dialog, which -> // Clear Watch History data
|
||||||
|
var doneClearMessage = R.string.clear_watching_done
|
||||||
|
try {
|
||||||
|
deleteAllResumeStateIds()
|
||||||
|
homeViewModel.loadResumeWatching()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logError(e)
|
||||||
|
doneClearMessage = R.string.clear_watching_error
|
||||||
|
}
|
||||||
|
dialog.dismiss()
|
||||||
|
|
||||||
|
val newBuilder = AlertDialog.Builder(it.context, R.style.AlertDialogCustom)
|
||||||
|
newBuilder.setTitle(R.string.clear_watching_pref)
|
||||||
|
newBuilder.setMessage(doneClearMessage)
|
||||||
|
newBuilder.setPositiveButton("OK"
|
||||||
|
) { newdialog, newwhich -> // Do nothing but close the dialog
|
||||||
|
newdialog.dismiss()
|
||||||
|
}
|
||||||
|
newBuilder.show()
|
||||||
|
}
|
||||||
|
builder.setNegativeButton(getString(R.string.no)
|
||||||
|
) { dialog, which -> // Do nothing but close the dialog
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
builder.show()
|
||||||
|
}
|
||||||
|
|
||||||
//Load value for toggling Random button. Hide at startup
|
//Load value for toggling Random button. Hide at startup
|
||||||
context?.let {
|
context?.let {
|
||||||
|
|
|
@ -29,8 +29,6 @@ import com.lagradost.cloudstream3.ui.EasterEggMonke
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setPaddingBottom
|
||||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
|
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
|
||||||
import com.lagradost.cloudstream3.utils.*
|
|
||||||
import com.lagradost.cloudstream3.utils.DataStore.removeKeys
|
|
||||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
|
||||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showDialog
|
||||||
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog
|
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog
|
||||||
|
@ -333,36 +331,6 @@ class SettingsGeneral : PreferenceFragmentCompat() {
|
||||||
return@setOnPreferenceClickListener true
|
return@setOnPreferenceClickListener true
|
||||||
}
|
}
|
||||||
|
|
||||||
getPref(R.string.key_clear_watching)?.setOnPreferenceClickListener {
|
|
||||||
val builder: AlertDialog.Builder =
|
|
||||||
AlertDialog.Builder(it.context, R.style.AlertDialogCustom)
|
|
||||||
builder.setTitle(R.string.clear_watching_pref)
|
|
||||||
builder.setMessage(R.string.clear_watching_prompt)
|
|
||||||
builder.setPositiveButton(getString(R.string.yes)
|
|
||||||
) { dialog, which -> // Clear Watch History data
|
|
||||||
var doneClearMessage = R.string.clear_watching_done
|
|
||||||
try {
|
|
||||||
it.context.removeKeys("${DataStoreHelper.currentAccount}/$RESULT_RESUME_WATCHING")
|
|
||||||
it.context.removeKeys("${DataStoreHelper.currentAccount}/$RESULT_RESUME_WATCHING_OLD")
|
|
||||||
} catch (e: Exception) {
|
|
||||||
logError(e)
|
|
||||||
doneClearMessage = R.string.clear_watching_error
|
|
||||||
}
|
|
||||||
dialog.dismiss()
|
|
||||||
|
|
||||||
val newBuilder = AlertDialog.Builder(it.context, R.style.AlertDialogCustom)
|
|
||||||
newBuilder.setTitle(R.string.clear_watching_pref)
|
|
||||||
newBuilder.setMessage(doneClearMessage)
|
|
||||||
newBuilder.show()
|
|
||||||
}
|
|
||||||
builder.setNegativeButton(getString(R.string.no)
|
|
||||||
) { dialog, which -> // Do nothing but close the dialog
|
|
||||||
dialog.dismiss()
|
|
||||||
}
|
|
||||||
builder.show()
|
|
||||||
return@setOnPreferenceClickListener true
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SettingsFragment.beneneCount =
|
SettingsFragment.beneneCount =
|
||||||
settingsManager.getInt(getString(R.string.benene_count), 0)
|
settingsManager.getInt(getString(R.string.benene_count), 0)
|
||||||
|
|
|
@ -395,6 +395,16 @@
|
||||||
style="@style/WatchHeaderText"
|
style="@style/WatchHeaderText"
|
||||||
android:text="@string/continue_watching" />
|
android:text="@string/continue_watching" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
app:tint="?attr/textColor"
|
||||||
|
android:id="@+id/home_clear_watching"
|
||||||
|
android:layout_marginEnd="40dp"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:src="@drawable/ic_baseline_clear_24"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:contentDescription="@string/clear_watching_pref" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
app:tint="?attr/textColor"
|
app:tint="?attr/textColor"
|
||||||
android:layout_marginEnd="5dp"
|
android:layout_marginEnd="5dp"
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
<string name="filter_sub_lang_key" translatable="false">filter_sub_lang_key</string>
|
<string name="filter_sub_lang_key" translatable="false">filter_sub_lang_key</string>
|
||||||
<string name="pref_filter_search_quality_key" translatable="false">pref_filter_search_quality_key</string>
|
<string name="pref_filter_search_quality_key" translatable="false">pref_filter_search_quality_key</string>
|
||||||
<string name="enable_nsfw_on_providers_key" translatable="false">enable_nsfw_on_providers_key</string>
|
<string name="enable_nsfw_on_providers_key" translatable="false">enable_nsfw_on_providers_key</string>
|
||||||
<string name="key_clear_watching" translatable="false">key_clear_watching</string>
|
|
||||||
|
|
||||||
<!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG -->
|
<!-- FORMAT MIGHT TRANSLATE, WILL CAUSE CRASH IF APPLIED WRONG -->
|
||||||
<string name="extra_info_format" formatted="true" translatable="false">%d %s | %s</string>
|
<string name="extra_info_format" formatted="true" translatable="false">%d %s | %s</string>
|
||||||
|
|
|
@ -23,12 +23,6 @@
|
||||||
android:title="@string/download_path_pref"
|
android:title="@string/download_path_pref"
|
||||||
android:icon="@drawable/netflix_download" />
|
android:icon="@drawable/netflix_download" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="@string/key_clear_watching"
|
|
||||||
android:title="@string/clear_watching_pref"
|
|
||||||
android:icon="@drawable/ic_baseline_playlist_play_24"
|
|
||||||
app:summary="@string/clear_watching_summ" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="@string/legal_notice_key"
|
android:key="@string/legal_notice_key"
|
||||||
android:title="@string/legal_notice"
|
android:title="@string/legal_notice"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue