mirror of
https://github.com/accelforce/Yuito
synced 2024-12-22 13:24:46 +01:00
Nicer login layout
This commit is contained in:
parent
bdc19efe3d
commit
4060f3f45f
@ -22,10 +22,12 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.volley.Request;
|
||||
@ -48,6 +50,7 @@ public class LoginActivity extends BaseActivity {
|
||||
private String domain;
|
||||
private String clientId;
|
||||
private String clientSecret;
|
||||
private EditText editText;
|
||||
|
||||
/**
|
||||
* Chain together the key-value pairs into a query string, for either appending to a URL or
|
||||
@ -173,7 +176,7 @@ public class LoginActivity extends BaseActivity {
|
||||
preferences = getSharedPreferences(
|
||||
getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
|
||||
Button button = (Button) findViewById(R.id.button_login);
|
||||
final EditText editText = (EditText) findViewById(R.id.edit_text_domain);
|
||||
editText = (EditText) findViewById(R.id.edit_text_domain);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -273,7 +276,7 @@ public class LoginActivity extends BaseActivity {
|
||||
try {
|
||||
accessToken = response.getString("access_token");
|
||||
} catch(JSONException e) {
|
||||
errorText.setText(e.getMessage());
|
||||
editText.setError(e.getMessage());
|
||||
return;
|
||||
}
|
||||
onLoginSuccess(accessToken);
|
||||
@ -281,7 +284,7 @@ public class LoginActivity extends BaseActivity {
|
||||
}, new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
errorText.setText(error.getMessage());
|
||||
editText.setError(error.getMessage());
|
||||
}
|
||||
});
|
||||
VolleySingleton.getInstance(this).addToRequestQueue(request);
|
||||
|
@ -3,12 +3,12 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="@color/media_preview_unloaded_background_dark" />
|
||||
<solid android:color="@color/color_background_dark" />
|
||||
|
||||
<stroke
|
||||
android:dashWidth="4dp"
|
||||
android:dashGap="4dp"
|
||||
android:width="2dp"
|
||||
android:color="#AFAFAF" />
|
||||
android:color="@color/color_primary_dark" />
|
||||
|
||||
</shape>
|
@ -4,15 +4,9 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
tools:context="com.keylesspalace.tusky.LoginActivity">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:elevation="4dp"
|
||||
android:background="?attr/toolbar_background_color" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -21,30 +15,44 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center">
|
||||
|
||||
<EditText
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textUri"
|
||||
android:hint="@string/hint_domain"
|
||||
android:ems="10"
|
||||
android:id="@+id/edit_text_domain" />
|
||||
android:src="@drawable/elephant_friend"/>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content">
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textUri"
|
||||
android:hint="@string/hint_domain"
|
||||
android:ems="10"
|
||||
android:id="@+id/edit_text_domain" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:text="@string/action_login"
|
||||
android:id="@+id/button_login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/button_login" />
|
||||
android:layout_marginTop="4dp"
|
||||
android:elevation="0dp"
|
||||
android:text="@string/action_login" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/text_error" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAlignment="center"
|
||||
android:id="@+id/no_account"
|
||||
android:text="@string/link_no_account" />
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
||||
<string name="report_comment_hint">Additional Comments?</string>
|
||||
|
||||
<string name="action_compose">Compose</string>
|
||||
<string name="action_login">Ask Site To Log In</string>
|
||||
<string name="action_login">Login with Mastodon</string>
|
||||
<string name="action_logout">Log Out</string>
|
||||
<string name="action_follow">Follow</string>
|
||||
<string name="action_unfollow">Unfollow</string>
|
||||
@ -120,7 +120,7 @@
|
||||
<string name="confirmation_send">Toot!</string>
|
||||
<string name="confirmation_reported">Sent!</string>
|
||||
|
||||
<string name="hint_domain">Which Site?</string>
|
||||
<string name="hint_domain">Which instance?</string>
|
||||
<string name="hint_compose">What\'s happening?</string>
|
||||
<string name="hint_content_warning">Content warning</string>
|
||||
|
||||
@ -155,5 +155,6 @@
|
||||
<string name="action_submit">Submit</string>
|
||||
<string name="action_photo_pick">Add media</string>
|
||||
<string name="action_compose_options">Privacy options</string>
|
||||
<string name="login_success">Welcome back!</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user