You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.4 KiB
40 lines
1.4 KiB
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();
|
|
}
|
|
}
|
|
} |