-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCity.java
More file actions
136 lines (110 loc) · 4.24 KB
/
Copy pathCity.java
File metadata and controls
136 lines (110 loc) · 4.24 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package com.example.loginpage.city;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import com.example.loginpage.AboutUs;
import com.example.loginpage.Feedback;
import com.example.loginpage.Profilepage;
import com.example.loginpage.loginactivity.Login2;
import com.example.loginpage.R;
public class City extends AppCompatActivity {
private static int tci;
RecyclerView rv, rv1;
private int tindex;
private int dindex;
private static Bundle b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_city);
rv = findViewById(R.id.cityrecyclerview);
int icons[] = {
R.drawable.ic_hotel_black_24dp,
R.drawable.ic_restaurant_black_24dp,
R.drawable.ic_person_pin_circle_black_24dp,
R.drawable.ic_movie_black_24dp,
};
String components[] = {
"Hotels",
"Restuarants",
"Tourist Places",
"Movie Theaters"
};
rv.setLayoutManager(new LinearLayoutManager(this));
CityAdaptar adaptar = new CityAdaptar(this, icons, components);
rv.setAdapter(adaptar);
b = this.getIntent().getExtras();
assert b != null;
tindex = b.getInt("key1");
dindex = b.getInt("inkey");
}
public static int getTopcitiesindex() {
tci = b.getInt("key1");
return tci;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menuitems, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.aboutus:
Intent intent6 = new Intent(this, AboutUs.class);
startActivity(intent6);
break;
case R.id.profile:
Intent intent = new Intent(this, Profilepage.class);
startActivity(intent);
break;
case R.id.share:
Uri uri = Uri.parse("http://www.google.com");
Intent i2 = new Intent(Intent.ACTION_VIEW, uri);
if (i2.resolveActivity(getPackageManager()) != null) {
startActivity(i2);
} else {
Toast.makeText(this, "Sorry can'handle intent", Toast.LENGTH_SHORT).show();
}
break;
case R.id.logout:
alertDialogue();
break;
case R.id.mfeedback:
Intent i1 = new Intent(City.this, Feedback.class);
startActivity(i1);
break;
}
return super.onOptionsItemSelected(item);
}
public void alertDialogue() {
final AlertDialog.Builder builder = new AlertDialog.Builder(City.this);
builder.setTitle("Logout");
builder.setMessage("Do you want to Logout?");
builder.setIcon(R.drawable.ic_exit_to_app_black_24dp);
builder.setPositiveButton("confirm", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent(City.this, Login2.class);
startActivity(intent);
Toast.makeText(City.this, "Logged Out Successfully!!!", Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("deneid", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
builder.show();
}
}