mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Use utils.handleWebUrl for view on commons web intent (#2796)
This commit is contained in:
parent
7820ed9d6f
commit
488bdd9800
1 changed files with 2 additions and 14 deletions
|
|
@ -15,7 +15,6 @@ import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
|
|
@ -50,9 +49,8 @@ import timber.log.Timber;
|
||||||
|
|
||||||
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
|
import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
|
||||||
import static android.content.Context.DOWNLOAD_SERVICE;
|
import static android.content.Context.DOWNLOAD_SERVICE;
|
||||||
import static android.content.Intent.ACTION_VIEW;
|
|
||||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
import static fr.free.nrw.commons.Utils.handleWebUrl;
|
||||||
|
|
||||||
public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment implements ViewPager.OnPageChangeListener {
|
public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment implements ViewPager.OnPageChangeListener {
|
||||||
|
|
||||||
|
|
@ -166,17 +164,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_browser_current_image:
|
case R.id.menu_browser_current_image:
|
||||||
// View in browser
|
// View in browser
|
||||||
Intent viewIntent = new Intent();
|
handleWebUrl(requireContext(), m.getFilePageTitle().getMobileUri());
|
||||||
viewIntent.setAction(ACTION_VIEW);
|
|
||||||
viewIntent.setData(m.getFilePageTitle().getMobileUri());
|
|
||||||
//check if web browser available
|
|
||||||
if (viewIntent.resolveActivity(getActivity().getPackageManager()) != null){
|
|
||||||
startActivity(viewIntent);
|
|
||||||
} else {
|
|
||||||
Toast toast = Toast.makeText(getContext(), getString(R.string.no_web_browser), LENGTH_SHORT);
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_download_current_image:
|
case R.id.menu_download_current_image:
|
||||||
// Download
|
// Download
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue