added "Open in browser" button to internal browser (#622)

This commit is contained in:
Giovanni Palmieri 2022-01-15 05:25:07 +01:00 committed by GitHub
parent af3447419a
commit aaa3e91b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.InflateException;
@ -149,6 +150,14 @@ public class WebViewActivity extends BaseActivity {
Toast.makeText(this, R.string.copy_link_failed, Toast.LENGTH_SHORT).show();
}
return true;
} else if (item.getItemId() == R.id.action_open_external_browser_web_view_activity) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.no_activity_found_for_external_browser, Toast.LENGTH_SHORT).show();
}
}
return false;
}

View File

@ -18,4 +18,9 @@
android:orderInCategory="3"
android:title="@string/action_copy_link"
app:showAsAction="never" />
<item
android:id="@+id/action_open_external_browser_web_view_activity"
android:orderInCategory="4"
android:title="@string/action_open_external_browser"
app:showAsAction="never" />
</menu>

View File

@ -86,6 +86,7 @@
<string name="action_add_to_multireddit">Add to Multireddit</string>
<string name="action_share_link">Share Link</string>
<string name="action_copy_link">Copy Link</string>
<string name="action_open_external_browser">Open in browser</string>
<string name="action_add_to_post_filter">Add to Post Filter</string>
<string name="action_delete_logs">Delete Logs</string>
<string name="action_share_rpan_link">Share RPAN Link</string>
@ -277,6 +278,7 @@
<string name="sort_time_all_time">All Time</string>
<string name="no_activity_found_for_share">There is no app that can handle the share action</string>
<string name="no_activity_found_for_external_browser">There is no app that can handle the open in external browser action</string>
<string name="archived_post_vote_unavailable">Archived post. Vote unavailable.</string>
<string name="archived_post_comment_unavailable">Archived post. Comment unavailable.</string>