Fix issue #683
This commit is contained in:
parent
a93107950c
commit
9244fe19d1
|
@ -46,7 +46,6 @@ import android.text.Spanned;
|
|||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -806,7 +805,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
private void manageButtonVisibility(){
|
||||
if( relationship == null)
|
||||
return;
|
||||
Log.v(Helper.TAG,"relationship.isRequested()= " + relationship.isRequested());
|
||||
account_follow.setEnabled(true);
|
||||
if( account.getId() != null && account.getId().equals(userId)){
|
||||
account_follow.hide();
|
||||
|
|
|
@ -34,7 +34,6 @@ import android.support.v7.widget.PopupMenu;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -1095,9 +1094,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
|||
|
||||
@Override
|
||||
public void onRetrieveEmoji(Notification notification) {
|
||||
Log.v(Helper.TAG,"notification: " + notification);
|
||||
if( notification != null && notification.getStatus() != null) {
|
||||
Log.v(Helper.TAG,"getContent: " + notification.getStatus().getContent());
|
||||
notification.getStatus().setEmojiFound(true);
|
||||
notifyNotificationChanged(notification);
|
||||
}
|
||||
|
|
|
@ -1819,24 +1819,26 @@ public class Helper {
|
|||
int matchStart = matcher.start(1);
|
||||
int matchEnd = matcher.end();
|
||||
final String url = spannableString.toString().substring(matchStart, matchEnd);
|
||||
if( matchEnd <= spannableString.toString().length() && matchEnd >= matchStart)
|
||||
spannableString.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View textView) {
|
||||
Helper.openBrowser(context, url);
|
||||
}
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setUnderlineText(false);
|
||||
if (theme == THEME_DARK)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.dark_link_toot));
|
||||
else if (theme == THEME_BLACK)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.black_link_toot));
|
||||
else if (theme == THEME_LIGHT)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.mastodonC4));
|
||||
}
|
||||
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
if( url.startsWith("http"))
|
||||
if( matchEnd <= spannableString.toString().length() && matchEnd >= matchStart)
|
||||
spannableString.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View textView) {
|
||||
Helper.openBrowser(context, url);
|
||||
}
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setUnderlineText(false);
|
||||
if (theme == THEME_DARK)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.dark_link_toot));
|
||||
else if (theme == THEME_BLACK)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.black_link_toot));
|
||||
else if (theme == THEME_LIGHT)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.mastodonC4));
|
||||
}
|
||||
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
matcher = hashtagPattern.matcher(spannableString);
|
||||
while (matcher.find()){
|
||||
|
@ -1897,7 +1899,76 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
}
|
||||
matcher = android.util.Patterns.EMAIL_ADDRESS.matcher(spannableString);
|
||||
while (matcher.find()){
|
||||
int matchStart = matcher.start(0);
|
||||
int matchEnd = matcher.end();
|
||||
final String email = spannableString.toString().substring(matchStart, matchEnd);
|
||||
if( matchEnd <= spannableString.toString().length() && matchEnd >= matchStart) {
|
||||
urls = spannableString.getSpans(matchStart, matchEnd, URLSpan.class);
|
||||
for(URLSpan span : urls)
|
||||
spannableString.removeSpan(span);
|
||||
spannableString.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View textView) {
|
||||
try {
|
||||
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||
emailIntent.setType("plain/text");
|
||||
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{email});
|
||||
context.startActivity(Intent.createChooser(emailIntent, context.getString(R.string.send_email)));
|
||||
}catch (Exception e){
|
||||
Toasty.error(context, context.getString(R.string.toast_no_apps), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setUnderlineText(false);
|
||||
if (theme == THEME_DARK)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.dark_link_toot));
|
||||
else if (theme == THEME_BLACK)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.black_link_toot));
|
||||
else if (theme == THEME_LIGHT)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.light_link_toot));
|
||||
}
|
||||
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
}
|
||||
matcher = Helper.xmppPattern.matcher(spannableString);
|
||||
while (matcher.find()){
|
||||
int matchStart = matcher.start(0);
|
||||
int matchEnd = matcher.end();
|
||||
final String url = spannableString.toString().substring(matchStart, matchEnd);
|
||||
if( matchEnd <= spannableString.toString().length() && matchEnd >= matchStart) {
|
||||
urls = spannableString.getSpans(matchStart, matchEnd, URLSpan.class);
|
||||
for(URLSpan span : urls)
|
||||
spannableString.removeSpan(span);
|
||||
spannableString.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View textView) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
context.startActivity(intent);
|
||||
}catch (Exception e){
|
||||
Toasty.error(context, context.getString(R.string.toast_no_apps), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setUnderlineText(false);
|
||||
if (theme == THEME_DARK)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.dark_link_toot));
|
||||
else if (theme == THEME_BLACK)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.black_link_toot));
|
||||
else if (theme == THEME_LIGHT)
|
||||
ds.setColor(ContextCompat.getColor(context, R.color.light_link_toot));
|
||||
}
|
||||
}, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
}
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,8 +211,6 @@
|
|||
android:gravity="center"
|
||||
android:textColor="?attr/color_in_account_header"
|
||||
android:layout_width="match_parent"
|
||||
android:maxLines="4"
|
||||
android:autoLink="web"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- Fields container -->
|
||||
|
|
|
@ -220,7 +220,6 @@
|
|||
android:gravity="center"
|
||||
android:textColor="?attr/color_in_account_header"
|
||||
android:layout_width="match_parent"
|
||||
android:autoLink="web"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<!-- Fields container -->
|
||||
|
|
Loading…
Reference in New Issue