Skip to content

Commit 7bdd975

Browse files
authored
Merge pull request #40 from pavel163/Placeholder_align
fix align PlaceHolder without navigation icon
2 parents f5eb547 + 4f139ea commit 7bdd975

File tree

7 files changed

+28
-20
lines changed

7 files changed

+28
-20
lines changed

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 23
5-
buildToolsVersion "23.0.3"
4+
compileSdkVersion 25
5+
buildToolsVersion "25.0.3"
66

77
defaultConfig {
88
applicationId "com.mancj.example"
99
minSdkVersion 16
10-
targetSdkVersion 23
10+
targetSdkVersion 25
1111
versionCode 2
1212
versionName "1.1"
1313
}
@@ -24,5 +24,5 @@ dependencies {
2424
compile project(':library')
2525
compile 'com.android.support:appcompat-v7:23.4.0'
2626
compile 'com.android.support:design:23.4.0'
27-
testCompile 'junit:junit:4.12'
27+
// testCompile 'junit:junit:4.12'
2828
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.3'
8+
classpath 'com.android.tools.build:gradle:2.3.3'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Dec 12 09:35:06 CAT 2016
1+
#Mon Jul 10 11:00:23 MSK 2017
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-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

library/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 23
5-
buildToolsVersion "23.0.3"
4+
compileSdkVersion 25
5+
buildToolsVersion "25.0.3"
66

77
defaultConfig {
88
minSdkVersion 16
9-
targetSdkVersion 23
9+
targetSdkVersion 25
1010
versionCode 1
1111
versionName "0.1"
1212
}
@@ -20,10 +20,10 @@ android {
2020

2121
dependencies {
2222
compile fileTree(dir: 'libs', include: ['*.jar'])
23-
testCompile 'junit:junit:4.12'
24-
compile 'com.android.support:appcompat-v7:23.4.0'
25-
compile 'com.android.support:recyclerview-v7:23.4.0'
26-
compile 'com.android.support:cardview-v7:23.4.0'
23+
// testCompile 'junit:junit:4.12'
24+
compile 'com.android.support:appcompat-v7:25.3.1'
25+
compile 'com.android.support:recyclerview-v7:25.3.1'
26+
compile 'com.android.support:cardview-v7:25.3.1'
2727
}
2828

2929
// build a jar with source files

library/src/main/java/com/mancj/materialsearchbar/MaterialSearchBar.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,21 @@ public void setNavButtonEnabled(boolean navButtonEnabled) {
440440
if (navButtonEnabled){
441441
navIcon.setVisibility(VISIBLE);
442442
navIcon.setClickable(true);
443-
LayoutParams lp = (LayoutParams) inputContainer.getLayoutParams();
444-
lp.leftMargin = (int) (50 * destiny);
445-
inputContainer.setLayoutParams(lp);
443+
navIcon.getLayoutParams().width = (int) (50 * destiny);
444+
445+
((LayoutParams) inputContainer.getLayoutParams()).leftMargin = (int) (50 * destiny);
446446
arrowIcon.setVisibility(GONE);
447447
}else {
448-
navIcon.setVisibility(GONE);
448+
navIcon.getLayoutParams().width = 1;
449+
navIcon.setVisibility(INVISIBLE);
449450
navIcon.setClickable(false);
451+
452+
((LayoutParams) inputContainer.getLayoutParams()).leftMargin = (int) (0 * destiny);
453+
arrowIcon.setVisibility(VISIBLE);
450454
}
455+
navIcon.requestLayout();
456+
placeHolder.requestLayout();
457+
arrowIcon.requestLayout();
451458
}
452459

453460
/**

library/src/main/res/layout/searchbar.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
android:layout_width="match_parent"
1111
android:layout_height="wrap_content">
1212
<RelativeLayout
13-
xmlns:android="http://schemas.android.com/apk/res/android"
1413
android:orientation="vertical"
1514
android:layout_width="match_parent"
1615
android:id="@+id/root"
@@ -57,7 +56,7 @@
5756
android:textColor="@color/material_grey_600"
5857
android:textStyle="bold"
5958
android:visibility="visible"
60-
tools:text="Hara haza mettig d1alocurg yu. Hara haza mettig d1alocurg yu. Hara haza mettig d1alocurg yu" />
59+
tools:text="Hara" />
6160

6261
<LinearLayout
6362
android:id="@+id/inputContainer"

library/src/main/res/values/dimens.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
<dimen name="activity_horizontal_margin">16dp</dimen>
44
<dimen name="activity_vertical_margin">16dp</dimen>
55
<dimen name="fab_margin">16dp</dimen>
6+
7+
<dimen name="icon_size">50dp</dimen>
68
</resources>

0 commit comments

Comments
 (0)