Commit 793e2ae4c9ed33b171b0dc37b2fb1c36bb0d8a36
1 parent
430dc15d
添加系统状态条,修改选举根据主控值发生改变
Showing
6 changed files
with
77 additions
and
12 deletions
C5/app/build.gradle
@@ -82,14 +82,17 @@ repositories { | @@ -82,14 +82,17 @@ repositories { | ||
82 | 82 | ||
83 | 83 | ||
84 | dependencies { | 84 | dependencies { |
85 | - compile 'com.android.support:appcompat-v7:23.4.0' | ||
86 | - compile 'com.android.support:support-v4:23.4.0' | 85 | + implementation fileTree(include: ['*.jar'], dir: 'libs') |
86 | + androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
87 | + exclude group: 'com.android.support', module: 'support-annotations' | ||
88 | + }) | ||
89 | + implementation 'com.android.support:appcompat-v7:26.+' | ||
87 | compile files('libs/ant.jar') | 90 | compile files('libs/ant.jar') |
88 | compile project(':udpmodule') | 91 | compile project(':udpmodule') |
89 | - compile project(':xpadprotocal') | ||
90 | compile(name: 'ycanfilereadfunc-release', ext: 'aar') | 92 | compile(name: 'ycanfilereadfunc-release', ext: 'aar') |
91 | compile(name: 'ycanreaderfileshow-release', ext: 'aar') | 93 | compile(name: 'ycanreaderfileshow-release', ext: 'aar') |
92 | compile(name: 'ycan-release', ext: 'aar') | 94 | compile(name: 'ycan-release', ext: 'aar') |
95 | + compile project(':statusBar') | ||
93 | compile 'com.bm.photoview:library:1.4.1' | 96 | compile 'com.bm.photoview:library:1.4.1' |
94 | compile 'com.github.barteksc:android-pdf-viewer:2.7.0' | 97 | compile 'com.github.barteksc:android-pdf-viewer:2.7.0' |
95 | compile 'cn.yipianfengye.android:zxing-library:2.2' | 98 | compile 'cn.yipianfengye.android:zxing-library:2.2' |
C5/app/src/main/AndroidManifest.xml
@@ -70,6 +70,15 @@ | @@ -70,6 +70,15 @@ | ||
70 | <!-- android:label="testActivity1" --> | 70 | <!-- android:label="testActivity1" --> |
71 | <!-- android:screenOrientation="landscape" > --> | 71 | <!-- android:screenOrientation="landscape" > --> |
72 | <!-- </activity> --> | 72 | <!-- </activity> --> |
73 | + <receiver | ||
74 | + android:name=".server.BatteryReceiver" | ||
75 | + android:enabled="true" | ||
76 | + android:permission="android.permission.RECEIVE_BOOT_COMPLETED" > | ||
77 | + <intent-filter> | ||
78 | + <action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
79 | + <category android:name="android.intent.category.DEFAULT" /> | ||
80 | + </intent-filter> | ||
81 | + </receiver> | ||
73 | 82 | ||
74 | <receiver | 83 | <receiver |
75 | android:name=".BootBroadcastReceiver" | 84 | android:name=".BootBroadcastReceiver" |
C5/app/src/main/java/com/sunvote/xpadapp/MainActivity.java
@@ -9,6 +9,7 @@ import android.app.ProgressDialog; | @@ -9,6 +9,7 @@ import android.app.ProgressDialog; | ||
9 | import android.content.BroadcastReceiver; | 9 | import android.content.BroadcastReceiver; |
10 | import android.content.DialogInterface; | 10 | import android.content.DialogInterface; |
11 | import android.content.Intent; | 11 | import android.content.Intent; |
12 | +import android.content.IntentFilter; | ||
12 | import android.content.pm.PackageManager; | 13 | import android.content.pm.PackageManager; |
13 | import android.graphics.Color; | 14 | import android.graphics.Color; |
14 | import android.net.Uri; | 15 | import android.net.Uri; |
@@ -72,9 +73,12 @@ import com.sunvote.xpadapp.fragments.SinginResultFragment; | @@ -72,9 +73,12 @@ import com.sunvote.xpadapp.fragments.SinginResultFragment; | ||
72 | import com.sunvote.xpadapp.fragments.SingleTitleFragment; | 73 | import com.sunvote.xpadapp.fragments.SingleTitleFragment; |
73 | import com.sunvote.xpadapp.presenter.ServicePresent; | 74 | import com.sunvote.xpadapp.presenter.ServicePresent; |
74 | import com.sunvote.xpadapp.presenter.XPadPresenter; | 75 | import com.sunvote.xpadapp.presenter.XPadPresenter; |
76 | +import com.sunvote.xpadapp.server.BatteryReceiver; | ||
75 | import com.sunvote.xpadapp.server.MoniService; | 77 | import com.sunvote.xpadapp.server.MoniService; |
76 | import com.sunvote.xpadapp.utils.FileUtil; | 78 | import com.sunvote.xpadapp.utils.FileUtil; |
77 | import com.sunvote.xpadapp.utils.SharedPreferencesUtil; | 79 | import com.sunvote.xpadapp.utils.SharedPreferencesUtil; |
80 | +import com.sunvote.xpadapp.widget.StatusBarView; | ||
81 | +import com.sunvote.xpadapp.widget.TimeThread; | ||
78 | import com.sunvote.xpadcomm.ComListener; | 82 | import com.sunvote.xpadcomm.ComListener; |
79 | import com.sunvote.xpadcomm.FileRecver; | 83 | import com.sunvote.xpadcomm.FileRecver; |
80 | import com.sunvote.xpadcomm.ScreenUtil; | 84 | import com.sunvote.xpadcomm.ScreenUtil; |
@@ -212,11 +216,13 @@ public class MainActivity extends BaseActivity implements ComListener { | @@ -212,11 +216,13 @@ public class MainActivity extends BaseActivity implements ComListener { | ||
212 | private TextView terminalId; | 216 | private TextView terminalId; |
213 | private ImageView service; | 217 | private ImageView service; |
214 | 218 | ||
219 | + BatteryReceiver m_receiver; | ||
220 | + StatusBarView statusBarView; | ||
215 | @Override | 221 | @Override |
216 | protected void onCreate(Bundle savedInstanceState) { | 222 | protected void onCreate(Bundle savedInstanceState) { |
217 | super.onCreate(savedInstanceState); | 223 | super.onCreate(savedInstanceState); |
218 | setContentView(R.layout.activity_main); | 224 | setContentView(R.layout.activity_main); |
219 | - terminalId = findViewById(R.id.terminal_id); | 225 | + // terminalId = findViewById(R.id.terminal_id); |
220 | service = findViewById(R.id.service); | 226 | service = findViewById(R.id.service); |
221 | lockscreen = findViewById(R.id.lockscreen); | 227 | lockscreen = findViewById(R.id.lockscreen); |
222 | if (service != null) { | 228 | if (service != null) { |
@@ -245,6 +251,11 @@ public class MainActivity extends BaseActivity implements ComListener { | @@ -245,6 +251,11 @@ public class MainActivity extends BaseActivity implements ComListener { | ||
245 | screenTimer = new Timer(true); | 251 | screenTimer = new Timer(true); |
246 | screenTimer.schedule(screenTask, 1000, 1000); // 延时1000ms后执行,1000ms执行一次 | 252 | screenTimer.schedule(screenTask, 1000, 1000); // 延时1000ms后执行,1000ms执行一次 |
247 | 253 | ||
254 | + IntentFilter intentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); | ||
255 | + m_receiver = new BatteryReceiver(); | ||
256 | + registerReceiver(m_receiver, intentFilter); | ||
257 | + setTiltleStatus(); | ||
258 | + | ||
248 | clearApkFile(); | 259 | clearApkFile(); |
249 | FirmUpdateFragment.clearUpdateFile(); | 260 | FirmUpdateFragment.clearUpdateFile(); |
250 | 261 | ||
@@ -254,7 +265,37 @@ public class MainActivity extends BaseActivity implements ComListener { | @@ -254,7 +265,37 @@ public class MainActivity extends BaseActivity implements ComListener { | ||
254 | } | 265 | } |
255 | 266 | ||
256 | public void setTerminalId(int id) { | 267 | public void setTerminalId(int id) { |
257 | - terminalId.setText(getString(R.string.terminal_id) + id); | 268 | + //terminalId.setText(getString(R.string.terminal_id) + id); |
269 | + statusBarView.setStatusKeyId(id); | ||
270 | + } | ||
271 | + | ||
272 | + /** | ||
273 | + * 设置标题状态栏 | ||
274 | + */ | ||
275 | + private void setTiltleStatus(){ | ||
276 | + statusBarView =(StatusBarView)findViewById(R.id.title_status); | ||
277 | + if(statusBarView!=null){ | ||
278 | + statusBarView.setStatusSignal(0); | ||
279 | + statusBarView.setStatusBarBaseId(0); | ||
280 | + //statusBarView.setStatusCH(0); | ||
281 | + statusBarView.setStatusKeyId(0); | ||
282 | + } | ||
283 | + | ||
284 | + m_receiver.setOnReceiveResultData(new BatteryReceiver.IReceiveData() { | ||
285 | + @Override | ||
286 | + public void onReceiveData() { | ||
287 | + runOnUiThread(new Runnable() { | ||
288 | + @Override | ||
289 | + public void run() { | ||
290 | + statusBarView.setStatusBattery(m_receiver.getCurrentLevel(),m_receiver.getBatteryPercent()); | ||
291 | + } | ||
292 | + }); | ||
293 | + } | ||
294 | + }); | ||
295 | + | ||
296 | + //显示时间的控件 | ||
297 | + TimeThread timeThread = new TimeThread(statusBarView.getTimeCtl()); | ||
298 | + timeThread.start();//启动线程 | ||
258 | } | 299 | } |
259 | 300 | ||
260 | @Override | 301 | @Override |
@@ -304,7 +345,8 @@ public class MainActivity extends BaseActivity implements ComListener { | @@ -304,7 +345,8 @@ public class MainActivity extends BaseActivity implements ComListener { | ||
304 | } | 345 | } |
305 | 346 | ||
306 | public void setBackgroundColor(int color){ | 347 | public void setBackgroundColor(int color){ |
307 | - findViewById(R.id.root).setBackgroundColor(color); | 348 | + //findViewById(R.id.root).setBackgroundColor(color); |
349 | + statusBarView.setBackgroundColor(color); | ||
308 | } | 350 | } |
309 | 351 | ||
310 | @Override | 352 | @Override |
C5/app/src/main/java/com/sunvote/xpadapp/fragments/ElectionFragment.java
@@ -861,10 +861,12 @@ public class ElectionFragment extends BaseFragment { | @@ -861,10 +861,12 @@ public class ElectionFragment extends BaseFragment { | ||
861 | listview.invalidate(); | 861 | listview.invalidate(); |
862 | 862 | ||
863 | if((aryContent.size()- voteInfo.select)<checkOpposeVoted()){ | 863 | if((aryContent.size()- voteInfo.select)<checkOpposeVoted()){ |
864 | - //list_election_item_add_btn.setVisibility(View.VISIBLE); | ||
865 | - list_election_item_add_btn.setEnabled(true); | 864 | + if(voteInfo.other>0){//允许另选他人 |
865 | + list_election_item_add_btn.setEnabled(true); | ||
866 | + }else{ | ||
867 | + list_election_item_add_btn.setEnabled(false); | ||
868 | + } | ||
866 | }else{ | 869 | }else{ |
867 | - //list_election_item_add_btn.setVisibility(View.GONE); | ||
868 | list_election_item_add_btn.setEnabled(false); | 870 | list_election_item_add_btn.setEnabled(false); |
869 | } | 871 | } |
870 | } | 872 | } |
C5/app/src/main/res/layout/activity_main.xml
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | tools:context="com.sunvote.xpadapp.MainActivity" | 6 | tools:context="com.sunvote.xpadapp.MainActivity" |
7 | android:background="#720600"> | 7 | android:background="#720600"> |
8 | 8 | ||
9 | - <TextView | 9 | + <TextView |
10 | android:id="@+id/terminal_id" | 10 | android:id="@+id/terminal_id" |
11 | android:layout_width="wrap_content" | 11 | android:layout_width="wrap_content" |
12 | android:layout_height="20dp" | 12 | android:layout_height="20dp" |
@@ -14,13 +14,21 @@ | @@ -14,13 +14,21 @@ | ||
14 | android:layout_centerHorizontal="true" | 14 | android:layout_centerHorizontal="true" |
15 | android:gravity="center_horizontal" | 15 | android:gravity="center_horizontal" |
16 | android:textColor="@color/white" | 16 | android:textColor="@color/white" |
17 | + android:visibility="gone" | ||
17 | android:text="Default" /> | 18 | android:text="Default" /> |
18 | 19 | ||
20 | + <com.sunvote.xpadapp.widget.StatusBarView | ||
21 | + android:id="@+id/title_status" | ||
22 | + android:layout_alignParentTop="true" | ||
23 | + android:layout_centerHorizontal="true" | ||
24 | + android:layout_width="match_parent" | ||
25 | + android:layout_height="22dp"/> | ||
26 | + | ||
19 | <FrameLayout | 27 | <FrameLayout |
20 | android:id="@+id/frame_content" | 28 | android:id="@+id/frame_content" |
21 | android:layout_width="fill_parent" | 29 | android:layout_width="fill_parent" |
22 | android:layout_height="fill_parent" | 30 | android:layout_height="fill_parent" |
23 | - android:layout_below="@id/terminal_id"/> | 31 | + android:layout_below="@id/title_status"/> |
24 | 32 | ||
25 | <ImageView | 33 | <ImageView |
26 | android:id="@+id/service" | 34 | android:id="@+id/service" |
C5/app/src/main/res/layout/fragment_election.xml
@@ -269,7 +269,8 @@ | @@ -269,7 +269,8 @@ | ||
269 | android:layout_width="match_parent" | 269 | android:layout_width="match_parent" |
270 | android:layout_height="match_parent" | 270 | android:layout_height="match_parent" |
271 | android:layout_below="@id/line_panel" | 271 | android:layout_below="@id/line_panel" |
272 | - android:background="#E5E5E5"> | 272 | + android:background="#E5E5E5" |
273 | + android:visibility="gone"> | ||
273 | 274 | ||
274 | <LinearLayout | 275 | <LinearLayout |
275 | android:id="@+id/name_layout" | 276 | android:id="@+id/name_layout" |