parent
398903588e
commit
3decdf19eb
@ -0,0 +1,40 @@
|
|||||||
|
package dev.garrettmills.starship.hyperlink;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import dev.garrettmills.starship.hyperlink.util.LoginToken;
|
||||||
|
|
||||||
|
public class LoginTokenFormActivity extends AppCompatActivity {
|
||||||
|
EditText serverInput;
|
||||||
|
EditText tokenInput;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_login_token_form);
|
||||||
|
|
||||||
|
serverInput = findViewById(R.id.activity_login_token_form_serverEditText);
|
||||||
|
tokenInput = findViewById(R.id.activity_login_token_form_tokenEditText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onContinueClick(View view) {
|
||||||
|
if ( serverInput.getText().length() > 0 && tokenInput.getText().length() > 0 ) {
|
||||||
|
String loginToken = "hyperlink|" + serverInput.getText().toString() + "|" + tokenInput.getText().toString();
|
||||||
|
if ( !LoginToken.isValidLoginToken(loginToken) ) {
|
||||||
|
Toast.makeText(this, "Invalid credentials. Make sure both the server and token are the proper format.", Toast.LENGTH_LONG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent result = new Intent();
|
||||||
|
result.putExtra(Hyperlink.EXTRA_LOGIN_TOKEN, loginToken);
|
||||||
|
setResult(RESULT_OK, result);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_margin="64dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
card_view:cardCornerRadius="8dp"
|
||||||
|
card_view:cardElevation="8dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="24dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:text="Hyperlink Server Information"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Server Address"
|
||||||
|
android:textSize="22sp" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/activity_login_token_form_serverEditText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="https://hyperlink.url/"
|
||||||
|
android:inputType="text" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Token"
|
||||||
|
android:textSize="22sp" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/activity_login_token_form_tokenEditText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textPassword" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/activity_login_token_form_loginButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="onContinueClick"
|
||||||
|
android:text="Continue" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
Loading…
Reference in new issue