From 37e2972664084d035491b3c6c7ca22b6b851fd90 Mon Sep 17 00:00:00 2001 From: AmirMohammad Date: Mon, 19 Aug 2019 10:54:48 +0430 Subject: [PATCH] add custom variable (emtpy title) --- library/build.gradle | 4 ++-- .../src/main/java/com/vasl/recyclerlibrary/MyCustomView.java | 4 ++++ library/src/main/res/values/attrs.xml | 1 + sample/src/main/res/layout/activity_main.xml | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index b7d1402..39be56b 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -8,8 +8,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 28 - versionCode 25 - versionName "1.2.5" + versionCode 26 + versionName "1.2.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/library/src/main/java/com/vasl/recyclerlibrary/MyCustomView.java b/library/src/main/java/com/vasl/recyclerlibrary/MyCustomView.java index 561628c..501d1c2 100644 --- a/library/src/main/java/com/vasl/recyclerlibrary/MyCustomView.java +++ b/library/src/main/java/com/vasl/recyclerlibrary/MyCustomView.java @@ -162,12 +162,16 @@ private void setColor(AttributeSet attrs) { return; } TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.MyCustomView); + titleColor = ta.getColor(R.styleable.MyCustomView_titleColor, Color.WHITE); subtitleColor = ta.getColor(R.styleable.MyCustomView_subtitleColor, Color.GRAY); retryButtonColor = ta.getColor(R.styleable.MyCustomView_retryButtonColor, Color.GRAY); retryButtonTextColor = ta.getColor(R.styleable.MyCustomView_retryButtonTextColor, Color.GRAY); iconTintColor = ta.getColor(R.styleable.MyCustomView_iconBackGroundColor, Color.GRAY); + CharSequence title = ta.getString(R.styleable.MyCustomView_emptyTitle); + if (title != null) + setEmptyTitle(title.toString()); emptyTextViewTitle.setTextColor(titleColor); errorTextViewTitle.setTextColor(titleColor); diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml index 6257db8..e170776 100644 --- a/library/src/main/res/values/attrs.xml +++ b/library/src/main/res/values/attrs.xml @@ -12,6 +12,7 @@ + diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index 798e20e..f919451 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -13,6 +13,7 @@ android:id="@+id/myCustomView" android:layout_width="match_parent" android:layout_height="match_parent" + app:emptyTitle="helloooooooooo" app:retryButtonColor="@color/purple" app:retryButtonTextColor="@color/gray" app:subtitleColor="@color/red"