Skip to content

Commit 8ddab6f

Browse files
Integrate AndroidBaseUtils & update support library to 23.2.0
1 parent a9bedd6 commit 8ddab6f

File tree

36 files changed

+332
-339
lines changed

36 files changed

+332
-339
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.5.0'
8+
classpath 'com.android.tools.build:gradle:2.0.0-beta5'
9+
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
910
classpath 'com.novoda:bintray-release:0.3.4'
1011
}
1112
}

library/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'com.neenbedankt.android-apt'
23
apply plugin: 'com.novoda.bintray-release'
34

45
android {
@@ -15,6 +16,7 @@ android {
1516
targetSdkVersion rootProject.ext.targetSdkVersion
1617
versionCode rootProject.ext.versionCode
1718
versionName rootProject.ext.versionName
19+
vectorDrawables.useSupportLibrary = true
1820
}
1921
}
2022

@@ -24,6 +26,8 @@ dependencies {
2426
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
2527
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
2628
compile 'com.nineoldandroids:library:2.4.0'
29+
compile 'com.thefinestartist:utils:0.8.5'
30+
apt 'com.thefinestartist:compilers:0.8.5'
2731
}
2832

2933
publish {

library/src/main/java/com/thefinestartist/finestwebview/FinestWebView.java

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
import android.support.annotation.StringRes;
1414
import android.support.annotation.StyleRes;
1515
import android.support.design.widget.AppBarLayout.LayoutParams.ScrollFlags;
16-
import android.support.v4.content.ContextCompat;
1716
import android.webkit.WebSettings;
1817

18+
import com.thefinestartist.Base;
1919
import com.thefinestartist.finestwebview.enums.Position;
2020
import com.thefinestartist.finestwebview.listeners.BroadCastManager;
2121
import com.thefinestartist.finestwebview.listeners.WebViewListener;
22+
import com.thefinestartist.utils.content.ResourcesUtil;
2223

2324
import java.io.Serializable;
2425
import java.util.ArrayList;
@@ -187,6 +188,7 @@ public Builder rtl(boolean rtl) {
187188

188189
public Builder(@NonNull Activity activity) {
189190
this.context = activity;
191+
Base.initialize(activity);
190192
}
191193

192194
/**
@@ -195,6 +197,7 @@ public Builder(@NonNull Activity activity) {
195197
*/
196198
public Builder(@NonNull Context context) {
197199
this.context = context;
200+
Base.initialize(context);
198201
}
199202

200203
public Builder theme(@StyleRes int theme) {
@@ -207,8 +210,8 @@ public Builder statusBarColor(@ColorInt int color) {
207210
return this;
208211
}
209212

210-
public Builder statusBarColorRes(@ColorRes int color) {
211-
this.statusBarColor = ContextCompat.getColor(context, color);
213+
public Builder statusBarColorRes(@ColorRes int colorRes) {
214+
this.statusBarColor = ResourcesUtil.getColor(colorRes);
212215
return this;
213216
}
214217

@@ -217,8 +220,8 @@ public Builder toolbarColor(@ColorInt int color) {
217220
return this;
218221
}
219222

220-
public Builder toolbarColorRes(@ColorRes int color) {
221-
this.toolbarColor = ContextCompat.getColor(context, color);
223+
public Builder toolbarColorRes(@ColorRes int colorRes) {
224+
this.toolbarColor = ResourcesUtil.getColor(colorRes);
222225
return this;
223226
}
224227

@@ -233,7 +236,7 @@ public Builder iconDefaultColor(@ColorInt int color) {
233236
}
234237

235238
public Builder iconDefaultColorRes(@ColorRes int color) {
236-
this.iconDefaultColor = ContextCompat.getColor(context, color);
239+
this.iconDefaultColor = ResourcesUtil.getColor(color);
237240
return this;
238241
}
239242

@@ -243,7 +246,7 @@ public Builder iconDisabledColor(@ColorInt int color) {
243246
}
244247

245248
public Builder iconDisabledColorRes(@ColorRes int colorRes) {
246-
this.iconDisabledColor = ContextCompat.getColor(context, colorRes);
249+
this.iconDisabledColor = ResourcesUtil.getColor(colorRes);
247250
return this;
248251
}
249252

@@ -253,7 +256,7 @@ public Builder iconPressedColor(@ColorInt int color) {
253256
}
254257

255258
public Builder iconPressedColorRes(@ColorRes int colorRes) {
256-
this.iconPressedColor = ContextCompat.getColor(context, colorRes);
259+
this.iconPressedColor = ResourcesUtil.getColor(colorRes);
257260
return this;
258261
}
259262

@@ -313,7 +316,7 @@ public Builder swipeRefreshColor(@ColorInt int color) {
313316
}
314317

315318
public Builder swipeRefreshColorRes(@ColorRes int colorRes) {
316-
this.swipeRefreshColor = ContextCompat.getColor(context, colorRes);
319+
this.swipeRefreshColor = ResourcesUtil.getColor(colorRes);
317320
return this;
318321
}
319322

@@ -326,7 +329,7 @@ public Builder swipeRefreshColors(int[] colors) {
326329
}
327330

328331
public Builder swipeRefreshColorsRes(@ArrayRes int colorsRes) {
329-
int[] colors = context.getResources().getIntArray(colorsRes);
332+
int[] colors = ResourcesUtil.getIntArray(colorsRes);
330333
return swipeRefreshColors(colors);
331334
}
332335

@@ -346,7 +349,7 @@ public Builder dividerColor(@ColorInt int color) {
346349
}
347350

348351
public Builder dividerColorRes(@ColorRes int colorRes) {
349-
this.dividerColor = ContextCompat.getColor(context, colorRes);
352+
this.dividerColor = ResourcesUtil.getColor(colorRes);
350353
return this;
351354
}
352355

@@ -361,7 +364,7 @@ public Builder dividerHeight(int height) {
361364
}
362365

363366
public Builder dividerHeightRes(@DimenRes int height) {
364-
this.dividerHeight = context.getResources().getDimension(height);
367+
this.dividerHeight = ResourcesUtil.getDimension(height);
365368
return this;
366369
}
367370

@@ -376,7 +379,7 @@ public Builder progressBarColor(@ColorInt int color) {
376379
}
377380

378381
public Builder progressBarColorRes(@ColorRes int colorRes) {
379-
this.progressBarColor = ContextCompat.getColor(context, colorRes);
382+
this.progressBarColor = ResourcesUtil.getColor(colorRes);
380383
return this;
381384
}
382385

@@ -391,7 +394,7 @@ public Builder progressBarHeight(int height) {
391394
}
392395

393396
public Builder progressBarHeightRes(@DimenRes int height) {
394-
this.progressBarHeight = context.getResources().getDimension(height);
397+
this.progressBarHeight = ResourcesUtil.getDimension(height);
395398
return this;
396399
}
397400

@@ -406,7 +409,7 @@ public Builder titleDefault(@NonNull String title) {
406409
}
407410

408411
public Builder titleDefaultRes(@StringRes int stringRes) {
409-
this.titleDefault = context.getString(stringRes);
412+
this.titleDefault = ResourcesUtil.getString(stringRes);
410413
return this;
411414
}
412415

@@ -426,7 +429,7 @@ public Builder titleSize(int titleSize) {
426429
}
427430

428431
public Builder titleSizeRes(@DimenRes int titleSize) {
429-
this.titleSize = context.getResources().getDimension(titleSize);
432+
this.titleSize = ResourcesUtil.getDimension(titleSize);
430433
return this;
431434
}
432435

@@ -441,7 +444,7 @@ public Builder titleColor(@ColorInt int color) {
441444
}
442445

443446
public Builder titleColorRes(@ColorRes int colorRes) {
444-
this.titleColor = ContextCompat.getColor(context, colorRes);
447+
this.titleColor = ResourcesUtil.getColor(colorRes);
445448
return this;
446449
}
447450

@@ -461,7 +464,7 @@ public Builder urlSize(int urlSize) {
461464
}
462465

463466
public Builder urlSizeRes(@DimenRes int urlSize) {
464-
this.urlSize = context.getResources().getDimension(urlSize);
467+
this.urlSize = ResourcesUtil.getDimension(urlSize);
465468
return this;
466469
}
467470

@@ -476,7 +479,7 @@ public Builder urlColor(@ColorInt int color) {
476479
}
477480

478481
public Builder urlColorRes(@ColorRes int colorRes) {
479-
this.urlColor = ContextCompat.getColor(context, colorRes);
482+
this.urlColor = ResourcesUtil.getColor(colorRes);
480483
return this;
481484
}
482485

@@ -486,7 +489,7 @@ public Builder menuColor(@ColorInt int color) {
486489
}
487490

488491
public Builder menuColorRes(@ColorRes int colorRes) {
489-
this.menuColor = ContextCompat.getColor(context, colorRes);
492+
this.menuColor = ResourcesUtil.getColor(colorRes);
490493
return this;
491494
}
492495

@@ -506,7 +509,7 @@ public Builder menuTextPaddingLeft(int menuTextPaddingLeft) {
506509
}
507510

508511
public Builder menuTextPaddingLeftRes(@DimenRes int menuTextPaddingLeft) {
509-
this.menuTextPaddingLeft = context.getResources().getDimension(menuTextPaddingLeft);
512+
this.menuTextPaddingLeft = ResourcesUtil.getDimension(menuTextPaddingLeft);
510513
return this;
511514
}
512515

@@ -521,7 +524,7 @@ public Builder menuTextPaddingRight(int menuTextPaddingRight) {
521524
}
522525

523526
public Builder menuTextPaddingRightRes(@DimenRes int menuTextPaddingRight) {
524-
this.menuTextPaddingRight = context.getResources().getDimension(menuTextPaddingRight);
527+
this.menuTextPaddingRight = ResourcesUtil.getDimension(menuTextPaddingRight);
525528
return this;
526529
}
527530

@@ -531,7 +534,7 @@ public Builder menuDropShadowColor(@ColorInt int color) {
531534
}
532535

533536
public Builder menuDropShadowColorRes(@ColorRes int colorRes) {
534-
this.menuDropShadowColor = ContextCompat.getColor(context, colorRes);
537+
this.menuDropShadowColor = ResourcesUtil.getColor(colorRes);
535538
return this;
536539
}
537540

@@ -546,7 +549,7 @@ public Builder menuDropShadowSize(int menuDropShadowSize) {
546549
}
547550

548551
public Builder menuDropShadowSizeRes(@DimenRes int menuDropShadowSize) {
549-
this.menuDropShadowSize = context.getResources().getDimension(menuDropShadowSize);
552+
this.menuDropShadowSize = ResourcesUtil.getDimension(menuDropShadowSize);
550553
return this;
551554
}
552555

@@ -566,7 +569,7 @@ public Builder menuTextSize(int menuTextSize) {
566569
}
567570

568571
public Builder menuTextSizeRes(@DimenRes int menuTextSize) {
569-
this.menuTextSize = context.getResources().getDimension(menuTextSize);
572+
this.menuTextSize = ResourcesUtil.getDimension(menuTextSize);
570573
return this;
571574
}
572575

@@ -581,7 +584,7 @@ public Builder menuTextColor(@ColorInt int color) {
581584
}
582585

583586
public Builder menuTextColorRes(@ColorRes int colorRes) {
584-
this.menuTextColor = ContextCompat.getColor(context, colorRes);
587+
this.menuTextColor = ResourcesUtil.getColor(colorRes);
585588
return this;
586589
}
587590

@@ -885,7 +888,7 @@ public Builder injectJavaScript(String injectJavaScript) {
885888
}
886889

887890
public void load(@StringRes int dataRes) {
888-
load(context.getString(dataRes));
891+
load(ResourcesUtil.getString(dataRes));
889892
}
890893

891894
public void load(String data) {
@@ -899,7 +902,7 @@ public void load(String data, String mimeType, String encoding) {
899902
}
900903

901904
public void show(@StringRes int urlRes) {
902-
show(context.getString(urlRes));
905+
show(ResourcesUtil.getString(urlRes));
903906
}
904907

905908
public void show(@NonNull String url) {

0 commit comments

Comments
 (0)