Moved some menu items to the drawable.

This commit is contained in:
Amine 2017-06-04 16:44:31 +02:00
parent fb84b31122
commit c3305b7523
5 changed files with 76 additions and 44 deletions

View File

@ -25,8 +25,8 @@ android {
applicationId "apps.amine.bou.readerforselfoss"
minSdkVersion 16
targetSdkVersion 25
versionCode 1502
versionName "1.5.0.2"
versionCode 1503
versionName "1.5.0.3"
// Enabling multidex support.
multiDexEnabled true

View File

@ -66,6 +66,7 @@ class HomeActivity : AppCompatActivity() {
private val REQUEST_INVITE_BYMAIL = 13232
private val DRAWER_ID_TAGS = 100101L
private val DRAWER_ID_SOURCES = 100110L
private val DRAWER_ID_FILTERS = 100111L
private var mRecyclerView: RecyclerView? = null
private var api: SelfossApi? = null
private var items: ArrayList<Item> = ArrayList()
@ -159,7 +160,7 @@ class HomeActivity : AppCompatActivity() {
gd.setSize(30, 30)
gd.cornerRadius = 30F
drawer!!.addItem(
PrimaryDrawerItem()
SecondaryDrawerItem()
.withName(tag.tag)
.withIdentifier(longHash(tag.tag))
.withIcon(gd)
@ -181,24 +182,68 @@ class HomeActivity : AppCompatActivity() {
else
for (tag in maybeSources)
drawer!!.addItem(
PrimaryDrawerItem()
.withName(tag.title)
.withIdentifier(tag.id.toLong())
.withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab(maybeSourceFilter = tag)
true
}
SecondaryDrawerItem()
.withName(tag.title)
.withIdentifier(tag.id.toLong())
.withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab(maybeSourceFilter = tag)
true
}
)
}
drawer!!.removeAllItems()
if (maybeDrawerData != null) {
drawer!!.addItem(SecondaryDrawerItem().withName("Tags").withIdentifier(DRAWER_ID_TAGS).withSelectable(false))
handleTags(maybeDrawerData.tags)
drawer!!.addItem(
PrimaryDrawerItem()
.withName("Filtres")
.withIdentifier(DRAWER_ID_FILTERS)
.withBadge("clear")
.withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab()
true
}
)
drawer!!.addItem(DividerDrawerItem())
drawer!!.addItem(SecondaryDrawerItem().withName("Sources").withIdentifier(DRAWER_ID_TAGS).withSelectable(false))
drawer!!.addItem(PrimaryDrawerItem().withName("Tags").withIdentifier(DRAWER_ID_TAGS).withSelectable(false))
handleTags(maybeDrawerData.tags)
drawer!!.addItem(
PrimaryDrawerItem()
.withName("Sources")
.withIdentifier(DRAWER_ID_TAGS)
.withBadge("edit")
.withOnDrawerItemClickListener { _, _, _ ->
startActivity(Intent(this, SourcesActivity::class.java))
true
}
)
handleSources(maybeDrawerData.sources)
drawer!!.addItem(DividerDrawerItem())
drawer!!.addStickyFooterItem(
PrimaryDrawerItem()
.withName(R.string.action_about)
.withIcon(R.drawable.ic_info_outline)
.withOnDrawerItemClickListener { _, _, _ ->
LibsBuilder()
.withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
.withAboutIconShown(true)
.withAboutVersionShown(true)
.start(this@HomeActivity)
true
})
drawer!!.addStickyFooterItem(
PrimaryDrawerItem()
.withName(R.string.title_activity_settings)
.withIcon(R.drawable.ic_settings)
.withOnDrawerItemClickListener { _, _, _ ->
startActivityForResult(Intent(this@HomeActivity, SettingsActivity::class.java), MENU_PREFERENCES)
true
}
)
if (!loadedFromCache)
Reservoir.putAsync("drawerData", maybeDrawerData, object : ReservoirPutCallback {
override fun onSuccess() {}
@ -544,24 +589,6 @@ class HomeActivity : AppCompatActivity() {
finish()
return true
}
R.id.action_sources -> {
val intent2 = Intent(this, SourcesActivity::class.java)
startActivity(intent2)
return true
}
R.id.action_settings -> {
val intent3 = Intent(this, SettingsActivity::class.java)
startActivityForResult(intent3, MENU_PREFERENCES)
return true
}
R.id.about -> {
LibsBuilder()
.withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
.withAboutIconShown(true)
.withAboutVersionShown(true)
.start(this)
return true
}
R.id.action_share_the_app -> {
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) {
val share = AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
</vector>

View File

@ -14,24 +14,11 @@
android:orderInCategory="99"
android:title="@string/menu_home_refresh"
app:showAsAction="ifRoom" />
<item android:id="@+id/action_settings"
android:title="@string/title_activity_settings"
android:orderInCategory="100"
app:showAsAction="never"/>
<item android:id="@+id/action_sources"
android:title="@string/action_source"
android:orderInCategory="101"
app:showAsAction="never"/>
<item
android:id="@+id/action_share_the_app"
android:orderInCategory="102"
android:title="@string/menu_share_the_app" />
<item android:id="@+id/about"
android:title="@string/action_about"
android:orderInCategory="103"
app:showAsAction="never"/>
<item android:id="@+id/action_disconnect"
android:title="@string/action_disconnect"