f
This commit is contained in:
parent
7c095281aa
commit
8cb3a5248b
2 changed files with 5 additions and 16 deletions
|
@ -1,17 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="deploymentTargetDropDown">
|
<component name="deploymentTargetDropDown">
|
||||||
<runningDeviceTargetSelectedWithDropDown>
|
|
||||||
<Target>
|
|
||||||
<type value="RUNNING_DEVICE_TARGET" />
|
|
||||||
<deviceKey>
|
|
||||||
<Key>
|
|
||||||
<type value="VIRTUAL_DEVICE_PATH" />
|
|
||||||
<value value="$USER_HOME$/.android/avd/4.7_WXGA_API_31.avd" />
|
|
||||||
</Key>
|
|
||||||
</deviceKey>
|
|
||||||
</Target>
|
|
||||||
</runningDeviceTargetSelectedWithDropDown>
|
|
||||||
<targetSelectedWithDropDown>
|
<targetSelectedWithDropDown>
|
||||||
<Target>
|
<Target>
|
||||||
<type value="QUICK_BOOT_TARGET" />
|
<type value="QUICK_BOOT_TARGET" />
|
||||||
|
|
|
@ -37,10 +37,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
// Database Queries
|
// Database Queries
|
||||||
try {
|
try {
|
||||||
String query = "SELECT username, password FROM account";
|
String query = "SELECT username FROM account";
|
||||||
Cursor cursor = db.rawQuery(query,null);
|
Cursor cursor = db.rawQuery(query,null);
|
||||||
if (cursor.moveToNext()){
|
if (cursor.moveToNext()){
|
||||||
login(cursor.getString(0), cursor.getString(1));
|
mainScreen(cursor.getString(0));
|
||||||
db.close();
|
db.close();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -64,7 +64,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
//buttonaction
|
//buttonaction
|
||||||
if(user.getText().toString().equals("") || pwd.getText().toString().equals("")) {
|
if(user.getText().toString().equals("") || pwd.getText().toString().equals("")) {
|
||||||
Toast.makeText(getApplicationContext(),"Introduzac el usuario y contraseña", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(),"Introduzca el usuario y contraseña", Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
login(user.getText().toString().toLowerCase(), pwd.getText().toString());
|
login(user.getText().toString().toLowerCase(), pwd.getText().toString());
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
db.execSQL("DELETE FROM account");
|
db.execSQL("DELETE FROM account");
|
||||||
db.execSQL("INSERT INTO account VALUES (\""+username+"\", \""+password+"\")");
|
db.execSQL("INSERT INTO account VALUES (\""+username+"\", \""+password+"\")");
|
||||||
db.close();
|
db.close();
|
||||||
mainScreen();
|
mainScreen(username);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(getApplicationContext(),"Base de datos corrupta", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(),"Base de datos corrupta", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mainScreen () {
|
private void mainScreen (String username) {
|
||||||
|
|
||||||
Intent intent = new Intent(this, MainScreen.class);
|
Intent intent = new Intent(this, MainScreen.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
Loading…
Reference in a new issue