Commit 31cd9deb6ca489cb4402d731f7bc47082baa2908
1 parent
0345eb58
修改民事投票结果显示
Showing
5 changed files
with
74 additions
and
93 deletions
C5/app/src/main/java/com/sunvote/xpadapp/MainActivity.java
@@ -57,6 +57,7 @@ import com.sunvote.xpadapp.fragments.MultiContentDetailFragment; | @@ -57,6 +57,7 @@ import com.sunvote.xpadapp.fragments.MultiContentDetailFragment; | ||
57 | import com.sunvote.xpadapp.fragments.MultiContentFragment; | 57 | import com.sunvote.xpadapp.fragments.MultiContentFragment; |
58 | import com.sunvote.xpadapp.fragments.MultiPingshengFragment; | 58 | import com.sunvote.xpadapp.fragments.MultiPingshengFragment; |
59 | import com.sunvote.xpadapp.fragments.MultiTitleFragment; | 59 | import com.sunvote.xpadapp.fragments.MultiTitleFragment; |
60 | +import com.sunvote.xpadapp.fragments.ResultElectionCustomFragment; | ||
60 | import com.sunvote.xpadapp.fragments.UserResultVoteFragment; | 61 | import com.sunvote.xpadapp.fragments.UserResultVoteFragment; |
61 | import com.sunvote.xpadapp.fragments.NoFileFragment; | 62 | import com.sunvote.xpadapp.fragments.NoFileFragment; |
62 | import com.sunvote.xpadapp.fragments.OfflineFragment; | 63 | import com.sunvote.xpadapp.fragments.OfflineFragment; |
@@ -150,6 +151,7 @@ public class MainActivity extends BaseActivity implements ComListener { | @@ -150,6 +151,7 @@ public class MainActivity extends BaseActivity implements ComListener { | ||
150 | private final int MSG_CLEAN_FILE = 101; | 151 | private final int MSG_CLEAN_FILE = 101; |
151 | 152 | ||
152 | public BroadcastReceiver batteryLevelRcvr; | 153 | public BroadcastReceiver batteryLevelRcvr; |
154 | + private final int Msg_ShowElectionCustom = 70; | ||
153 | 155 | ||
154 | // WifiManager wifiManager; | 156 | // WifiManager wifiManager; |
155 | // WiFiConnecter wac; | 157 | // WiFiConnecter wac; |
@@ -449,9 +451,11 @@ public class MainActivity extends BaseActivity implements ComListener { | @@ -449,9 +451,11 @@ public class MainActivity extends BaseActivity implements ComListener { | ||
449 | 451 | ||
450 | break; | 452 | break; |
451 | case Msg_ShowMultiVoteResult: | 453 | case Msg_ShowMultiVoteResult: |
452 | - | ||
453 | showMultiVoteResultFragment((byte[]) msg.obj); | 454 | showMultiVoteResultFragment((byte[]) msg.obj); |
454 | break; | 455 | break; |
456 | + case Msg_ShowElectionCustom: | ||
457 | + showElectionCustomFragment((byte[]) msg.obj); | ||
458 | + break; | ||
455 | case Msg_ShowElectionVoteResult: | 459 | case Msg_ShowElectionVoteResult: |
456 | showResultElectionFragment((byte[]) msg.obj); | 460 | showResultElectionFragment((byte[]) msg.obj); |
457 | break; | 461 | break; |
@@ -723,6 +727,37 @@ public class MainActivity extends BaseActivity implements ComListener { | @@ -723,6 +727,37 @@ public class MainActivity extends BaseActivity implements ComListener { | ||
723 | LogUtil.i(TAG, "showVoteResultFragment buffer"); | 727 | LogUtil.i(TAG, "showVoteResultFragment buffer"); |
724 | } | 728 | } |
725 | 729 | ||
730 | + private void showElectionCustomFragment(byte[] buffer) { | ||
731 | + int voteId = buffer[3] & 0xff; | ||
732 | + if (dbm == null) { | ||
733 | + Toast.makeText(this, "请先开始会议", Toast.LENGTH_SHORT).show(); | ||
734 | + return; | ||
735 | + } | ||
736 | + | ||
737 | + currBillInfo = dbm.getBillInfo(meetingId, voteId); | ||
738 | + if (currBillInfo == null) { | ||
739 | + Toast.makeText(this, "显示批次结果失败,没有找到会议资料", Toast.LENGTH_SHORT).show(); | ||
740 | + return; | ||
741 | + } | ||
742 | + if (currBillInfo.billOptions == null) { | ||
743 | + Toast.makeText(this, "显示批次结果失败,选项为空", Toast.LENGTH_SHORT).show(); | ||
744 | + return; | ||
745 | + } | ||
746 | + | ||
747 | + hideCurrFragment(); | ||
748 | + hideResultFragment(); | ||
749 | + FragmentManager fm = getFragmentManager(); | ||
750 | + FragmentTransaction transaction = fm.beginTransaction(); | ||
751 | + ResultElectionCustomFragment fr = new ResultElectionCustomFragment(); | ||
752 | + fr.bill = currBillInfo; | ||
753 | + fr.data = buffer; | ||
754 | + resultFragment = fr; | ||
755 | + // transaction.setCustomAnimations(android.R.animator.fade_in,android.R.animator.fade_out); | ||
756 | + transaction.add(R.id.frame_content, fr); | ||
757 | + transaction.addToBackStack("multivote"); | ||
758 | + transaction.commitAllowingStateLoss(); | ||
759 | + LogUtil.i(TAG, "showMultiVoteResultFragment buffer"); | ||
760 | + } | ||
726 | 761 | ||
727 | private void showMultiVoteResultFragment(byte[] buffer) { | 762 | private void showMultiVoteResultFragment(byte[] buffer) { |
728 | int voteId = buffer[3] & 0xff; | 763 | int voteId = buffer[3] & 0xff; |
@@ -1732,6 +1767,25 @@ public class MainActivity extends BaseActivity implements ComListener { | @@ -1732,6 +1767,25 @@ public class MainActivity extends BaseActivity implements ComListener { | ||
1732 | if(isInVoteState()){ | 1767 | if(isInVoteState()){ |
1733 | return; | 1768 | return; |
1734 | } | 1769 | } |
1770 | + | ||
1771 | + if(currBillInfo!=null) { | ||
1772 | + if (currBillInfo.billmodel == 1) { //民事选举 | ||
1773 | + if ((data[0] & 0xff) == 0xF2 && data[1] == 20) { | ||
1774 | + if (tmpMulResultBuffer != null && Arrays.equals(buf, tmpMulResultBuffer)) { | ||
1775 | + Log.e(TAG, "onMultiPackageData same data,abort"); | ||
1776 | + return; | ||
1777 | + } | ||
1778 | + tmpMulResultBuffer = buf; | ||
1779 | + | ||
1780 | + Message message = new Message(); | ||
1781 | + message.what = Msg_ShowElectionCustom; | ||
1782 | + message.obj = buf; | ||
1783 | + myHandler.sendMessage(message); | ||
1784 | + return; | ||
1785 | + } | ||
1786 | + } | ||
1787 | + } | ||
1788 | + | ||
1735 | if ((data[0] & 0xff) == 0xF2 && data[1] == 20) { | 1789 | if ((data[0] & 0xff) == 0xF2 && data[1] == 20) { |
1736 | if (tmpMulResultBuffer != null && Arrays.equals(buf, tmpMulResultBuffer)) { | 1790 | if (tmpMulResultBuffer != null && Arrays.equals(buf, tmpMulResultBuffer)) { |
1737 | Log.e(TAG, "onMultiPackageData same data,abort"); | 1791 | Log.e(TAG, "onMultiPackageData same data,abort"); |
C5/app/src/main/java/com/sunvote/xpadapp/db/DBManager.java
@@ -116,6 +116,9 @@ public class DBManager { | @@ -116,6 +116,9 @@ public class DBManager { | ||
116 | info.memo = c.getString(c.getColumnIndex("BillMemo")); | 116 | info.memo = c.getString(c.getColumnIndex("BillMemo")); |
117 | info.billFile = c.getString(c.getColumnIndex("BillFile")); | 117 | info.billFile = c.getString(c.getColumnIndex("BillFile")); |
118 | info.billOptions = c.getString(c.getColumnIndex("BillPar")); | 118 | info.billOptions = c.getString(c.getColumnIndex("BillPar")); |
119 | + if(c.getColumnIndex("BillMode")>0){ | ||
120 | + info.billmodel = c.getInt(c.getColumnIndex("BillMode")); | ||
121 | + } | ||
119 | break; | 122 | break; |
120 | } | 123 | } |
121 | } catch (Exception e) { | 124 | } catch (Exception e) { |
C5/app/src/main/java/com/sunvote/xpadapp/db/modal/BillInfo.java
@@ -16,6 +16,7 @@ public class BillInfo { | @@ -16,6 +16,7 @@ public class BillInfo { | ||
16 | public String memo; //投票内容 | 16 | public String memo; //投票内容 |
17 | public String billFile;//议案文件名 | 17 | public String billFile;//议案文件名 |
18 | public String billOptions;//评议选项 | 18 | public String billOptions;//评议选项 |
19 | + public int billmodel;//模式1:民事 | ||
19 | 20 | ||
20 | public int voteResult; | 21 | public int voteResult; |
21 | public int voteStatus; | 22 | public int voteStatus; |
C5/app/src/main/java/com/sunvote/xpadapp/fragments/ElectionCustomFragment.java
@@ -23,6 +23,7 @@ import com.sunvote.xpadapp.R; | @@ -23,6 +23,7 @@ import com.sunvote.xpadapp.R; | ||
23 | import com.sunvote.xpadapp.base.BaseFragment; | 23 | import com.sunvote.xpadapp.base.BaseFragment; |
24 | import com.sunvote.xpadapp.db.modal.BillInfo; | 24 | import com.sunvote.xpadapp.db.modal.BillInfo; |
25 | import com.sunvote.xpadapp.db.modal.MultiTitleItem; | 25 | import com.sunvote.xpadapp.db.modal.MultiTitleItem; |
26 | +import com.sunvote.xpadapp.dialog.ToastAlertDialog; | ||
26 | import com.sunvote.xpadapp.utils.SharedPreferencesUtil; | 27 | import com.sunvote.xpadapp.utils.SharedPreferencesUtil; |
27 | import com.sunvote.xpadcomm.XPadApi; | 28 | import com.sunvote.xpadcomm.XPadApi; |
28 | import com.sunvote.xpadcomm.XPadApiInterface; | 29 | import com.sunvote.xpadcomm.XPadApiInterface; |
@@ -218,17 +219,17 @@ public class ElectionCustomFragment extends BaseFragment { | @@ -218,17 +219,17 @@ public class ElectionCustomFragment extends BaseFragment { | ||
218 | private void confirmInfo(){ | 219 | private void confirmInfo(){ |
219 | btnConfirm.setEnabled(false); | 220 | btnConfirm.setEnabled(false); |
220 | if (agreeVotedCount < voteInfo.limitFavor) { | 221 | if (agreeVotedCount < voteInfo.limitFavor) { |
221 | - Toast.makeText(mMainActivity, "需投赞成票"+voteInfo.limitFavor+"张", Toast.LENGTH_SHORT).show(); | 222 | + ToastAlertDialog.makeText(mMainActivity, "需投票"+voteInfo.limitFavor+"张").show(); |
222 | btnConfirm.setEnabled(true); | 223 | btnConfirm.setEnabled(true); |
223 | return; | 224 | return; |
224 | } | 225 | } |
225 | 226 | ||
226 | - int count = agreeVotedCount+opposeVotedCount+abstantVotedCount; | 227 | + /* int count = agreeVotedCount+opposeVotedCount+abstantVotedCount; |
227 | if(count<aryContent.size()){ | 228 | if(count<aryContent.size()){ |
228 | Toast.makeText(mMainActivity, "需对所有项目进行投票", Toast.LENGTH_SHORT).show(); | 229 | Toast.makeText(mMainActivity, "需对所有项目进行投票", Toast.LENGTH_SHORT).show(); |
229 | btnConfirm.setEnabled(true); | 230 | btnConfirm.setEnabled(true); |
230 | return; | 231 | return; |
231 | - } | 232 | + }*/ |
232 | 233 | ||
233 | showSecrecyOrDisable(); | 234 | showSecrecyOrDisable(); |
234 | //tvTipInfo.setText(getString(R.string.submiting)); | 235 | //tvTipInfo.setText(getString(R.string.submiting)); |
@@ -412,7 +413,7 @@ public class ElectionCustomFragment extends BaseFragment { | @@ -412,7 +413,7 @@ public class ElectionCustomFragment extends BaseFragment { | ||
412 | voteWithValue(position,0); | 413 | voteWithValue(position,0); |
413 | }else{ | 414 | }else{ |
414 | if(agreeVotedCount >= voteInfo.limitFavor){ | 415 | if(agreeVotedCount >= voteInfo.limitFavor){ |
415 | - Toast.makeText(mMainActivity, "只允许投赞成票"+ voteInfo.limitFavor + getString(R.string.fix), Toast.LENGTH_SHORT).show(); | 416 | + ToastAlertDialog.makeText(mMainActivity, "已投"+agreeVotedCount+getString(R.string.fix)+",不可多选").show(); |
416 | checkVoted(); | 417 | checkVoted(); |
417 | return; | 418 | return; |
418 | } | 419 | } |
C5/app/src/main/java/com/sunvote/xpadapp/fragments/ResultElectionCustomFragment.java
@@ -62,7 +62,7 @@ public class ResultElectionCustomFragment extends BaseFragment { | @@ -62,7 +62,7 @@ public class ResultElectionCustomFragment extends BaseFragment { | ||
62 | @Override | 62 | @Override |
63 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | 63 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
64 | LogUtil.d(TAG, "onCreateView"); | 64 | LogUtil.d(TAG, "onCreateView"); |
65 | - View view = inflater.inflate(R.layout.fragment_result_multi_vote, container, false); | 65 | + View view = inflater.inflate(R.layout.fragment_result_election_custom, container, false); |
66 | final MainActivity mact = (MainActivity) getActivity(); | 66 | final MainActivity mact = (MainActivity) getActivity(); |
67 | 67 | ||
68 | view.setOnClickListener(new OnClickListener() { | 68 | view.setOnClickListener(new OnClickListener() { |
@@ -72,7 +72,7 @@ public class ResultElectionCustomFragment extends BaseFragment { | @@ -72,7 +72,7 @@ public class ResultElectionCustomFragment extends BaseFragment { | ||
72 | } | 72 | } |
73 | }); | 73 | }); |
74 | 74 | ||
75 | - listview = (ListView) view.findViewById(R.id.multi_vote_result_listview); | 75 | + listview = (ListView) view.findViewById(R.id.fragment_result_election_list); |
76 | options = bill.billOptions.split("/"); | 76 | options = bill.billOptions.split("/"); |
77 | 77 | ||
78 | try { | 78 | try { |
@@ -82,27 +82,13 @@ public class ResultElectionCustomFragment extends BaseFragment { | @@ -82,27 +82,13 @@ public class ResultElectionCustomFragment extends BaseFragment { | ||
82 | mAdapter = new MyAdapter(getActivity()); | 82 | mAdapter = new MyAdapter(getActivity()); |
83 | listview.setAdapter(mAdapter); | 83 | listview.setAdapter(mAdapter); |
84 | 84 | ||
85 | - tvTitle = (TextView) view.findViewById(R.id.multi_vote_result_tv_title); | 85 | + tvTitle = (TextView) view.findViewById(R.id.tv_title); |
86 | if (bill != null) { | 86 | if (bill != null) { |
87 | - tvTitle.setText( replaceBlank(bill.title)); | 87 | + tvTitle.setText(replaceBlank(bill.title)); |
88 | } | 88 | } |
89 | 89 | ||
90 | - titleAbstain = (TextView) view.findViewById(R.id.multi_vote_result_title_abstan); | ||
91 | - titleUnvote = (TextView) view.findViewById(R.id.multi_vote_result_title_unvote); | ||
92 | - titleResult = (TextView) view.findViewById(R.id.multi_vote_result_title_result); | ||
93 | - | ||
94 | - if (resultBits == 0xffff) { | ||
95 | - titleResult.setVisibility(View.GONE); | ||
96 | - } else { | ||
97 | - titleResult.setVisibility(View.VISIBLE); | ||
98 | - } | ||
99 | - if (options.length == 2) { | ||
100 | - titleAbstain.setVisibility(View.GONE); | ||
101 | - } else { | ||
102 | - titleAbstain.setVisibility(View.VISIBLE); | ||
103 | - } | ||
104 | - TextView tvYindao = (TextView) view.findViewById(R.id.multi_vote_result_yindao); | ||
105 | - TextView tvShidao = (TextView) view.findViewById(R.id.multi_vote_result_shidao); | 90 | + TextView tvYindao = (TextView) view.findViewById(R.id.yingdaoresult); |
91 | + TextView tvShidao = (TextView) view.findViewById(R.id.shidaoresult); | ||
106 | if (yindao == 0xff || yindao == 0xffff) { | 92 | if (yindao == 0xff || yindao == 0xffff) { |
107 | tvYindao.setVisibility(View.GONE); | 93 | tvYindao.setVisibility(View.GONE); |
108 | } else { | 94 | } else { |
@@ -116,7 +102,6 @@ public class ResultElectionCustomFragment extends BaseFragment { | @@ -116,7 +102,6 @@ public class ResultElectionCustomFragment extends BaseFragment { | ||
116 | tvShidao.setText("" + shidao); | 102 | tvShidao.setText("" + shidao); |
117 | tvShidao.setVisibility(View.VISIBLE); | 103 | tvShidao.setVisibility(View.VISIBLE); |
118 | } | 104 | } |
119 | - | ||
120 | return view; | 105 | return view; |
121 | } | 106 | } |
122 | 107 | ||
@@ -321,31 +306,21 @@ public class ResultElectionCustomFragment extends BaseFragment { | @@ -321,31 +306,21 @@ public class ResultElectionCustomFragment extends BaseFragment { | ||
321 | LogUtil.v("BaseAdapterTest", "getView " + position + " " + convertView); | 306 | LogUtil.v("BaseAdapterTest", "getView " + position + " " + convertView); |
322 | 307 | ||
323 | if (convertView == null) { | 308 | if (convertView == null) { |
324 | - convertView = mInflater.inflate(R.layout.list_multi_vote_result_item, null); | 309 | + convertView = mInflater.inflate(R.layout.list_result_election_custom_item, null); |
325 | holder = new ViewHolder(); | 310 | holder = new ViewHolder(); |
326 | - | ||
327 | - holder.tvNum = (TextView) convertView.findViewById(R.id.list_multi_result_item_num); | ||
328 | - holder.tvTitle = (TextView) convertView.findViewById(R.id.list_multi_result_item_name); | ||
329 | - holder.tvAgree = (TextView) convertView.findViewById(R.id.list_multi_result_item_agree); | ||
330 | - holder.tvOppose = (TextView) convertView.findViewById(R.id.list_multi_result_item_oppose); | ||
331 | - holder.tvAbstain = (TextView) convertView.findViewById(R.id.list_multi_result_item_abstan); | ||
332 | - holder.tvUnvote = (TextView) convertView.findViewById(R.id.list_multi_result_item_unvote); | ||
333 | - holder.tvResult = (TextView) convertView.findViewById(R.id.list_multi_result_item_result); | 311 | + holder.tvNum = (TextView) convertView.findViewById(R.id.item_result_election_num); |
312 | + holder.tvTitle = (TextView) convertView.findViewById(R.id.item_result_election_name); | ||
313 | + holder.tvAgree = (TextView) convertView.findViewById(R.id.item_result_election_agree); | ||
334 | 314 | ||
335 | convertView.setTag(holder); | 315 | convertView.setTag(holder); |
336 | } else { | 316 | } else { |
337 | holder = (ViewHolder) convertView.getTag(); | 317 | holder = (ViewHolder) convertView.getTag(); |
338 | } | 318 | } |
339 | 319 | ||
340 | - | ||
341 | - | ||
342 | ListItem it = aryContent.get(position); | 320 | ListItem it = aryContent.get(position); |
343 | holder.tvNum.setText(String.valueOf(it.No)); | 321 | holder.tvNum.setText(String.valueOf(it.No)); |
344 | holder.tvTitle.setText(it.title); | 322 | holder.tvTitle.setText(it.title); |
345 | 323 | ||
346 | - | ||
347 | - holder.tvOppose.setText(String.valueOf(it.oppose)); | ||
348 | - holder.tvAbstain.setText(String.valueOf(it.abstain)); | ||
349 | if(it.agree != 0xff && it.agree != 0xffff){ | 324 | if(it.agree != 0xff && it.agree != 0xffff){ |
350 | holder.tvAgree.setVisibility(View.VISIBLE); | 325 | holder.tvAgree.setVisibility(View.VISIBLE); |
351 | holder.tvAgree.setText(String.valueOf(it.agree)); | 326 | holder.tvAgree.setText(String.valueOf(it.agree)); |
@@ -353,66 +328,13 @@ public class ResultElectionCustomFragment extends BaseFragment { | @@ -353,66 +328,13 @@ public class ResultElectionCustomFragment extends BaseFragment { | ||
353 | holder.tvAgree.setVisibility(View.INVISIBLE); | 328 | holder.tvAgree.setVisibility(View.INVISIBLE); |
354 | holder.tvAgree.setText(""); | 329 | holder.tvAgree.setText(""); |
355 | } | 330 | } |
356 | - if(it.oppose != 0xff && it.oppose != 0xffff){ | ||
357 | - holder.tvOppose.setVisibility(View.VISIBLE); | ||
358 | - holder.tvOppose.setText(String.valueOf(it.oppose)); | ||
359 | - }else{ | ||
360 | - holder.tvOppose.setVisibility(View.INVISIBLE); | ||
361 | - holder.tvOppose.setText(""); | ||
362 | - } | ||
363 | - if(it.abstain != 0xff && it.abstain != 0xffff){ | ||
364 | - holder.tvAbstain.setVisibility(View.VISIBLE); | ||
365 | - holder.tvAbstain.setText(String.valueOf(it.abstain)); | ||
366 | - }else{ | ||
367 | - holder.tvAbstain.setVisibility(View.INVISIBLE); | ||
368 | - holder.tvAbstain.setText(""); | ||
369 | - } | ||
370 | - | ||
371 | - if (it.unvote != 0xff && it.unvote != 0xffff) { | ||
372 | - titleUnvote.setVisibility(View.VISIBLE); | ||
373 | - holder.tvUnvote.setVisibility(View.VISIBLE); | ||
374 | - holder.tvUnvote.setText(String.valueOf(it.unvote)); | ||
375 | - } else { | ||
376 | - titleUnvote.setVisibility(View.INVISIBLE); | ||
377 | - holder.tvUnvote.setVisibility(View.INVISIBLE); | ||
378 | - holder.tvUnvote.setText(""); | ||
379 | - | ||
380 | - } | ||
381 | - | ||
382 | - String strPass = ""; | ||
383 | - | ||
384 | - if (it.pass == 0) { | ||
385 | - strPass = getString(R.string.no_pass); | ||
386 | - } else if (it.pass == 1) { | ||
387 | - strPass = getString(R.string.pass); | ||
388 | - } | ||
389 | - | ||
390 | - holder.tvResult.setText(strPass); | ||
391 | - if (it.pass == 0xffff) { | ||
392 | - holder.tvResult.setVisibility(View.GONE); | ||
393 | - } else { | ||
394 | - holder.tvResult.setVisibility(View.VISIBLE); | ||
395 | - } | ||
396 | - | ||
397 | - if (options.length == 2) { | ||
398 | - holder.tvAbstain.setVisibility(View.GONE); | ||
399 | - | ||
400 | - } else { | ||
401 | - holder.tvAbstain.setVisibility(View.VISIBLE); | ||
402 | - } | ||
403 | - | ||
404 | return convertView; | 331 | return convertView; |
405 | } | 332 | } |
406 | 333 | ||
407 | - | ||
408 | public final class ViewHolder { | 334 | public final class ViewHolder { |
409 | public TextView tvNum; | 335 | public TextView tvNum; |
410 | public TextView tvTitle; | 336 | public TextView tvTitle; |
411 | public TextView tvAgree; | 337 | public TextView tvAgree; |
412 | - public TextView tvOppose; | ||
413 | - public TextView tvAbstain; | ||
414 | - public TextView tvUnvote; | ||
415 | - public TextView tvResult; | ||
416 | } | 338 | } |
417 | } | 339 | } |
418 | } | 340 | } |