Fixes #14 and fixes #15

This commit is contained in:
Amine 2017-06-04 20:25:29 +02:00
parent ca85e3d3ed
commit 2d3c297726
3 changed files with 56 additions and 37 deletions

View File

@ -1,7 +1,9 @@
**1.5.0.3 and 1.5.0.4** **1.5.0.3 to 1.5.0.5**
- Added a drawer for filtering sources and tags. - Added a drawer for filtering sources and tags.
- Fixes to the drawer.
**1.5.0.2** **1.5.0.2**
- If the content in the article viewer is empty, the article will open in a custom tab. - If the content in the article viewer is empty, the article will open in a custom tab.

View File

@ -25,8 +25,8 @@ android {
applicationId "apps.amine.bou.readerforselfoss" applicationId "apps.amine.bou.readerforselfoss"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 25 targetSdkVersion 25
versionCode 1504 versionCode 1505
versionName "1.5.0.4" versionName "1.5.0.5"
// Enabling multidex support. // Enabling multidex support.
multiDexEnabled true multiDexEnabled true
@ -98,7 +98,7 @@ dependencies {
compile 'com.burgstaller:okhttp-digest:1.12' compile 'com.burgstaller:okhttp-digest:1.12'
// Material-ish things // Material-ish things
compile 'com.roughike:bottom-bar:2.2.0' compile 'com.roughike:bottom-bar:2.3.1'
compile 'com.melnykov:floatingactionbutton:1.3.0' compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.jd-alexander:LikeButton:0.2.1' compile 'com.github.jd-alexander:LikeButton:0.2.1'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'

View File

@ -17,8 +17,10 @@ import android.support.v7.widget.RecyclerView
import android.support.v7.widget.StaggeredGridLayoutManager import android.support.v7.widget.StaggeredGridLayoutManager
import android.support.v7.widget.Toolbar import android.support.v7.widget.Toolbar
import android.support.v7.widget.helper.ItemTouchHelper import android.support.v7.widget.helper.ItemTouchHelper
import android.util.DisplayMetrics
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View
import android.widget.Toast import android.widget.Toast
import apps.amine.bou.readerforselfoss.adapters.ItemCardAdapter import apps.amine.bou.readerforselfoss.adapters.ItemCardAdapter
import apps.amine.bou.readerforselfoss.adapters.ItemListAdapter import apps.amine.bou.readerforselfoss.adapters.ItemListAdapter
@ -139,8 +141,44 @@ class HomeActivity : AppCompatActivity() {
.withActionBarDrawerToggle(true) .withActionBarDrawerToggle(true)
.withActionBarDrawerToggleAnimated(true) .withActionBarDrawerToggleAnimated(true)
.withShowDrawerOnFirstLaunch(true) .withShowDrawerOnFirstLaunch(true)
.withOnDrawerListener(object: Drawer.OnDrawerListener {
override fun onDrawerSlide(p0: View?, p1: Float) {
mBottomBar!!.alpha = (1 - p1)
}
override fun onDrawerClosed(p0: View?) {
mBottomBar!!.shySettings.showBar()
}
override fun onDrawerOpened(p0: View?) {
mBottomBar!!.shySettings.hideBar()
}
})
.build() .build()
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)
false
})
drawer!!.addStickyFooterItem(
PrimaryDrawerItem()
.withName(R.string.title_activity_settings)
.withIcon(R.drawable.ic_settings)
.withOnDrawerItemClickListener { _, _, _ ->
startActivityForResult(Intent(this@HomeActivity, SettingsActivity::class.java), MENU_PREFERENCES)
false
}
)
} }
fun handleDrawerItems() { fun handleDrawerItems() {
@ -164,7 +202,7 @@ class HomeActivity : AppCompatActivity() {
.withIcon(gd) .withIcon(gd)
.withOnDrawerItemClickListener { _, _, _ -> .withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab(maybeTagFilter = tag) getElementsAccordingToTab(maybeTagFilter = tag)
true false
} }
) )
} }
@ -185,7 +223,7 @@ class HomeActivity : AppCompatActivity() {
.withIdentifier(tag.id.toLong()) .withIdentifier(tag.id.toLong())
.withOnDrawerItemClickListener { _, _, _ -> .withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab(maybeSourceFilter = tag) getElementsAccordingToTab(maybeSourceFilter = tag)
true false
} }
) )
@ -200,7 +238,7 @@ class HomeActivity : AppCompatActivity() {
.withBadge(getString(R.string.drawer_action_clear)) .withBadge(getString(R.string.drawer_action_clear))
.withOnDrawerItemClickListener { _, _, _ -> .withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab() getElementsAccordingToTab()
true false
} }
) )
drawer!!.addItem(DividerDrawerItem()) drawer!!.addItem(DividerDrawerItem())
@ -213,34 +251,13 @@ class HomeActivity : AppCompatActivity() {
.withBadge(getString(R.string.drawer_action_edit)) .withBadge(getString(R.string.drawer_action_edit))
.withOnDrawerItemClickListener { _, _, _ -> .withOnDrawerItemClickListener { _, _, _ ->
startActivity(Intent(this, SourcesActivity::class.java)) startActivity(Intent(this, SourcesActivity::class.java))
true false
} }
) )
handleSources(maybeDrawerData.sources) handleSources(maybeDrawerData.sources)
drawer!!.addItem(DividerDrawerItem()) 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) if (!loadedFromCache)
Reservoir.putAsync("drawerData", maybeDrawerData, object : ReservoirPutCallback { Reservoir.putAsync("drawerData", maybeDrawerData, object : ReservoirPutCallback {
@ -262,7 +279,7 @@ class HomeActivity : AppCompatActivity() {
fun drawerApiCalls(maybeDrawerData: DrawerData?) { fun drawerApiCalls(maybeDrawerData: DrawerData?) {
var tags: List<Tag>? = null var tags: List<Tag>? = null
var sources: List<Sources>? = null var sources: List<Sources>?
fun sourcesApiCall() { fun sourcesApiCall() {
api!!.sources.enqueue(object: Callback<List<Sources>> { api!!.sources.enqueue(object: Callback<List<Sources>> {