Commit 691d9f67bd8d04d019af9af334931fdea27cbaab

Authored by wutaian
1 parent a5a485e9

修改投票选举UI,相关UI的业务逻辑

C5/app/src/main/AndroidManifest.xml
... ... @@ -4,9 +4,6 @@
4 4 package="com.sunvote.xpadapp"
5 5 android:versionCode="70"
6 6 android:versionName="1.3.0.0"> <!-- android:sharedUserId="android.studentUID.system" -->
7   - <uses-sdk
8   - android:minSdkVersion="11"
9   - android:targetSdkVersion="23" />
10 7  
11 8 <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"></uses-permission>
12 9 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
... ...
C5/app/src/main/java/com/sunvote/xpadapp/fragments/ElectionFragment.java
... ... @@ -6,6 +6,7 @@ import android.graphics.Bitmap;
6 6 import android.graphics.BitmapFactory;
7 7 import android.os.Bundle;
8 8 import android.os.Environment;
  9 +import android.text.Html;
9 10 import android.text.Spannable;
10 11 import android.text.SpannableStringBuilder;
11 12 import android.text.TextUtils;
... ... @@ -155,6 +156,8 @@ public class ElectionFragment extends BaseFragment {
155 156 }
156 157 drawView.clear();
157 158 addOtherLayout.setVisibility(View.VISIBLE);
  159 + tvInfo.setVisibility(View.GONE);
  160 + list_election_item_add_btn.setVisibility(View.GONE);
158 161 }
159 162 });
160 163 addOtherLayout.setOnClickListener(new OnClickListener() {
... ... @@ -347,6 +350,8 @@ public class ElectionFragment extends BaseFragment {
347 350 aryContent.add(aryContent.size() , it);
348 351 mAdapter.notifyDataSetChanged();
349 352 addOtherLayout.setVisibility(View.GONE);
  353 + tvInfo.setVisibility(View.VISIBLE);
  354 + list_election_item_add_btn.setVisibility(View.VISIBLE);
350 355 checkVoted();
351 356 edtOther.setText("");
352 357 }
... ... @@ -358,6 +363,8 @@ public class ElectionFragment extends BaseFragment {
358 363 public void onClick(View v) {
359 364 edtOther.setText("");
360 365 addOtherLayout.setVisibility(View.GONE);
  366 + tvInfo.setVisibility(View.VISIBLE);
  367 + list_election_item_add_btn.setVisibility(View.VISIBLE);
361 368 KeyboardUtils.hideSoftInput(getActivity());
362 369 }
363 370 });
... ... @@ -657,7 +664,7 @@ public class ElectionFragment extends BaseFragment {
657 664 holder.btnX = (RadioButton) convertView.findViewById(R.id.list_election_item_xx);// to
658 665 holder.RG = (RadioGroup) convertView.findViewById(R.id.list_election_item_radio_group);
659 666 holder.btnDel = (RadioButton) convertView.findViewById(R.id.list_election_item_del);
660   - holder.imgBook = (PhotoView) convertView.findViewById(R.id.img_book);
  667 + //holder.imgBook = (PhotoView) convertView.findViewById(R.id.img_book);
661 668 convertView.setTag(holder);
662 669 } else {
663 670 holder = (ViewHolder) convertView.getTag();
... ... @@ -674,21 +681,21 @@ public class ElectionFragment extends BaseFragment {
674 681  
675 682 if (it.No > 0) {
676 683 holder.btnX.setVisibility(View.VISIBLE);
677   - holder.btnDel.setVisibility(View.INVISIBLE);
  684 + holder.btnDel.setVisibility(View.GONE);
678 685 }else
679 686 {
680 687 holder.btnX.setVisibility(View.GONE);
681 688 holder.btnDel.setVisibility(View.VISIBLE);
682 689 }
683 690  
684   - String bookImgPath = (String)SharedPreferencesUtil.getData(getActivity(),it.title,"");
  691 + /*String bookImgPath = (String)SharedPreferencesUtil.getData(getActivity(),it.title,"");
685 692 if(!TextUtils.isEmpty(bookImgPath)){
686 693 holder.imgBook.setVisibility(View.VISIBLE);
687 694 Bitmap bitmap = BitmapFactory.decodeFile(bookImgPath);
688 695 holder.imgBook.setImageBitmap(bitmap);
689 696 }else{
690 697 holder.imgBook.setVisibility(View.GONE);
691   - }
  698 + }*/
692 699  
693 700 if(it.modifyModel){
694 701 holder.btnO.setEnabled(false);
... ... @@ -817,15 +824,20 @@ public class ElectionFragment extends BaseFragment {
817 824 }
818 825 }
819 826 if(voteInfo!=null){
820   - tvInfo.setText(getString(R.string.should_select1) + votedCount + getString(R.string.person));
  827 + String s=getString(R.string.should_select1);
  828 + String str= String.format("%s<font color='#FFFF00'><big>%s</big></font>%s",getString(R.string.should_select1),votedCount,getString(R.string.person));
  829 + tvInfo.setText(Html.fromHtml(str));
  830 + //tvInfo.setText(getString(R.string.should_select1) + votedCount + getString(R.string.person));
821 831 }
822 832 mAdapter.notifyDataSetChanged();
823 833 listview.invalidate();
824 834  
825 835 if((aryContent.size()- voteInfo.select)<checkOpposeVoted()){
826   - list_election_item_add_btn.setVisibility(View.VISIBLE);
  836 + //list_election_item_add_btn.setVisibility(View.VISIBLE);
  837 + list_election_item_add_btn.setEnabled(true);
827 838 }else{
828   - list_election_item_add_btn.setVisibility(View.GONE);
  839 + //list_election_item_add_btn.setVisibility(View.GONE);
  840 + list_election_item_add_btn.setEnabled(false);
829 841 }
830 842 }
831 843  
... ...
C5/app/src/main/res/drawable/darkgrey_round_button.xml
... ... @@ -5,5 +5,5 @@
5 5 <!-- 填充的颜色 -->
6 6 <solid android:color="@color/darkgrey" />
7 7 <!-- 圆角的半径 -->
8   - <corners android:radius="@dimen/px2dp_10" />
  8 + <corners android:radius="@dimen/px10dp" />
9 9 </shape>
... ...
C5/app/src/main/res/drawable/green_round_button.xml
... ... @@ -5,5 +5,5 @@
5 5 <!-- 填充的颜色 -->
6 6 <solid android:color="@color/green1" />
7 7 <!-- 圆角的半径 -->
8   - <corners android:radius="@dimen/px2dp_10" />
  8 + <corners android:radius="@dimen/px10dp" />
9 9 </shape>
... ...
C5/app/src/main/res/drawable/red_round_button.xml
... ... @@ -5,5 +5,5 @@
5 5 <!-- 填充的颜色 -->
6 6 <solid android:color="@color/red1" />
7 7 <!-- 圆角的半径 -->
8   - <corners android:radius="@dimen/px2dp_10" />
  8 + <corners android:radius="@dimen/px10dp" />
9 9 </shape>
... ...
C5/app/src/main/res/drawable/yellow_round_button.xml
... ... @@ -5,5 +5,5 @@
5 5 <!-- 填充的颜色 -->
6 6 <solid android:color="@color/yellow" />
7 7 <!-- 圆角的半径 -->
8   - <corners android:radius="@dimen/px2dp_10" />
  8 + <corners android:radius="@dimen/px10dp" />
9 9 </shape>
... ...
C5/app/src/main/res/layout/fragment_election.xml
... ... @@ -32,17 +32,18 @@
32 32 android:layout_width="wrap_content"
33 33 android:layout_height="wrap_content"
34 34 android:layout_marginRight="20dp"
  35 + android:textColor="@color/white"
35 36 android:text=""
36 37 android:textSize="@dimen/big_text_p5" />
37 38  
38 39 <Button
39 40 android:id="@+id/list_election_item_add_btn"
40   - android:layout_width="@dimen/px2dp_320"
41   - android:layout_height="@dimen/px2dp_90"
  41 + android:layout_width="@dimen/px320dp"
  42 + android:layout_height="@dimen/px100dp"
42 43 android:background="@drawable/agree_selector"
43 44 android:text="@string/select_other"
44 45 android:textColor="@color/white"
45   - android:layout_marginRight="@dimen/px2dp_206"
  46 + android:layout_marginRight="@dimen/px40dp"
46 47 android:textSize="@dimen/big_text_p5" />
47 48  
48 49 </LinearLayout>
... ... @@ -100,7 +101,7 @@
100 101 <RelativeLayout
101 102 android:id="@+id/election_pannal_bottom"
102 103 android:layout_width="match_parent"
103   - android:layout_height="@dimen/px2dp_138"
  104 + android:layout_height="@dimen/px138dp"
104 105 android:layout_alignParentBottom="true"
105 106 android:alpha="0.9"
106 107 android:background="@drawable/gray_alpha"
... ... @@ -108,26 +109,26 @@
108 109  
109 110 <Button
110 111 android:id="@+id/election_btn_confirm"
111   - android:layout_width="@dimen/px2dp_420"
112   - android:layout_height="@dimen/px2dp_110"
  112 + android:layout_width="@dimen/px420dp"
  113 + android:layout_height="@dimen/px110dp"
113 114 android:layout_centerInParent="true"
114 115 android:layout_marginRight="@dimen/content_margin"
115 116 android:background="@drawable/oppos_selector"
116 117 android:text="@string/confirm_submit"
117 118 android:textColor="@color/white"
118   - android:textSize="@dimen/px2sp_60"
  119 + android:textSize="@dimen/px60dp"
119 120 android:textStyle="bold" />
120 121  
121 122 <Button
122 123 android:id="@+id/election_btn_modify"
123   - android:layout_width="@dimen/px2dp_420"
124   - android:layout_height="@dimen/px2dp_110"
  124 + android:layout_width="@dimen/px420dp"
  125 + android:layout_height="@dimen/px110dp"
125 126 android:layout_centerInParent="true"
126 127 android:layout_marginRight="@dimen/content_margin"
127 128 android:background="@drawable/signin_selector"
128 129 android:text="@string/modify"
129 130 android:textColor="@color/white"
130   - android:textSize="@dimen/px2sp_60"
  131 + android:textSize="@dimen/px60dp"
131 132 android:textStyle="bold"
132 133 android:visibility="invisible" />
133 134 </RelativeLayout>
... ... @@ -164,33 +165,39 @@
164 165 android:textColor="@color/red"
165 166 android:textSize="@dimen/big_text_p6" />
166 167  
167   - <TextView
  168 + <LinearLayout
168 169 android:layout_width="wrap_content"
169   - android:layout_height="wrap_content"
170   - android:layout_gravity="center_vertical"
171   - android:layout_marginLeft="@dimen/button_to_content"
172   - android:text="@string/agree"
173   - android:textColor="@color/red"
174   - android:textSize="@dimen/big_text_p6" />
  170 + android:layout_height="match_parent"
  171 + android:orientation="horizontal"
  172 + android:gravity="center|center_vertical">
  173 + <TextView
  174 + android:layout_width="wrap_content"
  175 + android:layout_height="wrap_content"
  176 + android:layout_gravity="center_vertical"
  177 + android:text="@string/agree"
  178 + android:textColor="@color/red"
  179 + android:textSize="@dimen/big_text_p6" />
175 180  
176   - <TextView
177   - android:layout_width="wrap_content"
178   - android:layout_height="wrap_content"
179   - android:layout_gravity="center_vertical"
180   - android:layout_marginLeft="@dimen/button_to_content"
181   - android:text="@string/oppose"
182   - android:textColor="@color/red"
183   - android:textSize="@dimen/big_text_p6" />
  181 + <TextView
  182 + android:layout_width="wrap_content"
  183 + android:layout_height="wrap_content"
  184 + android:layout_gravity="center_vertical"
  185 + android:layout_marginLeft="@dimen/button_to_content"
  186 + android:text="@string/oppose"
  187 + android:textColor="@color/red"
  188 + android:textSize="@dimen/big_text_p6" />
184 189  
185   - <TextView
186   - android:layout_width="wrap_content"
187   - android:layout_height="wrap_content"
188   - android:layout_gravity="center_vertical"
189   - android:layout_marginLeft="@dimen/button_to_content"
190   - android:text="@string/delete"
191   - android:textColor="@color/red"
192   - android:textSize="@dimen/big_text_p6"
193   - android:visibility="gone" />
  190 + <TextView
  191 + android:layout_width="wrap_content"
  192 + android:layout_height="wrap_content"
  193 + android:layout_gravity="center_vertical"
  194 + android:layout_marginLeft="@dimen/button_to_content"
  195 + android:text="@string/delete"
  196 + android:textColor="@color/red"
  197 + android:textSize="@dimen/big_text_p6"
  198 + android:visibility="gone" />
  199 +
  200 + </LinearLayout>
194 201  
195 202 </LinearLayout>
196 203  
... ... @@ -259,23 +266,26 @@
259 266  
260 267 <LinearLayout
261 268 android:id="@+id/name_layout"
262   - android:layout_width="wrap_content"
263   - android:layout_height="wrap_content"
264   - android:layout_marginLeft="20dp"
265   - android:layout_marginTop="20dp"
266   - android:orientation="horizontal">
  269 + android:layout_width="match_parent"
  270 + android:layout_height="match_parent"
  271 + android:layout_marginLeft="@dimen/px20dp"
  272 + android:layout_above="@+id/bottom_linear"
  273 + android:layout_margin="@dimen/px20dp"
  274 + android:gravity="bottom|center"
  275 + android:orientation="vertical">
267 276  
268 277 <TextView
269 278 android:layout_width="wrap_content"
270   - android:layout_height="60dp"
  279 + android:layout_height="@dimen/px120dp"
271 280 android:text="@string/input_other"
272   - android:textColor="@color/gray"
273   - android:textSize="@dimen/big_text_p5" />
  281 + android:layout_marginRight="@dimen/px90dp"
  282 + android:textColor="@color/black"
  283 + android:textSize="@dimen/px60dp" />
274 284  
275 285 <com.sunvote.xpadapp.base.ZanyEditText
276 286 android:id="@+id/election_add_edit"
277   - android:layout_width="200dp"
278   - android:layout_height="60dp"
  287 + android:layout_width="@dimen/px787dp"
  288 + android:layout_height="@dimen/px120dp"
279 289 android:layout_marginLeft="20dp"
280 290 android:background="@color/white"
281 291 android:imeOptions="flagNoExtractUi"
... ... @@ -290,27 +300,28 @@
290 300 android:layout_height="wrap_content"
291 301 android:layout_alignParentBottom="true"
292 302 android:layout_centerHorizontal="true"
293   - android:layout_marginBottom="20dp"
  303 + android:layout_marginBottom="@dimen/px300dp"
  304 + android:layout_marginTop="@dimen/px30dp"
294 305 android:orientation="horizontal">
295 306  
296 307 <Button
297   - android:id="@+id/election_add_edit_btn_cancel"
298   - android:layout_width="@dimen/button_width"
299   - android:layout_height="@dimen/button_heigh"
300   - android:layout_marginRight="80dp"
301   - android:background="@drawable/oppos_selector"
302   - android:text="@string/cancel"
  308 + android:id="@+id/election_add_edit_btn_ok"
  309 + android:layout_width="@dimen/px360dp"
  310 + android:layout_height="@dimen/px120dp"
  311 + android:layout_marginLeft="@dimen/px67dp"
  312 + android:background="@drawable/btn_agree"
  313 + android:text="@string/ok"
303 314 android:textColor="@color/white"
304 315 android:textSize="@dimen/big_text_p4"
305 316 android:textStyle="bold" />
306 317  
307 318 <Button
308   - android:id="@+id/election_add_edit_btn_ok"
309   - android:layout_width="@dimen/button_width"
310   - android:layout_height="@dimen/button_heigh"
311   - android:layout_marginLeft="80dp"
312   - android:background="@drawable/btn_agree"
313   - android:text="@string/ok"
  319 + android:id="@+id/election_add_edit_btn_cancel"
  320 + android:layout_width="@dimen/px360dp"
  321 + android:layout_height="@dimen/px120dp"
  322 + android:background="@drawable/oppos_selector"
  323 + android:layout_marginLeft="@dimen/px90dp"
  324 + android:text="@string/cancel"
314 325 android:textColor="@color/white"
315 326 android:textSize="@dimen/big_text_p4"
316 327 android:textStyle="bold" />
... ... @@ -320,10 +331,10 @@
320 331 android:layout_width="match_parent"
321 332 android:layout_height="match_parent"
322 333 android:layout_below="@id/name_layout"
323   - android:layout_above="@id/bottom_linear"
324 334 android:layout_margin="20dp"
325 335 android:background="@color/white"
326 336 android:gravity="center"
  337 + android:visibility="invisible"
327 338 android:orientation="vertical">
328 339  
329 340 <TextView
... ... @@ -334,27 +345,26 @@
334 345 android:textSize="@dimen/big_text_p5"
335 346 android:textColor="@color/darkgrey"/>
336 347  
337   - <com.sunvote.xpadapp.base.PaletteView
338   - android:id="@+id/draw_view"
339   - android:layout_width="match_parent"
340   - android:layout_height="match_parent" />
341   -
342   - <ImageView
343   - android:id="@+id/clear_img"
344   - android:layout_width="wrap_content"
345   - android:layout_height="wrap_content"
346   - android:layout_alignParentRight="true"
347   - android:layout_alignParentTop="true"
348   - android:layout_marginTop="20dp"
349   - android:layout_marginRight="20dp"
350   - android:src="@drawable/ic_clear" />
351   -
352   - </RelativeLayout>
  348 + <com.sunvote.xpadapp.base.PaletteView
  349 + android:id="@+id/draw_view"
  350 + android:layout_width="match_parent"
  351 + android:layout_height="match_parent" />
353 352  
  353 + <ImageView
  354 + android:id="@+id/clear_img"
  355 + android:layout_width="wrap_content"
  356 + android:layout_height="wrap_content"
  357 + android:layout_alignParentRight="true"
  358 + android:layout_alignParentTop="true"
  359 + android:layout_marginTop="20dp"
  360 + android:layout_marginRight="20dp"
  361 + android:src="@drawable/ic_clear" />
354 362  
  363 + </RelativeLayout>
355 364  
356 365 </RelativeLayout>
357 366  
  367 +
358 368 <RelativeLayout
359 369 android:id="@+id/singlevote_confirm_panel"
360 370 android:layout_width="fill_parent"
... ...
C5/app/src/main/res/layout/list_election_item.xml
... ... @@ -3,11 +3,12 @@
3 3 android:layout_width="match_parent"
4 4 android:layout_height="@dimen/button_heigh" >
5 5  
6   - <LinearLayout
  6 + <!-- <LinearLayout
7 7 android:layout_width="fill_parent"
8 8 android:layout_height="fill_parent"
9 9 android:background="@color/white"
10   - android:orientation="horizontal">
  10 + android:orientation="horizontal"
  11 + android:paddingRight="100dp">
11 12  
12 13 <TextView
13 14 android:id="@+id/seq"
... ... @@ -80,8 +81,79 @@
80 81 android:layout_height="@dimen/button_heigh"
81 82 android:scaleType="fitXY"
82 83 android:layout_margin="2dp"
83   - android:layout_toRightOf="@+id/list_election_item_radio_group" />/>
84   -
  84 + android:visibility="gone"
  85 + android:layout_toRightOf="@+id/list_election_item_radio_group" />
85 86 </LinearLayout>
  87 +-->
  88 +
  89 + <LinearLayout
  90 + android:id="@+id/title_layout"
  91 + android:layout_width="fill_parent"
  92 + android:layout_height="60dp"
  93 + android:layout_below="@id/election_pannal_OX"
  94 + android:background="@color/white"
  95 + android:orientation="horizontal"
  96 + android:paddingRight="100dp">
  97 +
  98 + <TextView
  99 + android:id="@+id/seq"
  100 + android:layout_width="120dp"
  101 + android:layout_height="wrap_content"
  102 + android:layout_marginLeft="150dp"
  103 + android:gravity="center"
  104 + android:layout_gravity="center_vertical"
  105 + android:text="1"
  106 + android:textColor="@color/gray"
  107 + android:textSize="@dimen/big_text_p5" />
  108 +
  109 + <TextView
  110 + android:id="@+id/list_election_item_name"
  111 + android:layout_width="0dp"
  112 + android:layout_height="wrap_content"
  113 + android:layout_gravity="center_vertical"
  114 + android:layout_weight="1"
  115 + android:layout_marginLeft="40dp"
  116 + android:gravity="left|center_vertical"
  117 + android:text=""
  118 + android:textColor="@color/black"
  119 + android:textSize="@dimen/big_text_p5" />
86 120  
  121 + <RadioGroup
  122 + android:id="@+id/list_election_item_radio_group"
  123 + android:layout_width="wrap_content"
  124 + android:layout_height="wrap_content"
  125 + android:layout_gravity="center_vertical"
  126 + android:orientation="horizontal" >
  127 +
  128 + <RadioButton
  129 + android:id="@+id/list_election_item_oo"
  130 + android:layout_width="@dimen/px60dp"
  131 + android:layout_height="@dimen/px63dp"
  132 + android:layout_centerVertical="true"
  133 + android:layout_marginTop="@dimen/inner_button_margin"
  134 + android:layout_marginRight="@dimen/px180dp"
  135 + android:button="@null"
  136 + android:background="@drawable/oo_selector"
  137 + android:visibility="visible" />
  138 +
  139 + <RadioButton
  140 + android:id="@+id/list_election_item_xx"
  141 + android:layout_width="@dimen/px60dp"
  142 + android:layout_height="@dimen/px63dp"
  143 + android:layout_centerVertical="true"
  144 + android:layout_marginTop="@dimen/inner_button_margin"
  145 + android:button="@null"
  146 + android:background="@drawable/xx_selector"/>
  147 +
  148 + <RadioButton
  149 + android:id="@+id/list_election_item_del"
  150 + android:layout_width="@dimen/px60dp"
  151 + android:layout_height="@dimen/px63dp"
  152 + android:layout_centerVertical="true"
  153 + android:visibility="invisible"
  154 + android:layout_marginTop="@dimen/inner_button_margin"
  155 + android:button="@null"
  156 + android:background="@drawable/delete"/>
  157 + </RadioGroup>
  158 + </LinearLayout>
87 159 </RelativeLayout>
88 160 \ No newline at end of file
... ...