Skip to content

Commit 59abd02

Browse files
author
maskara
committed
Minor notification fixes
1 parent e5c8e40 commit 59abd02

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

app/src/main/java/fr/free/nrw/commons/Utils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public static void rateApp(Context context) {
177177
}
178178
}
179179

180-
public static void handleWebUrl(Context context,Uri url){
180+
public static void handleWebUrl(Context context, Uri url) {
181181
Intent browserIntent = new Intent(Intent.ACTION_VIEW, url);
182182
if (browserIntent.resolveActivity(context.getPackageManager()) == null) {
183183
Toast toast = Toast.makeText(context, context.getString(R.string.no_web_browser), LENGTH_SHORT);

app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java

+2-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.support.v7.widget.DividerItemDecoration;
1010
import android.support.v7.widget.LinearLayoutManager;
1111
import android.support.v7.widget.RecyclerView;
12-
import android.widget.Toast;
1312

1413
import com.pedrogomez.renderers.RVRendererAdapter;
1514

@@ -20,14 +19,13 @@
2019
import butterknife.BindView;
2120
import butterknife.ButterKnife;
2221
import fr.free.nrw.commons.R;
22+
import fr.free.nrw.commons.Utils;
2323
import fr.free.nrw.commons.theme.NavigationBaseActivity;
2424
import io.reactivex.Observable;
2525
import io.reactivex.android.schedulers.AndroidSchedulers;
2626
import io.reactivex.schedulers.Schedulers;
2727
import timber.log.Timber;
2828

29-
import static android.widget.Toast.LENGTH_SHORT;
30-
3129
/**
3230
* Created by root on 18.12.2017.
3331
*/
@@ -82,14 +80,7 @@ private void handleUrl(String url) {
8280
if (url == null || url.equals("")) {
8381
return;
8482
}
85-
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
86-
//check if web browser available
87-
if(browser.resolveActivity(this.getPackageManager()) != null){
88-
startActivity(browser);
89-
} else {
90-
Toast toast = Toast.makeText(this, getString(R.string.no_web_browser), LENGTH_SHORT);
91-
toast.show();
92-
}
83+
Utils.handleWebUrl(this, Uri.parse(url));
9384
}
9485

9586
private void setAdapter(List<Notification> notificationList) {

0 commit comments

Comments
 (0)