mirror of
https://github.com/leanote/leanote-android.git
synced 2025-10-14 14:10:56 +00:00
support forgot password;
This commit is contained in:
@@ -2,6 +2,7 @@ package org.houxg.leamonax.ui;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.Editable;
|
||||
@@ -32,6 +33,7 @@ public class SignInActivity extends BaseActivity implements TextWatcher {
|
||||
private static final String TAG = "SignInActivity";
|
||||
|
||||
private static final String LEANOTE_HOST = "https://leanote.com";
|
||||
private static final String FIND_PASSWORD = "/findPassword";
|
||||
private static final String EXT_IS_CUSTOM_HOST = "ext_is_custom_host";
|
||||
private static final String EXT_HOST = "ext_host";
|
||||
|
||||
@@ -75,6 +77,18 @@ public class SignInActivity extends BaseActivity implements TextWatcher {
|
||||
mHostEt.setText(savedInstanceState.getString(EXT_HOST));
|
||||
}
|
||||
|
||||
@OnClick(R.id.tv_forgot_password)
|
||||
void clickedForgotPassword() {
|
||||
String url = getHost() + FIND_PASSWORD;
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse(url));
|
||||
try {
|
||||
startActivity(i);
|
||||
} catch (Exception ex) {
|
||||
ToastUtils.show(this, R.string.host_address_is_incorrect);
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.tv_custom_host)
|
||||
void switchHost() {
|
||||
refreshHostSetting(!(boolean) mCustomHostBtn.getTag());
|
||||
@@ -111,13 +125,15 @@ public class SignInActivity extends BaseActivity implements TextWatcher {
|
||||
mCustomHostBtn.setTag(isCustomHost);
|
||||
}
|
||||
|
||||
private String getHost() {
|
||||
return (boolean) mCustomHostBtn.getTag() ? mHostEt.getText().toString().trim() : LEANOTE_HOST;
|
||||
}
|
||||
|
||||
@OnClick(R.id.tv_sign_in)
|
||||
void signIn() {
|
||||
String email = mEmailEt.getText().toString();
|
||||
String password = mPasswordEt.getText().toString();
|
||||
boolean isCustomHost = (boolean) mCustomHostBtn.getTag();
|
||||
final String host = isCustomHost ? mHostEt.getText().toString().trim() : LEANOTE_HOST;
|
||||
final String host = getHost();
|
||||
ApiProvider.getInstance().init(host);
|
||||
AccountService.login(email, password)
|
||||
.doOnSubscribe(new Action0() {
|
||||
|
BIN
app/src/main/res/drawable-xxhdpi/logo.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
@@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_fields"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
@@ -84,12 +85,14 @@
|
||||
android:indeterminate="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_forgot_password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv_sign_in"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="4dp"
|
||||
android:padding="8dp"
|
||||
android:text="@string/forgot_password"
|
||||
android:textColor="#EEEEEE" />
|
||||
</RelativeLayout>
|
||||
@@ -103,6 +106,14 @@
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/rl_fields"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@drawable/logo" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_custom_host"
|
||||
|
@@ -54,4 +54,5 @@
|
||||
<string name="changed">Changed</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="host_address_is_incorrect">Host address is incorrect</string>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user