Show operation parameters

pull/146/head
M66B 6 years ago
parent a0935be3af
commit 0f75bea049

@ -52,6 +52,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
View itemView;
TextView tvMessage;
TextView tvName;
TextView tvArgs;
TextView tvTime;
ViewHolder(View itemView) {
@ -60,6 +61,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
this.itemView = itemView;
tvMessage = itemView.findViewById(R.id.tvMessage);
tvName = itemView.findViewById(R.id.tvName);
tvArgs = itemView.findViewById(R.id.tvArgs);
tvTime = itemView.findViewById(R.id.tvTime);
}
@ -74,6 +76,7 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
private void bindTo(EntityOperation operation) {
tvMessage.setText(Long.toString(operation.message));
tvName.setText(operation.name);
tvArgs.setText(operation.args);
tvTime.setText(df.format(new Date(operation.created)));
}

@ -80,29 +80,29 @@ public class EntityOperation {
private static List<Intent> queue = new ArrayList<>();
static void queue(DB db, EntityMessage message, String name) {
JSONArray jsonArray = new JSONArray();
queue(db, message, name, jsonArray);
JSONArray jargs = new JSONArray();
queue(db, message, name, jargs);
}
static void queue(DB db, EntityMessage message, String name, Object value) {
JSONArray jsonArray = new JSONArray();
jsonArray.put(value);
queue(db, message, name, jsonArray);
JSONArray jargs = new JSONArray();
jargs.put(value);
queue(db, message, name, jargs);
}
static void queue(DB db, EntityMessage message, String name, Object value1, Object value2) {
JSONArray jsonArray = new JSONArray();
jsonArray.put(value1);
jsonArray.put(value2);
queue(db, message, name, jsonArray);
JSONArray jargs = new JSONArray();
jargs.put(value1);
jargs.put(value2);
queue(db, message, name, jargs);
}
private static void queue(DB db, EntityMessage message, String name, JSONArray jsonArray) {
private static void queue(DB db, EntityMessage message, String name, JSONArray jargs) {
EntityOperation operation = new EntityOperation();
operation.folder = message.folder;
operation.message = message.id;
operation.name = name;
operation.args = jsonArray.toString();
operation.args = jargs.toString();
operation.created = new Date().getTime();
operation.id = db.operation().insertOperation(operation);
@ -137,7 +137,8 @@ public class EntityOperation {
return (this.folder.equals(other.folder) &&
this.message.equals(other.message) &&
this.name.equals(other.name) &&
this.args.equals(other.args));
this.args.equals(other.args) &&
this.created.equals(other.created));
} else
return false;
}

@ -3,8 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp">
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp">
<TextView
android:id="@+id/tvMessage"
@ -26,6 +26,18 @@
app:layout_constraintStart_toEndOf="@id/tvMessage"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvArgs"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="Arguments"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toStartOf="@+id/tvTime"
app:layout_constraintStart_toEndOf="@id/tvName"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"
@ -35,4 +47,5 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Loading…
Cancel
Save