direct Floating Button to RentActivity
This commit is contained in:
parent
d42751d2d6
commit
cd6a5b7394
3 changed files with 12 additions and 13 deletions
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
|
|
@ -24,7 +24,8 @@
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".LoginActivity"
|
android:name=".LoginActivity"
|
||||||
android:label="@string/title_activity_login"></activity>
|
android:label="@string/title_activity_login" />
|
||||||
|
<activity android:name=".RentActivity"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
@ -21,15 +21,23 @@ public class MainActivity extends AppCompatActivity {
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
final Context context = this;
|
||||||
|
|
||||||
FloatingButton();
|
//Floating Button
|
||||||
|
FloatingActionButton fab = findViewById(R.id.fab);
|
||||||
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(context, RentActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
//pre-condition: Is there a login key?
|
//pre-condition: Is there a login key?
|
||||||
Context context = this;
|
|
||||||
SharedPreferences sharedPref = getSharedPreferences("persistence", MODE_PRIVATE);
|
SharedPreferences sharedPref = getSharedPreferences("persistence", MODE_PRIVATE);
|
||||||
String defaultValue = "nokey";
|
String defaultValue = "nokey";
|
||||||
String loginKey = sharedPref.getString("loginKey", defaultValue);
|
String loginKey = sharedPref.getString("loginKey", defaultValue);
|
||||||
|
|
@ -61,14 +69,4 @@ public class MainActivity extends AppCompatActivity {
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FloatingButton() {
|
|
||||||
FloatingActionButton fab = findViewById(R.id.fab);
|
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
|
||||||
.setAction("Action", null).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue