Added a setting for displaying or hiding the account header.
This commit is contained in:
parent
9fa178d513
commit
eb3872f7a6
@ -1,4 +1,10 @@
|
|||||||
**1.5.2.13**
|
**1.5.2.15/16**
|
||||||
|
|
||||||
|
- Adding an account header on the lateral drawer.
|
||||||
|
|
||||||
|
- The account header is only displayed when the setting is enabled.
|
||||||
|
|
||||||
|
**1.5.2.13/14**
|
||||||
|
|
||||||
- Updated glide.
|
- Updated glide.
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ import com.ashokvarma.bottomnavigation.TextBadgeItem
|
|||||||
import com.ftinc.scoop.Scoop
|
import com.ftinc.scoop.Scoop
|
||||||
import com.mikepenz.materialdrawer.AccountHeader
|
import com.mikepenz.materialdrawer.AccountHeader
|
||||||
import com.mikepenz.materialdrawer.AccountHeaderBuilder
|
import com.mikepenz.materialdrawer.AccountHeaderBuilder
|
||||||
import com.mikepenz.materialdrawer.holder.DimenHolder
|
|
||||||
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
|
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
|
||||||
|
|
||||||
|
|
||||||
@ -97,6 +96,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
private var maybeSourceFilter: Sources? = null
|
private var maybeSourceFilter: Sources? = null
|
||||||
private var maybeSearchFilter: String? = null
|
private var maybeSearchFilter: String? = null
|
||||||
private var userIdentifier: String = ""
|
private var userIdentifier: String = ""
|
||||||
|
private var displayAccountHeader: Boolean = false
|
||||||
|
|
||||||
private lateinit var emptyText: TextView
|
private lateinit var emptyText: TextView
|
||||||
private lateinit var recyclerView: RecyclerView
|
private lateinit var recyclerView: RecyclerView
|
||||||
@ -293,47 +293,55 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
fullHeightCards = sharedPref.getBoolean("full_height_cards", false)
|
fullHeightCards = sharedPref.getBoolean("full_height_cards", false)
|
||||||
itemsNumber = sharedPref.getString("prefer_api_items_number", "200").toInt()
|
itemsNumber = sharedPref.getString("prefer_api_items_number", "200").toInt()
|
||||||
userIdentifier = sharedPref.getString("unique_id", "")
|
userIdentifier = sharedPref.getString("unique_id", "")
|
||||||
|
displayAccountHeader = sharedPref.getBoolean("account_header_displaying", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleDrawer(dirtyPref: SharedPreferences) {
|
private fun handleDrawer(dirtyPref: SharedPreferences) {
|
||||||
|
displayAccountHeader =
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
.getBoolean("account_header_displaying", false)
|
||||||
|
val headerResult: AccountHeader? = if (displayAccountHeader) {
|
||||||
|
AccountHeaderBuilder()
|
||||||
|
.withActivity(this)
|
||||||
|
.withHeaderBackground(R.drawable.bg)
|
||||||
|
.addProfiles(
|
||||||
|
ProfileDrawerItem()
|
||||||
|
.withName(
|
||||||
|
dirtyPref.getString("url", "")
|
||||||
|
)
|
||||||
|
.withIcon(resources.getDrawable(R.mipmap.ic_launcher))
|
||||||
|
)
|
||||||
|
.withSelectionListEnabledForSingleProfile(false)
|
||||||
|
.build()
|
||||||
|
} else null
|
||||||
|
|
||||||
val headerResult: AccountHeader = AccountHeaderBuilder()
|
val drawerBuilder =
|
||||||
.withActivity(this)
|
DrawerBuilder()
|
||||||
.withHeaderBackground(R.drawable.bg)
|
.withActivity(this)
|
||||||
.addProfiles(
|
.withRootView(R.id.drawer_layout)
|
||||||
ProfileDrawerItem()
|
.withToolbar(toolbar)
|
||||||
.withName(
|
.withActionBarDrawerToggle(true)
|
||||||
dirtyPref.getString("url", "")
|
.withActionBarDrawerToggleAnimated(true)
|
||||||
)
|
.withShowDrawerOnFirstLaunch(true)
|
||||||
.withIcon(resources.getDrawable(R.mipmap.ic_launcher))
|
.withOnDrawerListener(object: Drawer.OnDrawerListener {
|
||||||
)
|
override fun onDrawerSlide(v: View?, p1: Float) {
|
||||||
.withSelectionListEnabledForSingleProfile(false)
|
bottomBar.alpha = (1 - p1)
|
||||||
.build()
|
}
|
||||||
|
|
||||||
drawer = DrawerBuilder()
|
override fun onDrawerClosed(v: View?) {
|
||||||
.withActivity(this)
|
bottomBar.show()
|
||||||
.withAccountHeader(headerResult)
|
}
|
||||||
.withHeaderHeight(DimenHolder.fromDp(140))
|
|
||||||
.withRootView(R.id.drawer_layout)
|
|
||||||
.withToolbar(toolbar)
|
|
||||||
.withActionBarDrawerToggle(true)
|
|
||||||
.withActionBarDrawerToggleAnimated(true)
|
|
||||||
.withShowDrawerOnFirstLaunch(true)
|
|
||||||
.withOnDrawerListener(object: Drawer.OnDrawerListener {
|
|
||||||
override fun onDrawerSlide(v: View?, p1: Float) {
|
|
||||||
bottomBar.alpha = (1 - p1)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDrawerClosed(v: View?) {
|
override fun onDrawerOpened(v: View?) {
|
||||||
bottomBar.show()
|
bottomBar.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDrawerOpened(v: View?) {
|
})
|
||||||
bottomBar.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
if (displayAccountHeader && headerResult != null)
|
||||||
.build()
|
drawerBuilder.withAccountHeader(headerResult)
|
||||||
|
|
||||||
|
drawer = drawerBuilder.build()
|
||||||
|
|
||||||
drawer.addStickyFooterItem(
|
drawer.addStickyFooterItem(
|
||||||
PrimaryDrawerItem()
|
PrimaryDrawerItem()
|
||||||
|
@ -145,4 +145,6 @@
|
|||||||
<string name="read_debug_off">Aucun log quand un article est marqué comme lu</string>
|
<string name="read_debug_off">Aucun log quand un article est marqué comme lu</string>
|
||||||
<string name="summary_debug_identifier">Identifiant de debug</string>
|
<string name="summary_debug_identifier">Identifiant de debug</string>
|
||||||
<string name="unique_id_to_clipboard">Texte copié</string>
|
<string name="unique_id_to_clipboard">Texte copié</string>
|
||||||
|
<string name="display_header_drawer_summary">Afficher une entête avec l\'url de votre instance de Selfoss en haut du drawer lateral.</string>
|
||||||
|
<string name="display_header_drawer_title">Entête de compte</string>
|
||||||
</resources>
|
</resources>
|
@ -145,4 +145,7 @@
|
|||||||
<string name="read_debug_off">No log when marking an item as read</string>
|
<string name="read_debug_off">No log when marking an item as read</string>
|
||||||
<string name="summary_debug_identifier">Debug identifier</string>
|
<string name="summary_debug_identifier">Debug identifier</string>
|
||||||
<string name="unique_id_to_clipboard">Identifier copied to your clipboard</string>
|
<string name="unique_id_to_clipboard">Identifier copied to your clipboard</string>
|
||||||
|
<string
|
||||||
|
name="display_header_drawer_summary">Display a header with the selfoss instance url on the lateral drawer.</string>
|
||||||
|
<string name="display_header_drawer_title">Account header</string>
|
||||||
</resources>
|
</resources>
|
@ -147,4 +147,7 @@
|
|||||||
<string name="read_debug_on">Api calls will be logged when marking an article as read</string>
|
<string name="read_debug_on">Api calls will be logged when marking an article as read</string>
|
||||||
<string name="summary_debug_identifier">Debug identifier</string>
|
<string name="summary_debug_identifier">Debug identifier</string>
|
||||||
<string name="unique_id_to_clipboard">Identifier copied to your clipboard</string>
|
<string name="unique_id_to_clipboard">Identifier copied to your clipboard</string>
|
||||||
|
<string
|
||||||
|
name="display_header_drawer_summary">Display a header with the selfoss instance url on the lateral drawer.</string>
|
||||||
|
<string name="display_header_drawer_title">Account header</string>
|
||||||
</resources>
|
</resources>
|
@ -39,6 +39,11 @@
|
|||||||
android:title="@string/pref_general_category_displaying">
|
android:title="@string/pref_general_category_displaying">
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="account_header_displaying"
|
||||||
|
android:summary="@string/display_header_drawer_summary"
|
||||||
|
android:title="@string/display_header_drawer_title" />
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="card_view_active"
|
android:key="card_view_active"
|
||||||
|
Loading…
Reference in New Issue
Block a user