Browse Source

Improvements

main
M66B 6 years ago
parent
commit
f83a4f60ec
3 changed files with 12 additions and 5 deletions
  1. +9
    -4
      app/src/main/java/eu/faircode/email/FragmentCompose.java
  2. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentFolder.java
  3. +2
    -0
      app/src/main/java/eu/faircode/email/MessageHelper.java

+ 9
- 4
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

@ -49,6 +49,7 @@ import android.widget.Spinner;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.snackbar.Snackbar;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
@ -79,6 +80,7 @@ import androidx.recyclerview.widget.RecyclerView;
import static android.app.Activity.RESULT_OK; import static android.app.Activity.RESULT_OK;
public class FragmentCompose extends FragmentEx { public class FragmentCompose extends FragmentEx {
private ViewGroup view;
private Spinner spFrom; private Spinner spFrom;
private ImageView ivIdentityAdd; private ImageView ivIdentityAdd;
private AutoCompleteTextView etTo; private AutoCompleteTextView etTo;
@ -106,7 +108,7 @@ public class FragmentCompose extends FragmentEx {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
setSubtitle(R.string.title_compose); setSubtitle(R.string.title_compose);
View view = inflater.inflate(R.layout.fragment_compose, container, false);
view = (ViewGroup) inflater.inflate(R.layout.fragment_compose, container, false);
// Get controls // Get controls
spFrom = view.findViewById(R.id.spFrom); spFrom = view.findViewById(R.id.spFrom);
@ -376,7 +378,7 @@ public class FragmentCompose extends FragmentEx {
} }
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex)); Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
Toast.makeText(getContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
Toast.makeText(getContext(), ex.toString(), Toast.LENGTH_LONG).show();
} finally { } finally {
if (cursor != null) if (cursor != null)
cursor.close(); cursor.close();
@ -794,14 +796,17 @@ public class FragmentCompose extends FragmentEx {
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
Toast.makeText(getContext(), R.string.title_draft_trashed, Toast.LENGTH_LONG).show(); Toast.makeText(getContext(), R.string.title_draft_trashed, Toast.LENGTH_LONG).show();
} else if (action == R.id.action_save) } else if (action == R.id.action_save)
Toast.makeText(getContext(), R.string.title_draft_saved, Toast.LENGTH_LONG).show();
Snackbar.make(view, R.string.title_draft_saved, Snackbar.LENGTH_LONG).show();
else if (action == R.id.action_send) { else if (action == R.id.action_send) {
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
Toast.makeText(getContext(), R.string.title_queued, Toast.LENGTH_LONG).show(); Toast.makeText(getContext(), R.string.title_queued, Toast.LENGTH_LONG).show();
} }
} else { } else {
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex)); Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
Toast.makeText(getContext(), Helper.formatThrowable(ex), Toast.LENGTH_LONG).show();
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
else
Toast.makeText(getContext(), ex.toString(), Toast.LENGTH_LONG).show();
} }
} }


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentFolder.java View File

@ -175,7 +175,7 @@ public class FragmentFolder extends FragmentEx {
getFragmentManager().popBackStack(); getFragmentManager().popBackStack();
else { else {
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex)); Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
Toast.makeText(getContext(), Helper.formatThrowable(ex), Toast.LENGTH_LONG).show();
Toast.makeText(getContext(), ex.toString(), Toast.LENGTH_LONG).show();
} }
} }


+ 2
- 0
app/src/main/java/eu/faircode/email/MessageHelper.java View File

@ -102,6 +102,8 @@ public class MessageHelper {
if (message.subject != null) if (message.subject != null)
imessage.setSubject(message.subject); imessage.setSubject(message.subject);
// TODO: plain message?
if (attachments.size() == 0) { if (attachments.size() == 0) {
if (message.body != null) if (message.body != null)
imessage.setText(message.body, Charset.defaultCharset().name(), "html"); imessage.setText(message.body, Charset.defaultCharset().name(), "html");


Loading…
Cancel
Save