parent
e15461041b
commit
a27f02b216
@ -0,0 +1,68 @@
|
||||
package net.micode.notes.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.micode.notes.R;
|
||||
|
||||
public class ChangedLoginPassword extends Activity{
|
||||
EditText OldPassword;
|
||||
EditText NewPassword;
|
||||
EditText AckPassword;
|
||||
Button Acknowledged;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_change_loginpassword);
|
||||
getWindow().setSoftInputMode(
|
||||
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
||||
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
OldPassword=(EditText) findViewById(R.id.old_password);
|
||||
NewPassword=(EditText) findViewById(R.id.new_password);
|
||||
AckPassword=(EditText) findViewById(R.id.ack_password);
|
||||
Acknowledged=(Button)findViewById(R.id.Bt_Acknowledged);
|
||||
Acknowledged.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String old_password = OldPassword.getText().toString();
|
||||
String new_password = NewPassword.getText().toString();
|
||||
String ack_password = AckPassword.getText().toString();
|
||||
SharedPreferences pref=getSharedPreferences("user management",MODE_PRIVATE);
|
||||
String login_password=pref.getString("password","");
|
||||
if(old_password.equals("")==true || new_password.equals("")==true || ack_password.equals("")==true) {
|
||||
Toast.makeText(ChangedLoginPassword.this, "密码不能为空", Toast.LENGTH_SHORT).show();
|
||||
}else if (new_password.equals(ack_password) == false) {
|
||||
Toast.makeText(ChangedLoginPassword.this, "新建密码与重复密码不匹配,请重新输入密码", Toast.LENGTH_SHORT).show();
|
||||
AckPassword.setText("");
|
||||
}else if(old_password.equals(login_password) == false){
|
||||
Toast.makeText(ChangedLoginPassword.this, "原有密码错误,请重新输入密码", Toast.LENGTH_SHORT).show();
|
||||
OldPassword.setText("");
|
||||
}
|
||||
else if (new_password.equals(ack_password) == true && old_password.equals(login_password) == true){
|
||||
SharedPreferences.Editor editor=getSharedPreferences("user management", MODE_PRIVATE).edit();
|
||||
editor.putString("password",new_password);
|
||||
editor.apply();
|
||||
Toast.makeText(ChangedLoginPassword.this, "修改密码成功", Toast.LENGTH_SHORT).show();
|
||||
Intent intent=new Intent(ChangedLoginPassword.this,NotesListActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Intent intent=new Intent(ChangedLoginPassword.this,NotesListActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package net.micode.notes.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.micode.notes.R;
|
||||
|
||||
public class DeleteLoginPassword extends Activity{
|
||||
EditText password01;
|
||||
Button Acknowledged;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_delete_loginpassword);
|
||||
getWindow().setSoftInputMode(
|
||||
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
||||
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
password01=(EditText) findViewById(R.id.old_password);
|
||||
Acknowledged=(Button)findViewById(R.id.Bt_Acknowledged);
|
||||
Acknowledged.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String text02 = password01.getText().toString();
|
||||
if(text02.equals("")==true)
|
||||
Toast.makeText(DeleteLoginPassword.this, "密码不能为空", Toast.LENGTH_SHORT).show();
|
||||
SharedPreferences pref=getSharedPreferences("user management",MODE_PRIVATE);
|
||||
String password = pref.getString("password","");
|
||||
if(password.equals("")==false&&password.equals(text02)==true){
|
||||
SharedPreferences.Editor editor=getSharedPreferences("user management",
|
||||
MODE_PRIVATE).edit();
|
||||
editor.putBoolean("user",false);//false表示已经设置登录密码
|
||||
editor.putString("password","");
|
||||
editor.apply();
|
||||
|
||||
Toast.makeText(DeleteLoginPassword.this, "已经删除登录密码", Toast.LENGTH_SHORT).show();
|
||||
Intent intent=new Intent(DeleteLoginPassword.this,NotesListActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(DeleteLoginPassword.this, "密码错误", Toast.LENGTH_SHORT).show();
|
||||
password01.setText("");//把密码框内输入过的错误密码清空
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Intent intent=new Intent(DeleteLoginPassword.this,NotesListActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package net.micode.notes.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.micode.notes.R;
|
||||
public class RegisterLoginPassword extends Activity {
|
||||
EditText password01;
|
||||
EditText password02;
|
||||
Button registered;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_set_loginpassword);
|
||||
getWindow().setSoftInputMode(
|
||||
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
||||
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
password01=(EditText) findViewById(R.id.rg_password01);
|
||||
password02=(EditText) findViewById(R.id.rg_password02);
|
||||
registered=(Button)findViewById(R.id.rg_registered);
|
||||
registered.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String text02 = password01.getText().toString();
|
||||
String text03 = password02.getText().toString();
|
||||
if(text02.equals("")==true) {
|
||||
Toast.makeText(RegisterLoginPassword.this, "密码不能为空", Toast.LENGTH_SHORT).show();
|
||||
}else if (text02.equals(text03) == false) {
|
||||
Toast.makeText(RegisterLoginPassword.this, "密码不匹配,请重新输入密码", Toast.LENGTH_SHORT).show();
|
||||
password02.setText("");
|
||||
}else if (text02.equals(text03) == true){
|
||||
SharedPreferences.Editor editor=getSharedPreferences("user management",
|
||||
MODE_PRIVATE).edit();
|
||||
editor.putBoolean("user",true);//true表示已经设置登录密码
|
||||
editor.putString("password",text02);
|
||||
editor.apply();
|
||||
Log.d("RegisterLoginPassword","password is "+text02);
|
||||
Toast.makeText(RegisterLoginPassword.this, "设置密码成功", Toast.LENGTH_SHORT).show();
|
||||
Intent intent=new Intent(RegisterLoginPassword.this,NotesListActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Intent intent=new Intent(RegisterLoginPassword.this,NotesListActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/drawable-hdpi.iml" filepath="$PROJECT_DIR$/.idea/drawable-hdpi.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
Before Width: | Height: | Size: 771 KiB |
Before Width: | Height: | Size: 121 KiB |
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="输入原有密码:"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/old_password"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:password="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="输入新建密码:"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/new_password"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:password="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="再次输入密码:"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ack_password"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:password="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/Bt_Acknowledged"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确认"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="输入原有密码:"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/old_password"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:password="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/Bt_Acknowledged"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确认"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:gravity="center">-->
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="用户:"/>-->
|
||||
|
||||
<!-- <EditText-->
|
||||
<!-- android:id="@+id/lg_user"-->
|
||||
<!-- android:layout_width="200dp"-->
|
||||
<!-- android:layout_height="wrap_content" />-->
|
||||
<!-- </LinearLayout>-->
|
||||
<LinearLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="密码:"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/lg_password"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:password="true"
|
||||
tools:ignore="Deprecated" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="74dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/login" />
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/lg_registered"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="注册"/>-->
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="新建密码:"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/rg_password01"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:password="true"
|
||||
tools:ignore="Deprecated" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确认密码:"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/rg_password02"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:password="true"
|
||||
tools:ignore="Deprecated" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="76dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/rg_registered"
|
||||
android:layout_width="91dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确认" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="menu_young" type="id">menu_young</item>
|
||||
</resources>
|
Loading…
Reference in new issue