Skip to content

Commit 6da10d2

Browse files
committed
Almost complete. Just missing config change
1 parent b39174b commit 6da10d2

File tree

6 files changed

+35
-1
lines changed

6 files changed

+35
-1
lines changed

.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/app.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
8080
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
8181
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
82+
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
8283
</content>
8384
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
8485
<orderEntry type="sourceFolder" forTests="false" />

app/src/main/java/com/teamtreehouse/oslist/MainActivity.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ protected void onCreate(Bundle savedInstanceState) {
3131

3232
addDrawerItems();
3333
setupDrawer();
34+
35+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
36+
getSupportActionBar().setHomeButtonEnabled(true);
3437
}
3538

3639
private void addDrawerItems() {
@@ -41,7 +44,7 @@ private void addDrawerItems() {
4144
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
4245
@Override
4346
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
44-
Toast.makeText(MainActivity.this, "Time for an upgrade!", Toast.LENGTH_LONG).show();
47+
Toast.makeText(MainActivity.this, "Time for an upgrade!", Toast.LENGTH_SHORT).show();
4548
}
4649
});
4750
}
@@ -63,6 +66,16 @@ public void onDrawerClosed(View view) {
6366
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
6467
}
6568
};
69+
70+
mDrawerToggle.setDrawerIndicatorEnabled(true);
71+
mDrawerLayout.setDrawerListener(mDrawerToggle);
72+
}
73+
74+
@Override
75+
protected void onPostCreate(Bundle savedInstanceState) {
76+
super.onPostCreate(savedInstanceState);
77+
// Sync the toggle state after onRestoreInstanceState has occurred.
78+
mDrawerToggle.syncState();
6679
}
6780

6881
@Override
@@ -84,6 +97,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
8497
return true;
8598
}
8699

100+
// Activate the navigation drawer toggle
101+
if (mDrawerToggle.onOptionsItemSelected(item)) {
102+
return true;
103+
}
104+
87105
return super.onOptionsItemSelected(item);
88106
}
89107
}

app/src/main/res/layout/activity_main.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent">
77

8+
<!-- The first child in the layout is for the main Activity UI-->
89
<RelativeLayout
910
android:layout_width="match_parent"
1011
android:layout_height="match_parent"
@@ -33,4 +34,12 @@
3334

3435
</RelativeLayout>
3536

37+
<!-- Side navigation drawer UI -->
38+
<ListView
39+
android:id="@+id/navList"
40+
android:layout_width="200dp"
41+
android:layout_height="match_parent"
42+
android:layout_gravity="left|start"
43+
android:background="#ffeeeeee"/>
44+
3645
</android.support.v4.widget.DrawerLayout>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
<string name="app_name">OS List</string>
55
<string name="hello_world">Hello world!</string>
66
<string name="action_settings">Settings</string>
7+
<string name="drawer_open">Open navigation drawer</string>
8+
<string name="drawer_close">Close navigation drawer</string>
79

810
</resources>

0 commit comments

Comments
 (0)