[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Update: hide description length on error, show on edit

2016-12-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/323987 )

Change subject: Update: hide description length on error, show on edit
..


Update: hide description length on error, show on edit

Bug: T148203
Change-Id: Ib94d135e925124bd79da5ef6f27cfb09ca1fa122
---
M app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
M app/src/main/res/layout/view_description_edit.xml
M app/src/main/res/values-ar/strings.xml
M app/src/main/res/values-ast/strings.xml
M app/src/main/res/values-be/strings.xml
M app/src/main/res/values-bn/strings.xml
M app/src/main/res/values-cs/strings.xml
M app/src/main/res/values-da/strings.xml
M app/src/main/res/values-de/strings.xml
M app/src/main/res/values-diq/strings.xml
M app/src/main/res/values-es/strings.xml
M app/src/main/res/values-fi/strings.xml
M app/src/main/res/values-fr/strings.xml
M app/src/main/res/values-gl/strings.xml
M app/src/main/res/values-in/strings.xml
M app/src/main/res/values-it/strings.xml
M app/src/main/res/values-iw/strings.xml
M app/src/main/res/values-ja/strings.xml
M app/src/main/res/values-jv/strings.xml
M app/src/main/res/values-ko/strings.xml
M app/src/main/res/values-lb/strings.xml
M app/src/main/res/values-lt/strings.xml
M app/src/main/res/values-mk/strings.xml
M app/src/main/res/values-ms/strings.xml
M app/src/main/res/values-nb/strings.xml
M app/src/main/res/values-ne/strings.xml
M app/src/main/res/values-nl/strings.xml
M app/src/main/res/values-pa/strings.xml
M app/src/main/res/values-pl/strings.xml
M app/src/main/res/values-qq/strings.xml
M app/src/main/res/values-ru/strings.xml
M app/src/main/res/values-sd/strings.xml
M app/src/main/res/values-sk/strings.xml
M app/src/main/res/values-sv/strings.xml
M app/src/main/res/values-tr/strings.xml
M app/src/main/res/values-uk/strings.xml
M app/src/main/res/values-ur/strings.xml
M app/src/main/res/values-vi/strings.xml
M app/src/main/res/values-zh-rTW/strings.xml
M app/src/main/res/values-zh/strings.xml
M app/src/main/res/values/strings.xml
M app/src/main/res/values/styles.xml
42 files changed, 9 insertions(+), 70 deletions(-)

Approvals:
  Dbrant: Looks good to me, approved
  jenkins-bot: Verified



diff --git 
a/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java 
b/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
index 4579265..96dec4d 100644
--- a/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
+++ b/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
@@ -3,14 +3,11 @@
 import android.annotation.TargetApi;
 import android.content.Context;
 import android.os.Build;
-import android.support.annotation.ColorInt;
-import android.support.annotation.ColorRes;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.VisibleForTesting;
 import android.support.design.widget.FloatingActionButton;
 import android.support.design.widget.TextInputLayout;
-import android.support.v4.content.ContextCompat;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.View;
@@ -33,7 +30,6 @@
 @BindView(R.id.view_description_edit_save_button) FloatingActionButton 
saveButton;
 @BindView(R.id.view_description_edit_text) EditText pageDescriptionText;
 @BindView(R.id.view_description_edit_text_layout) TextInputLayout 
pageDescriptionLayout;
-@BindView(R.id.view_description_edit_char_count) TextView charCountText;
 @BindView(R.id.view_description_edit_progress_bar) ProgressBar progressBar;
 
 @Nullable private PageTitle pageTitle;
@@ -103,7 +99,7 @@
 callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
 void pageDescriptionTextChanged() {
 updateSaveButtonVisible();
-updateCharCount();
+setError(null);
 }
 
 @VisibleForTesting void setTitle(@Nullable CharSequence text) {
@@ -130,19 +126,5 @@
 
 private void showProgressBar(boolean show) {
 progressBar.setVisibility(show ? View.VISIBLE : View.GONE);
-}
-
-private void updateCharCount() {
-int charCount = pageDescriptionText.getText().length();
-int maxChars = 
getResources().getInteger(R.integer.description_max_chars);
-charCountText.setText(String.format(getResources()
-.getString(R.string.description_edit_char_count), charCount, 
maxChars));
-@ColorInt int color = charCount > maxChars
-? getColor(R.color.foundation_red) : 
getColor(R.color.foundation_gray);
-charCountText.setTextColor(color);
-}
-
-@ColorInt private int getColor(@ColorRes int id) {
-return ContextCompat.getColor(getContext(), id);
 }
 }
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_description_edit.xml 
b/app/src/main/res/layout/view_description_edit.xml
index 7cb9c6e..198dcee 100644
--- 

