direct Floating Button to RentActivity
This commit is contained in:
parent
d42751d2d6
commit
cd6a5b7394
3 changed files with 12 additions and 13 deletions
|
|
@ -24,7 +24,8 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:label="@string/title_activity_login"></activity>
|
||||
android:label="@string/title_activity_login" />
|
||||
<activity android:name=".RentActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
@ -21,15 +21,23 @@ public class MainActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_main);
|
||||
Toolbar toolbar = findViewById(R.id.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
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
//pre-condition: Is there a login key?
|
||||
Context context = this;
|
||||
SharedPreferences sharedPref = getSharedPreferences("persistence", MODE_PRIVATE);
|
||||
String defaultValue = "nokey";
|
||||
String loginKey = sharedPref.getString("loginKey", defaultValue);
|
||||
|
|
@ -61,14 +69,4 @@ public class MainActivity extends AppCompatActivity {
|
|||
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