Added UI service

Unfinished work
This commit is contained in:
M66B
2019-02-27 15:05:15 +00:00
parent a736035bc9
commit 861cf0eb4a
12 changed files with 1876 additions and 1781 deletions

View File

@@ -2078,10 +2078,6 @@ public class FragmentCompose extends FragmentBase {
if (!attachment.available)
throw new IllegalArgumentException(context.getString(R.string.title_attachments_missing));
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (!prefs.getBoolean("enabled", true))
throw new IllegalStateException(context.getString(R.string.title_sync_disabled));
// Delete draft (cannot move to outbox)
EntityOperation.queue(context, db, draft, EntityOperation.DELETE);
@@ -2160,18 +2156,7 @@ public class FragmentCompose extends FragmentBase {
finish();
else if (ex instanceof IllegalArgumentException || ex instanceof AddressException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else if (ex instanceof IllegalStateException) {
Snackbar snackbar = Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG);
snackbar.setAction(R.string.title_enable, new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("enabled", true).apply();
ServiceSynchronize.reload(getContext(), "compose/disabled");
}
});
snackbar.show();
} else
else
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
}
};