[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Update: hide description length on error, show on edit

2016-11-28 Thread Niedzielski (Code Review)
Niedzielski has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/323987

Change subject: Update: hide description length on error, show on edit
..

Update: hide description length on error, show on edit

Bug: T148203
Change-Id: Ib94d135e925124bd79da5ef6f27cfb09ca1fa122
---
M app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
M app/src/main/res/layout/view_description_edit.xml
M app/src/main/res/values-ar/strings.xml
M app/src/main/res/values-ast/strings.xml
M app/src/main/res/values-bn/strings.xml
M app/src/main/res/values-cs/strings.xml
M app/src/main/res/values-da/strings.xml
M app/src/main/res/values-de/strings.xml
M app/src/main/res/values-es/strings.xml
M app/src/main/res/values-fi/strings.xml
M app/src/main/res/values-fr/strings.xml
M app/src/main/res/values-gl/strings.xml
M app/src/main/res/values-in/strings.xml
M app/src/main/res/values-it/strings.xml
M app/src/main/res/values-iw/strings.xml
M app/src/main/res/values-ja/strings.xml
M app/src/main/res/values-jv/strings.xml
M app/src/main/res/values-ko/strings.xml
M app/src/main/res/values-lb/strings.xml
M app/src/main/res/values-lt/strings.xml
M app/src/main/res/values-mk/strings.xml
M app/src/main/res/values-ms/strings.xml
M app/src/main/res/values-nl/strings.xml
M app/src/main/res/values-pl/strings.xml
M app/src/main/res/values-qq/strings.xml
M app/src/main/res/values-ru/strings.xml
M app/src/main/res/values-sd/strings.xml
M app/src/main/res/values-sk/strings.xml
M app/src/main/res/values-sv/strings.xml
M app/src/main/res/values-uk/strings.xml
M app/src/main/res/values-zh-rTW/strings.xml
M app/src/main/res/values-zh/strings.xml
M app/src/main/res/values/strings.xml
M app/src/main/res/values/styles.xml
34 files changed, 8 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/87/323987/1

diff --git 
a/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java 
b/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
index 4579265..96dec4d 100644
--- a/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
+++ b/app/src/main/java/org/wikipedia/descriptions/DescriptionEditView.java
@@ -3,14 +3,11 @@
 import android.annotation.TargetApi;
 import android.content.Context;
 import android.os.Build;
-import android.support.annotation.ColorInt;
-import android.support.annotation.ColorRes;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.VisibleForTesting;
 import android.support.design.widget.FloatingActionButton;
 import android.support.design.widget.TextInputLayout;
-import android.support.v4.content.ContextCompat;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.View;
@@ -33,7 +30,6 @@
 @BindView(R.id.view_description_edit_save_button) FloatingActionButton 
saveButton;
 @BindView(R.id.view_description_edit_text) EditText pageDescriptionText;
 @BindView(R.id.view_description_edit_text_layout) TextInputLayout 
pageDescriptionLayout;
-@BindView(R.id.view_description_edit_char_count) TextView charCountText;
 @BindView(R.id.view_description_edit_progress_bar) ProgressBar progressBar;
 
 @Nullable private PageTitle pageTitle;
@@ -103,7 +99,7 @@
 callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
 void pageDescriptionTextChanged() {
 updateSaveButtonVisible();
-updateCharCount();
+setError(null);
 }
 
 @VisibleForTesting void setTitle(@Nullable CharSequence text) {
@@ -130,19 +126,5 @@
 
 private void showProgressBar(boolean show) {
 progressBar.setVisibility(show ? View.VISIBLE : View.GONE);
-}
-
-private void updateCharCount() {
-int charCount = pageDescriptionText.getText().length();
-int maxChars = 
getResources().getInteger(R.integer.description_max_chars);
-charCountText.setText(String.format(getResources()
-.getString(R.string.description_edit_char_count), charCount, 
maxChars));
-@ColorInt int color = charCount > maxChars
-? getColor(R.color.foundation_red) : 
getColor(R.color.foundation_gray);
-charCountText.setTextColor(color);
-}
-
-@ColorInt private int getColor(@ColorRes int id) {
-return ContextCompat.getColor(getContext(), id);
 }
 }
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_description_edit.xml 
b/app/src/main/res/layout/view_description_edit.xml
index 7cb9c6e..198dcee 100644
--- a/app/src/main/res/layout/view_description_edit.xml
+++ b/app/src/main/res/layout/view_description_edit.xml
@@ -76,7 +76,10 @@
 android:layout_marginRight="16dp"
 android:layout_marginLeft="16dp"
 android:textAlignment="viewStart"
-android:gravity="start">
+android:gravity="start"
+