Skip to content

Commit 6bf99b3

Browse files
committedNov 16, 2015
Added action bars to every screen
1 parent 01f8b74 commit 6bf99b3

12 files changed

+239
-161
lines changed
 

‎app/src/main/AndroidManifest.xml

+32-23
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="ndejaco.pollgeo" >
2+
<manifest
3+
package="ndejaco.pollgeo"
4+
xmlns:android="http://schemas.android.com/apk/res/android">
45

5-
<uses-permission android:name="android.permission.INTERNET" />
6-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
8-
<uses-permission android:name="android.permission.CAMERA" />
6+
<uses-permission android:name="android.permission.INTERNET"/>
7+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
8+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
9+
<uses-permission android:name="android.permission.CAMERA"/>
910

1011
<application
1112
android:name=".PollgeoApplication"
@@ -18,69 +19,77 @@
1819

1920
<meta-data
2021
android:name="com.facebook.sdk.ApplicationId"
21-
android:value="@string/facebook_app_id" />
22+
android:value="@string/facebook_app_id"/>
2223

2324
<activity
2425
android:name=".LocalHomeListActivity"
25-
android:theme="@style/Theme.AppCompat.NoActionBar"
26-
android:label="@string/app_name" >
26+
android:label="@string/app_name"
27+
android:theme="@style/Theme.AppCompat.NoActionBar">
2728

2829
<intent-filter>
29-
<action android:name="android.intent.action.MAIN" />
30+
<action android:name="android.intent.action.MAIN"/>
3031

31-
<category android:name="android.intent.category.LAUNCHER" />
32+
<category android:name="android.intent.category.LAUNCHER"/>
3233
</intent-filter>
3334
</activity>
3435
<activity
3536
android:name=".LoginActivity"
36-
android:label="@string/title_activity_login" >
37+
android:label="@string/title_activity_login">
3738
</activity>
3839
<activity
3940
android:name=".MakePollActivity"
4041
android:label="@string/title_activity_make_poll"
41-
android:parentActivityName=".LocalHomeListActivity" >
42+
android:parentActivityName=".LocalHomeListActivity">
4243
<meta-data
4344
android:name="android.support.PARENT_ACTIVITY"
44-
android:value=".LocalHomeListActivity" />
45+
android:value=".LocalHomeListActivity"/>
4546
</activity>
4647
<activity
4748
android:name="com.parse.ui.ParseLoginActivity"
4849
android:label="@string/app_name"
49-
android:launchMode="singleTop" >
50+
android:launchMode="singleTop">
5051
</activity>
5152
<activity
5253
android:name=".GroupActivity"
53-
android:label="GroupActivity" >
54+
android:label="Pollgeo"
55+
android:theme="@style/Theme.AppCompat.NoActionBar">
5456
</activity>
5557
<activity
5658
android:name="com.facebook.FacebookActivity"
5759
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
5860
android:label="@string/app_name"
59-
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
61+
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
6062
<activity
6163
android:name=".VoterViewActivity"
62-
android:label="@string/title_activity_voter_view" >
64+
android:label="@string/title_activity_voter_view">
6365
</activity>
6466
<activity
6567
android:name=".ProfileActivity"
66-
android:label="@string/title_activity_profile">
68+
android:label="@string/app_name">
6769
</activity>
6870
<activity
6971
android:name=".GroupHomeListActivity"
70-
android:label="GroupHomeListActivity" >
72+
android:label="Pollgeo"
73+
android:theme="@style/Theme.AppCompat.NoActionBar">>
7174
</activity>
7275
<activity
7376
android:name=".MakeGroupActivity"
7477
android:label="MakeGroupActivity"
75-
android:screenOrientation="portrait" >
78+
android:screenOrientation="portrait">
7679
<meta-data
7780
android:name="android.support.PARENT_ACTIVITY"
78-
android:value=".GroupActivity" />
81+
android:value=".GroupActivity"/>
7982
</activity>
8083
<activity
8184
android:name=".PhotoUpload"
82-
android:label="@string/title_activity_photo_upload" >
85+
android:label="@string/title_activity_photo_upload">
86+
</activity>
87+
<activity
88+
android:name=".SettingsActivity"
89+
android:label="Settings">
8390
</activity>
91+
8492
</application>
8593

