Added back the badges.
This commit is contained in:
parent
04402c5ab9
commit
90a8fac8d4
@ -1,3 +1,7 @@
|
|||||||
|
**1.5.1.6**
|
||||||
|
|
||||||
|
- Added back the badges after it was fixed on the library side.
|
||||||
|
|
||||||
**1.5.1.5**
|
**1.5.1.5**
|
||||||
|
|
||||||
- THEMES !!!! For now, the app has predefined themes. You can ask for new ones until I make them dynamic.
|
- THEMES !!!! For now, the app has predefined themes. You can ask for new ones until I make them dynamic.
|
||||||
|
@ -25,8 +25,8 @@ android {
|
|||||||
applicationId "apps.amine.bou.readerforselfoss"
|
applicationId "apps.amine.bou.readerforselfoss"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 1515
|
versionCode 1516
|
||||||
versionName "1.5.1.5"
|
versionName "1.5.1.6"
|
||||||
|
|
||||||
// Enabling multidex support.
|
// Enabling multidex support.
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
@ -115,7 +115,7 @@ dependencies {
|
|||||||
compile 'com.burgstaller:okhttp-digest:1.12'
|
compile 'com.burgstaller:okhttp-digest:1.12'
|
||||||
|
|
||||||
// Material-ish things
|
// Material-ish things
|
||||||
compile 'com.ashokvarma.android:bottom-navigation-bar:2.0.1'
|
compile 'com.ashokvarma.android:bottom-navigation-bar:2.0.2'
|
||||||
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'
|
||||||
|
@ -53,6 +53,8 @@ import apps.amine.bou.readerforselfoss.api.selfoss.*
|
|||||||
import apps.amine.bou.readerforselfoss.settings.SettingsActivity
|
import apps.amine.bou.readerforselfoss.settings.SettingsActivity
|
||||||
import apps.amine.bou.readerforselfoss.themes.AppColors
|
import apps.amine.bou.readerforselfoss.themes.AppColors
|
||||||
import apps.amine.bou.readerforselfoss.utils.Config
|
import apps.amine.bou.readerforselfoss.utils.Config
|
||||||
|
import apps.amine.bou.readerforselfoss.utils.bottombar.maybeShow
|
||||||
|
import apps.amine.bou.readerforselfoss.utils.bottombar.removeBadge
|
||||||
import apps.amine.bou.readerforselfoss.utils.checkAndDisplayStoreApk
|
import apps.amine.bou.readerforselfoss.utils.checkAndDisplayStoreApk
|
||||||
import apps.amine.bou.readerforselfoss.utils.checkApkVersion
|
import apps.amine.bou.readerforselfoss.utils.checkApkVersion
|
||||||
import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper
|
import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper
|
||||||
@ -183,7 +185,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
} else {
|
} else {
|
||||||
(recyclerView.adapter as ItemListAdapter).removeItemAtIndex(position)
|
(recyclerView.adapter as ItemListAdapter).removeItemAtIndex(position)
|
||||||
}
|
}
|
||||||
//tabNew.setBadgeCount(items.size - 1)
|
tabNewBadge.setText("${items.size}").maybeShow()
|
||||||
|
|
||||||
mayBeEmpty()
|
mayBeEmpty()
|
||||||
|
|
||||||
@ -202,28 +204,37 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
|
|
||||||
bottomBar = findViewById(R.id.bottomBar)
|
bottomBar = findViewById(R.id.bottomBar)
|
||||||
|
|
||||||
tabNewBadge = TextBadgeItem().setText("")
|
tabNewBadge = TextBadgeItem()
|
||||||
tabArchiveBadge = TextBadgeItem().setText("")
|
.setText("")
|
||||||
tabStarredBadge = TextBadgeItem().setText("")
|
.setHideOnSelect(false).hide(false)
|
||||||
|
.setBackgroundColor(appColors.primary)
|
||||||
|
tabArchiveBadge = TextBadgeItem()
|
||||||
|
.setText("")
|
||||||
|
.setHideOnSelect(false).hide(false)
|
||||||
|
.setBackgroundColor(appColors.primary)
|
||||||
|
tabStarredBadge = TextBadgeItem()
|
||||||
|
.setText("")
|
||||||
|
.setHideOnSelect(false).hide(false)
|
||||||
|
.setBackgroundColor(appColors.primary)
|
||||||
|
|
||||||
val tabNew =
|
val tabNew =
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
R.drawable.ic_fiber_new_black_24dp,
|
R.drawable.ic_fiber_new_black_24dp,
|
||||||
getString(R.string.tab_new)
|
getString(R.string.tab_new)
|
||||||
).setActiveColor(appColors.accent)
|
).setActiveColor(appColors.accent)
|
||||||
//.setBadgeItem(tabNewBadge)
|
.setBadgeItem(tabNewBadge)
|
||||||
val tabArchive =
|
val tabArchive =
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
R.drawable.ic_archive_black_24dp,
|
R.drawable.ic_archive_black_24dp,
|
||||||
getString(R.string.tab_read)
|
getString(R.string.tab_read)
|
||||||
).setActiveColor(appColors.dark)
|
).setActiveColor(appColors.dark)
|
||||||
// .setBadgeItem(tabArchiveBadge)
|
.setBadgeItem(tabArchiveBadge)
|
||||||
val tabStarred =
|
val tabStarred =
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
R.drawable.ic_favorite_black_24dp,
|
R.drawable.ic_favorite_black_24dp,
|
||||||
getString(R.string.tab_favs)
|
getString(R.string.tab_favs)
|
||||||
).setActiveColorResource(R.color.pink)
|
).setActiveColorResource(R.color.pink)
|
||||||
// .setBadgeItem(tabStarredBadge)
|
.setBadgeItem(tabStarredBadge)
|
||||||
|
|
||||||
bottomBar
|
bottomBar
|
||||||
.addItem(tabNew)
|
.addItem(tabNew)
|
||||||
@ -649,24 +660,31 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
|
|||||||
api.stats.enqueue(object : Callback<Stats> {
|
api.stats.enqueue(object : Callback<Stats> {
|
||||||
override fun onResponse(call: Call<Stats>, response: Response<Stats>) {
|
override fun onResponse(call: Call<Stats>, response: Response<Stats>) {
|
||||||
if (response.body() != null) {
|
if (response.body() != null) {
|
||||||
tabStarredBadge.setText(response.body()!!.unread.toString())
|
if (displayUnreadCount)
|
||||||
|
tabNewBadge
|
||||||
|
.setText(response.body()!!.unread.toString())
|
||||||
|
.maybeShow()
|
||||||
if (displayAllCount) {
|
if (displayAllCount) {
|
||||||
tabStarredBadge.setText(response.body()!!.total.toString())
|
tabArchiveBadge
|
||||||
tabStarredBadge.setText(response.body()!!.starred.toString())
|
.setText(response.body()!!.total.toString())
|
||||||
}/* else {
|
.maybeShow()
|
||||||
tabArchive.removeBadge()
|
tabStarredBadge
|
||||||
tabStarred.removeBadge()
|
.setText(response.body()!!.starred.toString())
|
||||||
}*/
|
.maybeShow()
|
||||||
|
} else {
|
||||||
|
tabArchiveBadge.removeBadge()
|
||||||
|
tabStarredBadge.removeBadge()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(call: Call<Stats>, t: Throwable) {}
|
override fun onFailure(call: Call<Stats>, t: Throwable) {}
|
||||||
})
|
})
|
||||||
}/* else {
|
} else {
|
||||||
tabNew.removeBadge()
|
tabNewBadge.removeBadge()
|
||||||
tabArchive.removeBadge()
|
tabArchiveBadge.removeBadge()
|
||||||
tabStarred.removeBadge()
|
tabStarredBadge.removeBadge()
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateNoOfColumns(): Int {
|
private fun calculateNoOfColumns(): Int {
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package apps.amine.bou.readerforselfoss.utils.bottombar
|
||||||
|
|
||||||
|
import com.ashokvarma.bottomnavigation.TextBadgeItem
|
||||||
|
|
||||||
|
|
||||||
|
fun TextBadgeItem.removeBadge(): TextBadgeItem {
|
||||||
|
this.setText("")
|
||||||
|
this.hide()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun TextBadgeItem.maybeShow(): TextBadgeItem =
|
||||||
|
if (this.isHidden)
|
||||||
|
this.show()
|
||||||
|
else
|
||||||
|
this
|
Loading…
Reference in New Issue
Block a user