From 0d067e05af1c2d1eca9d9cfb5d52a63b3498a42b Mon Sep 17 00:00:00 2001 From: Amine Date: Sun, 4 Jun 2017 18:08:15 +0200 Subject: [PATCH] Fixed drawable on landscape and extracted strings to translation. --- app/build.gradle | 4 +- .../bou/readerforselfoss/HomeActivity.kt | 24 ++++---- .../main/res/layout-land/activity_home.xml | 55 ++++++++++++++++--- app/src/main/res/values-fr/strings.xml | 11 ++++ app/src/main/res/values/strings.xml | 11 ++++ 5 files changed, 81 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 44b2cb3..3ad9a9f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt index a3d36d8..93233be 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -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?) { 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?) { 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() {}.type Reservoir.getAsync("drawerData", resultType, object: ReservoirGetCallback { diff --git a/app/src/main/res/layout-land/activity_home.xml b/app/src/main/res/layout-land/activity_home.xml index c52ed6c..8b0dcc0 100644 --- a/app/src/main/res/layout-land/activity_home.xml +++ b/app/src/main/res/layout-land/activity_home.xml @@ -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"> - - - + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 132be5f..f954007 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -103,4 +103,15 @@ La taille de la carte sera fixe Code source Kan het artikel niet als gelezen markeren + Erreur lors du chargement des tags… + Erreur lors du chargement des sources… + Filtres + raz + Tags + Sources + editer + Impossible de mettre en cache les filtres pour le drawer + Pas de tags chargés + Pas de sources chargés + Chargement … \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cb1139b..644a88c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -105,4 +105,15 @@ Card height will be fixed Source code Can\'t mark article as read + Error loading tags… + Error loading sources… + Filters + clear + Tags + Sources + edit + Couldn\'t cache your drawer data + No tags loaded + No sources loaded + Loading … \ No newline at end of file