blob: 6d1e4c35ae68aaaf148583f29223e93d9adea844 [file] [log] [blame]
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -07001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.example.android.systemupdatersample.ui;
18
19import android.app.Activity;
20import android.app.AlertDialog;
Zhomart Mukhamejanov238beb72018-05-09 16:25:40 -070021import android.graphics.Color;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070022import android.os.Build;
23import android.os.Bundle;
Zhomart Mukhamejanov75f40732018-12-14 09:36:32 -080024import android.os.Handler;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070025import android.os.UpdateEngine;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070026import android.util.Log;
27import android.view.View;
28import android.widget.ArrayAdapter;
29import android.widget.Button;
30import android.widget.ProgressBar;
31import android.widget.Spinner;
32import android.widget.TextView;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070033
34import com.example.android.systemupdatersample.R;
35import com.example.android.systemupdatersample.UpdateConfig;
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -070036import com.example.android.systemupdatersample.UpdateManager;
Zhomart Mukhamejanov674aa6c2018-05-25 17:00:11 -070037import com.example.android.systemupdatersample.UpdaterState;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070038import com.example.android.systemupdatersample.util.UpdateConfigs;
39import com.example.android.systemupdatersample.util.UpdateEngineErrorCodes;
40import com.example.android.systemupdatersample.util.UpdateEngineStatuses;
41
42import java.util.List;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070043
44/**
45 * UI for SystemUpdaterSample app.
46 */
47public class MainActivity extends Activity {
48
Zhomart Mukhamejanovf7a70382018-05-02 20:37:12 -070049 private static final String TAG = "MainActivity";
50
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070051 private TextView mTextViewBuild;
52 private Spinner mSpinnerConfigs;
53 private TextView mTextViewConfigsDirHint;
54 private Button mButtonReload;
55 private Button mButtonApplyConfig;
56 private Button mButtonStop;
57 private Button mButtonReset;
Zhomart Mukhamejanov16db9942018-05-31 10:47:09 -070058 private Button mButtonSuspend;
59 private Button mButtonResume;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070060 private ProgressBar mProgressBar;
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -070061 private TextView mTextViewUpdaterState;
62 private TextView mTextViewEngineStatus;
63 private TextView mTextViewEngineErrorCode;
Zhomart Mukhamejanov238beb72018-05-09 16:25:40 -070064 private TextView mTextViewUpdateInfo;
65 private Button mButtonSwitchSlot;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070066
67 private List<UpdateConfig> mConfigs;
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070068
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -070069 private final UpdateManager mUpdateManager =
Zhomart Mukhamejanov75f40732018-12-14 09:36:32 -080070 new UpdateManager(new UpdateEngine(), new Handler());
Zhomart Mukhamejanovf7a70382018-05-02 20:37:12 -070071
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070072 @Override
73 protected void onCreate(Bundle savedInstanceState) {
74 super.onCreate(savedInstanceState);
75 setContentView(R.layout.activity_main);
76
77 this.mTextViewBuild = findViewById(R.id.textViewBuild);
78 this.mSpinnerConfigs = findViewById(R.id.spinnerConfigs);
79 this.mTextViewConfigsDirHint = findViewById(R.id.textViewConfigsDirHint);
80 this.mButtonReload = findViewById(R.id.buttonReload);
81 this.mButtonApplyConfig = findViewById(R.id.buttonApplyConfig);
82 this.mButtonStop = findViewById(R.id.buttonStop);
83 this.mButtonReset = findViewById(R.id.buttonReset);
Zhomart Mukhamejanov16db9942018-05-31 10:47:09 -070084 this.mButtonSuspend = findViewById(R.id.buttonSuspend);
85 this.mButtonResume = findViewById(R.id.buttonResume);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070086 this.mProgressBar = findViewById(R.id.progressBar);
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -070087 this.mTextViewUpdaterState = findViewById(R.id.textViewUpdaterState);
88 this.mTextViewEngineStatus = findViewById(R.id.textViewEngineStatus);
89 this.mTextViewEngineErrorCode = findViewById(R.id.textViewEngineErrorCode);
Zhomart Mukhamejanov238beb72018-05-09 16:25:40 -070090 this.mTextViewUpdateInfo = findViewById(R.id.textViewUpdateInfo);
91 this.mButtonSwitchSlot = findViewById(R.id.buttonSwitchSlot);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070092
93 this.mTextViewConfigsDirHint.setText(UpdateConfigs.getConfigsRoot(this));
94
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -070095 uiResetWidgets();
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -070096 loadUpdateConfigs();
Zhomart Mukhamejanovf7a70382018-05-02 20:37:12 -070097
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -070098 this.mUpdateManager.setOnStateChangeCallback(this::onUpdaterStateChange);
99 this.mUpdateManager.setOnEngineStatusUpdateCallback(this::onEngineStatusUpdate);
100 this.mUpdateManager.setOnEngineCompleteCallback(this::onEnginePayloadApplicationComplete);
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -0700101 this.mUpdateManager.setOnProgressUpdateCallback(this::onProgressUpdate);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700102 }
103
104 @Override
105 protected void onDestroy() {
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -0700106 this.mUpdateManager.setOnEngineStatusUpdateCallback(null);
107 this.mUpdateManager.setOnProgressUpdateCallback(null);
108 this.mUpdateManager.setOnEngineCompleteCallback(null);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700109 super.onDestroy();
110 }
111
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -0700112 @Override
113 protected void onResume() {
114 super.onResume();
Zhomart Mukhamejanov7671f682018-05-24 09:11:47 -0700115 // Binding to UpdateEngine invokes onStatusUpdate callback,
116 // persisted updater state has to be loaded and prepared beforehand.
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -0700117 this.mUpdateManager.bind();
118 }
119
120 @Override
121 protected void onPause() {
122 this.mUpdateManager.unbind();
123 super.onPause();
124 }
125
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700126 /**
127 * reload button is clicked
128 */
129 public void onReloadClick(View view) {
130 loadUpdateConfigs();
131 }
132
133 /**
134 * view config button is clicked
135 */
136 public void onViewConfigClick(View view) {
137 UpdateConfig config = mConfigs.get(mSpinnerConfigs.getSelectedItemPosition());
138 new AlertDialog.Builder(this)
139 .setTitle(config.getName())
140 .setMessage(config.getRawJson())
141 .setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss())
142 .show();
143 }
144
145 /**
146 * apply config button is clicked
147 */
148 public void onApplyConfigClick(View view) {
149 new AlertDialog.Builder(this)
150 .setTitle("Apply Update")
151 .setMessage("Do you really want to apply this update?")
152 .setIcon(android.R.drawable.ic_dialog_alert)
153 .setPositiveButton(android.R.string.ok, (dialog, whichButton) -> {
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700154 uiResetWidgets();
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700155 uiResetEngineText();
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700156 applyUpdate(getSelectedConfig());
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700157 })
158 .setNegativeButton(android.R.string.cancel, null)
159 .show();
160 }
161
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700162 private void applyUpdate(UpdateConfig config) {
163 try {
164 mUpdateManager.applyUpdate(this, config);
165 } catch (UpdaterState.InvalidTransitionException e) {
166 Log.e(TAG, "Failed to apply update " + config.getName(), e);
167 }
168 }
169
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700170 /**
171 * stop button clicked
172 */
173 public void onStopClick(View view) {
174 new AlertDialog.Builder(this)
175 .setTitle("Stop Update")
176 .setMessage("Do you really want to cancel running update?")
177 .setIcon(android.R.drawable.ic_dialog_alert)
178 .setPositiveButton(android.R.string.ok, (dialog, whichButton) -> {
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700179 cancelRunningUpdate();
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700180 })
181 .setNegativeButton(android.R.string.cancel, null).show();
182 }
183
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700184 private void cancelRunningUpdate() {
185 try {
186 mUpdateManager.cancelRunningUpdate();
187 } catch (UpdaterState.InvalidTransitionException e) {
188 Log.e(TAG, "Failed to cancel running update", e);
189 }
190 }
191
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700192 /**
193 * reset button clicked
194 */
195 public void onResetClick(View view) {
196 new AlertDialog.Builder(this)
197 .setTitle("Reset Update")
198 .setMessage("Do you really want to cancel running update"
199 + " and restore old version?")
200 .setIcon(android.R.drawable.ic_dialog_alert)
201 .setPositiveButton(android.R.string.ok, (dialog, whichButton) -> {
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700202 resetUpdate();
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700203 })
204 .setNegativeButton(android.R.string.cancel, null).show();
205 }
206
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700207 private void resetUpdate() {
208 try {
209 mUpdateManager.resetUpdate();
210 } catch (UpdaterState.InvalidTransitionException e) {
211 Log.e(TAG, "Failed to reset update", e);
212 }
213 }
214
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700215 /**
Zhomart Mukhamejanov16db9942018-05-31 10:47:09 -0700216 * suspend button clicked
217 */
218 public void onSuspendClick(View view) {
219 try {
220 mUpdateManager.suspend();
221 } catch (UpdaterState.InvalidTransitionException e) {
222 Log.e(TAG, "Failed to suspend running update", e);
223 }
224 }
225
226 /**
227 * resume button clicked
228 */
229 public void onResumeClick(View view) {
230 try {
231 uiResetWidgets();
232 uiResetEngineText();
233 mUpdateManager.resume();
234 } catch (UpdaterState.InvalidTransitionException e) {
235 Log.e(TAG, "Failed to resume running update", e);
236 }
237 }
238
239 /**
Zhomart Mukhamejanov238beb72018-05-09 16:25:40 -0700240 * switch slot button clicked
241 */
242 public void onSwitchSlotClick(View view) {
Zhomart Mukhamejanov16db9942018-05-31 10:47:09 -0700243 uiResetWidgets();
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -0700244 mUpdateManager.setSwitchSlotOnReboot();
Zhomart Mukhamejanov238beb72018-05-09 16:25:40 -0700245 }
246
247 /**
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700248 * Invoked when SystemUpdaterSample app state changes.
249 * Value of {@code state} will be one of the
Zhomart Mukhamejanov674aa6c2018-05-25 17:00:11 -0700250 * values from {@link UpdaterState}.
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700251 */
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700252 private void onUpdaterStateChange(int state) {
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700253 Log.i(TAG, "UpdaterStateChange state="
254 + UpdaterState.getStateText(state)
255 + "/" + state);
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -0700256 runOnUiThread(() -> {
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700257 setUiUpdaterState(state);
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700258
259 if (state == UpdaterState.IDLE) {
260 uiStateIdle();
261 } else if (state == UpdaterState.RUNNING) {
262 uiStateRunning();
263 } else if (state == UpdaterState.PAUSED) {
264 uiStatePaused();
265 } else if (state == UpdaterState.ERROR) {
266 uiStateError();
267 } else if (state == UpdaterState.SLOT_SWITCH_REQUIRED) {
268 uiStateSlotSwitchRequired();
269 } else if (state == UpdaterState.REBOOT_REQUIRED) {
270 uiStateRebootRequired();
271 }
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700272 });
273 }
274
275 /**
276 * Invoked when {@link UpdateEngine} status changes. Value of {@code status} will
277 * be one of the values from {@link UpdateEngine.UpdateStatusConstants}.
278 */
279 private void onEngineStatusUpdate(int status) {
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700280 Log.i(TAG, "StatusUpdate - status="
281 + UpdateEngineStatuses.getStatusText(status)
282 + "/" + status);
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700283 runOnUiThread(() -> {
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700284 setUiEngineStatus(status);
Zhomart Mukhamejanov6f26e712018-05-18 10:15:31 -0700285 });
286 }
287
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700288 /**
289 * Invoked when the payload has been applied, whether successfully or
290 * unsuccessfully. The value of {@code errorCode} will be one of the
291 * values from {@link UpdateEngine.ErrorCodeConstants}.
292 */
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700293 private void onEnginePayloadApplicationComplete(int errorCode) {
294 final String completionState = UpdateEngineErrorCodes.isUpdateSucceeded(errorCode)
Zhomart Mukhamejanovf7a70382018-05-02 20:37:12 -0700295 ? "SUCCESS"
296 : "FAILURE";
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700297 Log.i(TAG,
298 "PayloadApplicationCompleted - errorCode="
299 + UpdateEngineErrorCodes.getCodeName(errorCode) + "/" + errorCode
300 + " " + completionState);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700301 runOnUiThread(() -> {
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700302 setUiEngineErrorCode(errorCode);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700303 });
304 }
305
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700306 /**
307 * Invoked when update progress changes.
308 */
309 private void onProgressUpdate(double progress) {
310 mProgressBar.setProgress((int) (100 * progress));
311 }
312
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700313 /** resets ui */
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700314 private void uiResetWidgets() {
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700315 mTextViewBuild.setText(Build.DISPLAY);
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700316 mSpinnerConfigs.setEnabled(false);
317 mButtonReload.setEnabled(false);
318 mButtonApplyConfig.setEnabled(false);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700319 mButtonStop.setEnabled(false);
320 mButtonReset.setEnabled(false);
Zhomart Mukhamejanov16db9942018-05-31 10:47:09 -0700321 mButtonSuspend.setEnabled(false);
322 mButtonResume.setEnabled(false);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700323 mProgressBar.setEnabled(false);
324 mProgressBar.setVisibility(ProgressBar.INVISIBLE);
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700325 mButtonSwitchSlot.setEnabled(false);
326 mTextViewUpdateInfo.setTextColor(Color.parseColor("#aaaaaa"));
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700327 }
328
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700329 private void uiResetEngineText() {
330 mTextViewEngineStatus.setText(R.string.unknown);
331 mTextViewEngineErrorCode.setText(R.string.unknown);
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700332 // Note: Do not reset mTextViewUpdaterState; UpdateManager notifies updater state properly.
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700333 }
334
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700335 private void uiStateIdle() {
336 uiResetWidgets();
Zhomart Mukhamejanov16db9942018-05-31 10:47:09 -0700337 mButtonReset.setEnabled(true);
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700338 mSpinnerConfigs.setEnabled(true);
339 mButtonReload.setEnabled(true);
340 mButtonApplyConfig.setEnabled(true);
341 mProgressBar.setProgress(0);
342 }
343
344 private void uiStateRunning() {
345 uiResetWidgets();
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700346 mProgressBar.setEnabled(true);
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700347 mProgressBar.setVisibility(ProgressBar.VISIBLE);
348 mButtonStop.setEnabled(true);
Zhomart Mukhamejanov16db9942018-05-31 10:47:09 -0700349 mButtonSuspend.setEnabled(true);
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700350 }
351
352 private void uiStatePaused() {
353 uiResetWidgets();
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700354 mButtonReset.setEnabled(true);
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700355 mProgressBar.setEnabled(true);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700356 mProgressBar.setVisibility(ProgressBar.VISIBLE);
Zhomart Mukhamejanov16db9942018-05-31 10:47:09 -0700357 mButtonResume.setEnabled(true);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700358 }
359
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700360 private void uiStateSlotSwitchRequired() {
361 uiResetWidgets();
362 mButtonReset.setEnabled(true);
363 mProgressBar.setEnabled(true);
364 mProgressBar.setVisibility(ProgressBar.VISIBLE);
Zhomart Mukhamejanov238beb72018-05-09 16:25:40 -0700365 mButtonSwitchSlot.setEnabled(true);
366 mTextViewUpdateInfo.setTextColor(Color.parseColor("#777777"));
367 }
368
Zhomart Mukhamejanov469b35a2018-06-01 12:41:20 -0700369 private void uiStateError() {
370 uiResetWidgets();
371 mButtonReset.setEnabled(true);
372 mProgressBar.setEnabled(true);
373 mProgressBar.setVisibility(ProgressBar.VISIBLE);
374 }
375
376 private void uiStateRebootRequired() {
377 uiResetWidgets();
378 mButtonReset.setEnabled(true);
Zhomart Mukhamejanov238beb72018-05-09 16:25:40 -0700379 }
380
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700381 /**
382 * loads json configurations from configs dir that is defined in {@link UpdateConfigs}.
383 */
384 private void loadUpdateConfigs() {
385 mConfigs = UpdateConfigs.getUpdateConfigs(this);
386 loadConfigsToSpinner(mConfigs);
387 }
388
389 /**
390 * @param status update engine status code
391 */
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700392 private void setUiEngineStatus(int status) {
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700393 String statusText = UpdateEngineStatuses.getStatusText(status);
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700394 mTextViewEngineStatus.setText(statusText + "/" + status);
Zhomart Mukhamejanovf7a70382018-05-02 20:37:12 -0700395 }
396
397 /**
398 * @param errorCode update engine error code
399 */
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700400 private void setUiEngineErrorCode(int errorCode) {
Zhomart Mukhamejanovf7a70382018-05-02 20:37:12 -0700401 String errorText = UpdateEngineErrorCodes.getCodeName(errorCode);
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700402 mTextViewEngineErrorCode.setText(errorText + "/" + errorCode);
403 }
404
405 /**
406 * @param state updater sample state
407 */
408 private void setUiUpdaterState(int state) {
Zhomart Mukhamejanov674aa6c2018-05-25 17:00:11 -0700409 String stateText = UpdaterState.getStateText(state);
Zhomart Mukhamejanov8f4059d2018-05-18 10:15:31 -0700410 mTextViewUpdaterState.setText(stateText + "/" + state);
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700411 }
412
413 private void loadConfigsToSpinner(List<UpdateConfig> configs) {
414 String[] spinnerArray = UpdateConfigs.configsToNames(configs);
415 ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(this,
416 android.R.layout.simple_spinner_item,
417 spinnerArray);
418 spinnerArrayAdapter.setDropDownViewResource(android.R.layout
419 .simple_spinner_dropdown_item);
420 mSpinnerConfigs.setAdapter(spinnerArrayAdapter);
421 }
422
423 private UpdateConfig getSelectedConfig() {
424 return mConfigs.get(mSpinnerConfigs.getSelectedItemPosition());
425 }
426
Zhomart Mukhamejanovf4d280c2018-04-17 13:20:22 -0700427}