Skip to content

Commit 887fc7a

Browse files
committed
resolving
1 parent a5561b1 commit 887fc7a

File tree

10 files changed

+248
-39
lines changed

10 files changed

+248
-39
lines changed

Diff for: .idea/gradle.xml

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/misc.xml

+14-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.3'
9+
classpath 'com.android.tools.build:gradle:3.4.1'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files

Diff for: gradle/wrapper/gradle-wrapper.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sat Jun 09 06:47:39 CST 2018
1+
#Mon Jun 10 07:54:52 CST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

Diff for: sample/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 27
5-
buildToolsVersion '27.0.3'
4+
compileSdkVersion 28
5+
buildToolsVersion '28.0.3'
66
defaultConfig {
77
applicationId "studio.carbonylgroup.textfieldboxestest"
88
minSdkVersion 15
9-
targetSdkVersion 27
9+
targetSdkVersion 28
1010
versionCode 1
1111
versionName "1.0"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -24,9 +24,9 @@ dependencies {
2424
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2525
exclude group: 'com.android.support', module: 'support-annotations'
2626
})
27-
compile 'com.android.support:appcompat-v7:27.1.1'
28-
compile 'com.android.support.constraint:constraint-layout:1.1.0'
29-
compile 'com.android.support:design:27.1.1'
27+
compile 'com.android.support:appcompat-v7:28.1.1'
28+
compile 'com.android.support.constraint:constraint-layout:1.1.3'
29+
compile 'com.android.support:design:28.1.1'
3030
// compile 'com.github.HITGIF:TextFieldBoxes:1.4.1'
3131
compile project(':textfieldboxes')
3232
testCompile 'junit:junit:4.12'

Diff for: sample/src/main/res/layout/activity_main.xml

+4-5
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,24 @@
6565
android:layout_height="wrap_content"
6666
android:layout_gravity="center_horizontal"
6767
android:layout_weight="2"
68-
app:alwaysShowHint="true"
6968
app:endIcon="@drawable/ic_mic_black_24dp"
7069
app:hasFocus="true"
70+
app:rtl="true"
7171
app:helperText=" "
7272
app:iconSignifier="@drawable/ic_location_on_black_24dp"
7373
app:isResponsiveIconColor="true"
74-
app:labelText="Location">
74+
app:labelText="سلام تا جایی">
7575

7676
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
7777
android:id="@+id/extendedEditText"
7878
android:layout_width="match_parent"
7979
android:layout_height="wrap_content"
8080
android:ems="10"
81-
android:hint="Placeholder"
8281
android:imeOptions="actionNext"
8382
android:inputType="text"
8483
android:maxLines="1"
8584
android:popupElevation="5dp"
86-
android:text="" />
85+
android:text="سلام تا جایی" />
8786

8887
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
8988

@@ -96,6 +95,7 @@
9695
android:layout_gravity="center_horizontal"
9796
android:layout_marginTop="15dp"
9897
app:hasFocus="false"
98+
app:rtl="true"
9999
app:labelText="Description"
100100
app:maxCharacters="140">
101101

@@ -137,7 +137,6 @@
137137
android:layout_marginTop="16dp"
138138
android:text="@string/test_error" />
139139

140-
141140
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
142141
android:id="@+id/text_field_boxes6"
143142
android:layout_marginTop="16dp"

Diff for: textfieldboxes/src/main/java/studio/carbonylgroup/textfieldboxes/TextFieldBoxes.java

