Fixed drawable on landscape and extracted strings to translation.

This commit is contained in:
Amine 2017-06-04 18:08:15 +02:00
parent c3305b7523
commit 0d067e05af
5 changed files with 81 additions and 24 deletions

View File

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

View File

@ -19,7 +19,6 @@ import android.support.v7.widget.Toolbar
import android.support.v7.widget.helper.ItemTouchHelper
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
@ -49,7 +48,6 @@ import com.mikepenz.materialdrawer.DrawerBuilder
import com.mikepenz.materialdrawer.model.DividerDrawerItem
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
import com.roughike.bottombar.BottomBar
import com.roughike.bottombar.BottomBarTab
import retrofit2.Call
@ -150,7 +148,7 @@ class HomeActivity : AppCompatActivity() {
fun handleTags(maybeTags: List<Tag>?) {
if (maybeTags == null) {
if (loadedFromCache)
drawer!!.addItem(PrimaryDrawerItem().withName("Error loading tags..."))
drawer!!.addItem(PrimaryDrawerItem().withName(getString(R.string.drawer_error_loading_tags)))
}
else {
for (tag in maybeTags) {
@ -177,7 +175,7 @@ class HomeActivity : AppCompatActivity() {
fun handleSources(maybeSources: List<Sources>?) {
if (maybeSources == null) {
if (loadedFromCache)
drawer!!.addItem(PrimaryDrawerItem().withName("Error loading sources..."))
drawer!!.addItem(PrimaryDrawerItem().withName(getString(R.string.drawer_error_loading_sources)))
}
else
for (tag in maybeSources)
@ -197,22 +195,22 @@ class HomeActivity : AppCompatActivity() {
if (maybeDrawerData != null) {
drawer!!.addItem(
PrimaryDrawerItem()
.withName("Filtres")
.withName(getString(R.string.drawer_item_filters))
.withIdentifier(DRAWER_ID_FILTERS)
.withBadge("clear")
.withBadge(getString(R.string.drawer_action_clear))
.withOnDrawerItemClickListener { _, _, _ ->
getElementsAccordingToTab()
true
}
)
drawer!!.addItem(DividerDrawerItem())
drawer!!.addItem(PrimaryDrawerItem().withName("Tags").withIdentifier(DRAWER_ID_TAGS).withSelectable(false))
drawer!!.addItem(PrimaryDrawerItem().withName(getString(R.string.drawer_item_tags)).withIdentifier(DRAWER_ID_TAGS).withSelectable(false))
handleTags(maybeDrawerData.tags)
drawer!!.addItem(
PrimaryDrawerItem()
.withName("Sources")
.withName(getString(R.string.drawer_item_sources))
.withIdentifier(DRAWER_ID_TAGS)
.withBadge("edit")
.withBadge(getString(R.string.drawer_action_edit))
.withOnDrawerItemClickListener { _, _, _ ->
startActivity(Intent(this, SourcesActivity::class.java))
true
@ -249,14 +247,14 @@ class HomeActivity : AppCompatActivity() {
override fun onSuccess() {}
override fun onFailure(p0: Exception?) {
Toast.makeText(this@HomeActivity, "Couldn't cache your drawer data", Toast.LENGTH_SHORT).show()
Toast.makeText(this@HomeActivity, getString(R.string.cache_drawer_error), Toast.LENGTH_SHORT).show()
}
})
} else {
if (!loadedFromCache) {
drawer!!.addItem(SecondaryDrawerItem().withName("No tags loaded").withIdentifier(DRAWER_ID_TAGS).withSelectable(false))
drawer!!.addItem(SecondaryDrawerItem().withName("No sources loaded").withIdentifier(DRAWER_ID_SOURCES).withSelectable(false))
drawer!!.addItem(SecondaryDrawerItem().withName(getString(R.string.no_tags_loaded)).withIdentifier(DRAWER_ID_TAGS).withSelectable(false))
drawer!!.addItem(SecondaryDrawerItem().withName(getString(R.string.no_sources_loaded)).withIdentifier(DRAWER_ID_SOURCES).withSelectable(false))
}
}
@ -295,7 +293,7 @@ class HomeActivity : AppCompatActivity() {
})
}
drawer!!.addItem(SecondaryDrawerItem().withName("Loading ...").withSelectable(false))
drawer!!.addItem(SecondaryDrawerItem().withName(getString(R.string.drawer_loading)).withSelectable(false))
val resultType = object : TypeToken<DrawerData>() {}.type
Reservoir.getAsync("drawerData", resultType, object: ReservoirGetCallback<DrawerData> {

View File

@ -5,6 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="apps.amine.bou.readerforselfoss.HomeActivity">
<com.roughike.bottombar.BottomBar
@ -54,6 +55,36 @@
android:layout_toRightOf="@+id/bottomBar"
android:layout_below="@id/prompt_view">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/intern_coordLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:theme="@style/ToolBarStyle"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
@ -68,6 +99,12 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -103,4 +103,15 @@
<string name="card_height_off" >La taille de la carte sera fixe</string>
<string name="source_code">Code source</string>
<string name="cant_mark_read">Kan het artikel niet als gelezen markeren</string>
<string name="drawer_error_loading_tags">Erreur lors du chargement des tags…</string>
<string name="drawer_error_loading_sources">Erreur lors du chargement des sources…</string>
<string name="drawer_item_filters">Filtres</string>
<string name="drawer_action_clear">raz</string>
<string name="drawer_item_tags">Tags</string>
<string name="drawer_item_sources">Sources</string>
<string name="drawer_action_edit">editer</string>
<string name="cache_drawer_error">Impossible de mettre en cache les filtres pour le drawer</string>
<string name="no_tags_loaded">Pas de tags chargés</string>
<string name="no_sources_loaded">Pas de sources chargés</string>
<string name="drawer_loading">Chargement …</string>
</resources>

View File

@ -105,4 +105,15 @@
<string name="card_height_off">Card height will be fixed</string>
<string name="source_code">Source code</string>
<string name="cant_mark_read">Can\'t mark article as read</string>
<string name="drawer_error_loading_tags">Error loading tags…</string>
<string name="drawer_error_loading_sources">Error loading sources…</string>
<string name="drawer_item_filters">Filters</string>
<string name="drawer_action_clear">clear</string>
<string name="drawer_item_tags">Tags</string>
<string name="drawer_item_sources">Sources</string>
<string name="drawer_action_edit">edit</string>
<string name="cache_drawer_error">Couldn\'t cache your drawer data</string>
<string name="no_tags_loaded">No tags loaded</string>
<string name="no_sources_loaded">No sources loaded</string>
<string name="drawer_loading">Loading …</string>
</resources>