Merge pull request #1108 from vladrevers/dev
Added option to hide profile on home page
This commit is contained in:
commit
f26503aa3e
9 changed files with 71 additions and 32 deletions
|
@ -66,7 +66,7 @@ const val EXTRA_SONG_INFO = "extra_song_info"
|
|||
const val DESATURATED_COLOR = "desaturated_color"
|
||||
const val BLACK_THEME = "black_theme"
|
||||
const val KEEP_SCREEN_ON = "keep_screen_on"
|
||||
const val TOGGLE_HOME_BANNER = "toggle_home_banner"
|
||||
const val TYPE_HOME_BANNER = "type_home_banner"
|
||||
const val NOW_PLAYING_SCREEN_ID = "now_playing_screen_id"
|
||||
const val CAROUSEL_EFFECT = "carousel_effect"
|
||||
const val COLORED_NOTIFICATION = "colored_notification"
|
||||
|
|
|
@ -45,7 +45,7 @@ import code.name.monkey.retromusic.TAB_TEXT_MODE
|
|||
import code.name.monkey.retromusic.TOGGLE_ADD_CONTROLS
|
||||
import code.name.monkey.retromusic.TOGGLE_FULL_SCREEN
|
||||
import code.name.monkey.retromusic.TOGGLE_GENRE
|
||||
import code.name.monkey.retromusic.TOGGLE_HOME_BANNER
|
||||
import code.name.monkey.retromusic.TYPE_HOME_BANNER
|
||||
import code.name.monkey.retromusic.TOGGLE_SEPARATE_LINE
|
||||
import code.name.monkey.retromusic.TOGGLE_VOLUME
|
||||
import code.name.monkey.retromusic.USER_NAME
|
||||
|
@ -123,7 +123,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
|
|||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
||||
if (key == GENERAL_THEME || key == BLACK_THEME || key == ADAPTIVE_COLOR_APP || key == USER_NAME || key == TOGGLE_FULL_SCREEN || key == TOGGLE_VOLUME || key == ROUND_CORNERS || key == CAROUSEL_EFFECT || key == NOW_PLAYING_SCREEN_ID || key == TOGGLE_GENRE || key == BANNER_IMAGE_PATH || key == PROFILE_IMAGE_PATH || key == CIRCULAR_ALBUM_ART || key == KEEP_SCREEN_ON || key == TOGGLE_SEPARATE_LINE || key == TOGGLE_HOME_BANNER || key == TOGGLE_ADD_CONTROLS || key == ALBUM_COVER_STYLE || key == HOME_ARTIST_GRID_STYLE || key == ALBUM_COVER_TRANSFORM || key == DESATURATED_COLOR || key == EXTRA_SONG_INFO || key == TAB_TEXT_MODE || key == LANGUAGE_NAME || key == LIBRARY_CATEGORIES) {
|
||||
if (key == GENERAL_THEME || key == BLACK_THEME || key == ADAPTIVE_COLOR_APP || key == USER_NAME || key == TOGGLE_FULL_SCREEN || key == TOGGLE_VOLUME || key == ROUND_CORNERS || key == CAROUSEL_EFFECT || key == NOW_PLAYING_SCREEN_ID || key == TOGGLE_GENRE || key == BANNER_IMAGE_PATH || key == PROFILE_IMAGE_PATH || key == CIRCULAR_ALBUM_ART || key == KEEP_SCREEN_ON || key == TOGGLE_SEPARATE_LINE || key == TYPE_HOME_BANNER || key == TOGGLE_ADD_CONTROLS || key == ALBUM_COVER_STYLE || key == HOME_ARTIST_GRID_STYLE || key == ALBUM_COVER_TRANSFORM || key == DESATURATED_COLOR || key == EXTRA_SONG_INFO || key == TAB_TEXT_MODE || key == LANGUAGE_NAME || key == LIBRARY_CATEGORIES) {
|
||||
postRecreate()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import kotlinx.android.synthetic.main.fragment_banner_home.*
|
|||
import kotlinx.android.synthetic.main.home_content.*
|
||||
|
||||
class HomeFragment :
|
||||
AbsMainActivityFragment(if (PreferenceUtil.isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home) {
|
||||
AbsMainActivityFragment(if (PreferenceUtil.typeHomeBanner == 1) R.layout.fragment_banner_home else R.layout.fragment_home) {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
@ -52,13 +52,21 @@ class HomeFragment :
|
|||
mainActivity.setSupportActionBar(toolbar)
|
||||
mainActivity.supportActionBar?.title = null
|
||||
setStatusBarColorAuto(view)
|
||||
bannerImage?.setOnClickListener {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
mainActivity,
|
||||
userImage,
|
||||
getString(R.string.transition_user_image)
|
||||
)
|
||||
NavigationUtil.goToUserInfo(requireActivity(), options)
|
||||
val needShowProfileOrBanner = (PreferenceUtil.typeHomeBanner != 2)
|
||||
|
||||
if (needShowProfileOrBanner) {
|
||||
bannerImage?.setOnClickListener {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
mainActivity,
|
||||
userImage,
|
||||
getString(R.string.transition_user_image)
|
||||
)
|
||||
NavigationUtil.goToUserInfo(requireActivity(), options)
|
||||
}
|
||||
} else {
|
||||
userImage?.visibility = View.GONE
|
||||
titleWelcome?.visibility = View.GONE
|
||||
text?.visibility = View.GONE
|
||||
}
|
||||
|
||||
lastAdded.setOnClickListener {
|
||||
|
@ -86,15 +94,17 @@ class HomeFragment :
|
|||
)
|
||||
}
|
||||
|
||||
userImage.setOnClickListener {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
mainActivity,
|
||||
userImage,
|
||||
getString(R.string.transition_user_image)
|
||||
)
|
||||
NavigationUtil.goToUserInfo(requireActivity(), options)
|
||||
if (needShowProfileOrBanner) {
|
||||
userImage.setOnClickListener {
|
||||
val options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
mainActivity,
|
||||
userImage,
|
||||
getString(R.string.transition_user_image)
|
||||
)
|
||||
NavigationUtil.goToUserInfo(requireActivity(), options)
|
||||
}
|
||||
titleWelcome?.text = String.format("%s", PreferenceUtil.userName)
|
||||
}
|
||||
titleWelcome?.text = String.format("%s", PreferenceUtil.userName)
|
||||
|
||||
val homeAdapter = HomeAdapter(mainActivity)
|
||||
recyclerView.apply {
|
||||
|
@ -106,7 +116,10 @@ class HomeFragment :
|
|||
homeAdapter.swapData(it)
|
||||
})
|
||||
|
||||
loadProfile()
|
||||
if (needShowProfileOrBanner) {
|
||||
loadProfile()
|
||||
}
|
||||
|
||||
setupTitle()
|
||||
}
|
||||
|
||||
|
|
|
@ -218,10 +218,11 @@ object PreferenceUtil {
|
|||
TOGGLE_ADD_CONTROLS, false
|
||||
)
|
||||
|
||||
val isHomeBanner
|
||||
get() = sharedPreferences.getBoolean(
|
||||
TOGGLE_HOME_BANNER, false
|
||||
)
|
||||
val typeHomeBanner
|
||||
get() = sharedPreferences.getStringOrDefault(
|
||||
TYPE_HOME_BANNER, "0"
|
||||
).toInt()
|
||||
|
||||
var isClassicNotification
|
||||
get() = sharedPreferences.getBoolean(CLASSIC_NOTIFICATION, false)
|
||||
set(value) = sharedPreferences.edit { putBoolean(CLASSIC_NOTIFICATION, value) }
|
||||
|
|
|
@ -309,7 +309,7 @@
|
|||
<string name="pref_summary_extra_controls">Добавить дополнительные элементы управления для мини-плеера</string>
|
||||
<string name="pref_summary_extra_song_info">Показать дополнительную информацию о песне, такую как формат файла, битрейт и частота</string>
|
||||
<string name="pref_summary_gapless_playback">"Может вызвать проблемы с воспроизведением на некоторых устройствах."</string>
|
||||
<string name="pref_summary_home_banner">Показывать кнопку Домой</string>
|
||||
<string name="pref_summary_home_banner">Баннер на домашней странице</string>
|
||||
<string name="pref_summary_ignore_media_store_artwork">Может повысить качество обложки альбома, но привести к более медленной загрузки изображения. Включите это только в том случае, если у вас есть картинки с низким разрешением</string>
|
||||
<string name="pref_summary_library_categories">Настроить вид и порядок категорий в библиотеке.</string>
|
||||
<string name="pref_summary_lock_screen">Используйте собственный экран блокировки Retro Music</string>
|
||||
|
@ -342,7 +342,7 @@
|
|||
<string name="pref_title_general_theme">Тема приложения</string>
|
||||
<string name="pref_title_home_album_grid_style">Сетка альбома на Главной странице</string>
|
||||
<string name="pref_title_home_artist_grid_style">Сетка исполнителей</string>
|
||||
<string name="pref_title_home_banner">Кнопка Домой</string>
|
||||
<string name="pref_title_home_banner">Баннер</string>
|
||||
<string name="pref_title_ignore_media_store_artwork">Игнорировать обложки из хранилища</string>
|
||||
<string name="pref_title_last_added_interval">Дата последнего добавления плейлиста</string>
|
||||
<string name="pref_title_lock_screen">Полноэкранное управление</string>
|
||||
|
@ -490,4 +490,7 @@
|
|||
<string name="your_account_data_is_only_used_for_authentication">Данные вашей учетной записи используются только для аутентификации.</string>
|
||||
<string name="show_album_artists">Показать исполнителей альбома</string>
|
||||
<string name="action_add_to_blacklist">Добавить в чёрный список</string>
|
||||
<string name="home_only_profile">Только профиль</string>
|
||||
<string name="home_banner_full">Изображение и профиль</string>
|
||||
<string name="home_no_profile">Скрыть</string>
|
||||
</resources>
|
||||
|
|
|
@ -490,4 +490,7 @@
|
|||
<string name="your_account_data_is_only_used_for_authentication">Дані вашого облікового запису використовуються лише для автентифікації.</string>
|
||||
<string name="show_album_artists">Show Album Artists</string>
|
||||
<string name="action_add_to_blacklist">Add to Blacklist</string>
|
||||
<string name="home_only_profile">Тільки профіль</string>
|
||||
<string name="home_banner_full">Зображення і профіль</string>
|
||||
<string name="home_no_profile">Приховати</string>
|
||||
</resources>
|
||||
|
|
|
@ -98,6 +98,18 @@
|
|||
<item>this_year</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_type_home_banner_titles">
|
||||
<item>@string/home_only_profile</item>
|
||||
<item>@string/home_banner_full</item>
|
||||
<item>@string/home_no_profile</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_type_home_banner_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string-array name="pref_language_names">
|
||||
<item>System default</item>
|
||||
|
|
|
@ -503,4 +503,7 @@
|
|||
<string name="your_account_data_is_only_used_for_authentication">Your account data is only used for authentication.</string>
|
||||
<string name="show_album_artists">Show Album Artists</string>
|
||||
<string name="action_add_to_blacklist">Add to Blacklist</string>
|
||||
<string name="home_only_profile">Only profile</string>
|
||||
<string name="home_banner_full">Image and profile</string>
|
||||
<string name="home_no_profile">Hide</string>
|
||||
</resources>
|
||||
|
|
|
@ -27,12 +27,16 @@
|
|||
android:title="@string/pref_title_home_album_grid_style"
|
||||
/>
|
||||
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATESwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="toggle_home_banner"
|
||||
android:layout="@layout/list_item_view_switch"
|
||||
android:summary="@string/pref_summary_home_banner"
|
||||
android:title="@string/pref_title_home_banner" />
|
||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/pref_type_home_banner_titles"
|
||||
android:entryValues="@array/pref_type_home_banner_values"
|
||||
android:key="type_home_banner"
|
||||
android:layout="@layout/list_item_view"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null"
|
||||
android:title="@string/pref_title_home_banner"
|
||||
/>
|
||||
|
||||
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||
|
||||
|
|
Loading…
Reference in a new issue