diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 6153c14..4f55088 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -3,6 +3,9 @@
diff --git a/app/src/main/java/com/skyhope/showmoretext/MainActivity.java b/app/src/main/java/com/skyhope/showmoretext/MainActivity.java
index 1c75df1..d2ce105 100644
--- a/app/src/main/java/com/skyhope/showmoretext/MainActivity.java
+++ b/app/src/main/java/com/skyhope/showmoretext/MainActivity.java
@@ -23,7 +23,6 @@ protected void onCreate(Bundle savedInstanceState) {
//textView.setShowingChar(30);
textView.addShowMoreText("Continue");
- textView.addShowLessText("Less");
}
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 69b2233..5334991 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -3,4 +3,6 @@
#008577
#00574B
#D81B60
+
+ #80000000
diff --git a/showmoretextview/src/main/java/com/skyhope/showmoretextview/ShowMoreTextView.java b/showmoretextview/src/main/java/com/skyhope/showmoretextview/ShowMoreTextView.java
index 218e87a..5b1d201 100644
--- a/showmoretextview/src/main/java/com/skyhope/showmoretextview/ShowMoreTextView.java
+++ b/showmoretextview/src/main/java/com/skyhope/showmoretextview/ShowMoreTextView.java
@@ -2,8 +2,10 @@
import android.content.Context;
import android.graphics.Color;
+import android.graphics.Typeface;
import android.os.Parcelable;
import android.support.annotation.Nullable;
+import android.support.v4.content.res.ResourcesCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextPaint;
@@ -57,7 +59,10 @@ public ShowMoreTextView(Context context) {
public ShowMoreTextView(Context context, AttributeSet attrs) {
super(context, attrs);
-
+ showLess = context.getString(R.string.read_less);
+ showMore = context.getString(R.string.read_more);
+ showMoreTextColor = Color.parseColor("#80000000");
+ showLessTextColor = Color.parseColor("#80000000");
}
@Override
@@ -168,14 +173,15 @@ public void onClick(@Nullable View view) {
spannableString.setSpan(new ForegroundColorSpan(showMoreTextColor),
getText().length() - (dotdot.length() + showMore.length()),
getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ spannableString.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD), getText().length() - (dotdot.length() + showMore.length()),
+ getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
setMovementMethod(LinkMovementMethod.getInstance());
setText(spannableString, TextView.BufferType.SPANNABLE);
}
private void showLessButton() {
-
- String text = getText() + dotdot + showLess;
+ String text = getText() + showLess;
SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new ClickableSpan() {
@@ -195,11 +201,13 @@ public void onClick(@Nullable View view) {
}
},
- text.length() - (dotdot.length() + showLess.length()),
+ text.length() - showLess.length(),
text.length(), 0);
spannableString.setSpan(new ForegroundColorSpan(showLessTextColor),
- text.length() - (dotdot.length() + showLess.length()),
+ text.length() - showLess.length(),
+ text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ spannableString.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD), text.length() - showLess.length(),
text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
setMovementMethod(LinkMovementMethod.getInstance());
diff --git a/showmoretextview/src/main/res/values/strings.xml b/showmoretextview/src/main/res/values/strings.xml
index 0d5db9d..291bd15 100644
--- a/showmoretextview/src/main/res/values/strings.xml
+++ b/showmoretextview/src/main/res/values/strings.xml
@@ -1,3 +1,5 @@
ShowMoreTextView
+ read less
+ read more