Jelajahi Sumber

move timestamp below message, move buttons back to the left

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 2 tahun lalu
induk
melakukan
09c7aa2d0a

+ 13 - 1
app/src/main/java/com/owncloud/android/ui/adapter/NotificationListAdapter.java

@@ -36,6 +36,7 @@ import android.text.style.ForegroundColorSpan;
 import android.text.style.StyleSpan;
 import android.view.Gravity;
 import android.view.LayoutInflater;
+import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -144,7 +145,12 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
             }
         }
 
-        holder.binding.message.setText(notification.getMessage());
+        if (notification.getMessage() != null && !notification.getMessage().isEmpty()) {
+            holder.binding.message.setText(notification.getMessage());
+            holder.binding.message.setVisibility(View.VISIBLE);
+        } else {
+            holder.binding.message.setVisibility(View.GONE);
+        }
 
         if (!TextUtils.isEmpty(notification.getIcon())) {
             downloadIcon(notification.getIcon(), holder.binding.icon, notificationsActivity);
@@ -179,6 +185,12 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
 
         List<Action> overflowActions = new ArrayList<>();
 
+        if (notification.getActions().size() > 0) {
+            holder.binding.buttons.setVisibility(View.VISIBLE);
+        } else {
+            holder.binding.buttons.setVisibility(View.GONE);
+        }
+
         if (notification.getActions().size() > 2) {
             for (Action action : notification.getActions()) {
                 if (action.primary) {

+ 11 - 12
app/src/main/res/layout/notification_list_item.xml

@@ -23,7 +23,6 @@
   along with this program. If not, see <https://www.gnu.org/licenses/>.
 -->
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
@@ -80,31 +79,31 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:ellipsize="end"
+            android:paddingBottom="@dimen/standard_quarter_padding"
             android:textAppearance="?android:attr/textAppearanceListItem"
             android:textColor="@color/secondary_text_color"
             android:textSize="@dimen/txt_size_14sp"
             tools:text="@string/placeholder_sentence" />
 
-        <LinearLayout
-            android:id="@+id/buttons"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="end"
-            android:layout_marginEnd="@dimen/notification_list_item_grid_layout_left_start_margin"
-            android:layout_marginTop="@dimen/alternate_half_margin"
-            android:columnCount="3"
-            android:orientation="horizontal" />
-
         <TextView
             android:id="@+id/datetime"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="end"
             android:ellipsize="end"
             android:textColor="@color/secondary_text_color"
             android:textSize="@dimen/text_size_13sp"
             tools:text="@string/placeholder_sentence" />
 
+        <LinearLayout
+            android:id="@+id/buttons"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/standard_quarter_margin"
+            android:layout_marginEnd="@dimen/notification_list_item_grid_layout_left_start_margin"
+            android:columnCount="3"
+            android:gravity="start"
+            android:orientation="horizontal" />
+
     </LinearLayout>
 
 </RelativeLayout>

+ 1 - 1
app/src/main/res/values/dims.xml

@@ -100,7 +100,7 @@
     <dimen name="activity_row_layout_height">48dp</dimen>
     <dimen name="notification_icon_width">24dp</dimen>
     <dimen name="notification_icon_height">24dp</dimen>
-    <dimen name="notification_icon_layout_right_end_margin">22dp</dimen>
+    <dimen name="notification_icon_layout_right_end_margin">21dp</dimen>
     <dimen name="notification_list_item_grid_layout_left_start_margin">-8dp</dimen>
     <dimen name="uploader_list_separator_height">1dp</dimen>
     <dimen name="contactlist_item_icon_layout_width">40dp</dimen>