Skip to content

Commit 98ac376

Browse files
committed
synchronize remote and local
1 parent 3df87e0 commit 98ac376

5 files changed

Lines changed: 34 additions & 7 deletions

File tree

0 Bytes
Binary file not shown.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/example/hongjo/myfinancialmanager/LoginActivity.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.example.hongjo.myfinancialmanager;
22

33
import android.content.ContentValues;
4+
import android.content.DialogInterface;
45
import android.content.Intent;
56
import android.support.v7.app.AlertDialog;
67
import android.support.v7.app.AppCompatActivity;
@@ -9,6 +10,9 @@
910
import android.view.View;
1011
import android.widget.Button;
1112
import android.widget.EditText;
13+
import android.widget.TextView;
14+
import android.net.Uri;
15+
import android.widget.Toast;
1216

1317
import com.example.hongjo.myfinancialmanager.database.DataProvider;
1418
import com.example.hongjo.myfinancialmanager.database.DataSource;
@@ -29,6 +33,8 @@ public class LoginActivity extends AppCompatActivity{
2933

3034
private String email, password;
3135

36+
private TextView forgotPassword;
37+
3238
@Override
3339
protected void onCreate(Bundle savedInstanceState) {
3440
super.onCreate(savedInstanceState);
@@ -39,11 +45,14 @@ protected void onCreate(Bundle savedInstanceState) {
3945
emailEdt = findViewById(R.id.email);
4046
passwordEdt = findViewById(R.id.password);
4147

48+
forgotPassword = findViewById(R.id.forgot_password);
49+
4250
Button signIn = findViewById(R.id.sign_in_button);
4351
Button createAccount = findViewById(R.id.create_account_button);
4452

4553
signIn.setOnClickListener(listener);
4654
createAccount.setOnClickListener(listener);
55+
forgotPassword.setOnClickListener(listener);
4756

4857
}
4958

@@ -59,6 +68,10 @@ public void onClick(View view){
5968
case R.id.create_account_button:
6069
register();
6170
break;
71+
//if the user forgets the password, send it to the user's email
72+
case R.id.forgot_password:
73+
74+
break;
6275
}
6376
}
6477
};
@@ -73,6 +86,12 @@ private void checkValidity(){
7386

7487
AlertDialog.Builder builder = new AlertDialog.Builder(this);
7588
builder.setTitle("Sign In Error");
89+
90+
if(email.isEmpty()||password.isEmpty()){
91+
builder.setMessage("Both email and password are required");
92+
builder.setCancelable(false).setPositiveButton("OK", null).create().show();
93+
return;
94+
}
7695
//if there is no user in the database
7796
if(user==null){
7897
builder.setMessage("There is no user In database");
@@ -92,7 +111,7 @@ private void checkValidity(){
92111
builder.setCancelable(false).setPositiveButton("OK", null).create().show();
93112
}
94113
}else{
95-
//if there is no user by the email in the database
114+
//if there is no user who has the same email in the database
96115
builder.setMessage("No Email found in the Database");
97116
builder.setCancelable(false).setPositiveButton("OK", null).create().show();
98117
}

app/src/main/res/layout/activity_login.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@
106106
android:text="@string/register"
107107
android:textStyle="bold" />
108108

109+
<TextView
110+
android:id="@+id/forgot_password"
111+
android:layout_marginTop="16dp"
112+
android:layout_width="wrap_content"
113+
android:layout_height="wrap_content"
114+
android:text="forgot password"
115+
android:layout_gravity="center"/>
116+
109117
</LinearLayout>
110118
</ScrollView>
111119
</LinearLayout>

app/src/main/res/xml/settings.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
android:summary="@string/enable_login_summary"
1111
android:title="@string/enable_login" />
1212

13-
<EditTextPreference
14-
android:key="edit_text"
15-
android:selectAllOnFocus="true"
16-
android:singleLine="true"
17-
android:title="@string/change_password" />
18-
1913
</PreferenceCategory>
2014
<PreferenceCategory android:title="@string/data_display">
2115

0 commit comments

Comments
 (0)