94+
8695
</manifest>

‎app/src/main/java/ndejaco/pollgeo/GroupActivity.java

+54-25
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11

22
package ndejaco.pollgeo;
33

4-
import android.app.Activity;
5-
import android.app.ListActivity;
4+
65
import android.os.Bundle;
76
import android.content.Intent;
87
import android.support.v4.widget.DrawerLayout;
9-
import android.util.Log;
8+
import android.support.v7.app.ActionBar;
9+
import android.support.v7.app.AppCompatActivity;
10+
import android.support.v7.widget.Toolbar;
11+
import android.view.Gravity;
12+
import android.view.Menu;
13+
import android.view.MenuItem;
1014
import android.view.View;
1115
import android.widget.AdapterView;
1216
import android.widget.Button;
1317
import android.widget.ListView;
14-
import android.widget.RelativeLayout;
15-
import android.widget.TextView;
16-
import android.widget.Toast;
18+
1719

1820
import com.baoyz.widget.PullRefreshLayout;
1921
import com.facebook.login.widget.ProfilePictureView;
@@ -34,7 +36,7 @@
3436
* GroupActivity is the activity that will handle Group Poll functionality
3537
* It will display group polls are in and the option to make a group poll
3638
*/
37-
public class GroupActivity extends ListActivity {
39+
public class GroupActivity extends AppCompatActivity {
3840

3941
// TAG used for debugging
4042
private static final String TAG = GroupActivity.class.getSimpleName();
@@ -47,33 +49,21 @@ public class GroupActivity extends ListActivity {
4749
private GroupViewAdapter mGroupViewAdapter;
4850
private ProfilePictureView fbPhoto;
4951
private ListView groupList;
52+
private Toolbar toolBar;
5053

5154

5255
@Override
5356
protected void onCreate(Bundle savedInstanceState) {
5457
super.onCreate(savedInstanceState);
5558
setContentView(R.layout.activity_group_home);
5659

57-
create_button = (Button) findViewById(R.id.makeGroup);
58-
create_button.setOnClickListener(new View.OnClickListener() {
59-
@Override
60-
public void onClick(View v) {
61-
navigateToMakeGroup();
62-
}
63-
});
6460

65-
logOutButton = (Button) findViewById(R.id.logOutButton);
66-
logOutButton.setOnClickListener(new View.OnClickListener() {
67-
@Override
68-
public void onClick(View v) {
69-
navigateToLogin();
70-
}
71-
});
7261

7362
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
7463

7564
mGroupViewAdapter = new GroupViewAdapter(this, new ArrayList<Group>());
76-
setListAdapter(mGroupViewAdapter);
65+
groupList = (ListView) findViewById(R.id.list);
66+
groupList.setAdapter(mGroupViewAdapter);
7767

7868
swipeLayout = (PullRefreshLayout) findViewById(R.id.swipe_container);
7969
swipeLayout.setOnRefreshListener(new PullRefreshLayout.OnRefreshListener() {
@@ -96,7 +86,6 @@ public void onRefresh() {
9686
}
9787
}
9888

99-
groupList = getListView();
10089
groupList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
10190
@Override
10291
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@@ -111,6 +100,18 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
111100
mSections = getResources().getStringArray(R.array.sections_array);
112101
mDrawerList.setAdapter(new DrawerAdapter(this, mSections));
113102

103+
toolBar = (Toolbar) findViewById(R.id.toolbar);
104+
setSupportActionBar(toolBar);
105+
106+
ActionBar actionBar = getSupportActionBar();
107+
108+
109+
actionBar.setDisplayHomeAsUpEnabled(true);
110+
actionBar.setHomeButtonEnabled(true);
111+
actionBar.setHomeAsUpIndicator(R.drawable.ic_drawer);
112+
actionBar.setDisplayShowTitleEnabled(true);
113+
actionBar.setTitle("Pollgeo");
114+
114115
updateData();
115116

116117

@@ -148,8 +149,6 @@ public void done(List<Group> objects, ParseException e) {
148149
*/
149150
private void navigateToMakeGroup() {
150151
Intent intent = new Intent(this, MakeGroupActivity.class);
151-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
152-
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
153152
startActivity(intent);
154153
}
155154

@@ -160,4 +159,34 @@ private void navigateToLogin() {
160159
startActivity(intent);
161160
}
162161

162+
@Override
163+
public boolean onCreateOptionsMenu(Menu menu) {
164+
// Inflate the menu; this adds items to the action bar if it is present.
165+
getMenuInflater().inflate(R.menu.menu_group_make, menu);
166+
return true;
167+
}
168+
169+
@Override
170+
public boolean onOptionsItemSelected(MenuItem item) {
171+
// Handle action bar item clicks here. The action bar will
172+
// automatically handle clicks on the Home/Up button, so long
173+
// as you specify a parent activity in AndroidManifest.xml.
174+
int id = item.getItemId();
175+
176+
//noinspection SimplifiableIfStatement
177+
if (id == R.id.action_settings) {
178+
return true;
179+
}
180+
181+
if (id == android.R.id.home) {
182+
mDrawerLayout.openDrawer(Gravity.LEFT);
183+
}
184+
185+
if (id == R.id.create_group) {
186+
navigateToMakeGroup();
187+
}
188+
189+
return super.onOptionsItemSelected(item);
190+
}
191+
163192
}

‎app/src/main/java/ndejaco/pollgeo/GroupHomeListActivity.java

+40-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package ndejaco.pollgeo;
22

3+
import android.app.ActionBar;
4+
import android.app.Activity;
35
import android.app.Dialog;
46
import android.app.DialogFragment;
57
import android.app.ListActivity;
@@ -12,7 +14,10 @@
1214
import android.net.NetworkInfo;
1315
import android.os.Bundle;
1416
import android.support.v4.widget.DrawerLayout;
17+
import android.support.v7.app.AppCompatActivity;
18+
import android.support.v7.widget.Toolbar;
1519
import android.util.Log;
20+
import android.view.Gravity;
1621
import android.view.Menu;
1722
import android.view.MenuItem;
1823
import android.view.View;
@@ -39,7 +44,7 @@
3944
/**
4045
* Created by Nicholas on 10/31/2015.
4146
*/
42-
public class GroupHomeListActivity extends ListActivity {
47+
public class GroupHomeListActivity extends AppCompatActivity {
4348

4449
// TAG used for debugging
4550
private static final String TAG = GroupHomeListActivity.class.getSimpleName();
@@ -50,6 +55,7 @@ public class GroupHomeListActivity extends ListActivity {
5055
private Context mContext;
5156
private ListView mDrawerList;
5257
private String[] mSections;
58+
private Toolbar toolbar;
5359

5460
//Refresh layout swipe
5561
private PullRefreshLayout swipeLayout;
@@ -81,26 +87,11 @@ protected void onCreate(Bundle savedInstanceState) {
8187

8288

8389
// Button listener will navigate to screen where user can make poll
84-
create_button = (Button) findViewById(R.id.makePoll);
85-
create_button.setOnClickListener(new View.OnClickListener() {
86-
@Override
87-
public void onClick(View v) {
88-
navigateToMakePoll();
89-
}
90-
});
91-
92-
logOutButton = (Button) findViewById(R.id.logOutButton);
93-
logOutButton.setOnClickListener(new View.OnClickListener() {
94-
@Override
95-
public void onClick(View v) {
96-
ParseUser.logOut();
97-
navigateToLogin();
98-
}
99-
});
10090

10191
// Sets a blank homeView Adapter with no data
10292
mGroupHomeViewAdapter = new HomeViewAdapter(this, new ArrayList<Poll>());
103-
setListAdapter(mGroupHomeViewAdapter);
93+
ListView lv = (ListView) findViewById(R.id.list);
94+
lv.setAdapter(mGroupHomeViewAdapter);
10495

10596
// Set up the PullRefreshLayout and add the listener.
10697
swipeLayout = (PullRefreshLayout) findViewById(R.id.swipe_container);
@@ -133,6 +124,16 @@ public void onRefresh() {
133124
mSections = getResources().getStringArray(R.array.sections_array);
134125
mDrawerList.setAdapter(new DrawerAdapter(this, mSections));
135126

127+
toolbar = (Toolbar) findViewById(R.id.toolbar);
128+
setSupportActionBar(toolbar);
129+
130+
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
131+
132+
actionBar.setHomeAsUpIndicator(R.drawable.ic_drawer);
133+
actionBar.setDisplayHomeAsUpEnabled(true);
134+
actionBar.setHomeButtonEnabled(true);
135+
136+
136137
updateData();
137138

138139
}
@@ -199,14 +200,29 @@ public boolean onOptionsItemSelected(MenuItem item) {
199200
// Handle action bar item clicks here. The action bar will
200201
// automatically handle clicks on the Home/Up button, so long
201202
// as you specify a parent activity in AndroidManifest.xml.
202-
int id = item.getItemId();
203203

204-
if (id == R.id.logOutButton) {
205-
ParseUser.logOut();
206-
navigateToLogin();
207-
}
204+
// Handle action bar item clicks here.
205+
switch (item.getItemId()) {
206+
case R.id.action_settings:
207+
// User chose the "Settings" item, show the app settings UI...
208+
Log.i(TAG, "Settings clicked");
209+
return true;
210+
case R.id.create_poll:
211+
// User chose the "create_poll" action, take the user to create poll
212+
Log.i(TAG, "create_poll clicked");
213+
// go to MakePollActivity
214+
navigateToMakePoll();
215+
return true;
216+
case android.R.id.home:
217+
mDrawerLayout.openDrawer(Gravity.LEFT);
218+
return true;
208219

209-
return super.onOptionsItemSelected(item);
220+
default:
221+
// If we got here, the user's action was not recognized.
222+
// Invoke the superclass to handle it.
223+
return super.onOptionsItemSelected(item);
224+
225+
}
210226
}
211227

212228
}

‎app/src/main/java/ndejaco/pollgeo/LocalHomeListActivity.java

+8-47
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,24 @@
99
import android.content.IntentSender;
1010
import android.graphics.Bitmap;
1111
import android.location.Location;
12-
import android.net.ConnectivityManager;
13-
import android.net.NetworkInfo;
12+
1413
import android.support.v4.widget.DrawerLayout;
1514
import android.os.Bundle;
1615
import android.support.v7.app.ActionBarDrawerToggle;
1716
import android.support.v7.widget.Toolbar;
1817
import android.util.Log;
1918
import android.view.Gravity;
20-
import android.view.LayoutInflater;
19+
2120
import android.view.Menu;
2221
import android.view.MenuItem;
2322
import android.content.Intent;
2423
import android.view.View;
2524
import android.widget.Button;
26-
import android.widget.ImageButton;
25+
2726
import android.widget.ListView;
2827
import android.widget.Toast;
2928
import android.support.v7.app.AppCompatActivity;
30-
import android.app.ActionBar;
29+
3130

3231

3332
import com.baoyz.widget.PullRefreshLayout;
@@ -63,7 +62,6 @@ public class LocalHomeListActivity extends AppCompatActivity implements Location
6362
private ListView mDrawerList;
6463
private String[] mSections;
6564
private ActionBarDrawerToggle mDrawerToggle;
66-
private CharSequence mTitle = "Pollgeo";
6765

6866
//Refresh layout swipe
6967
private PullRefreshLayout swipeLayout;
@@ -204,18 +202,6 @@ public void onRefresh() {
204202
actionBar.setHomeButtonEnabled(true);
205203

206204

207-
mDrawerToggle = new ActionBarDrawerToggle(
208-
this, /* host Activity */
209-
mDrawerLayout, /* DrawerLayout object */
210-
// need a tool bar here????
211-
toolbar, /* tool bar */
212-
R.string.drawer_open, /* "open drawer" description */
213-
R.string.drawer_close /* "close drawer" description */
214-
);
215-
216-
// mDrawerToggle.syncState();
217-
218-
mDrawerLayout.setDrawerListener(mDrawerToggle);
219205

220206

221207

@@ -245,27 +231,6 @@ public void updateData() {
245231
// Queries poll data and orders by most recent polls. Finds in background.
246232
Location myLoc = (currentLocation == null) ? lastLocation : currentLocation;
247233

248-
ConnectivityManager connectivityManager
249-
= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
250-
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
251-
252-
/*if(activeNetworkInfo == null || !activeNetworkInfo.isConnected()){
253-
create_button.setText("No Internet Connection Detected :(");
254-
create_button.setOnClickListener(new View.OnClickListener() {
255-
@Override
256-
public void onClick(View v) {
257-
;
258-
}
259-
});
260-
}else{
261-
create_button.setOnClickListener(new View.OnClickListener() {
262-
@Override
263-
public void onClick(View v) {
264-
navigateToMakePoll();
265-
}
266-
});
267-
}*/
268-
269234
if(myLoc == null){
270235
return;
271236
}
@@ -324,26 +289,22 @@ public boolean onCreateOptionsMenu(Menu menu) {
324289
*/
325290
@Override
326291
public boolean onOptionsItemSelected(MenuItem item) {
327-
if (mDrawerToggle.onOptionsItemSelected(item)) {
328-
Log.i(TAG, "Drawer toggle clicked!!!!");
329-
mDrawerLayout.openDrawer(Gravity.LEFT);
330-
return true;
331-
}
292+
332293
// Handle action bar item clicks here.
333294
switch (item.getItemId()) {
334295
case R.id.action_settings:
335296
// User chose the "Settings" item, show the app settings UI...
336297
Log.i(TAG, "Settings clicked");
337298
return true;
338-
339299
case R.id.create_poll:
340300
// User chose the "create_poll" action, take the user to create poll
341301
Log.i(TAG, "create_poll clicked");
342302
// go to MakePollActivity
343303
navigateToMakePoll();
344304
return true;
345-
346-
305+
case android.R.id.home:
306+
mDrawerLayout.openDrawer(Gravity.LEFT);
307+
return true;
347308

348309
default:
349310
// If we got here, the user's action was not recognized.

‎app/src/main/java/ndejaco/pollgeo/MakeGroupActivity.java

+40-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
package ndejaco.pollgeo;
22

3+
import android.app.ActionBar;
4+
import android.app.Activity;
35
import android.app.AlertDialog;
46
import android.app.ListActivity;
57
import android.content.Intent;
68
import android.support.v4.widget.DrawerLayout;
79
import android.support.v7.app.AppCompatActivity;
810
import android.os.Bundle;
911
import android.util.Log;
12+
import android.view.Gravity;
13+
import android.view.Menu;
14+
import android.view.MenuItem;
1015
import android.view.View;
1116
import android.widget.Button;
1217
import android.widget.EditText;
@@ -41,7 +46,7 @@
4146
* Created by Matthew on 10/13/2015.
4247
* MakeGroupActivity is responsible for making a group
4348
*/
44-
public class MakeGroupActivity extends ListActivity {
49+
public class MakeGroupActivity extends Activity {
4550

4651
private static final String TAG = MakeGroupActivity.class.getSimpleName();
4752

@@ -69,7 +74,6 @@ protected void onCreate(Bundle savedInstanceState) {
6974
super.onCreate(savedInstanceState);
7075
setContentView(R.layout.make_group);
7176

72-
ListView lv = getListView();
7377
// Gets intent passed to this activity
7478
Intent passed = getIntent();
7579

@@ -141,6 +145,11 @@ public void onClick(View v) {
141145
mSections = getResources().getStringArray(R.array.sections_array);
142146
mDrawerList.setAdapter(new DrawerAdapter(this, mSections));
143147

148+
ActionBar actionBar = getActionBar();
149+
actionBar.setDisplayHomeAsUpEnabled(true);
150+
actionBar.setHomeButtonEnabled(true);
151+
actionBar.setDisplayShowTitleEnabled(true);
152+
actionBar.setTitle("Pollgeo");
144153

145154
// grab the users friend and display them to add
146155
setUpFriendsList();
@@ -218,7 +227,8 @@ public void setupAdapter(){
218227
// Sets a friends View Adapter with friendsList
219228
// ListView friendsListView = (ListView) findViewById(android.R.id.list);
220229
friendsViewAdapter = new friendsViewAdapter(this, friendsList, currentGroup);
221-
setListAdapter(friendsViewAdapter);
230+
ListView lv = (ListView) findViewById(R.id.list);
231+
lv.setAdapter(friendsViewAdapter);
222232

223233
}
224234

@@ -345,5 +355,32 @@ private void addMember(ParseUser user) {
345355
currentGroup.addMember(user);
346356

347357
} //end of addMember()
358+
359+
@Override
360+
public boolean onCreateOptionsMenu(Menu menu) {
361+
// Inflate the menu; this adds items to the action bar if it is present.
362+
getMenuInflater().inflate(R.menu.menu_group_make, menu);
363+
return true;
364+
}
365+
366+
@Override
367+
public boolean onOptionsItemSelected(MenuItem item) {
368+
// Handle action bar item clicks here. The action bar will
369+
// automatically handle clicks on the Home/Up button, so long
370+
// as you specify a parent activity in AndroidManifest.xml.
371+
int id = item.getItemId();
372+
373+
//noinspection SimplifiableIfStatement
374+
if (id == R.id.action_settings) {
375+
return true;
376+
}
377+
378+
if (id == android.R.id.home) {
379+
onBackPressed();
380+
}
381+
382+
383+
return super.onOptionsItemSelected(item);
384+
}
348385
}
349386

‎app/src/main/java/ndejaco/pollgeo/MakePollActivity.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package ndejaco.pollgeo;
22

3+
import android.app.ActionBar;
4+
import android.app.Activity;
35
import android.app.AlertDialog;
46
import android.content.Intent;
57
import android.location.Location;
6-
import android.support.v7.app.AppCompatActivity;
78
import android.os.Bundle;
89
import android.util.Log;
910
import android.view.Menu;
@@ -23,7 +24,7 @@
2324
import ndejaco.pollgeo.Model.LocalPoll;
2425
import ndejaco.pollgeo.Model.Poll;
2526

26-
public class MakePollActivity extends AppCompatActivity {
27+
public class MakePollActivity extends Activity {
2728

2829
private EditText title;
2930
private EditText option1;
@@ -143,6 +144,12 @@ else if (type.equals("group")) {
143144
}
144145
});
145146

147+
ActionBar actionBar = getActionBar();
148+
actionBar.setDisplayHomeAsUpEnabled(true);
149+
actionBar.setHomeButtonEnabled(true);
150+
actionBar.setDisplayShowTitleEnabled(true);
151+
actionBar.setTitle("Pollgeo");
152+
146153
}
147154

148155
// Private method to create a poll object.

‎app/src/main/java/ndejaco/pollgeo/ProfileActivity.java

+2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ protected void onCreate(Bundle savedInstanceState) {
128128

129129

130130
android.app.ActionBar actionBar = getActionBar();
131+
actionBar.setDisplayShowTitleEnabled(true);
132+
actionBar.setTitle("Pollgeo");
131133
actionBar.setHomeButtonEnabled(true);
132134
actionBar.setDisplayHomeAsUpEnabled(true);
133135
actionBar.setHomeAsUpIndicator(R.drawable.ic_drawer);

‎app/src/main/java/ndejaco/pollgeo/SettingsActivity.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package ndejaco.pollgeo;
22

3+
import android.app.ActionBar;
4+
import android.app.Activity;
35
import android.content.Context;
46
import android.content.Intent;
57
import android.support.v4.widget.DrawerLayout;
68
import android.support.v7.app.AppCompatActivity;
79
import android.os.Bundle;
10+
import android.view.Gravity;
811
import android.view.Menu;
912
import android.view.MenuItem;
1013
import android.view.View;
@@ -18,7 +21,7 @@
1821
import com.parse.ParseUser;
1922
import com.parse.SaveCallback;
2023

21-
public class SettingsActivity extends AppCompatActivity {
24+
public class SettingsActivity extends Activity {
2225

2326
protected ParseUser currentUser;
2427
private ListView mDrawerList;
@@ -139,6 +142,13 @@ public void done(ParseException e) {
139142
}
140143
}
141144
});
145+
146+
ActionBar actionBar = getActionBar();
147+
actionBar.setDisplayShowTitleEnabled(true);
148+
actionBar.setTitle("Pollgeo");
149+
actionBar.setHomeButtonEnabled(true);
150+
actionBar.setDisplayHomeAsUpEnabled(true);
151+
actionBar.setHomeAsUpIndicator(R.drawable.ic_drawer);
142152
}
143153

144154
@Override
@@ -160,6 +170,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
160170
return true;
161171
}
162172

173+
if (id == android.R.id.home) {
174+
mDrawerLayout.openDrawer(Gravity.LEFT);
175+
}
176+
163177
return super.onOptionsItemSelected(item);
164178
}
165179
}

‎app/src/main/res/layout/activity_group_home.xml

+17-35
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,44 @@
77
tools:context=".MainActivity">
88

99

10-
<FrameLayout
10+
<RelativeLayout
1111
android:layout_width="fill_parent"
12-
android:layout_height="fill_parent"
13-
android:background="#FFEDEDEA"
14-
android:paddingBottom="0dp"
15-
android:paddingLeft="0dp"
16-
android:paddingRight="0dp"
17-
android:paddingTop="0dp">
12+
android:layout_height="fill_parent">
13+
14+
<app:android.support.v7.widget.Toolbar
15+
xmlns:android="http://schemas.android.com/apk/res/android"
16+
xmlns:app="http://schemas.android.com/apk/res-auto"
17+
android:id="@+id/toolbar"
18+
android:layout_width="match_parent"
19+
android:layout_height="55dp"
20+
android:layout_gravity="top"
21+
android:background="#FFDE5842"
22+
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
23+
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
1824

1925
<com.baoyz.widget.PullRefreshLayout
2026
android:id="@+id/swipe_container"
2127
android:layout_width="fill_parent"
2228
android:layout_height="fill_parent"
2329
android:layout_alignParentEnd="true"
2430
android:layout_alignParentRight="true"
25-
android:layout_below="@+id/makePoll"
31+
android:layout_below="@+id/toolbar"
2632
android:layout_gravity="left|top">
2733

2834

2935
<ListView
30-
android:id="@android:id/list"
31-
android:paddingTop="50dp"
36+
android:id="@+id/list"
3237
android:layout_width="match_parent"
3338
android:layout_height="wrap_content"
34-
android:layout_below="@+id/makeGroup"
3539
android:layout_centerHorizontal="true"
3640
android:layout_weight="1"
41+
android:layout_below="@+id/toolbar"
3742
android:paddingLeft="10dp"
38-
android:background="#FFEDEDEA"
3943
android:fastScrollAlwaysVisible="true"
4044
android:fastScrollEnabled="true"/>
4145
</com.baoyz.widget.PullRefreshLayout>
4246

43-
<Button
44-
android:id="@+id/makeGroup"
45-
android:layout_width="match_parent"
46-
android:layout_height="wrap_content"
47-
android:layout_alignParentEnd="true"
48-
android:layout_alignParentRight="true"
49-
android:layout_alignParentTop="true"
50-
android:layout_gravity="top"
51-
android:background="#FFDE5842"
52-
android:text="Make Group"
53-
android:textColor="#FFEDEDEA"
54-
android:textSize="25sp"/>
55-
56-
<Button
57-
android:id="@+id/logOutButton"
58-
style="?android:attr/buttonStyleSmall"
59-
android:layout_width="wrap_content"
60-
android:layout_height="wrap_content"
61-
android:layout_alignParentBottom="true"
62-
android:layout_alignParentLeft="true"
63-
android:layout_alignParentStart="true"
64-
android:text="Log out"/>
65-
</FrameLayout>
47+
</RelativeLayout>
6648

6749
<RelativeLayout
6850
android:id="@+id/slider"

‎app/src/main/res/layout/make_group.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
android:layout_marginTop="20dp"
6161
android:layout_width="match_parent"
6262
android:layout_height="match_parent"
63-
android:id="@android:id/list"
63+
android:id="@+id/list"
6464
android:layout_alignParentLeft="true"
6565
android:layout_alignParentStart="true"
6666
android:layout_below="@+id/createGroupButton"
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:app="http://schemas.android.com/apk/res-auto"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
tools:context="ndejaco.pollgeo.GroupActivity">
5+
6+
7+
<item
8+
android:id="@+id/create_group"
9+
android:title="Create group"
10+
android:icon="@drawable/create"
11+
android:orderInCategory="1"
12+
app:showAsAction="always" />
13+
14+
15+
16+
</menu>

‎app/src/main/res/values/styles.xml

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
<style name="MyActionBar" parent="Theme.AppCompat.Light">
1111
<item name="android:background">#FFDE5842</item>
12+
<item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
13+
</style>
14+
15+
<style name="MyTheme.ActionBar.TitleTextStyle" parent="Theme.AppCompat.Light">
16+
<item name="android:textColor">#FFFFFFFF</item>
1217
</style>
1318
<!-- Customize your theme here. -->
1419

0 commit comments

Comments
 (0)
Please sign in to comment.