Seem to be a formatting bug in Android Studio

pull/30/head
M66B 6 years ago
parent cc88ea4e06
commit 5f48e38d6d

@ -30,7 +30,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
protected void onCreate(Bundle savedInstanceState) {
Log.i(Helper.TAG, "Create " + this.getClass().getName());
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String theme = prefs.getString("theme", "light");
String theme = prefs.getString("theme" , "light");
setTheme("light".equals(theme) ? R.style.AppThemeLight : R.style.AppThemeDark);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
super.onCreate(savedInstanceState);

@ -139,7 +139,7 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
private void syncState() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean eula = prefs.getBoolean("eula", false);
boolean eula = prefs.getBoolean("eula" , false);
int count = getSupportFragmentManager().getBackStackEntryCount();
drawerToggle.setDrawerIndicatorEnabled(count == 1 && eula);
}
@ -158,7 +158,7 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
if (newIntent) {
newIntent = false;
getSupportFragmentManager().popBackStack("unified", 0);
getSupportFragmentManager().popBackStack("unified" , 0);
}
}
@ -226,7 +226,7 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
menu.findItem(R.id.menu_folders).setVisible(prefs.getBoolean("eula", false));
menu.findItem(R.id.menu_folders).setVisible(prefs.getBoolean("eula" , false));
return super.onPrepareOptionsMenu(menu);
}
@ -251,11 +251,11 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
invalidateOptionsMenu();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getBoolean("eula", false)) {
if (prefs.getBoolean("eula" , false)) {
getSupportFragmentManager().popBackStack(); // eula
Bundle args = new Bundle();
args.putLong("folder", -1);
args.putLong("folder" , -1);
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(args);
@ -296,7 +296,7 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
}
private void onMenuFolders() {
getSupportFragmentManager().popBackStack("unified", 0);
getSupportFragmentManager().popBackStack("unified" , 0);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentFolders()).addToBackStack("folders");
@ -386,7 +386,7 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack
@Override
public void onReceive(Context context, Intent intent) {
if (ACTION_VIEW_MESSAGES.equals(intent.getAction())) {
getSupportFragmentManager().popBackStack("unified", 0);
getSupportFragmentManager().popBackStack("unified" , 0);
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(intent.getExtras());

@ -77,7 +77,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
ivPrimary.setVisibility(account.primary ? View.VISIBLE : View.GONE);
tvName.setText(account.name);
ivSync.setVisibility(account.synchronize ? View.VISIBLE : View.INVISIBLE);
tvHost.setText(String.format("%s:%d", account.host, account.port));
tvHost.setText(String.format("%s:%d" , account.host, account.port));
tvUser.setText(account.user);
}
@ -91,7 +91,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivitySetup.ACTION_EDIT_ACCOUNT)
.putExtra("id", account.id));
.putExtra("id" , account.id));
}
}

@ -116,10 +116,10 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
final File dir = new File(context.getCacheDir(), "attachments");
final File file = new File(dir, TextUtils.isEmpty(attachment.name)
? "attachment_" + attachment.id
: attachment.name.toLowerCase().replaceAll("[^a-zA-Z0-9-.]", "_"));
: attachment.name.toLowerCase().replaceAll("[^a-zA-Z0-9-.]" , "_"));
// https://developer.android.com/reference/android/support/v4/content/FileProvider
Uri uri = FileProvider.getUriForFile(context, "eu.faircode.email", file);
Uri uri = FileProvider.getUriForFile(context, "eu.faircode.email" , file);
// Build intent
final Intent intent = new Intent(Intent.ACTION_VIEW);

@ -93,7 +93,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
int resid = context.getResources().getIdentifier(
"title_folder_" + folder.type.toLowerCase(),
"string",
"string" ,
context.getPackageName());
tvType.setText(resid > 0 ? context.getString(resid) : folder.type);
}
@ -108,7 +108,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
.putExtra("folder", folder.id));
.putExtra("folder" , folder.id));
}
@Override
@ -122,7 +122,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_EDIT_FOLDER)
.putExtra("id", folder.id));
.putExtra("id" , folder.id));
return true;
}

@ -77,7 +77,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
ivPrimary.setVisibility(identity.primary ? View.VISIBLE : View.GONE);
tvName.setText(identity.name);
ivSync.setVisibility(identity.synchronize ? View.VISIBLE : View.INVISIBLE);
tvHost.setText(String.format("%s:%d", identity.host, identity.port));
tvHost.setText(String.format("%s:%d" , identity.host, identity.port));
tvEmail.setText(identity.email);
}
@ -91,7 +91,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivitySetup.ACTION_EDIT_IDENTITY)
.putExtra("id", identity.id));
.putExtra("id" , identity.id));
}
}

@ -138,7 +138,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
if (EntityFolder.TYPE_DRAFTS.equals(message.folderType))
context.startActivity(
new Intent(context, ActivityCompose.class)
.putExtra("id", message.id));
.putExtra("id" , message.id));
else {
boolean outbox = EntityFolder.TYPE_OUTBOX.equals(message.folderType);
if (!outbox && !message.seen && !message.ui_seen) {
@ -151,7 +151,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_MESSAGE)
.putExtra("id", message.id));
.putExtra("id" , message.id));
}
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
@ -165,7 +165,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
super(DIFF_CALLBACK);
this.context = context;
this.viewType = viewType;
this.debug = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("debug", false);
this.debug = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("debug" , false);
}
public static final DiffUtil.ItemCallback<TupleMessageEx> DIFF_CALLBACK =

@ -45,14 +45,14 @@ public class ApplicationEx extends Application {
db = DB.getBlockingInstance(ApplicationEx.this);
EntityFolder drafts = db.folder().getPrimaryFolder(EntityFolder.TYPE_DRAFTS);
if (drafts != null) {
Address to = new InternetAddress("marcel+email@faircode.eu", "FairCode");
Address to = new InternetAddress("marcel+email@faircode.eu" , "FairCode");
EntityMessage draft = new EntityMessage();
draft.account = drafts.account;
draft.folder = drafts.id;
draft.to = MessageHelper.encodeAddresses(new Address[]{to});
draft.subject = BuildConfig.APPLICATION_ID + " crash info";
draft.body = "<pre>" + ex.toString().replaceAll("\\r?\\n", "<br />") + "</pre>";
draft.body = "<pre>" + ex.toString().replaceAll("\\r?\\n" , "<br />") + "</pre>";
draft.received = new Date().getTime();
draft.seen = false;
draft.ui_seen = false;

@ -130,7 +130,7 @@ public abstract class DB extends RoomDatabase {
@TypeConverter
public static String toStringArray(String[] value) {
return TextUtils.join(",", value);
return TextUtils.join("," , value);
}
}
}

@ -33,11 +33,11 @@ import static android.arch.persistence.room.ForeignKey.CASCADE;
@Entity(
tableName = EntityAttachment.TABLE_NAME,
foreignKeys = {
@ForeignKey(childColumns = "message", entity = EntityMessage.class, parentColumns = "id", onDelete = CASCADE)
@ForeignKey(childColumns = "message" , entity = EntityMessage.class, parentColumns = "id" , onDelete = CASCADE)
},
indices = {
@Index(value = {"message"}),
@Index(value = {"message", "sequence"}, unique = true)
@Index(value = {"message" , "sequence"}, unique = true)
}
)
public class EntityAttachment {

@ -33,10 +33,10 @@ import static android.arch.persistence.room.ForeignKey.CASCADE;
@Entity(
tableName = EntityFolder.TABLE_NAME,
foreignKeys = {
@ForeignKey(childColumns = "account", entity = EntityAccount.class, parentColumns = "id", onDelete = CASCADE)
@ForeignKey(childColumns = "account" , entity = EntityAccount.class, parentColumns = "id" , onDelete = CASCADE)
},
indices = {
@Index(value = {"account", "name"}, unique = true),
@Index(value = {"account" , "name"}, unique = true),
@Index(value = {"account"}),
@Index(value = {"name"}),
@Index(value = {"type"})
@ -55,10 +55,10 @@ public class EntityFolder {
static final String TYPE_USER = "User";
static final List<String> SYSTEM_FOLDER_ATTR = Arrays.asList(
"All",
"Drafts",
"Trash",
"Junk",
"All" ,
"Drafts" ,
"Trash" ,
"Junk" ,
"Sent"
);
static final List<String> SYSTEM_FOLDER_TYPE = Arrays.asList(

@ -32,17 +32,17 @@ import static android.arch.persistence.room.ForeignKey.CASCADE;
@Entity(
tableName = EntityMessage.TABLE_NAME,
foreignKeys = {
@ForeignKey(childColumns = "account", entity = EntityAccount.class, parentColumns = "id", onDelete = CASCADE),
@ForeignKey(childColumns = "folder", entity = EntityFolder.class, parentColumns = "id", onDelete = CASCADE),
@ForeignKey(childColumns = "identity", entity = EntityIdentity.class, parentColumns = "id", onDelete = CASCADE),
@ForeignKey(childColumns = "replying", entity = EntityMessage.class, parentColumns = "id", onDelete = CASCADE)
@ForeignKey(childColumns = "account" , entity = EntityAccount.class, parentColumns = "id" , onDelete = CASCADE),
@ForeignKey(childColumns = "folder" , entity = EntityFolder.class, parentColumns = "id" , onDelete = CASCADE),
@ForeignKey(childColumns = "identity" , entity = EntityIdentity.class, parentColumns = "id" , onDelete = CASCADE),
@ForeignKey(childColumns = "replying" , entity = EntityMessage.class, parentColumns = "id" , onDelete = CASCADE)
},
indices = {
@Index(value = {"account"}),
@Index(value = {"folder"}),
@Index(value = {"identity"}),
@Index(value = {"replying"}),
@Index(value = {"folder", "uid"}, unique = true),
@Index(value = {"folder" , "uid"}, unique = true),
@Index(value = {"thread"}),
@Index(value = {"received"}),
@Index(value = {"ui_seen"}),

@ -39,7 +39,7 @@ import static android.arch.persistence.room.ForeignKey.CASCADE;
@Entity(
tableName = EntityOperation.TABLE_NAME,
foreignKeys = {
@ForeignKey(childColumns = "message", entity = EntityMessage.class, parentColumns = "id", onDelete = CASCADE)
@ForeignKey(childColumns = "message" , entity = EntityMessage.class, parentColumns = "id" , onDelete = CASCADE)
},
indices = {
@Index(value = {"message"})
@ -101,7 +101,7 @@ public class EntityOperation {
intent.setType("account/" + message.account);
intent.setAction(ServiceSynchronize.ACTION_PROCESS_FOLDER);
}
intent.putExtra("folder", message.folder);
intent.putExtra("folder" , message.folder);
synchronized (queue) {
queue.add(intent);

@ -67,14 +67,14 @@ public class FragmentAbout extends FragmentEx {
StringBuilder info = Helper.getDebugInfo();
info.insert(0, getString(R.string.title_debug_info_remark) + "\n\n\n\n");
Address to = new InternetAddress("marcel+email@faircode.eu", "FairCode");
Address to = new InternetAddress("marcel+email@faircode.eu" , "FairCode");
EntityMessage draft = new EntityMessage();
draft.account = drafts.account;
draft.folder = drafts.id;
draft.to = MessageHelper.encodeAddresses(new Address[]{to});
draft.subject = BuildConfig.APPLICATION_ID + " debug info";
draft.body = "<pre>" + info.toString().replaceAll("\\r?\\n", "<br />") + "</pre>";
draft.body = "<pre>" + info.toString().replaceAll("\\r?\\n" , "<br />") + "</pre>";
draft.received = new Date().getTime();
draft.seen = false;
draft.ui_seen = false;
@ -85,7 +85,7 @@ public class FragmentAbout extends FragmentEx {
EntityOperation.process(getContext());
startActivity(new Intent(getContext(), ActivityCompose.class)
.putExtra("id", draft.id));
.putExtra("id" , draft.id));
}
} catch (Throwable ex) {
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));

@ -77,7 +77,7 @@ public class FragmentAccount extends FragmentEx {
// Get arguments
Bundle args = getArguments();
final long id = (args == null ? -1 : args.getLong("id", -1));
final long id = (args == null ? -1 : args.getLong("id" , -1));
// Get providers
providers = Provider.loadProfiles(getContext());
@ -131,14 +131,14 @@ public class FragmentAccount extends FragmentEx {
pbCheck.setVisibility(View.VISIBLE);
Bundle args = new Bundle();
args.putLong("id", id);
args.putString("name", etName.getText().toString());
args.putString("host", etHost.getText().toString());
args.putString("port", etPort.getText().toString());
args.putString("user", etUser.getText().toString());
args.putString("password", tilPassword.getEditText().getText().toString());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
args.putLong("id" , id);
args.putString("name" , etName.getText().toString());
args.putString("host" , etHost.getText().toString());
args.putString("port" , etPort.getText().toString());
args.putString("user" , etUser.getText().toString());
args.putString("password" , tilPassword.getEditText().getText().toString());
args.putBoolean("synchronize" , cbSynchronize.isChecked());
args.putBoolean("primary" , cbPrimary.isChecked());
getLoaderManager().restartLoader(ActivityView.LOADER_ACCOUNT_PUT, args, putLoaderCallbacks).forceLoad();
}
@ -261,7 +261,7 @@ public class FragmentAccount extends FragmentEx {
Log.i(Helper.TAG, account.name +
" system=" + folder.name +
" type=" + folder.type + " attr=" + TextUtils.join(",", attrs));
" type=" + folder.type + " attr=" + TextUtils.join("," , attrs));
if (EntityFolder.TYPE_DRAFTS.equals(folder.type))
drafts = true;

@ -93,7 +93,7 @@ public class FragmentCompose extends FragmentEx {
// Get arguments
Bundle args = getArguments();
String action = (args == null ? null : args.getString("action"));
final long id = (TextUtils.isEmpty(action) ? (args == null ? -1 : args.getLong("id", -1)) : -1);
final long id = (TextUtils.isEmpty(action) ? (args == null ? -1 : args.getLong("id" , -1)) : -1);
// Get controls
spFrom = view.findViewById(R.id.spFrom);
@ -117,7 +117,7 @@ public class FragmentCompose extends FragmentEx {
@Override
public void onClick(View view) {
Bundle args = new Bundle();
args.putLong("id", -1);
args.putLong("id" , -1);
FragmentIdentity fragment = new FragmentIdentity();
fragment.setArguments(args);
@ -298,16 +298,16 @@ public class FragmentCompose extends FragmentEx {
EntityIdentity identity = (EntityIdentity) spFrom.getSelectedItem();
Bundle args = new Bundle();
args.putLong("id", id);
args.putLong("iid", identity == null ? -1 : identity.id);
args.putString("thread", FragmentCompose.this.thread);
args.putLong("rid", FragmentCompose.this.rid);
args.putString("to", etTo.getText().toString());
args.putString("cc", etCc.getText().toString());
args.putString("bcc", etBcc.getText().toString());
args.putString("subject", etSubject.getText().toString());
args.putString("body", etBody.getText().toString());
args.putString("action", action);
args.putLong("id" , id);
args.putLong("iid" , identity == null ? -1 : identity.id);
args.putString("thread" , FragmentCompose.this.thread);
args.putLong("rid" , FragmentCompose.this.rid);
args.putString("to" , etTo.getText().toString());
args.putString("cc" , etCc.getText().toString());
args.putString("bcc" , etBcc.getText().toString());
args.putString("subject" , etSubject.getText().toString());
args.putString("body" , etBody.getText().toString());
args.putString("action" , action);
getLoaderManager().restartLoader(ActivityCompose.LOADER_COMPOSE_PUT, args, putLoaderCallbacks).forceLoad();
}
@ -329,27 +329,27 @@ public class FragmentCompose extends FragmentEx {
Bundle result = new Bundle();
try {
String action = args.getString("action");
long id = args.getLong("id", -1);
long id = args.getLong("id" , -1);
EntityMessage msg = DB.getInstance(getContext()).message().getMessage(id);
result.putString("action", action);
result.putString("action" , action);
if (msg != null) {
if (msg.identity != null)
result.putLong("iid", msg.identity);
result.putLong("iid" , msg.identity);
if (msg.replying != null)
result.putLong("rid", msg.replying);
result.putString("cc", msg.cc);
result.putString("bcc", msg.bcc);
result.putString("thread", msg.thread);
result.putString("subject", msg.subject);
result.putString("body", msg.body);
result.putLong("rid" , msg.replying);
result.putString("cc" , msg.cc);
result.putString("bcc" , msg.bcc);
result.putString("thread" , msg.thread);
result.putString("subject" , msg.subject);
result.putString("body" , msg.body);
}
if (TextUtils.isEmpty(action)) {
if (msg != null) {
result.putString("from", msg.from);
result.putString("to", msg.to);
result.putString("from" , msg.from);
result.putString("to" , msg.to);
}
} else if ("reply".equals(action)) {
String to = null;
@ -360,9 +360,9 @@ public class FragmentCompose extends FragmentEx {
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
}
result.putLong("rid", msg.id);
result.putString("from", msg.to);
result.putString("to", to);
result.putLong("rid" , msg.id);
result.putString("from" , msg.to);
result.putString("to" , to);
} else if ("reply_all".equals(action)) {
String to = null;
if (msg != null) {
@ -378,9 +378,9 @@ public class FragmentCompose extends FragmentEx {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
}
}
result.putLong("rid", msg.id);
result.putString("from", msg.to);
result.putString("to", to);
result.putLong("rid" , msg.id);
result.putString("from" , msg.to);
result.putString("to" , to);
} else if ("forward".equals(action)) {
String to = null;
if (msg != null)
@ -390,8 +390,8 @@ public class FragmentCompose extends FragmentEx {
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
}
result.putString("from", msg.to);
result.putString("to", to);
result.putString("from" , msg.to);
result.putString("to" , to);
}
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
@ -413,8 +413,8 @@ public class FragmentCompose extends FragmentEx {
public void onLoadFinished(@NonNull Loader<Bundle> loader, Bundle result) {
getLoaderManager().destroyLoader(loader.getId());
long iid = result.getLong("iid", -1);
long rid = result.getLong("rid", -1);
long iid = result.getLong("iid" , -1);
long rid = result.getLong("rid" , -1);
String thread = result.getString("thread");
String from = result.getString("from");
String to = result.getString("to");
@ -449,11 +449,11 @@ public class FragmentCompose extends FragmentEx {
Handler handler = new Handler();
etCc.setText(TextUtils.join(", ", MessageHelper.decodeAddresses(cc)));
etBcc.setText(TextUtils.join(", ", MessageHelper.decodeAddresses(bcc)));
etCc.setText(TextUtils.join(", " , MessageHelper.decodeAddresses(cc)));
etBcc.setText(TextUtils.join(", " , MessageHelper.decodeAddresses(bcc)));
if (action == null) {
etTo.setText(TextUtils.join(", ", MessageHelper.decodeAddresses(to)));
etTo.setText(TextUtils.join(", " , MessageHelper.decodeAddresses(to)));
etSubject.setText(subject);
if (body != null)
etBody.setText(Html.fromHtml(HtmlHelper.sanitize(getContext(), body, false)));
@ -464,10 +464,10 @@ public class FragmentCompose extends FragmentEx {
}
});
} else if ("reply".equals(action) || "reply_all".equals(action)) {
etTo.setText(TextUtils.join(", ", MessageHelper.decodeAddresses(to)));
String text = String.format("<br><br>%s %s:<br><br>%s",
etTo.setText(TextUtils.join(", " , MessageHelper.decodeAddresses(to)));
String text = String.format("<br><br>%s %s:<br><br>%s" ,
Html.escapeHtml(new Date().toString()),
Html.escapeHtml(TextUtils.join(", ", MessageHelper.decodeAddresses(to))),
Html.escapeHtml(TextUtils.join(", " , MessageHelper.decodeAddresses(to))),
HtmlHelper.sanitize(getContext(), body, true));
etSubject.setText(getContext().getString(R.string.title_subject_reply, subject));
etBody.setText(Html.fromHtml(text));
@ -478,9 +478,9 @@ public class FragmentCompose extends FragmentEx {
}
});
} else if ("forward".equals(action)) {
String text = String.format("<br><br>%s %s:<br><br>%s",
String text = String.format("<br><br>%s %s:<br><br>%s" ,
Html.escapeHtml(new Date().toString()),
Html.escapeHtml(TextUtils.join(", ", MessageHelper.decodeAddresses(to))),
Html.escapeHtml(TextUtils.join(", " , MessageHelper.decodeAddresses(to))),
HtmlHelper.sanitize(getContext(), body, true));
etSubject.setText(getContext().getString(R.string.title_subject_forward, subject));
etBody.setText(Html.fromHtml(text));
@ -531,7 +531,7 @@ public class FragmentCompose extends FragmentEx {
if (drafts == null)
throw new Throwable(getContext().getString(R.string.title_no_primary_drafts));
long rid = args.getLong("rid", -1);
long rid = args.getLong("rid" , -1);
String thread = args.getString("thread");
String to = args.getString("to");
String cc = args.getString("cc");
@ -558,7 +558,7 @@ public class FragmentCompose extends FragmentEx {
draft.cc = MessageHelper.encodeAddresses(acc);
draft.bcc = MessageHelper.encodeAddresses(abcc);
draft.subject = subject;
draft.body = "<pre>" + body.replaceAll("\\r?\\n", "<br />") + "</pre>";
draft.body = "<pre>" + body.replaceAll("\\r?\\n" , "<br />") + "</pre>";
draft.received = new Date().getTime();
draft.seen = false;
draft.ui_seen = false;

@ -43,7 +43,7 @@ public class FragmentEula extends FragmentEx {
@Override
public void onClick(View view) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("eula", true).apply();
prefs.edit().putBoolean("eula" , true).apply();
}
});

@ -73,9 +73,9 @@ public class FragmentFolder extends FragmentEx {
pbSave.setVisibility(View.VISIBLE);
Bundle args = new Bundle();
args.putLong("id", id);
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putString("after", etAfter.getText().toString());
args.putLong("id" , id);
args.putBoolean("synchronize" , cbSynchronize.isChecked());
args.putString("after" , etAfter.getText().toString());
getLoaderManager().restartLoader(ActivityView.LOADER_FOLDER_PUT, args, putLoaderCallbacks).forceLoad();
}

@ -79,7 +79,7 @@ public class FragmentIdentity extends FragmentEx {
// Get arguments
Bundle args = getArguments();
final long id = (args == null ? -1 : args.getLong("id", -1));
final long id = (args == null ? -1 : args.getLong("id" , -1));
// Get providers
providers = Provider.loadProfiles(getContext());
@ -158,17 +158,17 @@ public class FragmentIdentity extends FragmentEx {
pbCheck.setVisibility(View.VISIBLE);
Bundle args = new Bundle();
args.putLong("id", id);
args.putString("name", etName.getText().toString());
args.putString("email", etEmail.getText().toString());
args.putString("replyto", etReplyTo.getText().toString());
args.putString("host", etHost.getText().toString());
args.putBoolean("starttls", cbStartTls.isChecked());
args.putString("port", etPort.getText().toString());
args.putString("user", etUser.getText().toString());
args.putString("password", tilPassword.getEditText().getText().toString());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
args.putLong("id" , id);
args.putString("name" , etName.getText().toString());
args.putString("email" , etEmail.getText().toString());
args.putString("replyto" , etReplyTo.getText().toString());
args.putString("host" , etHost.getText().toString());
args.putBoolean("starttls" , cbStartTls.isChecked());
args.putString("port" , etPort.getText().toString());
args.putString("user" , etUser.getText().toString());
args.putString("password" , tilPassword.getEditText().getText().toString());
args.putBoolean("synchronize" , cbSynchronize.isChecked());
args.putBoolean("primary" , cbPrimary.isChecked());
getLoaderManager().restartLoader(ActivityView.LOADER_IDENTITY_PUT, args, putLoaderCallbacks).forceLoad();
}

@ -135,7 +135,7 @@ public class FragmentMessage extends FragmentEx {
URLSpan[] link = buffer.getSpans(off, off, URLSpan.class);
if (link.length != 0) {
Bundle args = new Bundle();
args.putString("link", link[0].getURL());
args.putString("link" , link[0].getURL());
FragmentWebView fragment = new FragmentWebView();
fragment.setArguments(args);
@ -341,7 +341,7 @@ public class FragmentMessage extends FragmentEx {
private void onActionThread(long id) {
Bundle args = new Bundle();
args.putLong("thread", id); // message ID
args.putLong("thread" , id); // message ID
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(args);
@ -353,14 +353,14 @@ public class FragmentMessage extends FragmentEx {
private void onActionForward(long id) {
startActivity(new Intent(getContext(), ActivityCompose.class)
.putExtra("id", id)
.putExtra("action", "forward"));
.putExtra("id" , id)
.putExtra("action" , "forward"));
}
private void onActionReplyAll(long id) {
startActivity(new Intent(getContext(), ActivityCompose.class)
.putExtra("id", id)
.putExtra("action", "reply_all"));
.putExtra("id" , id)
.putExtra("action" , "reply_all"));
}
private void onActionDelete(final long id) {
@ -443,7 +443,7 @@ public class FragmentMessage extends FragmentEx {
private void onActionMove(final long id) {
Bundle args = new Bundle();
args.putLong("id", id);
args.putLong("id" , id);
getLoaderManager().restartLoader(ActivityView.LOADER_MESSAGE_MOVE, args, moveLoaderCallbacks).forceLoad();
}
@ -469,8 +469,8 @@ public class FragmentMessage extends FragmentEx {
private void onActionReply(long id) {
startActivity(new Intent(getContext(), ActivityCompose.class)
.putExtra("id", id)
.putExtra("action", "reply"));
.putExtra("id" , id)
.putExtra("action" , "reply"));
}
private static class MoveLoader extends AsyncTaskLoader<List<EntityFolder>> {

@ -61,8 +61,8 @@ public class FragmentMessages extends FragmentEx {
// Get arguments
Bundle args = getArguments();
long folder = (args == null ? -1 : args.getLong("folder", -1));
long thread = (args == null ? -1 : args.getLong("thread", -1)); // message ID
long folder = (args == null ? -1 : args.getLong("folder" , -1));
long thread = (args == null ? -1 : args.getLong("thread" , -1)); // message ID
// Get controls
rvMessage = view.findViewById(R.id.rvFolder);
@ -99,7 +99,7 @@ public class FragmentMessages extends FragmentEx {
// Observe folder/messages
DB db = DB.getInstance(getContext());
LiveData<PagedList<TupleMessageEx>> messages;
boolean debug = PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("debug", false);
boolean debug = PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("debug" , false);
if (thread < 0)
if (folder < 0) {
setSubtitle(R.string.title_folder_unified);
@ -152,10 +152,10 @@ public class FragmentMessages extends FragmentEx {
Bundle result = new Bundle();
try {
EntityFolder drafts = DB.getInstance(getContext()).folder().getPrimaryFolder(EntityFolder.TYPE_DRAFTS);
result.putBoolean("drafts", drafts != null);
result.putBoolean("drafts" , drafts != null);
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
result.putBoolean("drafts", false);
result.putBoolean("drafts" , false);
}
return result;
}
@ -170,7 +170,7 @@ public class FragmentMessages extends FragmentEx {
@Override
public void onLoadFinished(@NonNull Loader<Bundle> loader, Bundle data) {
fab.setVisibility(data.getBoolean("drafts", false) ? View.VISIBLE : View.GONE);
fab.setVisibility(data.getBoolean("drafts" , false) ? View.VISIBLE : View.GONE);
}
@Override

@ -114,7 +114,7 @@ public class FragmentSetup extends FragmentEx {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String theme = prefs.getString("theme", "light");
String theme = prefs.getString("theme" , "light");
boolean dark = "dark".equals(theme);
cbDarkTheme.setTag(dark);
cbDarkTheme.setChecked(dark);
@ -124,16 +124,16 @@ public class FragmentSetup extends FragmentEx {
if (checked != (Boolean) button.getTag()) {
button.setTag(checked);
cbDarkTheme.setChecked(checked);
prefs.edit().putString("theme", checked ? "dark" : "light").apply();
prefs.edit().putString("theme" , checked ? "dark" : "light").apply();
}
}
});
cbDebug.setChecked(prefs.getBoolean("debug", false));
cbDebug.setChecked(prefs.getBoolean("debug" , false));
cbDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("debug", checked).apply();
prefs.edit().putBoolean("debug" , checked).apply();
}
});

@ -72,33 +72,33 @@ public class Helper {
if (bytes < unit) return bytes + " B";
int exp = (int) (Math.log(bytes) / Math.log(unit));
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
return String.format("%.1f %sB" , bytes / Math.pow(unit, exp), pre);
}
static StringBuilder getDebugInfo() {
StringBuilder sb = new StringBuilder();
// Get version info
sb.append(String.format("%s: %s/%d\r\n", BuildConfig.APPLICATION_ID, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
sb.append(String.format("%s: %s/%d\r\n" , BuildConfig.APPLICATION_ID, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
sb.append(String.format("Android: %s (SDK %d)\r\n" , Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
sb.append("\r\n");
// Get device info
sb.append(String.format("Brand: %s\r\n", Build.BRAND));
sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER));
sb.append(String.format("Model: %s\r\n", Build.MODEL));
sb.append(String.format("Product: %s\r\n", Build.PRODUCT));
sb.append(String.format("Device: %s\r\n", Build.DEVICE));
sb.append(String.format("Host: %s\r\n", Build.HOST));
sb.append(String.format("Display: %s\r\n", Build.DISPLAY));
sb.append(String.format("Id: %s\r\n", Build.ID));
sb.append(String.format("Brand: %s\r\n" , Build.BRAND));
sb.append(String.format("Manufacturer: %s\r\n" , Build.MANUFACTURER));
sb.append(String.format("Model: %s\r\n" , Build.MODEL));
sb.append(String.format("Product: %s\r\n" , Build.PRODUCT));
sb.append(String.format("Device: %s\r\n" , Build.DEVICE));
sb.append(String.format("Host: %s\r\n" , Build.HOST));
sb.append(String.format("Display: %s\r\n" , Build.DISPLAY));
sb.append(String.format("Id: %s\r\n" , Build.ID));
sb.append("\r\n");
// Get logcat
Process proc = null;
BufferedReader br = null;
try {
String[] cmd = new String[]{"logcat", "-d", "-v", "threadtime"};
String[] cmd = new String[]{"logcat" , "-d" , "-v" , "threadtime"};
proc = Runtime.getRuntime().exec(cmd);
br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line;

@ -58,20 +58,20 @@ public class HtmlHelper implements NodeVisitor {
if (!refs.contains(ref))
refs.add(ref);
String alt = context.getString(R.string.title_link);
text = text.replace(ref, String.format("<a href=\"%s\">%s [%d]</a>", ref, alt, refs.size()));
text = text.replace(ref, String.format("<a href=\"%s\">%s [%d]</a>" , ref, alt, refs.size()));
}
sb.append(text);
} else if (name.equals("li"))
sb.append(newline).append(" * ");
else if (name.equals("dt"))
sb.append(" ");
else if (StringUtil.in(name, "p", "h1", "h2", "h3", "h4", "h5", "tr", "div"))
else if (StringUtil.in(name, "p" , "h1" , "h2" , "h3" , "h4" , "h5" , "tr" , "div"))
sb.append(newline);
}
public void tail(Node node, int depth) {
String name = node.nodeName();
if (StringUtil.in(name, "br", "dd", "dt", "p", "h1", "h2", "h3", "h4", "h5", "div"))
if (StringUtil.in(name, "br" , "dd" , "dt" , "p" , "h1" , "h2" , "h3" , "h4" , "h5" , "div"))
sb.append(newline);
else if (name.equals("a")) {
String ref = node.absUrl("href");
@ -82,7 +82,7 @@ public class HtmlHelper implements NodeVisitor {
if (TextUtils.isEmpty(alt))
alt = context.getString(R.string.title_link);
alt = Html.escapeHtml(alt);
sb.append(" ").append(String.format("<a href=\"%s\">%s [%d]</a>", ref, alt, refs.size()));
sb.append(" ").append(String.format("<a href=\"%s\">%s [%d]</a>" , ref, alt, refs.size()));
}
} else if (name.equals("img")) {
String ref = node.absUrl("src");
@ -93,7 +93,7 @@ public class HtmlHelper implements NodeVisitor {
if (TextUtils.isEmpty(alt))
alt = context.getString(R.string.title_image);
alt = Html.escapeHtml(alt);
sb.append(" ").append(String.format("<a href=\"%s\">%s [%d]</a>", ref, alt, refs.size()));
sb.append(" ").append(String.format("<a href=\"%s\">%s [%d]</a>" , ref, alt, refs.size()));
}
}
}
@ -103,7 +103,7 @@ public class HtmlHelper implements NodeVisitor {
if (refs.size() > 0)
sb.append(newline).append(newline);
for (int i = 0; i < refs.size(); i++)
sb.append(String.format("[%d] %s ", i + 1, refs.get(i))).append(newline);
sb.append(String.format("[%d] %s " , i + 1, refs.get(i))).append(newline);
return sb.toString();
}

@ -56,28 +56,28 @@ public class MessageHelper {
Properties props = new Properties();
// https://javaee.github.io/javamail/docs/api/com/sun/mail/imap/package-summary.html#properties
props.put("mail.imaps.ssl.checkserveridentity", "true");
props.put("mail.imaps.ssl.trust", "*");
props.put("mail.imaps.starttls.enable", "false");
props.put("mail.imaps.timeout", "20000");
props.put("mail.imaps.connectiontimeout", "20000");
props.put("mail.imaps.ssl.checkserveridentity" , "true");
props.put("mail.imaps.ssl.trust" , "*");
props.put("mail.imaps.starttls.enable" , "false");
props.put("mail.imaps.timeout" , "20000");
props.put("mail.imaps.connectiontimeout" , "20000");
// https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html#properties
props.put("mail.smtps.ssl.checkserveridentity", "true");
props.put("mail.smtps.ssl.trust", "*");
props.put("mail.smtps.starttls.enable", "false");
props.put("mail.smtps.starttls.required", "false");
props.put("mail.smtps.auth", "true");
props.put("mail.smtps.timeout", "20000");
props.put("mail.smtps.connectiontimeout", "20000");
props.put("mail.smtp.ssl.checkserveridentity", "true");
props.put("mail.smtp.ssl.trust", "*");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.starttls.required", "true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.timeout", "20000");
props.put("mail.smtp.connectiontimeout", "20000");
props.put("mail.smtps.ssl.checkserveridentity" , "true");
props.put("mail.smtps.ssl.trust" , "*");
props.put("mail.smtps.starttls.enable" , "false");
props.put("mail.smtps.starttls.required" , "false");
props.put("mail.smtps.auth" , "true");
props.put("mail.smtps.timeout" , "20000");
props.put("mail.smtps.connectiontimeout" , "20000");
props.put("mail.smtp.ssl.checkserveridentity" , "true");
props.put("mail.smtp.ssl.trust" , "*");
props.put("mail.smtp.starttls.enable" , "true");
props.put("mail.smtp.starttls.required" , "true");
props.put("mail.smtp.auth" , "true");
props.put("mail.smtp.timeout" , "20000");
props.put("mail.smtp.connectiontimeout" , "20000");
return props;
}
@ -113,8 +113,8 @@ public class MessageHelper {
static MimeMessageEx from(EntityMessage message, EntityMessage reply, Session isession) throws MessagingException {
MimeMessageEx imessage = from(message, isession);
imessage.addHeader("In-Reply-To", reply.msgid);
imessage.addHeader("References", (reply.references == null ? "" : reply.references + " ") + reply.msgid);
imessage.addHeader("In-Reply-To" , reply.msgid);
imessage.addHeader("References" , (reply.references == null ? "" : reply.references + " ") + reply.msgid);
return imessage;
}
@ -133,16 +133,16 @@ public class MessageHelper {
}
String getMessageID() throws MessagingException {
return imessage.getHeader("Message-ID", null);
return imessage.getHeader("Message-ID" , null);
}
String[] getReferences() throws MessagingException {
String refs = imessage.getHeader("References", null);
String refs = imessage.getHeader("References" , null);
return (refs == null ? new String[0] : refs.split("\\s+"));
}
String getInReplyTo() throws MessagingException {
return imessage.getHeader("In-Reply-To", null);
return imessage.getHeader("In-Reply-To" , null);
}
String getThreadId(long uid) throws MessagingException {
@ -184,9 +184,9 @@ public class MessageHelper {
String p = ((InternetAddress) address).getPersonal();
JSONObject jaddress = new JSONObject();
if (a != null)
jaddress.put("address", a);
jaddress.put("address" , a);
if (p != null)
jaddress.put("personal", p);
jaddress.put("personal" , p);
jaddresses.put(jaddress);
}
return jaddresses.toString();
@ -229,7 +229,7 @@ public class MessageHelper {
addresses.add(personal);
} else
addresses.add(address.toString());
return TextUtils.join(", ", addresses);
return TextUtils.join(", " , addresses);
} catch (Throwable ex) {
return ex.getMessage();
}
@ -244,7 +244,7 @@ public class MessageHelper {
try {
String s = part.getContent().toString();
if (part.isMimeType("text/plain"))
s = "<pre>" + s.replaceAll("\\r?\\n", "<br />") + "</pre>";
s = "<pre>" + s.replaceAll("\\r?\\n" , "<br />") + "</pre>";
return s;
} catch (IOException ex) {
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));

@ -30,7 +30,7 @@ public class MimeMessageEx extends MimeMessage {
.append("anonymous@localhost")
.append('>');
setHeader("Message-ID", sb.toString());
setHeader("Message-ID" , sb.toString());
Log.i(Helper.TAG, "Override Message-ID=" + sb.toString());
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
@ -50,7 +50,7 @@ public class MimeMessageEx extends MimeMessage {
String part = parts.get(0);
parts.remove(0);
if (!TextUtils.join(".", parts).startsWith(BuildConfig.APPLICATION_ID))
if (!TextUtils.join("." , parts).startsWith(BuildConfig.APPLICATION_ID))
return -1;
long id = Long.parseLong(part.substring(1));

@ -62,11 +62,11 @@ public class Provider {
provider.name = xml.getAttributeValue(null, "name");
} else if ("imap".equals(xml.getName())) {
provider.imap_host = xml.getAttributeValue(null, "host");
provider.imap_port = xml.getAttributeIntValue(null, "port", 0);
provider.imap_port = xml.getAttributeIntValue(null, "port" , 0);
} else if ("smtp".equals(xml.getName())) {
provider.smtp_host = xml.getAttributeValue(null, "host");
provider.smtp_port = xml.getAttributeIntValue(null, "port", 0);
provider.starttls = xml.getAttributeBooleanValue(null, "starttls", false);
provider.smtp_port = xml.getAttributeIntValue(null, "port" , 0);
provider.starttls = xml.getAttributeBooleanValue(null, "starttls" , false);
} else
throw new IllegalAccessException(xml.getName());
} else if (eventType == XmlPullParser.END_TAG) {

@ -114,9 +114,9 @@ public class ServiceSynchronize extends LifecycleService {
public ServiceSynchronize() {
// https://docs.oracle.com/javaee/6/api/javax/mail/internet/package-summary.html
System.setProperty("mail.mime.ignoreunknownencoding", "true");
System.setProperty("mail.mime.decodefilename", "true");
System.setProperty("mail.mime.encodefilename", "true");
System.setProperty("mail.mime.ignoreunknownencoding" , "true");
System.setProperty("mail.mime.decodefilename" , "true");
System.setProperty("mail.mime.encodefilename" , "true");
}
@Override
@ -286,8 +286,8 @@ public class ServiceSynchronize extends LifecycleService {
IMAPStore istore = null;
try {
Properties props = MessageHelper.getSessionProperties();
props.put("mail.imaps.peek", "true");
props.setProperty("mail.mime.address.strict", "false");
props.put("mail.imaps.peek" , "true");
props.setProperty("mail.mime.address.strict" , "false");
//props.put("mail.imaps.minidletime", "5000");
Session isession = Session.getInstance(props, null);
// isession.setDebug(true);
@ -392,7 +392,7 @@ public class ServiceSynchronize extends LifecycleService {
if (!EntityFolder.TYPE_OUTBOX.equals(folder.type))
lbm.sendBroadcast(new Intent(ACTION_PROCESS_FOLDER)
.setType("account/" + account.id)
.putExtra("folder", folder.id));
.putExtra("folder" , folder.id));
} catch (Throwable ex) {
Log.e(Helper.TAG, account.name + " " + ex + "\n" + Log.getStackTraceString(ex));
@ -444,7 +444,7 @@ public class ServiceSynchronize extends LifecycleService {
BroadcastReceiver processReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final long fid = intent.getLongExtra("folder", -1);
final long fid = intent.getLongExtra("folder" , -1);
IMAPFolder ifolder;
synchronized (mapFolder) {
@ -798,7 +798,7 @@ public class ServiceSynchronize extends LifecycleService {
Address[] to = imessage.getAllRecipients();
itransport.sendMessage(imessage, to);
Log.i(Helper.TAG, "Sent via " + ident.host + "/" + ident.user +
" to " + TextUtils.join(", ", to));
" to " + TextUtils.join(", " , to));
msg.sent = new Date().getTime();
msg.seen = true;
@ -919,7 +919,7 @@ public class ServiceSynchronize extends LifecycleService {
}
}
if (candidate) {
Log.i(Helper.TAG, ifolder.getFullName() + " candidate attr=" + TextUtils.join(",", attrs));
Log.i(Helper.TAG, ifolder.getFullName() + " candidate attr=" + TextUtils.join("," , attrs));
EntityFolder folder = dao.getFolderByName(account.id, ifolder.getFullName());
if (folder == null) {
folder = new EntityFolder();
@ -1068,7 +1068,7 @@ public class ServiceSynchronize extends LifecycleService {
message.folder = folder.id;
message.uid = uid;
message.msgid = helper.getMessageID();
message.references = TextUtils.join(" ", helper.getReferences());
message.references = TextUtils.join(" " , helper.getReferences());
message.inreplyto = helper.getInReplyTo();
message.thread = helper.getThreadId(uid);
message.from = helper.getFrom();
@ -1121,7 +1121,7 @@ public class ServiceSynchronize extends LifecycleService {
ifolder.doCommand(new IMAPFolder.ProtocolCommand() {
public Object doCommand(IMAPProtocol p) throws ProtocolException {
Log.i(Helper.TAG, ifolder.getName() + " start NOOP");
p.simpleCommand("NOOP", null);
p.simpleCommand("NOOP" , null);
Log.i(Helper.TAG, ifolder.getName() + " end NOOP");
return null;
}
@ -1234,20 +1234,20 @@ public class ServiceSynchronize extends LifecycleService {
NotificationManager nm = context.getSystemService(NotificationManager.class);
NotificationChannel service = new NotificationChannel(
"service",
"service" ,
context.getString(R.string.channel_service),
NotificationManager.IMPORTANCE_MIN);
service.setSound(null, Notification.AUDIO_ATTRIBUTES_DEFAULT);
nm.createNotificationChannel(service);
NotificationChannel notification = new NotificationChannel(
"notification",
"notification" ,
context.getString(R.string.channel_notification),
NotificationManager.IMPORTANCE_DEFAULT);
nm.createNotificationChannel(notification);
NotificationChannel error = new NotificationChannel(
"error",
"error" ,
context.getString(R.string.channel_error),
NotificationManager.IMPORTANCE_HIGH);
nm.createNotificationChannel(error);

Loading…
Cancel
Save