Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.46 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="match_parent"
  5. android:background="#000000" >
  6.  
  7. <ImageView
  8. android:id="@+id/divider_top"
  9. android:layout_width="fill_parent"
  10. android:layout_height="wrap_content"
  11. android:layout_alignParentTop="true"
  12. android:layout_centerHorizontal="true"
  13. android:background="@drawable/divider_vertical" />
  14.  
  15. <TextView
  16. android:id="@+id/lblListHeader"
  17. android:layout_width="fill_parent"
  18. android:layout_height="wrap_content"
  19. android:layout_below="@id/divider_top"
  20. android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
  21. android:textColor="#c5e26d"
  22. android:textSize="17dp" />
  23.  
  24. <ImageView
  25. android:id="@+id/divider_bottom"
  26. android:layout_width="fill_parent"
  27. android:layout_height="wrap_content"
  28. android:layout_below="@id/lblListHeader"
  29. android:layout_centerHorizontal="true"
  30. android:background="@drawable/divider" />
  31.  
  32. </RelativeLayout>
  33.  
  34. android:background="@drawable/top_divider"
  35.  
  36. <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  37. <item android:left="-1dp" android:right="-1dp" android:bottom="-1dp">
  38. <shape>
  39. <solid android:color="@android:color/transparent" />
  40. <stroke android:width="1dp" android:color="@android:color/black" />
  41. </shape>
  42. </item>
  43. </layer-list>
  44.  
  45. <?xml version="1.0" encoding="utf-8"?>
  46. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  47. android:layout_width="match_parent"
  48. android:layout_height="wrap_content"
  49. android:background="@color/white"
  50. android:minHeight="50dp"
  51. android:orientation="vertical">
  52.  
  53. <View
  54. android:id="@+id/adapter_divider_top"
  55. android:layout_width="match_parent"
  56. android:layout_height="1dp"
  57. android:background="#B6B6B6" />
  58.  
  59. <TextView
  60. android:id="@+id/tv_adapter_text"
  61. android:layout_width="match_parent"
  62. android:layout_height="match_parent"
  63. android:gravity="center_vertical"
  64. android:paddingBottom="10dp"
  65. android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
  66. android:paddingRight="10dp"
  67. android:paddingTop="10dp"
  68. android:text="Home"
  69. android:textAppearance="?android:attr/textAppearanceMedium"
  70. android:textColor="@color/primary_text" />
  71.  
  72. </LinearLayout>
  73.  
  74. <?xml version="1.0" encoding="utf-8"?>
  75. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  76. android:layout_width="match_parent"
  77. android:layout_height="wrap_content"
  78. android:orientation="vertical">
  79.  
  80. <TextView
  81. android:id="@+id/tv_adapter_desc"
  82. android:layout_width="match_parent"
  83. android:layout_height="match_parent"
  84. android:padding="10dp"
  85. android:text="description"
  86. android:textAppearance="?android:attr/textAppearanceMedium"
  87. android:textColor="#212121" />
  88.  
  89. <View
  90. android:id="@+id/adapter_divider_bottom"
  91. android:layout_width="match_parent"
  92. android:layout_height="1dp"
  93. android:background="@color/divider" />
  94. </LinearLayout>
  95.  
  96. @Override
  97. public View getGroupView(int groupPosition, boolean isExpanded, View view, ViewGroup viewGroup) {
  98.  
  99. if (view == null) {
  100.  
  101. view = mInflater.inflate(R.layout.group_item_layout, null);
  102.  
  103. mGroupViewHolder = new GroupViewHolder();
  104.  
  105. mGroupViewHolder.tvTitle = (TextView) view.findViewById(R.id.tv_adapter_title);
  106.  
  107. mGroupViewHolder.dividerTop = view.findViewById(R.id.adapter_divider_top);
  108.  
  109. view.setTag(mGroupViewHolder);
  110.  
  111. } else {
  112.  
  113. mGroupViewHolder = (GroupViewHolder) view.getTag();
  114.  
  115. }
  116.  
  117. // That if you want to show divider in expanded group only.
  118. // If you want to show divider in all group items remove this block.
  119. if (isExpanded) {
  120.  
  121. mGroupViewHolder.dividerTop.setVisibility(View.VISIBLE);
  122.  
  123. } else {
  124.  
  125. mGroupViewHolder.dividerTop.setVisibility(View.INVISIBLE);
  126.  
  127. }
  128. // That if you want to show divider in expanded group only.
  129.  
  130. String myTitle = getGroup(groupPosition);
  131.  
  132. if(myTitle != null) {
  133.  
  134. mGroupViewHolder.tvTitle.setText(myTitle);
  135.  
  136. }
  137.  
  138. return view;
  139. }
  140.  
  141. @Override
  142. public View getChildView(final int groupPosition, int childPosition, boolean isLastChild, View convertView, final ViewGroup parent) {
  143.  
  144.  
  145. if (view == null) {
  146.  
  147. view = mInflater.inflate(R.layout.child_item_layout, null);
  148.  
  149. mChildViewHolder = new ChildViewHolder();
  150.  
  151. mChildViewHolder.tvDesc = (TextView) view.findViewById(R.id.tv_adapter_desc);
  152.  
  153. mChildViewHolder.dividerBottom = view.findViewById(R.id.adapter_divider_bottom);
  154.  
  155. view.setTag(mChildViewHolder);
  156.  
  157. } else {
  158.  
  159. mChildViewHolder = (ChildViewHolder) view.getTag();
  160.  
  161. }
  162.  
  163. if(isLastChild) {
  164.  
  165. mChildViewHolder.dividerBottom.setVisibility(View.VISIBLE);
  166.  
  167. } else {
  168.  
  169. mChildViewHolder.dividerBottom.setVisibility(View.INVISIBLE);
  170.  
  171. }
  172.  
  173. Timesheet timesheet = getChild(groupPosition, childPosition);
  174.  
  175. if(timesheet != null) {
  176.  
  177. mChildViewHolder.tvDesc.setText(timesheet.getDescription());
  178.  
  179. }
  180.  
  181.  
  182. return view;
  183. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement