Change style of drawer navigation
Change-Id: I8e8856a4fbac712e52fd5d28a5d520b90132226c
diff --git a/app/build.gradle b/app/build.gradle
index abd1154..1815257 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -42,7 +42,7 @@
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
- abortOnError false
+ abortOnError false
}
splits {
@@ -87,18 +87,18 @@
def args = [getNdkBuildCmd(), '-C', file('src/main').absolutePath]
if (System.env.NDK_BUILD_PARALLEL != null) {
- args.add("-j" + System.env.NDK_BUILD_PARALLEL)
+ args.add("-j" + System.env.NDK_BUILD_PARALLEL)
}
else {
- args.add("-j" + Runtime.runtime.availableProcessors())
+ args.add("-j" + Runtime.runtime.availableProcessors())
}
if (System.env.NDK_BUILD_ABI != null) {
- args.add("APP_ABI=" + System.env.NDK_BUILD_ABI)
+ args.add("APP_ABI=" + System.env.NDK_BUILD_ABI)
}
if (System.env.NDK_DEBUG != null) {
- args.add("V=1")
+ args.add("V=1")
}
commandLine args
}
@@ -148,15 +148,20 @@
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation('com.google.android.material:material:1.1.0-alpha04') {
+ exclude group: 'com.google.guava', module: 'listenablefuture'
+ }
+ implementation('androidx.appcompat:appcompat:1.0.2') {
+ exclude group: 'com.google.guava', module: 'listenablefuture'
+ }
implementation 'com.android.volley:volley:1.1.1'
implementation('net.named-data.jndn-extra:jndn-management:1.2.0') {
- exclude group: 'net.named-data', module: 'jndn'
+ exclude group: 'net.named-data', module: 'jndn'
}
implementation('net.named-data:jndn-android:0.20') {
- exclude group: 'org.xerial'
- exclude group: 'com.google.android'
+ exclude group: 'org.xerial'
+ exclude group: 'com.google.android'
}
implementation 'net.named-data.jndn-extra:jndn-xx-util:0.0.2'
implementation 'joda-time:joda-time:2.10'
@@ -166,7 +171,7 @@
properties.load(project.rootProject.file('local.properties').newDataInputStream())
if (properties['keystore'] == null || properties['keystore.password'] == null ||
- properties['keystore.key.alias'] == null || properties['keystore.key.password'] == null) {
+ properties['keystore.key.alias'] == null || properties['keystore.key.password'] == null) {
println("Cannot sign .apk: specify keystore, keystore.password, keystore.key.alias, and keystore.key.password in local.properties.")
}
else {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9705135..724067c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -30,7 +30,7 @@
<service
android:name=".service.NfdService"
android:process="net.named_data.nfd.service.NfdService"
- android:icon="@drawable/ic_launcher"
+ android:icon="@drawable/nfd_app"
android:label="@string/service_name"
android:exported="true" >
<intent-filter>
diff --git a/app/src/main/java/net/named_data/nfd/DrawerFragment.java b/app/src/main/java/net/named_data/nfd/DrawerFragment.java
index 3ab74d3..6efe23d 100644
--- a/app/src/main/java/net/named_data/nfd/DrawerFragment.java
+++ b/app/src/main/java/net/named_data/nfd/DrawerFragment.java
@@ -20,33 +20,23 @@
package net.named_data.nfd;
import android.app.Activity;
-import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
-import android.os.Parcel;
-import android.os.Parcelable;
import android.preference.PreferenceManager;
-import android.view.LayoutInflater;
import android.view.Menu;
-import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.TextView;
-import java.util.ArrayList;
+import com.google.android.material.navigation.NavigationView;
+
+import net.named_data.nfd.utils.G;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.content.ContextCompat;
import androidx.customview.widget.ViewDragHelper;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
@@ -57,13 +47,8 @@
public class DrawerFragment extends Fragment {
public static DrawerFragment
- newInstance(ArrayList<DrawerFragment.DrawerItem> items) {
- Bundle drawerParams = new Bundle();
- drawerParams.putParcelableArrayList(DrawerFragment.BUNDLE_PARAMETERS, items);
-
- DrawerFragment fragment = new DrawerFragment();
- fragment.setArguments(drawerParams);
- return fragment;
+ newInstance() {
+ return new DrawerFragment();
}
@SuppressWarnings("deprecation")
@@ -98,29 +83,7 @@
m_restoredFromSavedInstanceState = true;
}
- m_drawerItems = getArguments().getParcelableArrayList(BUNDLE_PARAMETERS);
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater,
- ViewGroup container,
- Bundle savedInstanceState)
- {
- m_drawerListView = (ListView)inflater.inflate(
- R.layout.activity_main_drawer_listview, container, false);
-
- m_drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- // Update UI
- updateSelection(position);
- }
- });
-
- m_drawerListView.setAdapter(new DrawerListAdapter(getActionBar().getThemedContext(), m_drawerItems));
- m_drawerListView.setItemChecked(m_drawerSelectedPosition, true);
-
- return m_drawerListView;
+ G.Log("DrawerFragment: onCreate");
}
@Override
@@ -129,14 +92,23 @@
// Fragment influences action bar
setHasOptionsMenu(true);
+ G.Log("DrawerFragment: onActivityCreated");
+
// Initialize and set up the navigation drawer UI
initializeDrawerFragment(getActivity().findViewById(R.id.navigation_drawer),
- (DrawerLayout)getActivity().findViewById(R.id.drawer_layout));
+ getActivity().findViewById(R.id.drawer_layout));
if (savedInstanceState == null) {
// when restoring (e.g., after rotation), rely on system to restore previous state of
// fragments
- updateSelection(m_drawerSelectedPosition);
+ MenuItem item = m_drawerFragmentViewContainer.getMenu().findItem(m_drawerSelectedPosition);
+ if (item != null) {
+ item.setChecked(true);
+ m_callbacks.onDrawerItemSelected(item.getItemId(), item.getTitle());
+ }
+ else {
+ G.Log("Logic problem: there should always be some menu item found");
+ }
}
}
@@ -146,12 +118,28 @@
* @param drawerFragmentViewContainer View container that holds the navigation drawer
* @param drawerLayout DrawerLayout of the drawer in the host Activity
*/
- private void initializeDrawerFragment(View drawerFragmentViewContainer,
+ private void initializeDrawerFragment(NavigationView drawerFragmentViewContainer,
DrawerLayout drawerLayout)
{
m_drawerFragmentViewContainer = drawerFragmentViewContainer;
m_drawerLayout = drawerLayout;
+ m_drawerFragmentViewContainer.setNavigationItemSelectedListener(
+ new NavigationView.OnNavigationItemSelectedListener() {
+ @Override
+ public boolean onNavigationItemSelected(@NonNull MenuItem item)
+ {
+ item.setChecked(true);
+ m_drawerLayout.closeDrawers();
+
+ m_callbacks.onDrawerItemSelected(item.getItemId(), item.getTitle());
+ m_drawerSelectedPosition = item.getItemId();
+
+ return true;
+ }
+ }
+ );
+
// Setup drawer and action bar
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
@@ -200,12 +188,10 @@
if (newState != ViewDragHelper.STATE_IDLE) {
// opened/closed is handled by onDrawerOpened and onDrawerClosed callbacks
m_shouldHideOptionsMenu = true;
- getActivity().invalidateOptionsMenu();
} else if (!isDrawerOpen()) {
// This condition takes care of the case of displaying the option menu
// items when the drawer is retracted prematurely.
m_shouldHideOptionsMenu = false;
- getActivity().invalidateOptionsMenu();
}
}
};
@@ -241,18 +227,6 @@
}
@Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
- super.onCreateOptionsMenu(menu, inflater);
- // Update menu UI when the drawer is open. This gives the user a better
- // contextual perception of the application.
- if (isDrawerOpen()) {
- // Inflate drawer specific menu here (if any)
- showGlobalContextActionBar();
- }
-
- }
-
- @Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
// Remove option menu items when drawer is sliding out
@@ -285,32 +259,6 @@
}
/**
- * Convenience method that updates the UI and callbacks the host activity.
- *
- * @param position Position of the selected item within the Drawer's ListView.
- */
- private void updateSelection(int position) {
- // Update Position
- m_drawerSelectedPosition = position;
-
- // Update UI of selected position
- if (m_drawerListView != null) {
- m_drawerListView.setItemChecked(position, true);
- }
-
- // Close drawer
- if (m_drawerLayout != null) {
- m_drawerLayout.closeDrawer(m_drawerFragmentViewContainer);
- }
-
- // Invoke host activity callback
- if (m_callbacks != null) {
- DrawerItem item = m_drawerItems.get(position);
- m_callbacks.onDrawerItemSelected(item.getItemCode(), item.getItemName());
- }
- }
-
- /**
* Safe convenience method to determine if drawer is open.
*
* @return True if drawer is present and in an open state; false otherwise
@@ -321,16 +269,6 @@
}
/**
- * Convenience method to update host activity action bar so that the user is informed of
- * the app's "current context" of the fragment.
- */
- private void showGlobalContextActionBar() {
- ActionBar actionBar = getActionBar();
- actionBar.setDisplayShowTitleEnabled(true);
- actionBar.setTitle(R.string.app_name);
- }
-
- /**
* Convenience method to get host activity's ActionBar. This makes for easy updates
* in a single location when upgrading to use >= HONEYCOMB (API 11) ActionBar.
*
@@ -342,130 +280,10 @@
//////////////////////////////////////////////////////////////////////////////
- /**
- * DrawerItem represents a single selection option in the Drawer, complete
- * with the ability to set a Drawable resource icon for display along
- * with the drawer item name.
- */
- public static class DrawerItem implements Parcelable {
- @Override
- public int describeContents()
- {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel parcel, int i)
- {
- parcel.writeInt(m_itemNameId);
- parcel.writeInt(m_iconResId);
- parcel.writeInt(m_itemCode);
- }
-
- public static final Parcelable.Creator<DrawerItem> CREATOR = new Parcelable.Creator<DrawerItem>() {
- public DrawerItem
- createFromParcel(Parcel in) {
- return new DrawerItem(in.readInt(), in.readInt(), in.readInt());
- }
-
- public DrawerItem[] newArray(int size) {
- return new DrawerItem[size];
- }
- };
-
- DrawerItem(int itemNameId, int resIconId, int itemCode) {
- m_itemNameId = itemNameId;
- m_iconResId = resIconId;
- m_itemCode = itemCode;
- }
-
- int
- getItemName() {
- return m_itemNameId;
- }
-
- int
- getIconResId() {
- return m_iconResId;
- }
-
- int
- getItemCode() {
- return m_itemCode;
- }
-
- ///////////////////////////////////////////////////////////////////////////
-
- /** Drawer item name */
- private final int m_itemNameId;
-
- /** Resource ID of a drawable to be shown as the item's icon */
- private final int m_iconResId;
-
- /** Item code for feedback to the host activity's implemented callback. */
- private final int m_itemCode;
-
- }
-
- /**
- * Customized DrawerListAdapter to furnishes the Drawer with DrawerItem
- * information.
- */
- private static class DrawerListAdapter extends ArrayAdapter<DrawerItem> {
-
- DrawerListAdapter(Context context, ArrayList<DrawerItem> drawerItems) {
- super(context, 0, drawerItems);
- m_layoutInflater =
- (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- m_context = context;
- }
-
- @Override @NonNull
- public View getView(int position, View convertView, @NonNull ViewGroup parent) {
- DrawerItemHolder holder;
-
- if (convertView == null) {
- holder = new DrawerItemHolder();
-
- convertView = m_layoutInflater.inflate(R.layout.list_item_drawer_item, parent, false);
- convertView.setTag(holder);
-
- holder.m_icon = convertView.findViewById(R.id.drawer_item_icon);
- holder.m_text = convertView.findViewById(R.id.drawer_item_text);
- } else {
- holder = (DrawerItemHolder)convertView.getTag();
- }
-
- // Update items in holder
- DrawerItem item = getItem(position);
- if (item != null) {
- if (item.getIconResId() != 0) {
- holder.m_icon.setImageDrawable(ContextCompat.getDrawable(m_context, item.getIconResId()));
- }
- holder.m_text.setText(item.getItemName());
- }
-
- return convertView;
- }
-
- private static class DrawerItemHolder {
- private ImageView m_icon;
- private TextView m_text;
- }
-
- /** Layout inflater for use */
- private final LayoutInflater m_layoutInflater;
-
- /** Reference to get context's resources */
- private final Context m_context;
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
/** Callback that host activity must implement */
public interface DrawerCallbacks {
/** Callback to host activity when a drawer item is selected */
- void onDrawerItemSelected(int itemCode, int itemNameId);
+ void onDrawerItemSelected(int itemCode, CharSequence itemTitle);
}
//////////////////////////////////////////////////////////////////////////////
@@ -478,9 +296,6 @@
private static final String DRAWER_SELECTED_POSITION_BUNDLE_KEY
= "DRAWER_SELECTED_POSITION";
- /** Bundle argument key for bundle parameters */
- private static final String BUNDLE_PARAMETERS = "net.named_data.nfd.drawer_fragment_parameters";
-
/** Callback to parent activity */
private DrawerCallbacks m_callbacks;
@@ -490,14 +305,11 @@
/** Reference to DrawerLayout fragment in host activity */
private DrawerLayout m_drawerLayout;
- /** Reference to drawer's ListView */
- private ListView m_drawerListView;
-
/** Drawer's fragment container in the host activity */
- private View m_drawerFragmentViewContainer;
+ private NavigationView m_drawerFragmentViewContainer;
/** Current position of the Drawer's selection */
- private int m_drawerSelectedPosition = 0;
+ private int m_drawerSelectedPosition = R.id.nav_general;
/** Flag that denotes if the fragment is restored from an instance state */
private boolean m_restoredFromSavedInstanceState;
@@ -505,9 +317,6 @@
/** Flag that denotes if the user has seen the Drawer when the app loads for the first time */
private boolean m_hasUserSeenDrawer;
- /** ArrayList of DrawerItems to be displayed in the Drawer */
- private ArrayList<DrawerItem> m_drawerItems;
-
/** Flag that marks if drawer is sliding outwards and being displayed */
private boolean m_shouldHideOptionsMenu = false;
}
diff --git a/app/src/main/java/net/named_data/nfd/MainActivity.java b/app/src/main/java/net/named_data/nfd/MainActivity.java
index 467b052..b3a8c1c 100644
--- a/app/src/main/java/net/named_data/nfd/MainActivity.java
+++ b/app/src/main/java/net/named_data/nfd/MainActivity.java
@@ -59,25 +59,11 @@
}
if (m_drawerFragment == null) {
- ArrayList<DrawerFragment.DrawerItem> items = new ArrayList<DrawerFragment.DrawerItem>();
-
- items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_general, 0,
- DRAWER_ITEM_GENERAL));
- items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_faces, 0,
- DRAWER_ITEM_FACES));
- items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_routes, 0,
- DRAWER_ITEM_ROUTES));
- items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_ping, 0,
- DRAWER_ITEM_PING));
- // items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_strategies, 0,
- // DRAWER_ITEM_STRATEGIES));
- items.add(new DrawerFragment.DrawerItem(R.string.drawer_item_wifidirect, 0, DRAWER_ITEM_WIFIDIRECT));
-
// TODO here we are preloading the NDNController singleton to avoid UI slowdown
// it is due to building a test keychain: See NDNController.getInstance()
NDNController.getInstance();
- m_drawerFragment = DrawerFragment.newInstance(items);
+ m_drawerFragment = DrawerFragment.newInstance();
fragmentManager
.beginTransaction()
@@ -88,9 +74,7 @@
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- G.Log("onCreateOptionsMenu" + String.valueOf(m_drawerFragment.shouldHideOptionsMenu()));
if (!m_drawerFragment.shouldHideOptionsMenu()) {
- updateActionBar();
return super.onCreateOptionsMenu(menu);
}
else
@@ -104,27 +88,14 @@
//////////////////////////////////////////////////////////////////////////////
- /**
- * Convenience method that updates and display the current title in the Action Bar
- */
- @SuppressWarnings("deprecation")
- private void updateActionBar() {
- ActionBar actionBar = getSupportActionBar();
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
- actionBar.setDisplayShowTitleEnabled(true);
- if (m_actionBarTitleId != -1) {
- actionBar.setTitle(m_actionBarTitleId);
- }
- }
-
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
FragmentManager fragmentManager = getSupportFragmentManager();
- int drawItem = getIntent().getIntExtra(INTENT_KEY_FRAGMENT_TAG, -1);
- if (drawItem == DRAWER_ITEM_GENERAL) {
+ int drawItem = getIntent().getIntExtra(INTENT_KEY_FRAGMENT_TAG, R.id.nav_general);
+ if (drawItem == R.id.nav_general) {
MainFragment mainFragment = MainFragment.newInstance();
fragmentManager
.beginTransaction()
@@ -152,8 +123,8 @@
@Override
public void
- onDrawerItemSelected(int itemCode, int itemNameId) {
-
+ onDrawerItemSelected(int itemCode, CharSequence itemTitle) {
+ G.Log("onDrawerItemSelected: " + itemTitle);
String fragmentTag = "net.named-data.nfd.content-" + String.valueOf(itemCode);
FragmentManager fragmentManager = getSupportFragmentManager();
@@ -161,22 +132,22 @@
Fragment fragment = fragmentManager.findFragmentByTag(fragmentTag);
if (fragment == null) {
switch (itemCode) {
- case DRAWER_ITEM_GENERAL:
+ case R.id.nav_general:
fragment = MainFragment.newInstance();
break;
- case DRAWER_ITEM_FACES:
+ case R.id.nav_faces:
fragment = FaceListFragment.newInstance();
break;
- case DRAWER_ITEM_ROUTES:
+ case R.id.nav_routes:
fragment = RouteListFragment.newInstance();
break;
- case DRAWER_ITEM_PING:
+ case R.id.nav_ping:
fragment = PingClientFragment.newInstance();
break;
// TODO: Placeholders; Fill these in when their fragments have been created
// case DRAWER_ITEM_STRATEGIES:
// break;
- case DRAWER_ITEM_WIFIDIRECT:
+ case R.id.nav_wifidirect:
fragment = WiFiDirectFragment.newInstance();
break;
default:
@@ -185,8 +156,8 @@
}
}
- // Update ActionBar title
- m_actionBarTitleId = itemNameId;
+ ActionBar actionBar = getSupportActionBar();
+ actionBar.setTitle(itemTitle);
fragmentManager.beginTransaction()
.replace(R.id.main_fragment_container, fragment, fragmentTag)
@@ -209,17 +180,6 @@
/** Reference to drawer fragment */
private DrawerFragment m_drawerFragment;
- /** Title that is to be displayed in the ActionBar */
- private int m_actionBarTitleId = -1;
-
- /** Item code for drawer items: For use in onDrawerItemSelected() callback */
- public static final int DRAWER_ITEM_GENERAL = 1;
- public static final int DRAWER_ITEM_FACES = 2;
- public static final int DRAWER_ITEM_ROUTES = 3;
- public static final int DRAWER_ITEM_PING = 4;
- //public static final int DRAWER_ITEM_STRATEGIES = X;
- public static final int DRAWER_ITEM_WIFIDIRECT = 5;
-
/** Indent key for jump to a fragment */
public static final String INTENT_KEY_FRAGMENT_TAG = "fragmentTag";
}
diff --git a/app/src/main/java/net/named_data/nfd/service/NfdService.java b/app/src/main/java/net/named_data/nfd/service/NfdService.java
index 184799e..a3a3248 100644
--- a/app/src/main/java/net/named_data/nfd/service/NfdService.java
+++ b/app/src/main/java/net/named_data/nfd/service/NfdService.java
@@ -488,7 +488,7 @@
(NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
- intent.putExtra(MainActivity.INTENT_KEY_FRAGMENT_TAG, MainActivity.DRAWER_ITEM_GENERAL);
+ intent.putExtra(MainActivity.INTENT_KEY_FRAGMENT_TAG, R.id.nav_general);
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(),
NOTIFICATION_ID, intent,
diff --git a/app/src/main/res/drawable-hdpi/ic_faces.png b/app/src/main/res/drawable-hdpi/ic_faces.png
new file mode 100755
index 0000000..4115013
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_faces.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_ping.png b/app/src/main/res/drawable-hdpi/ic_ping.png
new file mode 100755
index 0000000..4604839
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_ping.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_route.png b/app/src/main/res/drawable-hdpi/ic_route.png
new file mode 100755
index 0000000..64223fe
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_route.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_status.png b/app/src/main/res/drawable-hdpi/ic_status.png
new file mode 100755
index 0000000..5ebbdb2
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_status.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_strategy.png b/app/src/main/res/drawable-hdpi/ic_strategy.png
new file mode 100755
index 0000000..e0c6423
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_strategy.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_wifidirect.png b/app/src/main/res/drawable-hdpi/ic_wifidirect.png
new file mode 100755
index 0000000..d0e59fc
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_wifidirect.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_faces.png b/app/src/main/res/drawable-mdpi/ic_faces.png
new file mode 100755
index 0000000..df9e712
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_faces.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_ping.png b/app/src/main/res/drawable-mdpi/ic_ping.png
new file mode 100755
index 0000000..85e83c5
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_ping.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_route.png b/app/src/main/res/drawable-mdpi/ic_route.png
new file mode 100755
index 0000000..09ff8d8
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_route.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_status.png b/app/src/main/res/drawable-mdpi/ic_status.png
new file mode 100755
index 0000000..b6b346f
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_status.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_strategy.png b/app/src/main/res/drawable-mdpi/ic_strategy.png
new file mode 100755
index 0000000..703ddeb
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_strategy.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_wifidirect.png b/app/src/main/res/drawable-mdpi/ic_wifidirect.png
new file mode 100755
index 0000000..2cdef27
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_wifidirect.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_faces.png b/app/src/main/res/drawable-xhdpi/ic_faces.png
new file mode 100755
index 0000000..2176e5f
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_faces.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_pingy.png b/app/src/main/res/drawable-xhdpi/ic_pingy.png
new file mode 100755
index 0000000..ad7a04f
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_pingy.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_route.png b/app/src/main/res/drawable-xhdpi/ic_route.png
new file mode 100755
index 0000000..62a9206
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_route.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_status.png b/app/src/main/res/drawable-xhdpi/ic_status.png
new file mode 100755
index 0000000..9c6ef97
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_status.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_strategy.png b/app/src/main/res/drawable-xhdpi/ic_strategy.png
new file mode 100755
index 0000000..50d3bc4
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_strategy.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_wifidirect.png b/app/src/main/res/drawable-xhdpi/ic_wifidirect.png
new file mode 100755
index 0000000..d28c978
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_wifidirect.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_faces.png b/app/src/main/res/drawable-xxhdpi/ic_faces.png
new file mode 100755
index 0000000..2979280
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_faces.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_ping.png b/app/src/main/res/drawable-xxhdpi/ic_ping.png
new file mode 100755
index 0000000..6be6635
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_ping.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_route.png b/app/src/main/res/drawable-xxhdpi/ic_route.png
new file mode 100755
index 0000000..10f3e52
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_route.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_status.png b/app/src/main/res/drawable-xxhdpi/ic_status.png
new file mode 100755
index 0000000..ca4e163
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_status.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_strategy.png b/app/src/main/res/drawable-xxhdpi/ic_strategy.png
new file mode 100755
index 0000000..97e4672
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_strategy.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_wifidirect.png b/app/src/main/res/drawable-xxhdpi/ic_wifidirect.png
new file mode 100755
index 0000000..8c15d21
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_wifidirect.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_faces.png b/app/src/main/res/drawable-xxxhdpi/ic_faces.png
new file mode 100755
index 0000000..6f3dd19
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ic_faces.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_pingy.png b/app/src/main/res/drawable-xxxhdpi/ic_pingy.png
new file mode 100755
index 0000000..c0e69e5
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ic_pingy.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_route.png b/app/src/main/res/drawable-xxxhdpi/ic_route.png
new file mode 100755
index 0000000..1d623d5
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ic_route.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_status.png b/app/src/main/res/drawable-xxxhdpi/ic_status.png
new file mode 100755
index 0000000..ea4e927
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ic_status.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_strategy.png b/app/src/main/res/drawable-xxxhdpi/ic_strategy.png
new file mode 100755
index 0000000..13f12e8
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ic_strategy.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_wifidirect.png b/app/src/main/res/drawable-xxxhdpi/ic_wifidirect.png
new file mode 100755
index 0000000..f289e9d
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ic_wifidirect.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ndn_logo.png b/app/src/main/res/drawable-xxxhdpi/ndn_logo.png
new file mode 100644
index 0000000..5a7c14a
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/ndn_logo.png
Binary files differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 037aa3f..fe3c704 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -2,6 +2,7 @@
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -14,13 +15,13 @@
android:layout_height="match_parent"
/>
- <!-- DrawerFragment for user navigation -->
- <FrameLayout
+ <com.google.android.material.navigation.NavigationView
android:id="@+id/navigation_drawer"
- android:layout_width="@dimen/drawer_width"
+ android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
- tools:layout="@layout/activity_main_drawer_listview"
+ app:headerLayout="@layout/drawer_header"
+ app:menu="@menu/drawer_menu"
/>
</androidx.drawerlayout.widget.DrawerLayout>
diff --git a/app/src/main/res/layout/drawer_header.xml b/app/src/main/res/layout/drawer_header.xml
new file mode 100644
index 0000000..c36facc
--- /dev/null
+++ b/app/src/main/res/layout/drawer_header.xml
@@ -0,0 +1,14 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical" android:layout_width="match_parent"
+ android:padding="10dp"
+ android:gravity="center"
+ android:layout_height="80dp"
+ android:layout_gravity="center">
+
+ <ImageView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:src="@drawable/ndn_logo"
+ android:layout_gravity="center" />
+
+</LinearLayout>
diff --git a/app/src/main/res/layout/list_item_drawer_item.xml b/app/src/main/res/layout/list_item_drawer_item.xml
index 08a598b..c14d385 100644
--- a/app/src/main/res/layout/list_item_drawer_item.xml
+++ b/app/src/main/res/layout/list_item_drawer_item.xml
@@ -4,8 +4,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/drawer_item_background_activated"
- android:paddingLeft="@dimen/default_padding_left"
- android:paddingRight="@dimen/default_padding_right"
+ android:paddingStart="@dimen/default_padding_left"
+ android:paddingEnd="@dimen/default_padding_right"
>
<ImageView
diff --git a/app/src/main/res/menu/drawer_menu.xml b/app/src/main/res/menu/drawer_menu.xml
new file mode 100644
index 0000000..7499683
--- /dev/null
+++ b/app/src/main/res/menu/drawer_menu.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+ <group android:checkableBehavior="single">
+ <item
+ android:id="@+id/nav_general"
+ android:icon="@drawable/ic_status"
+ android:title="@string/drawer_item_general" />
+ <item
+ android:id="@+id/nav_faces"
+ android:icon="@drawable/ic_faces"
+ android:title="@string/drawer_item_faces" />
+ <item
+ android:id="@+id/nav_routes"
+ android:icon="@drawable/ic_route"
+ android:title="@string/drawer_item_routes" />
+ <item
+ android:id="@+id/nav_ping"
+ android:icon="@drawable/ic_ping"
+ android:title="@string/drawer_item_ping" />
+ <item
+ android:id="@+id/nav_wifidirect"
+ android:icon="@drawable/ic_wifidirect"
+ android:title="@string/drawer_item_wifidirect" />
+ </group>
+</menu>
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index f851cec..ca9896c 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
<resources>
<!-- Base application theme. -->
- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>