+16-5
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ public class TextFieldBoxes extends FrameLayout {
143143
*/
144144
protected boolean useDenseSpacing;
145145

146+
/**
147+
* whether the field uses a rtl direction for 'Persian (Farsi)' and 'Arabic' languages
148+
* False by default.
149+
*/
150+
protected boolean rtl;
151+
146152
protected int labelColor = -1;
147153
protected int labelTopMargin = -1;
148154
protected int ANIMATION_DURATION = 100;
@@ -326,7 +332,8 @@ private void updateClearAndEndIconLayout() {
326332

327333
// We add a fake drawableRight to EditText so it will have padding on the right side and text will not go
328334
// under the icons.
329-
mPasswordToggleDummyDrawable.setBounds(0, 0, endIconW + clearButtonW, 0);
335+
if (!rtl)
336+
mPasswordToggleDummyDrawable.setBounds(0, 0, endIconW + clearButtonW, 0);
330337

331338
final Drawable[] compounds = TextViewCompat.getCompoundDrawablesRelative(editText);
332339
// Store the user defined end compound drawable so that we can restore it later
@@ -357,7 +364,10 @@ private void initViews() {
357364

358365
this.editText = findEditTextChild();
359366
if (editText == null) return;
360-
this.addView(LayoutInflater.from(getContext()).inflate(R.layout.text_field_boxes_layout, this, false));
367+
this.addView(LayoutInflater.from(getContext()).inflate(rtl ?
368+
R.layout.text_field_boxes_layout_rtl :
369+
R.layout.text_field_boxes_layout,
370+
this, false));
361371
removeView(this.editText);
362372

363373
this.editText.setBackgroundColor(Color.TRANSPARENT);
@@ -510,6 +520,7 @@ protected void handleAttributes(Context context, AttributeSet attrs) {
510520
this.hasFocus = styledAttrs.getBoolean(R.styleable.TextFieldBoxes_hasFocus, false);
511521
this.alwaysShowHint = styledAttrs.getBoolean(R.styleable.TextFieldBoxes_alwaysShowHint, false);
512522
this.useDenseSpacing = styledAttrs.getBoolean(R.styleable.TextFieldBoxes_useDenseSpacing, false);
523+
this.rtl = styledAttrs.getBoolean(R.styleable.TextFieldBoxes_rtl, false);
513524

514525
styledAttrs.recycle();
515526

@@ -655,7 +666,7 @@ public boolean validate() { //Reverted: "validateError" has the opposite meaning
655666
/**
656667
* @deprecated Pseudonym for {@link #validate()} to provide legacy support for
657668
* a bad PR.
658-
*
669+
* <p>
659670
* Note: This does NOT validate that there is an error, it does the opposite
660671
*/
661672
@Deprecated
@@ -765,8 +776,8 @@ protected void updateCounterText(boolean performValidation) {
765776
}
766777

767778
/* Don't Count Space & Line Feed */
768-
int length = this.editText.getText().toString() .replaceAll(" ", "")
769-
.replaceAll("\n", "").length();
779+
int length = this.editText.getText().toString().replaceAll(" ", "")
780+
.replaceAll("\n", "").length();
770781
String lengthStr = Integer.toString(length) + " / ";
771782
String counterLabelResourceStr = getResources().getString(R.string.counter_label_text_constructor);
772783
if (this.maxCharacters > 0) {

Diff for: textfieldboxes/src/main/res/layout/text_field_boxes_layout.xml

+18-16
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
android:layout_marginTop="@dimen/icon_signifier_marginTop"
1414
android:background="?selectableItemBackgroundBorderless"
1515
android:contentDescription="@string/icon"
16-
android:visibility="gone"/>
16+
android:visibility="gone" />
1717

1818
<RelativeLayout
1919
android:id="@+id/text_field_boxes_right_shell"
@@ -42,7 +42,7 @@
4242
android:layout_alignLeft="@+id/text_field_boxes_upper_panel"
4343
android:layout_alignRight="@+id/text_field_boxes_upper_panel"
4444
android:layout_alignStart="@+id/text_field_boxes_upper_panel"
45-
android:layout_below="@+id/text_field_boxes_upper_panel"/>
45+
android:layout_below="@+id/text_field_boxes_upper_panel" />
4646

4747
<RelativeLayout
4848
android:id="@+id/text_field_boxes_upper_panel"
@@ -59,12 +59,12 @@
5959
<android.support.v7.widget.AppCompatTextView
6060
android:id="@+id/text_field_boxes_label"
6161
android:layout_width="wrap_content"
62-
android:includeFontPadding="false"
63-
android:gravity="center"
6462
android:layout_height="wrap_content"
6563
android:layout_marginTop="@dimen/label_idle_margin_top"
64+
android:gravity="center"
65+
android:includeFontPadding="false"
6666
android:textSize="@dimen/label_text_size"
67-
tools:text="Label"/>
67+
tools:text="Label" />
6868

6969
<android.support.v4.widget.Space
7070
android:id="@+id/text_field_boxes_label_space"
@@ -74,7 +74,7 @@
7474
android:layout_alignLeft="@+id/text_field_boxes_editTextLayout"
7575
android:layout_alignParentTop="true"
7676
android:layout_alignRight="@+id/text_field_boxes_editTextLayout"
77-
android:layout_alignStart="@+id/text_field_boxes_editTextLayout"/>
77+
android:layout_alignStart="@+id/text_field_boxes_editTextLayout" />
7878

7979
<FrameLayout
8080
android:id="@+id/text_field_boxes_editTextLayout"
@@ -87,34 +87,36 @@
8787
android:id="@+id/text_field_boxes_input_layout"
8888
android:layout_width="match_parent"
8989
android:layout_height="wrap_content"
90-
android:paddingRight="20dp">
91-
</RelativeLayout>
90+
android:paddingLeft="0dp"
91+
android:paddingStart="0dp"
92+
android:paddingRight="20dp"
93+
android:paddingEnd="20dp"/>
9294

9395
<LinearLayout
94-
android:background="@android:color/transparent"
9596
android:layout_width="wrap_content"
9697
android:layout_height="wrap_content"
9798
android:layout_gravity="bottom|end"
99+
android:background="@android:color/transparent"
98100
android:orientation="horizontal">
99101

100102
<android.support.v7.widget.AppCompatImageButton
101103
android:id="@+id/text_field_boxes_clear_button"
102104
android:layout_width="wrap_content"
103105
android:layout_height="wrap_content"
106+
android:background="?selectableItemBackgroundBorderless"
104107
android:minHeight="@dimen/clear_button_min_height"
105108
android:minWidth="@dimen/clear_button_min_width"
106109
android:src="@drawable/ic_clear_circle_black_24dp"
107-
android:background="?selectableItemBackgroundBorderless"
108-
android:visibility="gone"/>
110+
android:visibility="gone" />
109111

110112
<android.support.v7.widget.AppCompatImageButton
111113
android:id="@+id/text_field_boxes_end_icon_button"
112114
android:layout_width="wrap_content"
113115
android:layout_height="wrap_content"
116+
android:background="?selectableItemBackgroundBorderless"
114117
android:minHeight="@dimen/end_icon_min_height"
115118
android:minWidth="@dimen/end_icon_min_width"
116-
android:background="?selectableItemBackgroundBorderless"
117-
android:visibility="gone"/>
119+
android:visibility="gone" />
118120

119121
</LinearLayout>
120122

@@ -130,7 +132,7 @@
130132
android:layout_alignStart="@+id/text_field_boxes_editTextLayout"
131133
android:layout_below="@+id/text_field_boxes_editTextLayout"
132134
android:background="@color/A400red"
133-
android:visibility="gone"/>
135+
android:visibility="gone" />
134136

135137
</RelativeLayout>
136138

@@ -161,15 +163,15 @@
161163
android:layout_marginRight="@dimen/helper_marginEnd"
162164
android:layout_toLeftOf="@+id/text_field_boxes_counter"
163165
android:layout_toStartOf="@+id/text_field_boxes_counter"
164-
android:textSize="@dimen/helper_text_size"/>
166+
android:textSize="@dimen/helper_text_size" />
165167

166168
<android.support.v7.widget.AppCompatTextView
167169
android:id="@+id/text_field_boxes_counter"
168170
android:layout_width="wrap_content"
169171
android:layout_height="wrap_content"
170172
android:layout_alignParentEnd="true"
171173
android:layout_alignParentRight="true"
172-
android:textSize="@dimen/counter_text_size"/>
174+
android:textSize="@dimen/counter_text_size" />
173175

174176
</RelativeLayout>
175177

0 commit comments

Comments
 (0)