mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-15 19:27:31 +00:00
Handle no map app. Fixes austinhuang0131/barinsta#1175
This commit is contained in:
parent
c0fb6e3a50
commit
1a57c4c813
@ -1,5 +1,6 @@
|
|||||||
package awais.instagrabber.fragments;
|
package awais.instagrabber.fragments;
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@ -461,9 +462,16 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
if (!locationModel.getGeo().startsWith("geo:0.0,0.0?z=17")) {
|
if (!locationModel.getGeo().startsWith("geo:0.0,0.0?z=17")) {
|
||||||
locationDetailsBinding.btnMap.setVisibility(View.VISIBLE);
|
locationDetailsBinding.btnMap.setVisibility(View.VISIBLE);
|
||||||
locationDetailsBinding.btnMap.setOnClickListener(v -> {
|
locationDetailsBinding.btnMap.setOnClickListener(v -> {
|
||||||
|
try {
|
||||||
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setData(Uri.parse(locationModel.getGeo()));
|
intent.setData(Uri.parse(locationModel.getGeo()));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Toast.makeText(context, R.string.no_external_map_app, Toast.LENGTH_LONG).show();
|
||||||
|
Log.e(TAG, "setupLocationDetails: ", e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "setupLocationDetails: ", e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
locationDetailsBinding.btnMap.setVisibility(View.GONE);
|
locationDetailsBinding.btnMap.setVisibility(View.GONE);
|
||||||
|
@ -498,4 +498,5 @@
|
|||||||
<string name="top">Top</string>
|
<string name="top">Top</string>
|
||||||
<string name="recent">Recent</string>
|
<string name="recent">Recent</string>
|
||||||
<string name="clear">Clear</string>
|
<string name="clear">Clear</string>
|
||||||
|
<string name="no_external_map_app">No Map app found!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user