Journal list: Use icons for actions instead of text.

pull/14/head
Tom Hacohen 7 years ago
parent a3e4fc48ab
commit 889eede699

@ -19,6 +19,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.etesync.syncadapter.App;
@ -29,7 +30,6 @@ import com.etesync.syncadapter.model.JournalEntity;
import com.etesync.syncadapter.model.JournalModel;
import java.util.List;
import java.util.Locale;
import io.requery.Persistable;
import io.requery.sql.EntityDataStore;
@ -126,13 +126,26 @@ public class ListEntriesFragment extends ListFragment implements AdapterView.OnI
}
String content = getLine(fullContent, prefix);
content = (content != null) ? content : entryEntity.getUid().substring(0, 20);
tv.setText(String.format(Locale.getDefault(), "%s: %s", entryEntity.getContent().getAction().toString(), content));
tv.setText(content);
tv = (TextView) v.findViewById(R.id.description);
content = getLine(fullContent, "UID:");
content = "UID: " + ((content != null) ? content : "Not found");
tv.setText(content);
ImageView action = (ImageView) v.findViewById(R.id.action);
switch (entryEntity.getContent().getAction()) {
case ADD:
action.setImageResource(R.drawable.action_add);
break;
case CHANGE:
action.setImageResource(R.drawable.action_change);
break;
case DELETE:
action.setImageResource(R.drawable.action_delete);
break;
}
return v;
}
}

@ -0,0 +1,17 @@
<!--
~ Copyright © 2013 2016 Ricki Hirner (bitfire web engineering).
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the GNU Public License v3.0
~ which accompanies this distribution, and is available at
~ http://www.gnu.org/licenses/gpl.html
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF16B14B"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

@ -0,0 +1,5 @@
<vector android:alpha="0.54" android:height="24dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFEB115" android:pathData="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"/>
</vector>

@ -0,0 +1,5 @@
<vector android:alpha="0.54" android:height="24dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFF20C0C" android:pathData="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z"/>
</vector>

@ -7,6 +7,11 @@
android:padding="8dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/action"
android:layout_width="32dp"
android:layout_height="32dp" />
<LinearLayout android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"

Loading…
Cancel
Save