forked from Abhimanyu121/cafeteria
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.java
More file actions
71 lines (56 loc) · 2.47 KB
/
MainActivity.java
File metadata and controls
71 lines (56 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.example.abhimanyu.cafeteria;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.view.MenuItem;
import android.widget.TextView;
import java.io.File;
public class MainActivity extends AppCompatActivity {
private TextView mTextMessage;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
FragmentManager frag=getSupportFragmentManager();
FragmentTransaction ft=frag.beginTransaction();
switch (item.getItemId()) {
case R.id.navigation_home:
ft.replace(R.id.container,new Prices()).commit();
return true;
case R.id.navigation_dashboard:
ft.replace(R.id.container,new Bookings()).commit();
return true;
case R.id.navigation_notifications:
ft.replace(R.id.container,new feed()).commit();
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().setTitle(Html.fromHtml("<font color=\"black\">" + getString(R.string.app_name) + "</font>"));
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
FragmentManager frag=getSupportFragmentManager();
FragmentTransaction ft=frag.beginTransaction();
ft.replace(R.id.container,new Prices()).commit();
File f = new File(
"/data/data/com.example.abhimanyu.cafeteria/shared_prefs/creds.xml");
if (f.exists()){
}
else{
Intent myIntent = new Intent(getApplicationContext(), login.class);
startActivity(myIntent);
}
}
}