Browse Source

record over view: number of attacks in section header

Julien Clauter 11 năm trước cách đây
mục cha
commit
641ae69af5

+ 16 - 2
res/layout/expandable_section_header.xml

@@ -3,9 +3,10 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical"
+    android:orientation="horizontal"
     android:padding="8dp"
-    android:background="#ffffff">
+    android:background="#ffffff"
+    android:weightSum="1">
 
 
     <TextView
@@ -14,6 +15,19 @@
         android:layout_height="wrap_content"
         android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
         android:textSize="17dp"
+        android:layout_weight="0.4"
         android:textColor="#505c6d" />
 
+    <TextView
+        android:id="@+id/sectionHeaderValue"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
+        android:textSize="15dp"
+        android:gravity="right"
+        android:textColor="#505c6d"
+        android:layout_weight="0.6"
+        />
+
+
 </LinearLayout>

+ 8 - 3
src/de/tudarmstadt/informatik/hostage/ui2/adapter/RecordListAdapter.java

@@ -1,12 +1,13 @@
 package de.tudarmstadt.informatik.hostage.ui2.adapter;
 
+import android.content.Context;
+import android.view.View;
+import android.widget.TextView;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
-import android.content.Context;
-import android.view.View;
-import android.widget.TextView;
 import de.tudarmstadt.informatik.hostage.R;
 import de.tudarmstadt.informatik.hostage.ui2.model.ExpandableListItem;
 
@@ -37,8 +38,12 @@ public class RecordListAdapter extends ExpandableListAdapter {
     @Override
     public void configureSectionHeaderView(View sectionHeader, int section) {
         int headerLabelID = R.id.sectionHeaderTitle;
+        int valueLabelID = R.id.sectionHeaderValue;
         TextView tView = (TextView) sectionHeader.findViewById(headerLabelID);
+        TextView vView = (TextView) sectionHeader.findViewById(valueLabelID);
+        int value = this.getChildrenCount(section);
         tView.setText(this._sectionHeader.get(section));
+        vView.setText("" + value);
     }
 
     @Override

+ 2 - 0
src/de/tudarmstadt/informatik/hostage/ui2/fragment/RecordOverviewFragment.java

@@ -303,6 +303,8 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
                 sectionData.put(groupID, items);
                 groupTitle.add(groupID);
             }
+
+
 			items.add(item);
 		}