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.
- Fixes to the drawer.
**1.5.0.2**
- 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"
minSdkVersion 16
targetSdkVersion 25
versionCode 1504
versionName "1.5.0.4"
versionCode 1505
versionName "1.5.0.5"
// Enabling multidex support.
multiDexEnabled true
@ -98,7 +98,7 @@ dependencies {
compile 'com.burgstaller:okhttp-digest:1.12'
// 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.github.jd-alexander:LikeButton:0.2.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.Toolbar
import android.support.v7.widget.helper.ItemTouchHelper
import android.util.DisplayMetrics
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.Toast
import apps.amine.bou.readerforselfoss.adapters.ItemCardAdapter
import apps.amine.bou.readerforselfoss.adapters.ItemListAdapter
@ -139,8 +141,44 @@ class HomeActivity : AppCompatActivity() {
.withActionBarDrawerToggle(true)
.withActionBarDrawerToggleAnimated(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()
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() {
@ -164,7 +202,7 @@ class HomeActivity : AppCompatActivity() {
.withIcon(gd)
.withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab(maybeTagFilter = tag)
true
false
}
)
}
@ -185,7 +223,7 @@ class HomeActivity : AppCompatActivity() {
.withIdentifier(tag.id.toLong())
.withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab(maybeSourceFilter = tag)
true
false
}
)
@ -200,7 +238,7 @@ class HomeActivity : AppCompatActivity() {
.withBadge(getString(R.string.drawer_action_clear))
.withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab()
true
false
}
)
drawer!!.addItem(DividerDrawerItem())
@ -213,34 +251,13 @@ class HomeActivity : AppCompatActivity() {
.withBadge(getString(R.string.drawer_action_edit))
.withOnDrawerItemClickListener { _, _, _ ->
startActivity(Intent(this, SourcesActivity::class.java))
true
false
}
)
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 {
@ -262,7 +279,7 @@ class HomeActivity : AppCompatActivity() {
fun drawerApiCalls(maybeDrawerData: DrawerData?) {
var tags: List<Tag>? = null
var sources: List<Sources>? = null
var sources: List<Sources>?
fun sourcesApiCall() {
api!!.sources.enqueue(object: Callback<List<Sources>> {