mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Use NotificationChannel and prevent crash in API 26 (#1835)
This commit is contained in:
parent
7a43c59c80
commit
6842420aeb
4 changed files with 44 additions and 16 deletions
|
|
@ -14,6 +14,7 @@ import java.util.Locale;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.Media;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.auth.SessionManager;
|
||||
|
|
@ -44,14 +45,17 @@ public class DeleteTask extends AsyncTask<Void, Integer, Boolean> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute(){
|
||||
protected void onPreExecute() {
|
||||
ApplicationlessInjection
|
||||
.getInstance(context.getApplicationContext())
|
||||
.getCommonsApplicationComponent()
|
||||
.inject(this);
|
||||
|
||||
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationBuilder = new NotificationCompat.Builder(context);
|
||||
notificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationBuilder = new NotificationCompat.Builder(
|
||||
context,
|
||||
CommonsApplication.NOTIFICATION_CHANNEL_ID_ALL);
|
||||
Toast toast = new Toast(context);
|
||||
toast.setGravity(Gravity.CENTER,0,0);
|
||||
toast = Toast.makeText(context,"Trying to nominate "+media.getDisplayTitle()+ " for deletion",Toast.LENGTH_SHORT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue