Download flags for debugging purposes

pull/147/head
M66B 6 years ago
parent 174ff16b4c
commit 187ec27083

File diff suppressed because it is too large Load Diff

@ -187,6 +187,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private TextView tvTimeEx;
private TextView tvSizeEx;
private TextView tvSubjectEx;
private TextView tvFlags;
private TextView tvKeywords;
private TextView tvHeaders;
@ -257,6 +258,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvTimeEx = itemView.findViewById(R.id.tvTimeEx);
tvSizeEx = itemView.findViewById(R.id.tvSizeEx);
tvSubjectEx = itemView.findViewById(R.id.tvSubjectEx);
tvFlags = itemView.findViewById(R.id.tvFlags);
tvKeywords = itemView.findViewById(R.id.tvKeywords);
tvHeaders = itemView.findViewById(R.id.tvHeaders);
@ -393,6 +395,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvError.setVisibility(View.GONE);
pbLoading.setVisibility(View.VISIBLE);
tvFlags.setVisibility(View.GONE);
tvKeywords.setVisibility(View.GONE);
pbHeaders.setVisibility(View.GONE);
@ -616,6 +619,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
grpExpanded.setVisibility(viewType == ViewType.THREAD && show_expanded ? View.VISIBLE : View.GONE);
grpAddress.setVisibility(viewType == ViewType.THREAD && show_expanded && show_addresses ? View.VISIBLE : View.GONE);
tvFlags.setVisibility(View.GONE);
tvKeywords.setVisibility(View.GONE);
ivSearchContact.setVisibility(
viewType == ViewType.THREAD && show_expanded && show_addresses &&
@ -663,6 +667,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvSizeEx.setVisibility(message.size == null ? View.GONE : View.VISIBLE);
tvSubjectEx.setText(message.subject);
tvFlags.setText(message.flags);
tvFlags.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
tvKeywords.setText(TextUtils.join(" ", message.keywords));
tvKeywords.setVisibility(message.keywords.length > 0 ? View.VISIBLE : View.GONE);

@ -49,7 +49,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 40,
version = 41,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -475,6 +475,13 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `identity` ADD COLUMN `last_connected` INTEGER");
}
})
.addMigrations(new Migration(40, 41) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `message` ADD COLUMN `flags` TEXT");
}
})
.build();
}

@ -116,6 +116,7 @@ public class EntityMessage implements Serializable {
public Boolean answered = false;
@NonNull
public Boolean flagged = false;
public String flags; // system flags
public String[] keywords; // user flags
@NonNull
public Boolean ui_seen = false;
@ -217,6 +218,7 @@ public class EntityMessage implements Serializable {
//this.seen.equals(other.seen) &&
//this.answered.equals(other.answered) &&
//this.flagged.equals(other.flagged) &&
(!BuildConfig.DEBUG || (this.flags == null ? other.flags == null : this.flags.equals(other.flags))) &&
Helper.equal(this.keywords, other.keywords) &&
this.ui_seen.equals(other.ui_seen) &&
this.ui_answered.equals(other.ui_answered) &&
@ -263,6 +265,7 @@ public class EntityMessage implements Serializable {
this.seen.equals(other.seen) &&
this.answered.equals(other.answered) &&
this.flagged.equals(other.flagged) &&
(this.flags == null ? other.flags == null : this.flags.equals(other.flags)) &&
Helper.equal(this.keywords, other.keywords) &&
this.ui_seen.equals(other.ui_seen) &&
this.ui_answered.equals(other.ui_answered) &&

@ -413,6 +413,15 @@ public class MessageHelper {
return imessage.isSet(Flags.Flag.FLAGGED);
}
String getFlags() throws MessagingException {
if (!BuildConfig.DEBUG)
return null;
Flags flags = imessage.getFlags();
flags.clearUserFlags();
return flags.toString();
}
String[] getKeywords() throws MessagingException {
return imessage.getFlags().getUserFlags();
}

@ -2561,6 +2561,7 @@ public class ServiceSynchronize extends LifecycleService {
boolean seen = helper.getSeen();
boolean answered = helper.getAnsered();
boolean flagged = helper.getFlagged();
String flags = helper.getFlags();
String[] keywords = helper.getKeywords();
boolean filter = false;
@ -2677,6 +2678,7 @@ public class ServiceSynchronize extends LifecycleService {
message.seen = seen;
message.answered = answered;
message.flagged = flagged;
message.flags = flags;
message.keywords = keywords;
message.ui_seen = seen;
message.ui_answered = answered;
@ -2735,6 +2737,12 @@ public class ServiceSynchronize extends LifecycleService {
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " flagged=" + flagged);
}
if (flags == null ? message.flags != null : !flags.equals(message.flags)) {
update = true;
message.flags = flags;
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " flags=" + flags);
}
if (!Helper.equal(message.keywords, keywords)) {
update = true;
message.keywords = keywords;

@ -519,6 +519,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSizeEx" />
<TextView
android:id="@+id/tvFlags"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="Flags"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEx" />
<TextView
android:id="@+id/tvKeywords"
android:layout_width="0dp"
@ -530,7 +543,7 @@
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEx" />
app:layout_constraintTop_toBottomOf="@id/tvFlags" />
<View
android:id="@+id/vSeparatorHeaders"

@ -511,6 +511,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSizeEx" />
<TextView
android:id="@+id/tvFlags"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="Flags"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEx" />
<TextView
android:id="@+id/tvKeywords"
android:layout_width="0dp"
@ -522,7 +535,7 @@
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEx" />
app:layout_constraintTop_toBottomOf="@id/tvFlags" />
<View
android:id="@+id/vSeparatorHeaders"

Loading…
Cancel
Save