mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
62dee461ee
commit
cd1d89a7d3
|
@ -340,10 +340,10 @@ public class FragmentCompose extends FragmentBase {
|
||||||
onMenuStyle(item.getItemId());
|
onMenuStyle(item.getItemId());
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_image:
|
case R.id.menu_image:
|
||||||
onMenuImage();
|
onActionImage();
|
||||||
return true;
|
return true;
|
||||||
case R.id.menu_attachment:
|
case R.id.menu_attachment:
|
||||||
onMenuAttachment();
|
onActionAttachment();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -787,6 +787,34 @@ public class FragmentCompose extends FragmentBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onMenuAddresses() {
|
||||||
|
grpAddresses.setVisibility(grpAddresses.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onMenuZoom() {
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
boolean compact = prefs.getBoolean("compact", false);
|
||||||
|
int zoom = prefs.getInt("zoom", compact ? 0 : 1);
|
||||||
|
zoom = ++zoom % 3;
|
||||||
|
prefs.edit().putInt("zoom", zoom).apply();
|
||||||
|
setZoom();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setZoom() {
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
boolean compact = prefs.getBoolean("compact", false);
|
||||||
|
int zoom = prefs.getInt("zoom", compact ? 0 : 1);
|
||||||
|
setZoom(zoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setZoom(int zoom) {
|
||||||
|
float textSize = Helper.getTextSize(getContext(), zoom);
|
||||||
|
if (textSize != 0) {
|
||||||
|
etBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
||||||
|
tvReference.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onMenuStyle(int id) {
|
private void onMenuStyle(int id) {
|
||||||
int s = etBody.getSelectionStart();
|
int s = etBody.getSelectionStart();
|
||||||
int e = etBody.getSelectionEnd();
|
int e = etBody.getSelectionEnd();
|
||||||
|
@ -942,31 +970,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMenuZoom() {
|
private void onActionImage() {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
||||||
boolean compact = prefs.getBoolean("compact", false);
|
|
||||||
int zoom = prefs.getInt("zoom", compact ? 0 : 1);
|
|
||||||
zoom = ++zoom % 3;
|
|
||||||
prefs.edit().putInt("zoom", zoom).apply();
|
|
||||||
setZoom();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setZoom() {
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
||||||
boolean compact = prefs.getBoolean("compact", false);
|
|
||||||
int zoom = prefs.getInt("zoom", compact ? 0 : 1);
|
|
||||||
setZoom(zoom);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setZoom(int zoom) {
|
|
||||||
float textSize = Helper.getTextSize(getContext(), zoom);
|
|
||||||
if (textSize != 0) {
|
|
||||||
etBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
|
||||||
tvReference.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onMenuImage() {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
intent.setType("image/*");
|
intent.setType("image/*");
|
||||||
|
@ -977,7 +981,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
startActivityForResult(Helper.getChooser(getContext(), intent), ActivityCompose.REQUEST_IMAGE);
|
startActivityForResult(Helper.getChooser(getContext(), intent), ActivityCompose.REQUEST_IMAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMenuAttachment() {
|
private void onActionAttachment() {
|
||||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
intent.setType("*/*");
|
intent.setType("*/*");
|
||||||
|
@ -989,10 +993,6 @@ public class FragmentCompose extends FragmentBase {
|
||||||
startActivityForResult(Helper.getChooser(getContext(), intent), ActivityCompose.REQUEST_ATTACHMENT);
|
startActivityForResult(Helper.getChooser(getContext(), intent), ActivityCompose.REQUEST_ATTACHMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMenuAddresses() {
|
|
||||||
grpAddresses.setVisibility(grpAddresses.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onActionDelete() {
|
private void onActionDelete() {
|
||||||
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
|
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
|
||||||
.setMessage(R.string.title_ask_discard)
|
.setMessage(R.string.title_ask_discard)
|
||||||
|
|
Loading…
Reference in New Issue