Password reset
This commit is contained in:
parent
8e83728485
commit
f2df74fd26
@ -9,6 +9,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.SyncStateContract;
|
import android.provider.SyncStateContract;
|
||||||
@ -84,11 +85,18 @@ public class DetailActivity extends AppCompatActivity implements View.OnClickLis
|
|||||||
TextView tv_resetPass;
|
TextView tv_resetPass;
|
||||||
EditText edtPassR,edtConPassR;
|
EditText edtPassR,edtConPassR;
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences;
|
||||||
|
private static final String KEY_PASS= "password";
|
||||||
|
private static final String SHARED_PREF_NAME = "myPref";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_detail);
|
setContentView(R.layout.activity_detail);
|
||||||
|
|
||||||
|
sharedPreferences = getSharedPreferences(SHARED_PREF_NAME,MODE_PRIVATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
@ -135,6 +143,9 @@ public class DetailActivity extends AppCompatActivity implements View.OnClickLis
|
|||||||
if(pass.equals(conpass) ){
|
if(pass.equals(conpass) ){
|
||||||
Intent intent = new Intent(DetailActivity.this,MainActivity.class);
|
Intent intent = new Intent(DetailActivity.this,MainActivity.class);
|
||||||
intent.putExtra("password",pass);
|
intent.putExtra("password",pass);
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putString(KEY_PASS,null);
|
||||||
|
editor.apply();
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private static final String SHARED_PREF_NAME = "myPref";
|
private static final String SHARED_PREF_NAME = "myPref";
|
||||||
private static final String KEY_PASS= "password";
|
private static final String KEY_PASS= "password";
|
||||||
|
|
||||||
String passAvail = "";
|
String passAvail = "test";
|
||||||
|
String newPass = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -112,8 +113,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
System.out.println("Value of passAvail "+ passAvail);
|
System.out.println("Value of passAvail "+ passAvail);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
String newPass = intent.getStringExtra("password");
|
newPass = intent.getStringExtra("password");
|
||||||
System.out.println("Value of newPass " + newPass);
|
System.out.println("Value of newPass22 " + newPass);
|
||||||
|
|
||||||
|
|
||||||
if (!ensureBleExists())
|
if (!ensureBleExists())
|
||||||
@ -165,8 +166,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mMtCentralManager.startScan();
|
mMtCentralManager.startScan();
|
||||||
mMtCentralManager.setMTCentralManagerListener(new MTCentralManagerListener() {
|
mMtCentralManager.setMTCentralManagerListener(new MTCentralManagerListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -288,10 +287,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -415,9 +410,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
System.out.println("Data is set in recyclerview through the adapter");
|
System.out.println("Data is set in recyclerview through the adapter");
|
||||||
/*mRecycle.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager
|
/*mRecycle.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager
|
||||||
.HORIZONTAL));*/
|
.HORIZONTAL));*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initManager() {
|
private void initManager() {
|
||||||
@ -524,8 +516,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
String userPass = edtPass.getText().toString().trim();
|
String userPass = edtPass.getText().toString().trim();
|
||||||
System.out.println("Value of userPass "+userPass);
|
System.out.println("Value of userPass "+userPass + " "+ passAvail);
|
||||||
if(userPass.equals(passAvail)){
|
if( userPass.equals(newPass)){
|
||||||
//if(userPass.equals("test")){
|
//if(userPass.equals("test")){
|
||||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
editor.putString(KEY_PASS,userPass);
|
editor.putString(KEY_PASS,userPass);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user