Moved address book link into nav drawer

This commit is contained in:
str4d
2014-05-15 10:56:30 +00:00
parent 84bdafa39d
commit 2a4100d82d
5 changed files with 45 additions and 22 deletions

View File

@@ -14,14 +14,35 @@
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView
android:id="@+id/drawer"
<RelativeLayout
android:id="@+id/drawer_outer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
android:layout_gravity="start" >
<ListView
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<TextView
android:id="@+id/address_book"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:text="@string/address_book"
android:textAppearance="?android:attr/textAppearanceMediumInverse" />
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>

View File

@@ -8,7 +8,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMediumInverse"
android:padding="5dp"
android:padding="15dp"
android:text="Folder Name" />
</RelativeLayout>

View File

@@ -1,12 +1,6 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:i2pandroid="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/action_address_book"
android:orderInCategory="50"
android:title="@string/action_address_book"
i2pandroid:showAsAction="never"/>
<item
android:id="@+id/action_settings"
android:orderInCategory="100"

View File

@@ -4,7 +4,6 @@
<string name="app_name">Bote</string>
<string name="action_new_email">New email</string>
<string name="action_send_email">Send email</string>
<string name="action_address_book">Address book</string>
<string name="action_settings">Settings</string>
<string name="items_selected">%s selected</string>
@@ -26,6 +25,7 @@
<string name="folder_outbox">Outbox</string>
<string name="folder_sent">Sent</string>
<string name="folder_trash">Trash</string>
<string name="address_book">Address book</string>
<string name="folder_empty">Folder is empty</string>
<string name="folder_does_not_exist">Folder does not exist</string>

View File

@@ -21,6 +21,8 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class EmailListActivity extends ActionBarActivity implements
EmailListFragment.OnEmailSelectedListener,
@@ -33,6 +35,7 @@ public class EmailListActivity extends ActionBarActivity implements
* Navigation drawer variables
*/
private DrawerLayout mDrawerLayout;
private RelativeLayout mDrawerOuter;
private FolderListAdapter mFolderAdapter;
private ListView mFolderList;
private ActionBarDrawerToggle mDrawerToggle;
@@ -54,6 +57,7 @@ public class EmailListActivity extends ActionBarActivity implements
mTitle = mDrawerTitle = getTitle();
mSharedPrefs = getSharedPreferences(SHARED_PREFS, 0);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerOuter = (RelativeLayout) findViewById(R.id.drawer_outer);
mFolderAdapter = new FolderListAdapter(this);
mFolderList = (ListView) findViewById(R.id.drawer);
@@ -117,9 +121,18 @@ public class EmailListActivity extends ActionBarActivity implements
savedInstanceState.getInt(ACTIVE_FOLDER), true);
}
// Set up fixed actions
TextView addressBook = (TextView) findViewById(R.id.address_book);
addressBook.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent ai = new Intent(EmailListActivity.this, AddressBookActivity.class);
startActivity(ai);
}
});
// Open nav drawer if the user has never opened it themselves
if (!mSharedPrefs.getBoolean(PREF_NAV_DRAWER_OPENED, false))
mDrawerLayout.openDrawer(mFolderList);
mDrawerLayout.openDrawer(mDrawerOuter);
}
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@@ -139,7 +152,7 @@ public class EmailListActivity extends ActionBarActivity implements
// Highlight the selected item and close the drawer
mFolderList.setItemChecked(position, true);
mDrawerLayout.closeDrawer(mFolderList);
mDrawerLayout.closeDrawer(mDrawerOuter);
}
@Override
@@ -164,11 +177,6 @@ public class EmailListActivity extends ActionBarActivity implements
}
switch (item.getItemId()) {
case R.id.action_address_book:
Intent ai = new Intent(this, AddressBookActivity.class);
startActivity(ai);
return true;
case R.id.action_settings:
Intent si = new Intent(this, SettingsActivity.class);
startActivity(si);