mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
feat: hide and show radio and podcast tabs
This commit is contained in:
parent
16b95bacc5
commit
69e9d5686f
4 changed files with 37 additions and 2 deletions
|
|
@ -17,6 +17,7 @@ import com.cappielloantonio.play.R;
|
|||
import com.cappielloantonio.play.databinding.FragmentHomeBinding;
|
||||
import com.cappielloantonio.play.ui.activity.MainActivity;
|
||||
import com.cappielloantonio.play.ui.fragment.pager.HomePager;
|
||||
import com.cappielloantonio.play.util.Preferences;
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
|
||||
|
|
@ -94,8 +95,12 @@ public class HomeFragment extends Fragment {
|
|||
HomePager pager = new HomePager(this);
|
||||
|
||||
pager.addFragment(new HomeTabMusicFragment(), "Music", R.drawable.ic_home);
|
||||
pager.addFragment(new HomeTabPodcastFragment(), "Podcast", R.drawable.ic_graphic_eq);
|
||||
pager.addFragment(new HomeTabRadioFragment(), "Radio", R.drawable.ic_play_for_work);
|
||||
|
||||
if (Preferences.isPodcastSectionVisible())
|
||||
pager.addFragment(new HomeTabPodcastFragment(), "Podcast", R.drawable.ic_graphic_eq);
|
||||
|
||||
if (Preferences.isRadioSectionVisible())
|
||||
pager.addFragment(new HomeTabRadioFragment(), "Radio", R.drawable.ic_play_for_work);
|
||||
|
||||
bind.homeViewPager.setAdapter(pager);
|
||||
bind.homeViewPager.setUserInputEnabled(false);
|
||||
|
|
@ -106,5 +111,7 @@ public class HomeFragment extends Fragment {
|
|||
// tab.setIcon(pager.getPageIcon(position));
|
||||
}
|
||||
).attach();
|
||||
|
||||
bind.homeTabLayout.setVisibility(Preferences.isPodcastSectionVisible() || Preferences.isRadioSectionVisible() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ object Preferences {
|
|||
private const val QUEUE_SYNCING_COUNTDOWN = "queue_syncing_countdown"
|
||||
private const val ROUNDED_CORNER = "rounded_corner"
|
||||
private const val ROUNDED_CORNER_SIZE = "rounded_corner_size"
|
||||
private const val PODCAST_SECTION_VISIBILITY = "podcast_section_visibility"
|
||||
private const val RADIO_SECTION_VISIBILITY = "radio_section_visibility"
|
||||
|
||||
@JvmStatic
|
||||
fun getServer(): String? {
|
||||
|
|
@ -207,4 +209,14 @@ object Preferences {
|
|||
fun getRoundedCornerSize(): Int {
|
||||
return App.getInstance().preferences.getString(ROUNDED_CORNER_SIZE, "12")!!.toInt()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isPodcastSectionVisible(): Boolean {
|
||||
return App.getInstance().preferences.getBoolean(PODCAST_SECTION_VISIBILITY, true)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isRadioSectionVisible(): Boolean {
|
||||
return App.getInstance().preferences.getBoolean(RADIO_SECTION_VISIBILITY, true)
|
||||
}
|
||||
}
|
||||
|
|
@ -174,6 +174,10 @@
|
|||
<string name="settings_queue_syncing_title">Sync play queue for this user</string>
|
||||
<string name="settings_queue_syncing_countdown">Sync timer</string>
|
||||
<string name="settings_queue_syncing_summary">If enabled, the user will have the ability to save their play queue and will have the ability to load state when opening the application.</string>
|
||||
<string name="settings_podcast">Show podcast</string>
|
||||
<string name="settings_podcast_summary">If enabled, show the podcast section.</string>
|
||||
<string name="settings_radio">Show radio</string>
|
||||
<string name="settings_radio_summary">If enabled, show the radio section.</string>
|
||||
<string name="settings_rounded_corner">Rounded corners</string>
|
||||
<string name="settings_rounded_corner_summary">If enabled, sets a curvature angle for all rendered covers. The changes will take effect on restart.</string>
|
||||
<string name="settings_rounded_corner_size">Corners size</string>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,18 @@
|
|||
app:key="rounded_corner_size"
|
||||
app:title="@string/settings_rounded_corner_size"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:title="@string/settings_podcast"
|
||||
android:defaultValue="true"
|
||||
android:summary="@string/settings_podcast_summary"
|
||||
android:key="podcast_section_visibility" />
|
||||
|
||||
<SwitchPreference
|
||||
android:title="@string/settings_radio"
|
||||
android:defaultValue="true"
|
||||
android:summary="@string/settings_radio_summary"
|
||||
android:key="radio_section_visibility" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/settings_title_data">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue