From 691d9f67bd8d04d019af9af334931fdea27cbaab Mon Sep 17 00:00:00 2001 From: wutaian Date: Thu, 14 Mar 2019 20:00:51 +0800 Subject: [PATCH] 修改投票选举UI,相关UI的业务逻辑 --- C5/app/src/main/AndroidManifest.xml | 3 --- C5/app/src/main/java/com/sunvote/xpadapp/fragments/ElectionFragment.java | 26 +++++++++++++++++++------- C5/app/src/main/res/drawable/darkgrey_round_button.xml | 2 +- C5/app/src/main/res/drawable/green_round_button.xml | 2 +- C5/app/src/main/res/drawable/red_round_button.xml | 2 +- C5/app/src/main/res/drawable/yellow_round_button.xml | 2 +- C5/app/src/main/res/layout/fragment_election.xml | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------- C5/app/src/main/res/layout/list_election_item.xml | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 8 files changed, 183 insertions(+), 92 deletions(-) diff --git a/C5/app/src/main/AndroidManifest.xml b/C5/app/src/main/AndroidManifest.xml index e7585a4..2441972 100644 --- a/C5/app/src/main/AndroidManifest.xml +++ b/C5/app/src/main/AndroidManifest.xml @@ -4,9 +4,6 @@ package="com.sunvote.xpadapp" android:versionCode="70" android:versionName="1.3.0.0"> - diff --git a/C5/app/src/main/java/com/sunvote/xpadapp/fragments/ElectionFragment.java b/C5/app/src/main/java/com/sunvote/xpadapp/fragments/ElectionFragment.java index 8190308..f405fde 100644 --- a/C5/app/src/main/java/com/sunvote/xpadapp/fragments/ElectionFragment.java +++ b/C5/app/src/main/java/com/sunvote/xpadapp/fragments/ElectionFragment.java @@ -6,6 +6,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Environment; +import android.text.Html; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.TextUtils; @@ -155,6 +156,8 @@ public class ElectionFragment extends BaseFragment { } drawView.clear(); addOtherLayout.setVisibility(View.VISIBLE); + tvInfo.setVisibility(View.GONE); + list_election_item_add_btn.setVisibility(View.GONE); } }); addOtherLayout.setOnClickListener(new OnClickListener() { @@ -347,6 +350,8 @@ public class ElectionFragment extends BaseFragment { aryContent.add(aryContent.size() , it); mAdapter.notifyDataSetChanged(); addOtherLayout.setVisibility(View.GONE); + tvInfo.setVisibility(View.VISIBLE); + list_election_item_add_btn.setVisibility(View.VISIBLE); checkVoted(); edtOther.setText(""); } @@ -358,6 +363,8 @@ public class ElectionFragment extends BaseFragment { public void onClick(View v) { edtOther.setText(""); addOtherLayout.setVisibility(View.GONE); + tvInfo.setVisibility(View.VISIBLE); + list_election_item_add_btn.setVisibility(View.VISIBLE); KeyboardUtils.hideSoftInput(getActivity()); } }); @@ -657,7 +664,7 @@ public class ElectionFragment extends BaseFragment { holder.btnX = (RadioButton) convertView.findViewById(R.id.list_election_item_xx);// to holder.RG = (RadioGroup) convertView.findViewById(R.id.list_election_item_radio_group); holder.btnDel = (RadioButton) convertView.findViewById(R.id.list_election_item_del); - holder.imgBook = (PhotoView) convertView.findViewById(R.id.img_book); + //holder.imgBook = (PhotoView) convertView.findViewById(R.id.img_book); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); @@ -674,21 +681,21 @@ public class ElectionFragment extends BaseFragment { if (it.No > 0) { holder.btnX.setVisibility(View.VISIBLE); - holder.btnDel.setVisibility(View.INVISIBLE); + holder.btnDel.setVisibility(View.GONE); }else { holder.btnX.setVisibility(View.GONE); holder.btnDel.setVisibility(View.VISIBLE); } - String bookImgPath = (String)SharedPreferencesUtil.getData(getActivity(),it.title,""); + /*String bookImgPath = (String)SharedPreferencesUtil.getData(getActivity(),it.title,""); if(!TextUtils.isEmpty(bookImgPath)){ holder.imgBook.setVisibility(View.VISIBLE); Bitmap bitmap = BitmapFactory.decodeFile(bookImgPath); holder.imgBook.setImageBitmap(bitmap); }else{ holder.imgBook.setVisibility(View.GONE); - } + }*/ if(it.modifyModel){ holder.btnO.setEnabled(false); @@ -817,15 +824,20 @@ public class ElectionFragment extends BaseFragment { } } if(voteInfo!=null){ - tvInfo.setText(getString(R.string.should_select1) + votedCount + getString(R.string.person)); + String s=getString(R.string.should_select1); + String str= String.format("%s%s%s",getString(R.string.should_select1),votedCount,getString(R.string.person)); + tvInfo.setText(Html.fromHtml(str)); + //tvInfo.setText(getString(R.string.should_select1) + votedCount + getString(R.string.person)); } mAdapter.notifyDataSetChanged(); listview.invalidate(); if((aryContent.size()- voteInfo.select) - + diff --git a/C5/app/src/main/res/drawable/green_round_button.xml b/C5/app/src/main/res/drawable/green_round_button.xml index 9bd57c3..4f4442f 100644 --- a/C5/app/src/main/res/drawable/green_round_button.xml +++ b/C5/app/src/main/res/drawable/green_round_button.xml @@ -5,5 +5,5 @@ - + diff --git a/C5/app/src/main/res/drawable/red_round_button.xml b/C5/app/src/main/res/drawable/red_round_button.xml index 5848916..74fe51b 100644 --- a/C5/app/src/main/res/drawable/red_round_button.xml +++ b/C5/app/src/main/res/drawable/red_round_button.xml @@ -5,5 +5,5 @@ - + diff --git a/C5/app/src/main/res/drawable/yellow_round_button.xml b/C5/app/src/main/res/drawable/yellow_round_button.xml index 8da50fa..2848e5a 100644 --- a/C5/app/src/main/res/drawable/yellow_round_button.xml +++ b/C5/app/src/main/res/drawable/yellow_round_button.xml @@ -5,5 +5,5 @@ - + diff --git a/C5/app/src/main/res/layout/fragment_election.xml b/C5/app/src/main/res/layout/fragment_election.xml index 53ceefe..02f27b5 100644 --- a/C5/app/src/main/res/layout/fragment_election.xml +++ b/C5/app/src/main/res/layout/fragment_election.xml @@ -32,17 +32,18 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" + android:textColor="@color/white" android:text="" android:textSize="@dimen/big_text_p5" />