diff --git a/app/src/androidTest/java/org/tasks/preferences/PermissivePermissionChecker.java b/app/src/androidTest/java/org/tasks/preferences/PermissivePermissionChecker.java index 43cc869b2..9d142fb63 100644 --- a/app/src/androidTest/java/org/tasks/preferences/PermissivePermissionChecker.java +++ b/app/src/androidTest/java/org/tasks/preferences/PermissivePermissionChecker.java @@ -33,9 +33,4 @@ public class PermissivePermissionChecker extends PermissionChecker { public boolean canAccessMic() { return true; } - - @Override - public boolean canAccessMissedCallPermissions() { - return true; - } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 221289dc1..9bd5e0471 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -30,13 +30,6 @@ - - - - - - - @@ -210,12 +203,6 @@ android:resource="@xml/scrollable_widget_provider_info"/> - - - - - - - - See the file "LICENSE" for the full license governing this code. - */ -package com.todoroo.astrid.calls; - -import static org.tasks.time.DateTimeUtils.currentTimeMillis; - -import android.annotation.SuppressLint; -import android.app.PendingIntent; -import android.content.ContentUris; -import android.content.Context; -import android.content.Intent; -import android.database.Cursor; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.net.Uri; -import android.provider.CallLog.Calls; -import android.provider.ContactsContract; -import android.support.v4.app.NotificationCompat; -import android.telephony.TelephonyManager; -import android.text.TextUtils; -import com.todoroo.andlib.utility.AndroidUtilities; -import com.todoroo.andlib.utility.DateUtilities; -import java.io.InputStream; -import javax.inject.Inject; -import org.tasks.R; -import org.tasks.injection.BroadcastComponent; -import org.tasks.injection.ForApplication; -import org.tasks.injection.InjectingBroadcastReceiver; -import org.tasks.notifications.NotificationManager; -import org.tasks.preferences.PermissionChecker; -import org.tasks.preferences.Preferences; -import org.tasks.reminders.MissedCallActivity; -import timber.log.Timber; - -public class PhoneStateChangedReceiver extends InjectingBroadcastReceiver { - - private static final String PREF_LAST_INCOMING_NUMBER = "last_incoming_number"; - - private static final long WAIT_BEFORE_READ_LOG = 3000L; - - @Inject Preferences preferences; - @Inject NotificationManager notificationManager; - @Inject PermissionChecker permissionChecker; - @Inject @ForApplication Context context; - - @Override - public void onReceive(final Context context, Intent intent) { - super.onReceive(context, intent); - - if (!intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { - return; - } - - if (!preferences.fieldMissedPhoneCalls()) { - preferences.clear(PREF_LAST_INCOMING_NUMBER); - return; - } - - String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); - - if (TelephonyManager.EXTRA_STATE_RINGING.equals(state)) { - String number = digitsOnly(intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER)); - if (TextUtils.isEmpty(number)) { - return; - } - - preferences.setString(PREF_LAST_INCOMING_NUMBER, number); - } else if (TelephonyManager.EXTRA_STATE_IDLE.equals(state)) { - final String lastNumber = preferences.getStringValue(PREF_LAST_INCOMING_NUMBER); - if (TextUtils.isEmpty(lastNumber)) { - return; - } - - preferences.clear(PREF_LAST_INCOMING_NUMBER); - - new Thread() { - @Override - public void run() { - AndroidUtilities.sleepDeep(WAIT_BEFORE_READ_LOG); - Cursor calls; - try { - calls = getMissedCalls(); - } catch (Exception e) { // Sometimes database is locked, retry once - Timber.e(e); - AndroidUtilities.sleepDeep(300L); - try { - calls = getMissedCalls(); - } catch (Exception e2) { - Timber.e(e2); - calls = null; - } - } - try { - if (calls == null) { - return; - } - if (calls.moveToFirst()) { - int numberIndex = calls.getColumnIndex(Calls.NUMBER); - String number = calls.getString(numberIndex); - - // Sanity check for phone number match - // in case the phone logs haven't updated for some reaosn - if (!lastNumber.equals(digitsOnly(number))) { - return; - } - - // If a lot of time has passed since the most recent missed call, ignore - // It could be the same person calling you back before you call them back, - // but if you answer this time, the missed call will still be in the database - // and will be processed again. - int dateIndex = calls.getColumnIndex(Calls.DATE); - long date = calls.getLong(dateIndex); - if (DateUtilities.now() - date > 2 * DateUtilities.ONE_MINUTE) { - return; - } - - int nameIndex = calls.getColumnIndex(Calls.CACHED_NAME); - String name = calls.getString(nameIndex); - - long contactId = getContactIdFromNumber(context, number); - - triggerMissedCallNotification(name, number, contactId); - } - } catch (Exception e) { - Timber.e(e); - } finally { - if (calls != null) { - calls.close(); - } - } - } - }.start(); - } - } - - @SuppressLint("MissingPermission") - private Cursor getMissedCalls() { - if (permissionChecker.canAccessMissedCallPermissions()) { - //noinspection MissingPermission - return context - .getContentResolver() - .query( - Calls.CONTENT_URI, - new String[] {Calls.NUMBER, Calls.DATE, Calls.CACHED_NAME}, - Calls.TYPE + " = ? AND " + Calls.NEW + " = ?", - new String[] {Integer.toString(Calls.MISSED_TYPE), "1"}, - Calls.DATE + " DESC"); - } - return null; - } - - @Override - protected void inject(BroadcastComponent component) { - component.inject(this); - } - - private String digitsOnly(String number) { - if (number == null) { - return ""; - } - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < number.length(); i++) { - char c = number.charAt(i); - if (Character.isDigit(c)) { - builder.append(c); - } - } - return builder.toString(); - } - - private long getContactIdFromNumber(Context context, String number) { - Uri contactUri = - Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number)); - Cursor c = - context - .getContentResolver() - .query(contactUri, new String[] {ContactsContract.PhoneLookup._ID}, null, null, null); - - try { - if (c.moveToFirst()) { - return c.getLong(c.getColumnIndex(ContactsContract.PhoneLookup._ID)); - } - } finally { - c.close(); - } - return -1; - } - - private void triggerMissedCallNotification( - final String name, final String number, long contactId) { - final String title = - context.getString(R.string.missed_call, TextUtils.isEmpty(name) ? number : name); - - Intent missedCallDialog = new Intent(context, MissedCallActivity.class); - missedCallDialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - missedCallDialog.putExtra(MissedCallActivity.EXTRA_NUMBER, number); - missedCallDialog.putExtra(MissedCallActivity.EXTRA_NAME, name); - missedCallDialog.putExtra(MissedCallActivity.EXTRA_TITLE, title); - - NotificationCompat.Builder builder = - new NotificationCompat.Builder(context, NotificationManager.NOTIFICATION_CHANNEL_CALLS) - .setTicker(title) - .setContentTitle(title) - .setContentText(context.getString(R.string.app_name)) - .setWhen(currentTimeMillis()) - .setShowWhen(true) - .setSmallIcon(R.drawable.ic_check_white_24dp) - .setContentIntent( - PendingIntent.getActivity( - context, - missedCallDialog.hashCode(), - missedCallDialog, - PendingIntent.FLAG_UPDATE_CURRENT)); - - Bitmap contactImage = getContactImage(contactId); - if (contactImage != null) { - builder.setLargeIcon(contactImage); - } - - Intent callNow = new Intent(context, MissedCallActivity.class); - callNow.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - callNow.putExtra(MissedCallActivity.EXTRA_NUMBER, number); - callNow.putExtra(MissedCallActivity.EXTRA_NAME, name); - callNow.putExtra(MissedCallActivity.EXTRA_TITLE, title); - callNow.putExtra(MissedCallActivity.EXTRA_CALL_NOW, true); - - Intent callLater = new Intent(context, MissedCallActivity.class); - callLater.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - callLater.putExtra(MissedCallActivity.EXTRA_NUMBER, number); - callLater.putExtra(MissedCallActivity.EXTRA_NAME, name); - callLater.putExtra(MissedCallActivity.EXTRA_TITLE, title); - callLater.putExtra(MissedCallActivity.EXTRA_CALL_LATER, true); - builder - .addAction( - R.drawable.ic_phone_white_24dp, - context.getString(R.string.MCA_return_call), - PendingIntent.getActivity( - context, callNow.hashCode(), callNow, PendingIntent.FLAG_UPDATE_CURRENT)) - .addAction( - R.drawable.ic_add_white_24dp, - context.getString(R.string.MCA_add_task), - PendingIntent.getActivity( - context, callLater.hashCode(), callLater, PendingIntent.FLAG_UPDATE_CURRENT)); - - notificationManager.notify(number.hashCode(), builder, true, false, false); - } - - private Bitmap getContactImage(long contactId) { - Bitmap b = null; - if (contactId >= 0) { - Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId); - InputStream input = - ContactsContract.Contacts.openContactPhotoInputStream(context.getContentResolver(), uri); - try { - b = BitmapFactory.decodeStream(input); - } catch (OutOfMemoryError e) { - Timber.e(e); - } - } - return b; - } -} diff --git a/app/src/main/java/com/todoroo/astrid/reminders/ReminderPreferences.java b/app/src/main/java/com/todoroo/astrid/reminders/ReminderPreferences.java index 81d06cf97..461023bf8 100644 --- a/app/src/main/java/com/todoroo/astrid/reminders/ReminderPreferences.java +++ b/app/src/main/java/com/todoroo/astrid/reminders/ReminderPreferences.java @@ -9,7 +9,6 @@ import static com.todoroo.andlib.utility.AndroidUtilities.atLeastJellybean; import static com.todoroo.andlib.utility.AndroidUtilities.atLeastMarshmallow; import static com.todoroo.andlib.utility.AndroidUtilities.atLeastOreo; import static com.todoroo.andlib.utility.AndroidUtilities.preOreo; -import static org.tasks.PermissionUtil.verifyPermissions; import android.annotation.TargetApi; import android.content.Intent; @@ -18,11 +17,9 @@ import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceManager; import android.provider.Settings; -import android.support.annotation.NonNull; import com.todoroo.astrid.api.Filter; import javax.inject.Inject; import org.tasks.LocalBroadcastManager; @@ -35,7 +32,6 @@ import org.tasks.preferences.ActivityPermissionRequestor; import org.tasks.preferences.DefaultFilterProvider; import org.tasks.preferences.Device; import org.tasks.preferences.PermissionChecker; -import org.tasks.preferences.PermissionRequestor; import org.tasks.receivers.Badger; import org.tasks.scheduling.GeofenceSchedulingIntentService; import org.tasks.scheduling.NotificationSchedulerIntentService; @@ -56,8 +52,6 @@ public class ReminderPreferences extends InjectingPreferenceActivity { @Inject DefaultFilterProvider defaultFilterProvider; @Inject LocalBroadcastManager localBroadcastManager; - private CheckBoxPreference fieldMissedCalls; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -72,15 +66,6 @@ public class ReminderPreferences extends InjectingPreferenceActivity { R.string.p_rmd_persistent); resetGeofencesOnChange(R.string.p_geofence_radius, R.string.p_geofence_responsiveness); - fieldMissedCalls = - (CheckBoxPreference) findPreference(getString(R.string.p_field_missed_calls)); - fieldMissedCalls.setOnPreferenceChangeListener( - (preference, newValue) -> - newValue != null - && (!(boolean) newValue || permissionRequestor.requestMissedCallPermissions())); - fieldMissedCalls.setChecked( - fieldMissedCalls.isChecked() && permissionChecker.canAccessMissedCallPermissions()); - initializeRingtonePreference(); initializeTimePreference(getDefaultRemindTimePreference(), REQUEST_DEFAULT_REMIND); initializeTimePreference(getQuietStartPreference(), REQUEST_QUIET_START); @@ -171,18 +156,6 @@ public class ReminderPreferences extends InjectingPreferenceActivity { } } - @Override - public void onRequestPermissionsResult( - int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - if (requestCode == PermissionRequestor.REQUEST_CONTACTS) { - if (verifyPermissions(grantResults)) { - fieldMissedCalls.setChecked(true); - } - } else { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - } - } - private void initializeTimePreference(final TimePreference preference, final int requestCode) { preference.setOnPreferenceClickListener( ignored -> { diff --git a/app/src/main/java/org/tasks/injection/ActivityComponent.java b/app/src/main/java/org/tasks/injection/ActivityComponent.java index 346f20e4b..d21da9b4a 100644 --- a/app/src/main/java/org/tasks/injection/ActivityComponent.java +++ b/app/src/main/java/org/tasks/injection/ActivityComponent.java @@ -32,7 +32,6 @@ import org.tasks.preferences.AppearancePreferences; import org.tasks.preferences.BasicPreferences; import org.tasks.preferences.DateTimePreferences; import org.tasks.preferences.MiscellaneousPreferences; -import org.tasks.reminders.MissedCallActivity; import org.tasks.reminders.NotificationActivity; import org.tasks.reminders.SnoozeActivity; import org.tasks.sync.SynchronizationPreferences; @@ -80,8 +79,6 @@ public interface ActivityComponent { void inject(SnoozeActivity snoozeActivity); - void inject(MissedCallActivity missedCallActivity); - void inject(FileExplore fileExplore); void inject(CalendarSelectionActivity calendarSelectionActivity); diff --git a/app/src/main/java/org/tasks/injection/BroadcastComponent.java b/app/src/main/java/org/tasks/injection/BroadcastComponent.java index 74efe2074..36fd97e18 100644 --- a/app/src/main/java/org/tasks/injection/BroadcastComponent.java +++ b/app/src/main/java/org/tasks/injection/BroadcastComponent.java @@ -1,6 +1,5 @@ package org.tasks.injection; -import com.todoroo.astrid.calls.PhoneStateChangedReceiver; import com.todoroo.astrid.gcal.CalendarAlarmReceiver; import dagger.Subcomponent; import org.tasks.notifications.NotificationClearedReceiver; @@ -12,8 +11,6 @@ import org.tasks.widget.TasksWidget; @Subcomponent(modules = BroadcastModule.class) public interface BroadcastComponent { - void inject(PhoneStateChangedReceiver phoneStateChangedReceiver); - void inject(CalendarAlarmReceiver calendarAlarmReceiver); void inject(MyPackageReplacedReceiver myPackageReplacedReceiver); diff --git a/app/src/main/java/org/tasks/injection/DialogFragmentComponent.java b/app/src/main/java/org/tasks/injection/DialogFragmentComponent.java index a7336715f..8076f320f 100644 --- a/app/src/main/java/org/tasks/injection/DialogFragmentComponent.java +++ b/app/src/main/java/org/tasks/injection/DialogFragmentComponent.java @@ -10,7 +10,6 @@ import org.tasks.dialogs.SortDialog; import org.tasks.gtasks.CreateListDialog; import org.tasks.gtasks.DeleteListDialog; import org.tasks.gtasks.RenameListDialog; -import org.tasks.reminders.MissedCallDialog; import org.tasks.reminders.NotificationDialog; import org.tasks.reminders.SnoozeDialog; import org.tasks.repeats.BasicRecurrenceDialog; @@ -23,8 +22,6 @@ public interface DialogFragmentComponent { void inject(NotificationDialog notificationDialog); - void inject(MissedCallDialog missedCallDialog); - void inject(CalendarSelectionDialog calendarSelectionDialog); void inject(AddAttachmentDialog addAttachmentDialog); diff --git a/app/src/main/java/org/tasks/notifications/NotificationManager.java b/app/src/main/java/org/tasks/notifications/NotificationManager.java index 3b29f39eb..943253e2b 100644 --- a/app/src/main/java/org/tasks/notifications/NotificationManager.java +++ b/app/src/main/java/org/tasks/notifications/NotificationManager.java @@ -53,7 +53,6 @@ public class NotificationManager { public static final String NOTIFICATION_CHANNEL_DEFAULT = "notifications"; public static final String NOTIFICATION_CHANNEL_TASKER = "notifications_tasker"; - public static final String NOTIFICATION_CHANNEL_CALLS = "notifications_calls"; public static final String NOTIFICATION_CHANNEL_TIMERS = "notifications_timers"; static final String EXTRA_NOTIFICATION_ID = "extra_notification_id"; private static final String GROUP_KEY = "tasks"; @@ -83,8 +82,6 @@ public class NotificationManager { (android.app.NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.createNotificationChannel( createNotificationChannel(NOTIFICATION_CHANNEL_DEFAULT, R.string.notifications)); - notificationManager.createNotificationChannel( - createNotificationChannel(NOTIFICATION_CHANNEL_CALLS, R.string.missed_calls)); notificationManager.createNotificationChannel( createNotificationChannel(NOTIFICATION_CHANNEL_TASKER, R.string.tasker_locale)); notificationManager.createNotificationChannel( diff --git a/app/src/main/java/org/tasks/preferences/PermissionChecker.java b/app/src/main/java/org/tasks/preferences/PermissionChecker.java index c01072788..3e5ccefbb 100644 --- a/app/src/main/java/org/tasks/preferences/PermissionChecker.java +++ b/app/src/main/java/org/tasks/preferences/PermissionChecker.java @@ -1,15 +1,12 @@ package org.tasks.preferences; import static com.todoroo.andlib.utility.AndroidUtilities.atLeastOreo; -import static com.todoroo.andlib.utility.AndroidUtilities.preJellybean; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import android.Manifest; -import android.annotation.TargetApi; import android.content.Context; import android.content.pm.PackageManager; -import android.os.Build; import android.support.v4.app.ActivityCompat; import java.util.List; import javax.inject.Inject; @@ -46,13 +43,6 @@ public class PermissionChecker { return checkPermission(Manifest.permission.RECORD_AUDIO); } - @TargetApi(Build.VERSION_CODES.JELLY_BEAN) - public boolean canAccessMissedCallPermissions() { - return checkPermission(Manifest.permission.READ_CONTACTS) - && checkPermission(Manifest.permission.READ_PHONE_STATE) - && (preJellybean() || checkPermission(Manifest.permission.READ_CALL_LOG)); - } - private boolean checkPermission(String permission) { return checkPermissions(singletonList(permission)); } diff --git a/app/src/main/java/org/tasks/preferences/PermissionRequestor.java b/app/src/main/java/org/tasks/preferences/PermissionRequestor.java index 8cefc3d29..8ad8e58dd 100644 --- a/app/src/main/java/org/tasks/preferences/PermissionRequestor.java +++ b/app/src/main/java/org/tasks/preferences/PermissionRequestor.java @@ -1,7 +1,5 @@ package org.tasks.preferences; -import static com.todoroo.andlib.utility.AndroidUtilities.atLeastJellybean; - import android.Manifest; public abstract class PermissionRequestor { @@ -11,7 +9,6 @@ public abstract class PermissionRequestor { public static final int REQUEST_MIC = 52; public static final int REQUEST_GOOGLE_ACCOUNTS = 53; public static final int REQUEST_LOCATION = 54; - public static final int REQUEST_CONTACTS = 55; private final PermissionChecker permissionChecker; @@ -65,24 +62,6 @@ public abstract class PermissionRequestor { return false; } - public boolean requestMissedCallPermissions() { - if (permissionChecker.canAccessMissedCallPermissions()) { - return true; - } - String[] permissions = - atLeastJellybean() - ? new String[] { - Manifest.permission.READ_CONTACTS, - Manifest.permission.READ_PHONE_STATE, - Manifest.permission.READ_CALL_LOG - } - : new String[] { - Manifest.permission.READ_CONTACTS, Manifest.permission.READ_PHONE_STATE - }; - requestPermissions(permissions, REQUEST_CONTACTS); - return false; - } - private void requestPermission(String permission, int rc) { requestPermissions(new String[] {permission}, rc); } diff --git a/app/src/main/java/org/tasks/preferences/Preferences.java b/app/src/main/java/org/tasks/preferences/Preferences.java index 9bb68d9ed..5f78c51c2 100644 --- a/app/src/main/java/org/tasks/preferences/Preferences.java +++ b/app/src/main/java/org/tasks/preferences/Preferences.java @@ -285,16 +285,6 @@ public class Preferences { } } - private boolean notificationsEnabled() { - return getBoolean(R.string.p_rmd_enabled, true); - } - - public boolean fieldMissedPhoneCalls() { - return getBoolean(R.string.p_field_missed_calls, true) - && notificationsEnabled() - && permissionChecker.canAccessMissedCallPermissions(); - } - public boolean getBoolean(int keyResources, boolean defValue) { return getBoolean(context.getString(keyResources), defValue); } diff --git a/app/src/main/java/org/tasks/reminders/MissedCallActivity.java b/app/src/main/java/org/tasks/reminders/MissedCallActivity.java deleted file mode 100644 index 56fde3749..000000000 --- a/app/src/main/java/org/tasks/reminders/MissedCallActivity.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.tasks.reminders; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.text.TextUtils; -import com.todoroo.astrid.data.Task; -import com.todoroo.astrid.service.TaskCreator; -import javax.inject.Inject; -import org.tasks.R; -import org.tasks.injection.ActivityComponent; -import org.tasks.injection.InjectingAppCompatActivity; -import org.tasks.intents.TaskIntents; -import org.tasks.notifications.NotificationManager; - -public class MissedCallActivity extends InjectingAppCompatActivity - implements MissedCallDialog.MissedCallHandler { - - public static final String EXTRA_NUMBER = "number"; // $NON-NLS-1$ - public static final String EXTRA_NAME = "name"; // $NON-NLS-1$ - public static final String EXTRA_TITLE = "extra_title"; - public static final String EXTRA_CALL_NOW = "extra_call_now"; - public static final String EXTRA_CALL_LATER = "extra_call_later"; - private static final String FRAG_TAG_MISSED_CALL_FRAGMENT = "frag_tag_missed_call_fragment"; - @Inject NotificationManager notificationManager; - @Inject TaskCreator taskCreator; - - private String name; - private String number; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setup(getIntent()); - } - - @Override - public void inject(ActivityComponent component) { - component.inject(this); - } - - @Override - protected void onNewIntent(Intent intent) { - super.onNewIntent(intent); - - setup(intent); - } - - private void setup(Intent intent) { - name = intent.getStringExtra(EXTRA_NAME); - number = intent.getStringExtra(EXTRA_NUMBER); - - if (intent.getBooleanExtra(EXTRA_CALL_NOW, false)) { - callNow(); - } else if (intent.getBooleanExtra(EXTRA_CALL_LATER, false)) { - callLater(); - } else { - FragmentManager fragmentManager = getSupportFragmentManager(); - MissedCallDialog fragment = - (MissedCallDialog) fragmentManager.findFragmentByTag(FRAG_TAG_MISSED_CALL_FRAGMENT); - if (fragment == null) { - fragment = new MissedCallDialog(); - fragment.show(fragmentManager, FRAG_TAG_MISSED_CALL_FRAGMENT); - } - fragment.setTitle(intent.getStringExtra(EXTRA_TITLE)); - } - } - - @Override - public void dismiss() { - finish(); - } - - @Override - public void callNow() { - Intent call = new Intent(Intent.ACTION_VIEW); - call.setData(Uri.parse("tel:" + number)); // $NON-NLS-1$ - startActivity(call); - cancelNotificationAndFinish(); - } - - @Override - public void callLater() { - String title = - TextUtils.isEmpty(name) - ? getString(R.string.MCA_task_title_no_name, number) - : getString(R.string.MCA_task_title_name, name, number); - Task task = taskCreator.basicQuickAddTask(title); - TaskIntents.getEditTaskStack(this, null, task.getId()).startActivities(); - cancelNotificationAndFinish(); - } - - @Override - public void ignore() { - cancelNotificationAndFinish(); - } - - private void cancelNotificationAndFinish() { - notificationManager.cancel(number.hashCode()); - finish(); - } -} diff --git a/app/src/main/java/org/tasks/reminders/MissedCallDialog.java b/app/src/main/java/org/tasks/reminders/MissedCallDialog.java deleted file mode 100644 index 08a9db8a8..000000000 --- a/app/src/main/java/org/tasks/reminders/MissedCallDialog.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.tasks.reminders; - -import static java.util.Arrays.asList; - -import android.app.Dialog; -import android.content.DialogInterface; -import android.os.Bundle; -import android.support.annotation.NonNull; -import java.util.List; -import javax.inject.Inject; -import org.tasks.R; -import org.tasks.dialogs.DialogBuilder; -import org.tasks.injection.DialogFragmentComponent; -import org.tasks.injection.InjectingDialogFragment; - -public class MissedCallDialog extends InjectingDialogFragment { - - @Inject DialogBuilder dialogBuilder; - private String title; - private MissedCallHandler handler; - - @Override - protected void inject(DialogFragmentComponent component) { - component.inject(this); - } - - @NonNull - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - List actions = - asList( - getString(R.string.MCA_return_call), - getString(R.string.MCA_add_task), - getString(R.string.MCA_ignore)); - - handler = (MissedCallHandler) getActivity(); - - return dialogBuilder - .newDialog() - .setTitle(title) - .setItems( - actions, - (dialog, which) -> { - switch (which) { - case 0: - handler.callNow(); - break; - case 1: - handler.callLater(); - break; - default: - handler.ignore(); - break; - } - }) - .show(); - } - - @Override - public void onDismiss(DialogInterface dialog) { - handler.dismiss(); - } - - public void setTitle(String title) { - this.title = title; - Dialog dialog = getDialog(); - if (dialog != null) { - dialog.setTitle(title); - } - } - - public interface MissedCallHandler { - - void callNow(); - - void callLater(); - - void ignore(); - - void dismiss(); - } -} diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index ccd40e3db..a75253eba 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -45,9 +45,6 @@ الملفات مذكرات المهام ---إخفاء دائما--- - اتصل الان - اتصل لاحقاً - تجاهل تجاهل تريد قائمة للمقابلات؟ تجاهل جميع الأحداث diff --git a/app/src/main/res/values-bg-rBG/strings.xml b/app/src/main/res/values-bg-rBG/strings.xml index a93d5dc30..aea1a0773 100644 --- a/app/src/main/res/values-bg-rBG/strings.xml +++ b/app/src/main/res/values-bg-rBG/strings.xml @@ -75,13 +75,6 @@ Управление на таймера ----Винаги скрито---- Зареди повече... - Пропуснато обаждане от %s - Обади се сега - Обади се по-късно - Игнорирай - Пропуснати обаждания - Обади се на %1$s на %2$s - Обади се на %s Игнорирай Нуждаете се от списък за среща? Вие пренебрегнахте няколко събития в календара. Трябва ли Tasks да спре да пита за тях? diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index e5d2ab764..ce610c521 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -53,11 +53,6 @@ Controls de temporització ----Oculta-ho sempre---- Carrega més... - Truca ara - Truca després - Ignora - Retorna la trucada a en/na %1$s a %2$s - Retorna la trucada a %s Aparença Restableix els valors predeterminats Mostra el títol sencer de la tasca diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index d3d96a714..ebedcd633 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -65,13 +65,6 @@ Ovladač časovače -----Vždy skrývat---- Více... - Zmeškaný hovor od %s - Hned zavolat - Zavolat později - Ignorovat - Zmeškané hovory - Zavolat %1$s zpět v %2$s - Zavolat %s zpět Ignorovat Potřebujete seznam schůze? Ignoroval jste několik událostí v kalendáři. Mám Vás přestat informovat i o úkolech? diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index a59f9654d..c3cd956d2 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -70,13 +70,6 @@ Timer-Einstellungen ----Immer Verbergen---- Weitere laden … - Verpasster Anruf von %s - Jetzt anrufen - Später anrufen - Ignorieren - Verpasste Anrufe - %1$s unter %2$s zurückrufen - %s zurückrufen Ablehnen Willst Du eine Besprechungsliste erstellen? Sie haben mehrere Kalendertermine ignoriert. Soll Tasks nicht mehr danach fragen? diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 0a74beb63..ac4f9ce9b 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -61,11 +61,6 @@ Χειριστήρια χρονοδιακόπτη -----Απόκρυψη πάντα----- Φόρτωση περισσότερων - Κάλεσε τώρα - Κάλεσε αργότερα - Αγνοήστε - Ξανακαλέστε %1$s στίς %2$s - Ξανακαλέστε %s Αγνοήστε Χρειάζεστε λίστα για συνάντηση? Αγνοήσατε αρκετές κλήσεις. Να σταματήσουμε να ρωτάμε για αυτές; diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 137315ed3..5ff62d267 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -71,13 +71,6 @@ Controles de tiempo ---Ocultar Siempre--- Cargar mas... - Llamada perdida de %s - Llamar ahora - Llamar luego - Ignorar - Llamadas Perdidas - Devolver la llamada a %1$s al %2$s - Devolver la llamada a %s Ignorar ¿Necesita una lista de reuniones? Ha ignorado varios eventos de calendario. ¿Debe Tasks dejar de preguntarle sobre ellos? diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index 46681a53b..e52f43bac 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -56,10 +56,6 @@ کنترل تایمر ----همیشه مخفی---- بارگزاری بیشتر - اکنون تماس بگیر - بعدا تماس بگیر - رد کردن - تماس های از دست داده رد کردن نیاز به لیست ملاقات دارید ؟ نادیده گرفتن تمام رویداد ها diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index e04c6cbeb..30ef34726 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -71,13 +71,6 @@ Ajastuksen säätimet ----Piilota aina---- Lataa lisää... - Vastaamaton puhelu: %s - Soita heti - Soita myöhemmin - Ohita - Vastaamattomat puhelut - Soita %1$s takaisin %2$s - Soita %s takaisin Ohita Tarvitaanko listaa tapaamisista? Olet ohittanut useita kalenteritapahtumia. Lopettaako Tasks niistä kyselemisen? diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index b06a66108..9e3c73eba 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -70,13 +70,6 @@ Contrôles de rappel ---- Toujours masquer ---- Charger plus... - Appel manqué de %s - Appeler maintenant - Appeler plus tard - Ignorer - Appels manqués - Rappeler %1$s au %2$s - Rappeler %s Ignorer Besoin d\'une liste de réunion ? Vous avez ignoré plusieurs événements du calendrier. Souhaitez-vous que Tasks cesse de vous les proposer? diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index ef80d61d8..424082282 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -67,13 +67,6 @@ Controles de tiempo ---Ocultar Siempre--- Cargar mas... - Llamada perdida de %s - Llamar ahora - Llamar luego - Ignorar - Llamadas Perdidas - Devolver la llamada a %1$s al %2$s - Devolver la llamada a %s Ignorar ¿Necesita una lista de reuniones? Ha ignorado varios eventos de calendario. ¿Debe Tasks dejar de preguntarle sobre ellos? diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 2cdf26039..cfbe599f3 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -75,13 +75,6 @@ Időzítő Beállítása ---Elrejtve--- Továbbiak betöltése... - Nem fogadott hívás tőle: %s - Hívás most - Hívás később - Kihagy - Nem fogadott hívások - %1$s visszahívása ekkor: %2$s - %s visszahívása Kihagy Szeretne egy listát a találkozókról? Kihagytál jónéhány naptáreseményt. Ne kérdezzen rá többet a Tasks? diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index fc4c50231..3c4ff9e45 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -72,13 +72,6 @@ Regolazioni Tempo ----Nascondi Sempre---- Caricane altri... - Chiamate perse da %s - Chiama ora - Chiama più tardi - Ignora - Chiamate perse - Richiama %1$s al %2$s - Richiama %s Ignora Hai bisogno di una lista per le riunioni? Hai ignorato diverse chiamate perse. Vuoi che Tasks smetta di notificartele? diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 0f7b54b15..5690e68d8 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -68,13 +68,6 @@ הערכת זמן ----מוסתר תמיד---- טען עוד... - שיחה שלא נענתה מ%s - התקשר כעת - התקשר מאוחר יותר - התעלם - שיחות שלא נענו - \"החזר שיחה ל־%1$s ב־%2$s\" - החזר שיחה ל־%s התעלם צריך רשימה לפגישה? התעלמת ממספר אירועי יומן. האם עלי לחדול מלהזכיר לך אירועי יומן? diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 110ba2c42..cf58920dd 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -68,13 +68,6 @@ タイマーコントロール ----常に隠す---- さらに読み込む... - %s から不在着信 - いますぐ呼び出し - 後で呼び出し - 無視する - 不在着信 - %1$s に %2$s 折り返し連絡 - %s に折り返し連絡 無視する ミーティングリストが必要ですか? いくつかのカレンダーイベントを無視しました. その報告を停止しますか? diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 21e11a7cb..af64798a3 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -71,13 +71,6 @@ 타이머 조절 ----항상 숨김---- 더 불러오기... - %s (으)로부터의 부재중 전화 - 지금 전화하기 - 나중에 전화하기 - 무시하기 - 부재중 전화 - %1$s 님에게 %2$s 에 다시 연락하세요 - %s 님에게 다시 연락하세요 무시하기 모임 목록이 필요하세요? 당신은 몇몇의 달력 이벤트를 무시했습니다. Tasks가 이것을 더이상 알려드리지 않도록 할까요? diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index f482f6e4d..59f1633c3 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -72,13 +72,6 @@ Laikmačio nustatymai ----Visada slėpti---- Užkrauti daugiau... - Praleistas skambutis nuo: %s - Paskambinti dabar - Paskambinti vėliau - Ignoruoti - Praleisti skambučiai - Perskambinti %1$s šiuo metu: %2$s - Perskambinti %s Ignoruoti Reikia susitikimų sąrašo? Jūs ignoravote kelis kalendoriaus įvykius. Ar Tasks turėtų nustoti apie juos klausti? diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 662cd71e7..352c37509 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -47,9 +47,6 @@ Filer Påminnelser ----Skjul alltid---- - Ring nå - Ring senere - Ignorer Utseende Standardfrist Standardviktighet diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 8c6100c7e..0dc5efa79 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -72,13 +72,6 @@ Tijd Controlers ----Altijd Verbergen---- Laad meer... - Gemiste oproepen van %s - Bel nu - Bel later - Negeren - Gemiste oproepen - Bel %1$s terug op %2$s - Bel %s terug Negeren Heb je een bijeenkomst lijst nodig? Je hebt meerdere agenda gebeurtenissen genegeerd. Moet Tasks je er niet meer naar vragen? diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index dc9dc2841..232413711 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -68,13 +68,6 @@ Sterowanie zegara ----Zawsze Ukryte---- Wczytaj więcej... - Nieodebrane połączenie od %s - Zadzwoń teraz - Zadzwoń później - Ignoruj - Nieodebrane połączenia - Oddzwoń do %1$s o %2$s - Oddzwoń do %s Ignoruj Czy potrzebujesz listy spotkań? Zignorowałeś kilka wydarzeń z kalendarza. Czy Tasks powinien przestać cię o nie pytać? diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 1c0ffab0f..4116f6deb 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -66,13 +66,6 @@ Temporizador ----Esconder Sempre--- Carregar mais... - Chamada perdida de %s - Ligar agora - Ligar mais tarde - Ignorar - Chamadas perdidas - Retornar ligação de %1$s às %2$s - Retornar ligação de %s Ignorar Precisa de uma lista de reuniões? Você ignorou vários eventos do calendário. O Tasks deve parar de lhe perguntar sobre eles? diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d08d9ca7f..99d60ed21 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -69,13 +69,6 @@ Controlos temporais ----Ocultar sempre---- Carregar mais... - Chamada perdida de %s - Chamar agora - Chamar mais tarde - Ignorar - Chamadas perdidas - Ligar a %1$s às %2$s - Ligar a %s Ignorar Precisa de uma lista de encontros? Você ignorou vários eventos de calendário. Pretende que o Tasks não o notifique novamente? diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index f9733591c..6af7b07af 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -72,13 +72,6 @@ Учет времени Всегда скрывать Загрузить больше... - Пропущенный звонок от %s - Позвонить сейчас - Позвонить позже - Игнорировать - Пропущенные звонки - Перезвонить %1$s в %2$s - Перезвонить %s Игнорировать Необходим список встреч? Вы пропустили несколько событий календаря. Прекратить спрашивать о них? diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 1e981a4a8..fc2b34a19 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -68,13 +68,6 @@ Stopky - nastavenie ----Skryť vždy---- Načítať viac... - Zmeškaný hovor od %s - Volať teraz - Volať neskôr - Ignorovať - Zmeškané hovory - Zavolať %1$s späť o %2$s - Zavolať %s späť Ignorovať Potrebuješ zoznam na stretnutie? Nevenoval si pozornosť niekoľkým udalostiam kalendára. Chceš, aby sa Úlohy na ne prestali pýtať? diff --git a/app/src/main/res/values-sl-rSI/strings.xml b/app/src/main/res/values-sl-rSI/strings.xml index 46ca5c111..a2356f3d2 100644 --- a/app/src/main/res/values-sl-rSI/strings.xml +++ b/app/src/main/res/values-sl-rSI/strings.xml @@ -62,11 +62,6 @@ Upravljanje s štoparico ----Vedno skrij---- Naloži še... - Kliči zdaj - Kliči kasneje - Ignoriraj - %1$s pokliči nazaj ob %2$s - Vrni klic %s Ignoriraj Potrebujete seznam sestankov? Ignorirali ste številne dogodke na koledarju. Naj vas aplikacija Opravki neha spraševati o njih? diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 726e145ba..8770c4fd2 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -68,13 +68,6 @@ Inställningar för tidtagarur ----Göm alltid---- Ladda mer... - Missat samtal från %s - Ring nu - Ring senare - Ignorera - Missade samtal - Ring %1$s tillbaka kl %2$s - Ring %s tillbaka Ignorera Behöver du en lista över möten? Du har ignorerat flera kalenderhändelser. Vill du att Tasks slutar fråga dig om dem? diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 01101014a..68ccf4599 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -76,13 +76,6 @@ Kronometre Denetimleri ----Her Zaman Gizle---- Daha yükle... - %s kişisinden yanıtsız çağrı - Şimdi ara - Sonra ara - Yoksay - Yanıtsız çağrılar - %1$s kişisini geri ara: %2$s - %s kişisini geri ara Yoksay Bir toplantı listesine mi ihtiyacınız var? Bir kaç tane takvim etkinliğini yok saydınız. Tasks\'in size bunlar hakkında sormayı kesmesini ister misiniz? diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 6f1f10ef1..3b3c7f5e4 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -71,13 +71,6 @@ Управління таймером ----Приховувати завжди---- Завантажити більше... - Пропущений дзвінок від %s - Зателефонувати зараз - Зателефонувати пізніше - Ігнорувати - Пропущені виклики - Перетелефонувати %1$s о %2$s - Перетелефонувати %s Ігнорувати Потрібен список для зустрічі? Ви проігнорували декілька календарних подій. Більше не запитувати про них? diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index ad672d5f5..87d937176 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -72,13 +72,6 @@ 定时器控件 ----始终隐藏---- 加载更多…… - 来自 %s 的未接来电 - 现在回电 - 稍后回电 - 忽略 - 未接来电 - 请回电给 %1$s,电话是 %2$s - 请回电给 %s 忽略 需要会议列表? 您已经忽略了几个日历事件。对于这些事件,清单小助理是否应该不再询问您呢? diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index eae6f9e53..d2a9ceb54 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -56,11 +56,6 @@ 定時器控件 ----始終隱藏---- 加載更多…… - 現在回電 - 稍後回電 - 忽略 - 請回電給 %1$s,電話是 %2$s - 請回電給 %s 忽略 需要一個會議列表嗎? 您已經忽略了好幾個月曆上的事件, 之後 Tasks 是不是不要再詢問您了呢? diff --git a/app/src/main/res/values/keys.xml b/app/src/main/res/values/keys.xml index 6aa33952b..004bfbafe 100644 --- a/app/src/main/res/values/keys.xml +++ b/app/src/main/res/values/keys.xml @@ -44,9 +44,6 @@ notif_default_reminder - - field_missed_calls - p_calendar_reminder diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5726b0eec..c4192bca2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -194,27 +194,6 @@ File %1$s contained %2$s.\n\n Load more… - - - Missed call from %s - - - Call now - - - Call later - - - Ignore - - Missed calls - - - Call %1$s back at %2$s - - - Call %s back - diff --git a/app/src/main/res/xml/preferences_reminders.xml b/app/src/main/res/xml/preferences_reminders.xml index 7971d0ee5..ed9346cc6 100644 --- a/app/src/main/res/xml/preferences_reminders.xml +++ b/app/src/main/res/xml/preferences_reminders.xml @@ -52,11 +52,6 @@ android:key="@string/p_led_notification" android:summary="@string/hardware_support_required" android:title="@string/led_notification"/> -