parent
9700b0b4df
commit
8ce1defef2
|
@ -333,13 +333,9 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
return true;
|
||||
case R.id.action_open_browser:
|
||||
if( accountUrl != null) {
|
||||
Intent intent = new Intent(getApplicationContext(), WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
if( !accountUrl.startsWith("http://") && ! accountUrl.startsWith("https://"))
|
||||
accountUrl = "http://" + accountUrl;
|
||||
b.putString("url", accountUrl);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
Helper.openBrowser(ShowAccountActivity.this, accountUrl);
|
||||
}
|
||||
return true;
|
||||
case R.id.action_mention:
|
||||
|
@ -482,13 +478,9 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
warning_message.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getApplicationContext(), WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
if( !accountUrl.startsWith("http://") && ! accountUrl.startsWith("https://"))
|
||||
accountUrl = "http://" + accountUrl;
|
||||
b.putString("url", accountUrl);
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
Helper.openBrowser(ShowAccountActivity.this, accountUrl);
|
||||
}
|
||||
});
|
||||
//Timed muted account
|
||||
|
|
|
@ -621,8 +621,8 @@ public class Status implements Parcelable{
|
|||
spannableString.removeSpan(span);
|
||||
List<Mention> mentions = this.status.getReblog() != null ? this.status.getReblog().getMentions() : this.status.getMentions();
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);
|
||||
if( embedded_browser){
|
||||
|
||||
|
||||
Matcher matcher;
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
|
||||
matcher = Patterns.WEB_URL.matcher(spannableString);
|
||||
|
@ -635,14 +635,10 @@ public class Status implements Parcelable{
|
|||
spannableString.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View textView) {
|
||||
Intent intent = new Intent(context, WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
String finalUrl = url;
|
||||
if( !url.startsWith("http://") && ! url.startsWith("https://"))
|
||||
finalUrl = "http://" + url;
|
||||
b.putString("url", finalUrl);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
Helper.openBrowser(context, finalUrl);
|
||||
}
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
|
@ -651,9 +647,8 @@ public class Status implements Parcelable{
|
|||
},
|
||||
matchStart, matchEnd,
|
||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//Deals with mention to make them clickable
|
||||
if( mentions != null && mentions.size() > 0 ) {
|
||||
//Looping through accounts which are mentioned
|
||||
|
@ -685,7 +680,7 @@ public class Status implements Parcelable{
|
|||
|
||||
}
|
||||
}
|
||||
Matcher matcher = Helper.hashtagPattern.matcher(spannableString);
|
||||
matcher = Helper.hashtagPattern.matcher(spannableString);
|
||||
while (matcher.find()){
|
||||
int matchStart = matcher.start(1);
|
||||
int matchEnd = matcher.end();
|
||||
|
|
|
@ -965,11 +965,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.status_cardview.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(context, WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("url", status.getCard().getUrl());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
Helper.openBrowser(context, status.getCard().getUrl());
|
||||
}
|
||||
});
|
||||
}else {
|
||||
|
@ -991,11 +987,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
}
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading (WebView view, String url){
|
||||
Intent intent = new Intent(context, WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("url", url);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
Helper.openBrowser(context, url);
|
||||
holder.status_cardview_webview.loadUrl(finalSrc);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1286,11 +1286,7 @@ public class Helper {
|
|||
spannableString.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View textView) {
|
||||
Intent intent = new Intent(context, WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("url", url);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
Helper.openBrowser(context, url);
|
||||
}
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
|
@ -1786,6 +1782,31 @@ public class Helper {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage URLs to open (built-in or external app)
|
||||
* @param context Context
|
||||
* @param url String url to open
|
||||
*/
|
||||
public static void openBrowser(Context context, String url){
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);
|
||||
if( embedded_browser) {
|
||||
Intent intent = new Intent(context, WebviewActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
String finalUrl = url;
|
||||
if (!url.startsWith("http://") && !url.startsWith("https://"))
|
||||
finalUrl = "http://" + url;
|
||||
b.putString("url", finalUrl);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}else {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void installProvider(){
|
||||
Security.insertProviderAt(Conscrypt.newProvider(),1);
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ public class NotificationsSyncJob extends Job {
|
|||
})
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
notify_user(getContext(), intent, notificationId, resource, finalTitle, message);
|
||||
String lastNotif = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + account.getId() + account.getInstance(), null);
|
||||
if( lastNotif == null || Long.parseLong(notifications.get(0).getId()) > Long.parseLong(lastNotif)){
|
||||
|
|
Loading…
Reference in New Issue