display link to reset password on website.

This commit is contained in:
Phillip Thelen 2015-12-10 02:26:25 +01:00
parent 18995b0905
commit dd925b8b41
3 changed files with 54 additions and 15 deletions

View file

@ -140,39 +140,41 @@
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_span="2"
android:layout_gravity="center" >
android:layout_height="match_parent"
android:layout_marginTop="16dp">
<Button
android:id="@+id/login_btn"
android:layout_width="150dp"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="@string/register_btn"
android:layout_gravity="center_horizontal"
android:textColor="@color/white"
android:background="@drawable/rounded_purple_square"
android:layout_span="2"
android:layout_marginBottom="8dp"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ProgressBar
android:id="@+id/PB_AsyncTask"
android:indeterminate="true"
android:visibility="gone"
android:layout_span="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp">
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">
<com.facebook.login.widget.LoginButton
android:id="@+id/login_button"
android:layout_width="wrap_content"
@ -181,7 +183,20 @@
android:layout_span="2"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/forgot_pw_tv"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="@string/forgot_pw_tv"
android:layout_gravity="center_horizontal"
android:textColor="@color/best_10"
android:layout_span="2"
/>
</TableRow>
</TableLayout>
</ScrollView>

View file

@ -199,4 +199,6 @@
<string name="flag_confirm">Flag Message</string>
<string name="unlock_lvl_10">Unlock at lvl 10</string>
<string name="no_party_message">You are not in a party. To join a party, please visit the website.</string>
<string name="forgot_pw_btn">Forgot Password</string>
<string name="forgot_pw_tv">Forgot Password? Please use the mobile Website.</string>
</resources>

View file

@ -4,10 +4,14 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.text.SpannableString;
import android.text.style.UnderlineSpan;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@ -17,6 +21,7 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TableRow;
import android.widget.TextView;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
@ -48,6 +53,7 @@ public class LoginActivity extends AppCompatActivity
private final static String TAG_APIKEY="key";
private Button mLoginNormalBtn;
private TextView mForgotPWTV;
private LoginButton mFacebookLoginBtn;
private EditText mUsernameET, mPasswordET,mEmail,mConfirmPassword;
private TableRow mEmailRow, mConfirmPasswordRow;
@ -88,6 +94,12 @@ public class LoginActivity extends AppCompatActivity
mFacebookLoginBtn = (LoginButton) this.findViewById(R.id.login_button);
mFacebookLoginBtn.setReadPermissions("user_friends");
mForgotPWTV = (TextView) this.findViewById(R.id.forgot_pw_tv);
mForgotPWTV.setOnClickListener(mForgotPWClick);
SpannableString content = new SpannableString(mForgotPWTV.getText());
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
mForgotPWTV.setText(content);
callbackManager = CallbackManager.Factory.create();
mFacebookLoginBtn.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@ -163,6 +175,16 @@ public class LoginActivity extends AppCompatActivity
}
};
private View.OnClickListener mForgotPWClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = "https://habitica.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
};
public static void expand(final View v) {
v.setVisibility(View.VISIBLE);
@ -177,9 +199,9 @@ public class LoginActivity extends AppCompatActivity
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
}
private void toggleRegistering() {
private void toggleRegistering() {
this.isRegistering = !this.isRegistering;
this.setRegistering(this.isRegistering);
}