This commit is contained in:
hismaeel 2018-02-20 21:38:22 -05:00
parent 671e1e61ab
commit f9b99f9280
5 changed files with 15 additions and 28 deletions

View file

@ -15,6 +15,8 @@ import butterknife.OnClick;
import fr.free.nrw.commons.theme.NavigationBaseActivity;
import fr.free.nrw.commons.ui.widget.HtmlTextView;
import static android.widget.Toast.LENGTH_SHORT;
/**
* Represents about screen of this app
*/
@ -57,10 +59,7 @@ public class AboutActivity extends NavigationBaseActivity {
if(intent.resolveActivity(this.getPackageManager()) != null){
startActivity(intent);
} else {
CharSequence text = "No app found to open URL";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(this, text, duration);
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
@ -76,9 +75,7 @@ public class AboutActivity extends NavigationBaseActivity {
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
startActivity(browserIntent);
} else {
CharSequence text = "No app found to open URL";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(this, text, duration);
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
}
@ -91,9 +88,7 @@ public class AboutActivity extends NavigationBaseActivity {
if (browserIntent.resolveActivity(this.getPackageManager()) != null) {
startActivity(browserIntent);
} else {
CharSequence text = "No app found to open URL";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(this, text, duration);
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
}

View file

@ -37,6 +37,8 @@ import fr.free.nrw.commons.location.LatLng;
import fr.free.nrw.commons.ui.widget.CompatTextView;
import timber.log.Timber;
import static android.widget.Toast.LENGTH_SHORT;
public class MediaDetailFragment extends CommonsDaggerSupportFragment {
private boolean editable;
@ -309,9 +311,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
if(viewIntent.resolveActivity(getActivity().getPackageManager()) != null){
startActivity(viewIntent);
} else {
CharSequence text = "No app found to open URL";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(getContext(), text, duration);
Toast toast = Toast.makeText(getContext(), getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
});
@ -397,10 +397,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
if(browser.resolveActivity(getActivity().getPackageManager()) != null){
startActivity(browser);
} else {
CharSequence text = "No app found to open URL";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(getContext(), text, duration);
Toast toast = Toast.makeText(getContext(), getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}

View file

@ -41,6 +41,7 @@ import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
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.widget.Toast.LENGTH_SHORT;
public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment implements ViewPager.OnPageChangeListener {
@ -123,10 +124,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
if(viewIntent.resolveActivity(getActivity().getPackageManager()) != null){
startActivity(viewIntent);
} else {
CharSequence text = "No app found to open URL";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(getContext(), text, duration);
Toast toast = Toast.makeText(getContext(), getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}

View file

@ -24,6 +24,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import timber.log.Timber;
import static android.widget.Toast.LENGTH_SHORT;
/**
* Created by root on 18.12.2017.
*/
@ -65,22 +67,17 @@ public class NotificationActivity extends NavigationBaseActivity {
}
private void handleUrl(String url) {
if (url == null || url.equals("")) {
return;
}
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
//check if web browser available
if(browser.resolveActivity(this.getPackageManager()) != null){
startActivity(browser);
} else {
CharSequence text = "No app found to open URL";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(this, text, duration);
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
toast.show();
}
}
private void setAdapter(List<Notification> notificationList) {

View file

@ -211,7 +211,7 @@
<string name="send_log_file">Send log file</string>
<string name="send_log_file_description">Send log file to developers via email</string>
<string name="login_to_your_account">Login to your account</string>
<string name="error_null_url">URL not found</string>
<string name="no_web_browser">No app found to open URL</string>
<string name="nearby_location_has_not_changed">Location has not changed.</string>
<string name="nearby_location_not_available">Location not available.</string>