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