mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-15 08:29:24 +00:00
Small fixes and improvements
This commit is contained in:
parent
84f63ab473
commit
2ac7976681
9 changed files with 34 additions and 82 deletions
|
@ -41,6 +41,7 @@ This app starts a foreground service with a low priority status bar notification
|
|||
* Snooze messages
|
||||
* Send messages after selected time
|
||||
* Reply templates
|
||||
* Filter rules
|
||||
* Search on server
|
||||
* Keyword management
|
||||
* Encryption/decryption ([OpenPGP](https://www.openpgp.org/))
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.content.Intent;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.text.Collator;
|
||||
|
@ -52,6 +53,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
|||
private View itemView;
|
||||
private TextView tvName;
|
||||
private TextView tvOrder;
|
||||
private ImageView ivStop;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
@ -59,6 +61,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
|||
this.itemView = itemView.findViewById(R.id.clItem);
|
||||
tvName = itemView.findViewById(R.id.tvName);
|
||||
tvOrder = itemView.findViewById(R.id.tvOrder);
|
||||
ivStop = itemView.findViewById(R.id.ivStop);
|
||||
}
|
||||
|
||||
private void wire() {
|
||||
|
@ -73,6 +76,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
|||
itemView.setActivated(!rule.enabled);
|
||||
tvName.setText(rule.name);
|
||||
tvOrder.setText(Integer.toString(rule.order));
|
||||
ivStop.setVisibility(rule.stop ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -134,7 +134,7 @@ public class EntityRule {
|
|||
try {
|
||||
JSONObject jargs = new JSONObject(action);
|
||||
int type = jargs.getInt("type");
|
||||
Log.i("Executing rule=" + type + " message=" + message.id);
|
||||
Log.i("Executing rule=" + type + ":" + name + " message=" + message.id);
|
||||
|
||||
switch (type) {
|
||||
case TYPE_SEEN:
|
||||
|
|
|
@ -34,7 +34,6 @@ import com.google.android.material.bottomnavigation.BottomNavigationView;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
|
||||
public class FragmentAnswer extends FragmentBase {
|
||||
private ViewGroup view;
|
||||
|
@ -70,7 +69,7 @@ public class FragmentAnswer extends FragmentBase {
|
|||
|
||||
bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(MenuItem menuItem) {
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.action_delete:
|
||||
onActionDelete();
|
||||
|
@ -84,8 +83,6 @@ public class FragmentAnswer extends FragmentBase {
|
|||
}
|
||||
});
|
||||
|
||||
((ActivityBase) getActivity()).addBackPressedListener(onBackPressedListener);
|
||||
|
||||
// Initialize
|
||||
grpReady.setVisibility(View.GONE);
|
||||
pbWait.setVisibility(View.VISIBLE);
|
||||
|
@ -93,12 +90,6 @@ public class FragmentAnswer extends FragmentBase {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
((ActivityBase) getActivity()).removeBackPressedListener(onBackPressedListener);
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
@ -223,31 +214,4 @@ public class FragmentAnswer extends FragmentBase {
|
|||
}
|
||||
}.execute(this, args, "answer:save");
|
||||
}
|
||||
|
||||
private void handleExit() {
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
|
||||
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
|
||||
.setMessage(R.string.title_ask_save)
|
||||
.setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
onActionSave();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.title_no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
ActivityBase.IBackPressedListener onBackPressedListener = new ActivityBase.IBackPressedListener() {
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
handleExit();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ import java.util.List;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
|
||||
public class FragmentRule extends FragmentBase {
|
||||
private ViewGroup view;
|
||||
|
@ -136,7 +135,7 @@ public class FragmentRule extends FragmentBase {
|
|||
|
||||
bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(MenuItem menuItem) {
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.action_delete:
|
||||
onActionTrash();
|
||||
|
@ -150,8 +149,6 @@ public class FragmentRule extends FragmentBase {
|
|||
}
|
||||
});
|
||||
|
||||
((ActivityBase) getActivity()).addBackPressedListener(onBackPressedListener);
|
||||
|
||||
// Initialize
|
||||
bottom_navigation.setVisibility(View.GONE);
|
||||
grpReady.setVisibility(View.GONE);
|
||||
|
@ -161,12 +158,6 @@ public class FragmentRule extends FragmentBase {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
((ActivityBase) getActivity()).removeBackPressedListener(onBackPressedListener);
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
@ -388,8 +379,7 @@ public class FragmentRule extends FragmentBase {
|
|||
JSONObject jsender = jcondition.optJSONObject("sender");
|
||||
JSONObject jsubject = jcondition.optJSONObject("subject");
|
||||
|
||||
if (TextUtils.isEmpty(jsender.optString("value")) &&
|
||||
TextUtils.isEmpty(jsubject.optString("value")))
|
||||
if (jsender == null && jsubject == null)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_rule_condition_missing));
|
||||
|
||||
if (TextUtils.isEmpty(order))
|
||||
|
@ -439,33 +429,6 @@ public class FragmentRule extends FragmentBase {
|
|||
}
|
||||
}
|
||||
|
||||
private void handleExit() {
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
|
||||
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
|
||||
.setMessage(R.string.title_ask_save)
|
||||
.setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
onActionSave();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.title_no, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
ActivityBase.IBackPressedListener onBackPressedListener = new ActivityBase.IBackPressedListener() {
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
handleExit();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
private class Action {
|
||||
int type;
|
||||
String name;
|
||||
|
|
10
app/src/main/res/drawable/baseline_stop_24.xml
Normal file
10
app/src/main/res/drawable/baseline_stop_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M6,6h12v12H6z"/>
|
||||
</vector>
|
|
@ -117,6 +117,7 @@
|
|||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_rule_and"
|
||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etSender" />
|
||||
|
|
|
@ -15,25 +15,35 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="Name"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivStop"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvOrder"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="@+id/ivStop" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvOrder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:text="Order"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivStop"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivStop"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivStop" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivStop"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:src="@drawable/baseline_stop_24"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@ -45,6 +55,6 @@
|
|||
android:layout_marginBottom="6dp"
|
||||
android:background="?attr/colorSeparator"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvName" />
|
||||
app:layout_constraintTop_toBottomOf="@id/ivStop" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
|
@ -308,7 +308,6 @@
|
|||
<string name="title_ask_delete_answer">Delete reply template permanently?</string>
|
||||
<string name="title_ask_delete_rule">Delete rule permanently?</string>
|
||||
<string name="title_ask_discard">Discard draft?</string>
|
||||
<string name="title_ask_save">Save changes?</string>
|
||||
<string name="title_ask_spam">Report as spam?</string>
|
||||
<string name="title_ask_show_html">Showing the original message can leak privacy sensitive information</string>
|
||||
<string name="title_ask_show_image">Showing images can leak privacy sensitive information</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue