auth status usability
This commit is contained in:
parent
5e34753d5f
commit
48360c6cf1
|
@ -70,7 +70,8 @@ public class rusEFI extends Activity {
|
|||
private TextView mStatusView;
|
||||
private TextView mResultView;
|
||||
private EditText authToken;
|
||||
private TextView myClickableUrl;
|
||||
private TextView authStatusMessage;
|
||||
private TextView authStatusClickableUrl;
|
||||
|
||||
private UsbManager usbManager;
|
||||
private DfuUpload dfuUpload;
|
||||
|
@ -83,6 +84,9 @@ public class rusEFI extends Activity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_usb);
|
||||
|
||||
findViewById(R.id.buttonSound).setVisibility(View.GONE);
|
||||
findViewById(R.id.buttonDfu).setVisibility(View.GONE);
|
||||
|
||||
usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
||||
|
||||
// turn on scree while ADB debugging idle phone
|
||||
|
@ -109,15 +113,16 @@ public class rusEFI extends Activity {
|
|||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putString(AuthTokenUtil.AUTH_TOKEN, text);
|
||||
editor.commit();
|
||||
myClickableUrl.setVisibility(View.GONE);
|
||||
authStatusMessage.setVisibility(View.GONE);
|
||||
authStatusClickableUrl.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
myClickableUrl = (TextView) findViewById(R.id.authStatus);
|
||||
myClickableUrl.setText(AuthTokenUtil.TOKEN_PROFILE_URL);
|
||||
Linkify.addLinks(myClickableUrl, Linkify.WEB_URLS);
|
||||
|
||||
authStatusMessage = findViewById(R.id.authStatus1);
|
||||
authStatusClickableUrl = findViewById(R.id.authStatus2);
|
||||
authStatusClickableUrl.setText(AuthTokenUtil.TOKEN_PROFILE_URL);
|
||||
Linkify.addLinks(authStatusClickableUrl, Linkify.WEB_URLS);
|
||||
|
||||
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
|
||||
registerReceiver(mUsbReceiver, filter);
|
||||
|
@ -129,7 +134,9 @@ public class rusEFI extends Activity {
|
|||
dfuUpload.fileOperation(mResultView);
|
||||
String authToken = getAuthToken();
|
||||
this.authToken.setText(authToken);
|
||||
myClickableUrl.setVisibility(AuthTokenUtil.isToken(authToken) ? View.VISIBLE : View.GONE);
|
||||
int visibility = AuthTokenUtil.isToken(authToken) ? View.GONE : View.VISIBLE;
|
||||
authStatusMessage.setVisibility(visibility);
|
||||
authStatusClickableUrl.setVisibility(visibility);
|
||||
|
||||
// switchOrProgramDfu();
|
||||
|
||||
|
@ -229,7 +236,7 @@ public class rusEFI extends Activity {
|
|||
* Called when the user touches the button
|
||||
*/
|
||||
public void sendMessage(View view) {
|
||||
if (view.getId() == R.id.button) {
|
||||
if (view.getId() == R.id.buttonDfu) {
|
||||
switchOrProgramDfu();
|
||||
} else if (view.getId() == R.id.buttonSound) {
|
||||
soundBroadcast.start();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
android:textAppearance="?android:textAppearanceMedium" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:id="@+id/buttonDfu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="sendMessage"
|
||||
|
@ -35,7 +35,13 @@
|
|||
android:text="Auth Token" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/authStatus"
|
||||
android:id="@+id/authStatus1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Please paste your auth token" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/authStatus2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextView" />
|
||||
|
|
Loading…
Reference in New Issue