Merge pull request #699 from da-kid/master

Partial fix for #597 (Navbar)
This commit is contained in:
Dominik Schürmann 2014-06-28 17:44:11 +02:00
commit 6e188be81e
10 changed files with 20 additions and 18 deletions

View File

@ -37,8 +37,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ImageView;
import com.beardedhen.androidbootstrap.FontAwesomeText;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
@ -79,10 +78,10 @@ public class DrawerActivity extends ActionBarActivity {
} }
NavItem mItemIconTexts[] = new NavItem[]{ NavItem mItemIconTexts[] = new NavItem[]{
new NavItem("fa-user", getString(R.string.nav_keys)), new NavItem(R.drawable.ic_action_person, getString(R.string.nav_keys)),
new NavItem("fa-lock", getString(R.string.nav_encrypt)), new NavItem(R.drawable.ic_action_secure, getString(R.string.nav_encrypt)),
new NavItem("fa-unlock", getString(R.string.nav_decrypt)), new NavItem(R.drawable.ic_action_not_secure, getString(R.string.nav_decrypt)),
new NavItem("fa-android", getString(R.string.nav_apps))}; new NavItem(R.drawable.ic_action_view_as_list, getString(R.string.nav_apps))};
mDrawerList.setAdapter(new NavigationDrawerAdapter(this, R.layout.drawer_list_item, mDrawerList.setAdapter(new NavigationDrawerAdapter(this, R.layout.drawer_list_item,
mItemIconTexts)); mItemIconTexts));
@ -239,10 +238,15 @@ public class DrawerActivity extends ActionBarActivity {
} }
private class NavItem { private class NavItem {
public String icon; public int icon; // res-id
public String title; public String title;
public NavItem(String icon, String title) { /**
* NavItem constructor
* @param icon The icons resource-id
* @param title The title of the menu entry
*/
public NavItem(int icon, String title) {
super(); super();
this.icon = icon; this.icon = icon;
this.title = title; this.title = title;
@ -271,7 +275,7 @@ public class DrawerActivity extends ActionBarActivity {
row = inflater.inflate(mLayoutResourceId, parent, false); row = inflater.inflate(mLayoutResourceId, parent, false);
holder = new NavItemHolder(); holder = new NavItemHolder();
holder.mImg = (FontAwesomeText) row.findViewById(R.id.drawer_item_icon); holder.mImg = (ImageView) row.findViewById(R.id.drawer_item_icon);
holder.mTxtTitle = (TextView) row.findViewById(R.id.drawer_item_text); holder.mTxtTitle = (TextView) row.findViewById(R.id.drawer_item_text);
row.setTag(holder); row.setTag(holder);
@ -281,7 +285,7 @@ public class DrawerActivity extends ActionBarActivity {
NavItem item = mData[position]; NavItem item = mData[position];
holder.mTxtTitle.setText(item.title); holder.mTxtTitle.setText(item.title);
holder.mImg.setIcon(item.icon); holder.mImg.setImageResource(item.icon);
return row; return row;
} }
@ -289,7 +293,7 @@ public class DrawerActivity extends ActionBarActivity {
} }
static class NavItemHolder { static class NavItemHolder {
FontAwesomeText mImg; ImageView mImg;
TextView mTxtTitle; TextView mTxtTitle;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 441 B

View File

@ -3,17 +3,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.beardedhen.androidbootstrap.FontAwesomeText <ImageView
android:id="@+id/drawer_item_icon" android:id="@+id/drawer_item_icon"
android:gravity="center_vertical"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textSize="24sp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
fontawesometext:fa_icon="fa-github" android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /> android:layout_centerVertical="true" />
<TextView <TextView
android:id="@+id/drawer_item_text" android:id="@+id/drawer_item_text"
@ -28,6 +26,6 @@
android:textAppearance="@android:style/TextAppearance.Medium" android:textAppearance="@android:style/TextAppearance.Medium"
android:textColor="#111" android:textColor="#111"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/drawer_item_icon" /> android:layout_toRightOf="@id/drawer_item_icon"/>
</RelativeLayout> </RelativeLayout>