Handle error when task not found

pull/795/head
Alex Baker 6 years ago
parent 4cd3d6695f
commit 268a774b0a

@ -79,6 +79,7 @@ import org.tasks.ui.EmptyTaskEditFragment;
import org.tasks.ui.NavigationDrawerFragment;
import org.tasks.ui.PriorityControlSet;
import org.tasks.ui.TaskListViewModel;
import org.tasks.ui.Toaster;
public class MainActivity extends InjectingAppCompatActivity
implements OnFilterItemClickedListener,
@ -115,6 +116,7 @@ public class MainActivity extends InjectingAppCompatActivity
@Inject LocalBroadcastManager localBroadcastManager;
@Inject TaskCreator taskCreator;
@Inject PlayServices playServices;
@Inject Toaster toaster;
@BindView(R.id.drawer_layout)
DrawerLayout drawerLayout;
@ -245,7 +247,8 @@ public class MainActivity extends InjectingAppCompatActivity
task -> {
getSupportFragmentManager().executePendingTransactions();
onTaskListItemClicked(task);
}));
},
exception -> toaster.longToast(R.string.error_task_not_found)));
} else if (intent.hasExtra(OPEN_NEW_TASK)) {
Task task = intent.getParcelableExtra(OPEN_NEW_TASK);
intent.removeExtra(OPEN_NEW_TASK);

@ -20,9 +20,16 @@ public class Toaster {
this.locale = locale;
}
public void longToast(@StringRes int resId) {
longToast(context.getString(resId));
}
public void longToast(@StringRes int resId, int number) {
Toast.makeText(context, context.getString(resId, locale.formatNumber(number)), LENGTH_LONG)
.show();
longToast(context.getString(resId, locale.formatNumber(number)));
}
private void longToast(String text) {
Toast.makeText(context, text, LENGTH_LONG).show();
}
@SuppressWarnings("DeprecatedIsStillUsed")

@ -878,4 +878,5 @@ File %1$s contained %2$s.\n\n
<string name="location_arrived">Arrived at %s</string>
<string name="location_departed">Departed %s</string>
<string name="building_notifications">Generating notifications</string>
<string name="error_task_not_found">Task not found</string>
</resources>

Loading…
Cancel
Save