gui: UI improvements
- Make use of addHeaderView of ListViews, instead of using embedded
ListViews
- Use action bar icons as an entry point for settings, refresh, and add
functions
Change-Id: I6db1cf1a84271a224cf777e06262380afca49709
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 8190941..e15c9ed 100644
--- a/app/src/main/java/net/named_data/nfd/DrawerFragment.java
+++ b/app/src/main/java/net/named_data/nfd/DrawerFragment.java
@@ -163,22 +163,16 @@
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
- if (!isAdded()) {
- return;
- }
// Allow update calls to onCreateOptionsMenu() and
// onPrepareOptionsMenu() to update Menu UI.
+ m_shouldHideOptionsMenu = false;
getActivity().supportInvalidateOptionsMenu();
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
- if (!isAdded()) {
- // Drawer has not been added; Nothing to de here
- return;
- }
// Flag that user has seen drawer for the first time
if (!m_hasUserSeenDrawer) {
@@ -193,31 +187,17 @@
// Allow update calls to onCreateOptionsMenu() and
// onPrepareOptionsMenu() to update Menu UI
+ m_shouldHideOptionsMenu = true;
getActivity().supportInvalidateOptionsMenu();
}
@Override
public void onDrawerStateChanged(int newState) {
super.onDrawerStateChanged(newState);
- switch (newState) {
- case ViewDragHelper.STATE_DRAGGING:
- // Fall through; Same condition.
- case ViewDragHelper.STATE_SETTLING:
- if (m_drawerCurrentState == DRAWER_CLOSED) {
- m_shouldHideOptionsMenu = true;
- m_drawerCurrentState = DRAWER_SLIDING;
- getActivity().supportInvalidateOptionsMenu();
- }
- break;
- case ViewDragHelper.STATE_IDLE:
- if (m_drawerCurrentState == DRAWER_SLIDING) {
- m_drawerCurrentState = DRAWER_OPENED;
- m_shouldHideOptionsMenu = false;
- getActivity().supportInvalidateOptionsMenu();
- } else if (m_drawerCurrentState == DRAWER_OPENED) {
- m_drawerCurrentState = DRAWER_CLOSED;
- }
- break;
+ if (newState != ViewDragHelper.STATE_IDLE) {
+ // opened/closed is handled by onDrawerOpened and onDrawerClosed callbacks
+ m_shouldHideOptionsMenu = true;
+ getActivity().supportInvalidateOptionsMenu();
}
}
};
@@ -225,7 +205,6 @@
// Open drawer for the first time
if (!m_hasUserSeenDrawer && !m_restoredFromSavedInstanceState) {
m_shouldHideOptionsMenu = true;
- m_drawerCurrentState = DRAWER_OPENED;
m_drawerLayout.openDrawer(m_drawerFragmentViewContainer);
}
@@ -258,7 +237,7 @@
super.onCreateOptionsMenu(menu, inflater);
// Update menu UI when the drawer is open. This gives the user a better
// contextual perception of the application.
- if (m_drawerLayout != null && isDrawerOpen()) {
+ if (isDrawerOpen()) {
// Inflate drawer specific menu here (if any)
showGlobalContextActionBar();
}
@@ -292,6 +271,11 @@
}
}
+ public boolean
+ shouldHideOptionsMenu() {
+ return m_shouldHideOptionsMenu;
+ }
+
/**
* Convenience method that updates the UI and callbacks the host activity.
*
@@ -323,7 +307,8 @@
*
* @return True if drawer is present and in an open state; false otherwise
*/
- public boolean isDrawerOpen() {
+ private boolean
+ isDrawerOpen() {
return m_drawerLayout != null && m_drawerLayout.isDrawerOpen(m_drawerFragmentViewContainer);
}
@@ -515,13 +500,5 @@
private ArrayList<DrawerItem> m_drawerItems;
/** Flag that marks if drawer is sliding outwards and being displayed */
- private boolean m_shouldHideOptionsMenu;
-
- /** Keeping track of the drawer state */
- private int m_drawerCurrentState = DRAWER_CLOSED;
-
- /** Drawer State Values that are used by m_drawerCurrentState */
- private static final int DRAWER_SLIDING = 1;
- private static final int DRAWER_CLOSED = 2;
- private static final int DRAWER_OPENED = 3;
+ private boolean m_shouldHideOptionsMenu = false;
}
diff --git a/app/src/main/java/net/named_data/nfd/FaceCreateDialogFragment.java b/app/src/main/java/net/named_data/nfd/FaceCreateDialogFragment.java
index 2013129..5e5340a 100644
--- a/app/src/main/java/net/named_data/nfd/FaceCreateDialogFragment.java
+++ b/app/src/main/java/net/named_data/nfd/FaceCreateDialogFragment.java
@@ -47,7 +47,7 @@
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
builder
- .setView(inflater.inflate(R.layout.create_face, null))
+ .setView(inflater.inflate(R.layout.dialog_create_face, null))
.setPositiveButton(R.string.face_add_dialog_create_face, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id)
diff --git a/app/src/main/java/net/named_data/nfd/FaceListFragment.java b/app/src/main/java/net/named_data/nfd/FaceListFragment.java
index 168fe85..540201d 100644
--- a/app/src/main/java/net/named_data/nfd/FaceListFragment.java
+++ b/app/src/main/java/net/named_data/nfd/FaceListFragment.java
@@ -24,6 +24,7 @@
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
+import android.support.annotation.Nullable;
import android.support.v4.app.ListFragment;
import android.util.Pair;
import android.view.ActionMode;
@@ -35,7 +36,6 @@
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
-import android.widget.Button;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
@@ -47,8 +47,9 @@
import net.named_data.nfd.utils.G;
import net.named_data.nfd.utils.Nfdc;
-import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
public class FaceListFragment extends ListFragment implements FaceCreateDialogFragment.OnFaceCreateRequested {
@@ -61,46 +62,28 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setListAdapter(new FaceListAdapter(getActivity()));
+ setHasOptionsMenu(true);
}
@Override
- public View onCreateView(final LayoutInflater inflater,
- ViewGroup container,
- Bundle savedInstanceState)
+ public void onViewCreated(View view, Bundle savedInstanceState)
{
+ super.onViewCreated(view, savedInstanceState);
+
@SuppressLint("InflateParams")
- View v = inflater.inflate(R.layout.fragment_face_list, null);
+ View v = getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_face_list_list_header, null);
+ getListView().addHeaderView(v, null, false);
+ getListView().setDivider(getResources().getDrawable(R.drawable.list_item_divider));
// Get info unavailable view
m_faceListInfoUnavailableView = v.findViewById(R.id.face_list_info_unavailable);
// Get progress bar spinner view
m_reloadingListProgressBar
- = (ProgressBar)v.findViewById(R.id.face_list_reloading_list_progress_bar);
-
- // Set refresh button click listener
- Button refreshFaceListButton = (Button)v.findViewById(R.id.face_list_refresh_button);
- refreshFaceListButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- retrieveFaceList();
- }
- });
-
- Button addFaceButton = (Button)v.findViewById(R.id.face_list_add_button);
- addFaceButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view)
- {
- FaceCreateDialogFragment dialog = FaceCreateDialogFragment.newInstance();
- dialog.setTargetFragment(FaceListFragment.this, 0);
- dialog.show(getFragmentManager(), "FaceCreateFragment");
- }
- });
+ = (ProgressBar)v.findViewById(R.id.face_list_reloading_list_progress_bar);
// Setup list view for deletion
- ListView listView = (ListView)v.findViewById(android.R.id.list);
+ ListView listView = getListView();
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
listView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
@Override
@@ -108,7 +91,12 @@
onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
if (checked && id < 256) {
getListView().setItemChecked(position, false);
+ return;
}
+ if (checked)
+ m_facesToDelete.add((int)id);
+ else
+ m_facesToDelete.remove((int)id);
}
@Override
@@ -129,22 +117,13 @@
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_item_delete_face_item:
- FaceListAdapter faceListAdapter = (FaceListAdapter)getListAdapter();
- List<Integer> deleteFaceInfoList = new ArrayList<Integer>();
-
- for (int i = faceListAdapter.getCount() - 1; i >= 0; i--) {
- if (getListView().isItemChecked(i)) {
- int faceId = faceListAdapter.getItem(i).getFaceId();
- if (faceId < 256)
- continue;
- deleteFaceInfoList.add(faceListAdapter.getItem(i).getFaceId());
- }
- }
+ G.Log("Requesting to delete " + String.valueOf(m_facesToDelete));
// Delete selected faceIds
m_faceDestroyAsyncTask = new FaceDestroyAsyncTask();
- m_faceDestroyAsyncTask.execute(deleteFaceInfoList);
+ m_faceDestroyAsyncTask.execute(m_facesToDelete);
+ m_facesToDelete = new HashSet<>();
mode.finish();
return true;
default:
@@ -155,9 +134,52 @@
@Override
public void onDestroyActionMode(ActionMode mode) {
}
- });
- return v;
+ private HashSet<Integer> m_facesToDelete = new HashSet<>();
+ });
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState)
+ {
+ super.onActivityCreated(savedInstanceState);
+
+ if (m_faceListAdapter == null) {
+ m_faceListAdapter = new FaceListAdapter(getActivity());
+ }
+ // setListAdapter must be called after addHeaderView. Otherwise, there is an exception on some platforms.
+ // http://stackoverflow.com/a/8141537/2150331
+ setListAdapter(m_faceListAdapter);
+ }
+
+ @Override
+ public void onDestroyView()
+ {
+ super.onDestroyView();
+ setListAdapter(null);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
+ {
+ super.onCreateOptionsMenu(menu, inflater);
+ inflater.inflate(R.menu.menu_face_list, menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ switch (item.getItemId()) {
+ case R.id.face_list_refresh:
+ retrieveFaceList();
+ return true;
+ case R.id.face_list_add:
+ FaceCreateDialogFragment dialog = FaceCreateDialogFragment.newInstance();
+ dialog.setTargetFragment(FaceListFragment.this, 0);
+ dialog.show(getFragmentManager(), "FaceCreateFragment");
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
}
@Override
@@ -273,8 +295,7 @@
}
private void
- updateList(List<FaceStatus> faces)
- {
+ updateList(List<FaceStatus> faces) {
m_faces = faces;
notifyDataSetChanged();
}
@@ -386,7 +407,7 @@
/**
* AsyncTask that destroys faces that are passed in as a list of FaceInfo.
*/
- private class FaceDestroyAsyncTask extends AsyncTask<List<Integer>, Void, Exception> {
+ private class FaceDestroyAsyncTask extends AsyncTask<Set<Integer>, Void, Exception> {
@Override
protected void
onPreExecute() {
@@ -397,12 +418,12 @@
@SafeVarargs
@Override
protected final Exception
- doInBackground(List<Integer>... params) {
+ doInBackground(Set<Integer>... params) {
Exception retval = null;
Nfdc nfdc = new Nfdc();
try {
- for (List<Integer> faces : params) {
+ for (Set<Integer> faces : params) {
for (int faceId : faces) {
nfdc.faceDestroy(faceId);
}
@@ -525,4 +546,6 @@
/** Progress bar spinner to display to user when destroying faces */
private ProgressBar m_reloadingListProgressBar;
+
+ private FaceListAdapter m_faceListAdapter;
}
diff --git a/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java b/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
index 13aa367..e9804cb 100644
--- a/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
+++ b/app/src/main/java/net/named_data/nfd/FaceStatusFragment.java
@@ -76,54 +76,70 @@
}
@Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- m_listItems = new ArrayList<>();
+ public void onViewCreated(View view, Bundle savedInstanceState)
+ {
+ super.onViewCreated(view, savedInstanceState);
- Resources res = getResources();
- m_scopes = res.getStringArray(R.array.face_scopes);
- m_linkTypes = res.getStringArray(R.array.face_link_types);
- m_persistencies = res.getStringArray(R.array.face_persistency);
+ View v = getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_face_detail_list_header, null);
+ getListView().addHeaderView(v, null, false);
+ getListView().setDivider(getResources().getDrawable(R.drawable.list_item_divider));
+ }
- // Get face status information
- FaceStatus faceStatus = new FaceStatus();
- try {
- byte [] args = getArguments().getByteArray(EXTRA_FACE_INFORMATION);
- faceStatus.wireDecode(new Blob(args).buf());
- } catch (EncodingException e) {
- G.Log("EXTRA_FACE_INFORMATION: EncodingException: " + e);
- }
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState)
+ {
+ super.onActivityCreated(savedInstanceState);
- // Creating list of items to be displayed
- m_listItems.add(new ListItem("Face ID", String.valueOf(faceStatus.getFaceId())));
- m_listItems.add(new ListItem("Local FaceUri", faceStatus.getLocalUri()));
- m_listItems.add(new ListItem("Remote FaceUri", faceStatus.getUri()));
- m_listItems.add(new ListItem("Expires in", faceStatus.getExpirationPeriod() < 0 ?
- getString(R.string.expire_never):
+ if (m_faceStatusAdapter == null) {
+ m_listItems = new ArrayList<>();
+
+ Resources res = getResources();
+ m_scopes = res.getStringArray(R.array.face_scopes);
+ m_linkTypes = res.getStringArray(R.array.face_link_types);
+ m_persistencies = res.getStringArray(R.array.face_persistency);
+
+ // Get face status information
+ FaceStatus faceStatus = new FaceStatus();
+ try {
+ byte[] args = getArguments().getByteArray(EXTRA_FACE_INFORMATION);
+ faceStatus.wireDecode(new Blob(args).buf());
+ } catch (EncodingException e) {
+ G.Log("EXTRA_FACE_INFORMATION: EncodingException: " + e);
+ }
+
+ // Creating list of items to be displayed
+ m_listItems.add(new ListItem(R.string.face_id, String.valueOf(faceStatus.getFaceId())));
+ m_listItems.add(new ListItem(R.string.local_face_uri, faceStatus.getLocalUri()));
+ m_listItems.add(new ListItem(R.string.remote_face_uri, faceStatus.getUri()));
+ m_listItems.add(new ListItem(R.string.expires_in, faceStatus.getExpirationPeriod() < 0 ?
+ getString(R.string.expire_never) :
PeriodFormat.getDefault().print(new Period(faceStatus.getExpirationPeriod()))));
- m_listItems.add(new ListItem("Face scope", getScope(faceStatus.getFaceScope())));
- m_listItems.add(new ListItem("Face persistency", getPersistency(faceStatus.getFacePersistency())));
- m_listItems.add(new ListItem("Link type", getLinkType(faceStatus.getLinkType())));
- m_listItems.add(new ListItem("In interests", String.valueOf(faceStatus.getInInterests())));
- m_listItems.add(new ListItem("In data", String.valueOf(faceStatus.getInDatas())));
- m_listItems.add(new ListItem("Out interests", String.valueOf(faceStatus.getOutInterests())));
- m_listItems.add(new ListItem("Out data", String.valueOf(faceStatus.getOutDatas())));
- m_listItems.add(new ListItem("In bytes", String.valueOf(faceStatus.getInBytes())));
- m_listItems.add(new ListItem("Out bytes", String.valueOf(faceStatus.getOutBytes())));
+ m_listItems.add(new ListItem(R.string.face_scope, getScope(faceStatus.getFaceScope())));
+ m_listItems.add(new ListItem(R.string.face_persistency, getPersistency(
+ faceStatus.getFacePersistency())));
+ m_listItems.add(new ListItem(R.string.link_type, getLinkType(faceStatus.getLinkType())));
+ m_listItems.add(new ListItem(R.string.in_interests, String.valueOf(
+ faceStatus.getInInterests())));
+ m_listItems.add(new ListItem(R.string.in_data, String.valueOf(faceStatus.getInDatas())));
+ m_listItems.add(new ListItem(R.string.out_interests, String.valueOf(
+ faceStatus.getOutInterests())));
+ m_listItems.add(new ListItem(R.string.out_data, String.valueOf(faceStatus.getOutDatas())));
+ m_listItems.add(new ListItem(R.string.in_bytes, String.valueOf(faceStatus.getInBytes())));
+ m_listItems.add(new ListItem(R.string.out_bytes, String.valueOf(faceStatus.getOutBytes())));
- m_faceStatusAdapter = new FaceStatusAdapter(getActivity(), m_listItems);
+ m_faceStatusAdapter = new FaceStatusAdapter(getActivity(), m_listItems);
+ }
+ // setListAdapter must be called after addHeaderView. Otherwise, there is an exception on some platforms.
+ // http://stackoverflow.com/a/8141537/2150331
setListAdapter(m_faceStatusAdapter);
}
- @SuppressLint("InflateParams")
@Override
- public View onCreateView(LayoutInflater inflater,
- @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState)
+ public void onDestroyView()
{
- return inflater.inflate(R.layout.fragment_face_detail, null);
+ super.onDestroyView();
+ setListAdapter(null);
}
-
/////////////////////////////////////////////////////////////////////////
private String
@@ -149,7 +165,7 @@
* {@link net.named_data.nfd.FaceStatusFragment.FaceStatusAdapter}.
*/
private static class ListItem {
- public ListItem(String title, String value) {
+ public ListItem(int title, String value) {
m_title = title;
m_value = value;
}
@@ -162,15 +178,15 @@
m_value = value;
}
- public String getTitle() {
+ public int getTitle() {
return m_title;
}
- public void setTitle(String title) {
+ public void setTitle(int title) {
m_title = title;
}
- private String m_title;
+ private int m_title;
private String m_value;
}
diff --git a/app/src/main/java/net/named_data/nfd/LogcatSettingsFragment.java b/app/src/main/java/net/named_data/nfd/LogcatSettingsFragment.java
index 805a568..7368c3a 100644
--- a/app/src/main/java/net/named_data/nfd/LogcatSettingsFragment.java
+++ b/app/src/main/java/net/named_data/nfd/LogcatSettingsFragment.java
@@ -28,19 +28,17 @@
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.ListFragment;
-import android.view.ActionMode;
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.AbsListView;
import android.widget.ArrayAdapter;
-import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
@@ -56,79 +54,106 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- m_logcatSettingsManager = LogcatSettingsManager.get(getActivity());
- m_logcatSettingItems = m_logcatSettingsManager.getLogcatSettingItems();
-
- ArrayAdapter<LogcatSettingItem> adapter
- = new LogcatSettingsAdapter(getActivity(), m_logcatSettingItems);
-
- setListAdapter(adapter);
- setRetainInstance(true);
+ setHasOptionsMenu(true);
}
@Override
- public View onCreateView(LayoutInflater inflater,
- ViewGroup container,
- Bundle savedInstanceState) {
- @SuppressLint("InflateParams")
- View v = inflater.inflate(R.layout.fragment_logcat_tags_list, null);
+ public void onViewCreated(View view, Bundle savedInstanceState)
+ {
+ super.onViewCreated(view, savedInstanceState);
- // Set resetLogLevelButton listener
- Button resetLogLevelButton = (Button) v.findViewById(R.id.logcat_reset_loglevel_defaults);
- resetLogLevelButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
+ View v = getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_logcat_tags_list_header, null);
+ getListView().addHeaderView(v, null, false);
+ getListView().setDivider(getResources().getDrawable(R.drawable.list_item_divider));
+
+ // @TODO implement log item removal
+ // ListView listView = (ListView) v.findViewById(android.R.id.list);
+ // listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
+ // listView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
+ // @Override
+ // public void onItemCheckedStateChanged(ActionMode mode,
+ // int position,
+ // long id,
+ // boolean checked)
+ // {
+ // // Nothing to do here
+ // }
+ //
+ // @Override
+ // public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ // MenuInflater inflater = mode.getMenuInflater();
+ // inflater.inflate(R.menu.menu_logcat_settings_multiple_modal_menu, menu);
+ // return true;
+ // }
+ //
+ // @Override
+ // public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ // return false;
+ // }
+ //
+ // @Override
+ // public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+ // switch (item.getItemId()) {
+ // case R.id.menu_item_delete_setting_item:
+ // // TODO: Delete log item tag
+ // return true;
+ // default:
+ // return false;
+ // }
+ // }
+ //
+ // @Override
+ // public void onDestroyActionMode(ActionMode mode) {
+ // // Nothing to do here
+ // }
+ // });
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState)
+ {
+ super.onActivityCreated(savedInstanceState);
+
+ if (m_adapter == null) {
+ m_logcatSettingsManager = LogcatSettingsManager.get(getActivity());
+ m_logcatSettingItems = m_logcatSettingsManager.getLogcatSettingItems();
+
+ m_adapter = new LogcatSettingsAdapter(getActivity(), m_logcatSettingItems);
+ }
+ // setListAdapter must be called after addHeaderView. Otherwise, there is an exception on some platforms.
+ // http://stackoverflow.com/a/8141537/2150331
+ setListAdapter(m_adapter);
+ }
+
+ @Override
+ public void onDestroyView()
+ {
+ super.onDestroyView();
+ setListAdapter(null);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
+ {
+ super.onCreateOptionsMenu(menu, inflater);
+ inflater.inflate(R.menu.menu_logcat_settings, menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ switch (item.getItemId()) {
+ case R.id.action_log_settings:
FragmentManager fm = getActivity().getSupportFragmentManager();
ResetLogLevelDialog dialog
- = ResetLogLevelDialog.newInstance(getString(R.string.reset_log_level_dialog_title));
+ = ResetLogLevelDialog.newInstance(getString(R.string.reset_log_level_dialog_title));
dialog.setTargetFragment(LogcatSettingsFragment.this, REQUEST_CODE_DIALOG_RESET_ALL_LOG_LEVELS);
dialog.show(fm, DIALOG_RESET_ALL_LOG_LEVELS_TAG);
- }
- });
- // Register context listener
- ListView listView = (ListView) v.findViewById(android.R.id.list);
- listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
- listView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
- @Override
- public void onItemCheckedStateChanged(ActionMode mode,
- int position,
- long id,
- boolean checked)
- {
- // Nothing to do here
- }
-
- @Override
- public boolean onCreateActionMode(ActionMode mode, Menu menu) {
- MenuInflater inflater = mode.getMenuInflater();
- inflater.inflate(R.menu.menu_logcat_settings_multiple_modal_menu, menu);
return true;
- }
-
- @Override
- public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
- return false;
- }
-
- @Override
- public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
- switch (item.getItemId()) {
- case R.id.menu_item_delete_setting_item:
- // TODO: Delete log item tag
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void onDestroyActionMode(ActionMode mode) {
- // Nothing to do here
- }
- });
-
- return v;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
}
@Override
@@ -338,4 +363,6 @@
/** Unique tag that identifies dialog fragment in the fragment manager */
private static final String DIALOG_SET_LOG_LEVEL_TAG = "SetLogLevelDialog";
+
+ private ArrayAdapter<LogcatSettingItem> m_adapter;
}
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 aecc7f9..05b1e72 100644
--- a/app/src/main/java/net/named_data/nfd/MainActivity.java
+++ b/app/src/main/java/net/named_data/nfd/MainActivity.java
@@ -31,6 +31,8 @@
import com.intel.jndn.management.types.FaceStatus;
import com.intel.jndn.management.types.RibEntry;
+import net.named_data.nfd.utils.G;
+
import java.util.ArrayList;
/**
@@ -79,14 +81,13 @@
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- if (!m_drawerFragment.isDrawerOpen()) {
- // Inflate current Activity's menu only if the drawer is not
- // displayed; otherwise, allow the drawer to inflate its own
- // menu in the action bar. Inflate activity wide menu here.
+ G.Log("onCreateOptionsMenu" + String.valueOf(m_drawerFragment.shouldHideOptionsMenu()));
+ if (!m_drawerFragment.shouldHideOptionsMenu()) {
updateActionBar();
- return true;
+ return super.onCreateOptionsMenu(menu);
}
- return super.onCreateOptionsMenu(menu);
+ else
+ return true;
}
@Override
diff --git a/app/src/main/java/net/named_data/nfd/RouteCreateDialogFragment.java b/app/src/main/java/net/named_data/nfd/RouteCreateDialogFragment.java
index 6517b32..a6e0887 100644
--- a/app/src/main/java/net/named_data/nfd/RouteCreateDialogFragment.java
+++ b/app/src/main/java/net/named_data/nfd/RouteCreateDialogFragment.java
@@ -49,7 +49,7 @@
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
builder
- .setView(inflater.inflate(R.layout.create_route, null))
+ .setView(inflater.inflate(R.layout.dialog_create_route, null))
.setPositiveButton(R.string.route_add_dialog_create_route, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id)
diff --git a/app/src/main/java/net/named_data/nfd/RouteInfoFragment.java b/app/src/main/java/net/named_data/nfd/RouteInfoFragment.java
index bf22848..a1979c4 100644
--- a/app/src/main/java/net/named_data/nfd/RouteInfoFragment.java
+++ b/app/src/main/java/net/named_data/nfd/RouteInfoFragment.java
@@ -1,6 +1,5 @@
package net.named_data.nfd;
-import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;
@@ -12,6 +11,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
+import android.widget.HeaderViewListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@@ -25,8 +25,6 @@
import net.named_data.nfd.utils.G;
import net.named_data.nfd.utils.Nfdc;
-import org.w3c.dom.Text;
-
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -67,28 +65,40 @@
catch (EncodingException e) {
G.Log("ROUTE_INFORMATION: EncodingException: " + e);
}
-
- setListAdapter(new RouteFaceListAdapter(getActivity(), m_ribEntry));
- }
-
- @SuppressLint("InflateParams")
- @Override
- public View onCreateView(LayoutInflater inflater,
- @Nullable ViewGroup container,
- @Nullable Bundle savedInstanceState)
- {
- return inflater.inflate(R.layout.fragment_route_detail, null);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
- TextView prefix = (TextView)view.findViewById(R.id.route_detail_prefix);
+ View v = getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_route_detail_list_header, null);
+ getListView().addHeaderView(v, null, false);
+ getListView().setDivider(getResources().getDrawable(R.drawable.list_item_divider));
+
+ TextView prefix = (TextView)v.findViewById(R.id.route_detail_prefix);
prefix.setText(m_ribEntry.getName().toUri());
}
@Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState)
+ {
+ super.onActivityCreated(savedInstanceState);
+ if (m_routeFaceListAdapter == null) {
+ m_routeFaceListAdapter = new RouteFaceListAdapter(getActivity(), m_ribEntry);
+ }
+ // setListAdapter must be called after addHeaderView. Otherwise, there is an exception on some platforms.
+ // http://stackoverflow.com/a/8141537/2150331
+ setListAdapter(m_routeFaceListAdapter);
+ }
+
+ @Override
+ public void onDestroyView()
+ {
+ super.onDestroyView();
+ setListAdapter(null);
+ }
+
+ @Override
public void onResume()
{
super.onResume();
@@ -111,12 +121,12 @@
onListItemClick(ListView l, View v, int position, long id)
{
if (m_callbacks != null) {
- RouteFaceListAdapter adapter = (RouteFaceListAdapter)l.getAdapter();
- if (adapter.m_faces == null)
+ RouteFaceListAdapter ra = (RouteFaceListAdapter)((HeaderViewListAdapter)l.getAdapter()).getWrappedAdapter();
+ if (ra.m_faces == null)
return;
- Route route = adapter.getItem(position);
- FaceStatus faceStatus = adapter.m_faces.get(route.getFaceId());
+ Route route = (Route)l.getAdapter().getItem(position);
+ FaceStatus faceStatus = ra.m_faces.get(route.getFaceId());
m_callbacks.onFaceItemSelected(faceStatus);
}
}
@@ -276,4 +286,6 @@
/** Reference to the most recent AsyncTask that was created for listing faces */
private FaceListAsyncTask m_faceListAsyncTask;
+
+ private RouteFaceListAdapter m_routeFaceListAdapter;
}
diff --git a/app/src/main/java/net/named_data/nfd/RouteListFragment.java b/app/src/main/java/net/named_data/nfd/RouteListFragment.java
index f570545..e75fc3d 100644
--- a/app/src/main/java/net/named_data/nfd/RouteListFragment.java
+++ b/app/src/main/java/net/named_data/nfd/RouteListFragment.java
@@ -23,20 +23,22 @@
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
+import android.support.annotation.Nullable;
import android.support.v4.app.ListFragment;
import android.text.TextUtils;
import android.util.Pair;
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.BaseAdapter;
-import android.widget.Button;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
-import com.intel.jndn.management.types.FaceStatus;
import com.intel.jndn.management.types.RibEntry;
import com.intel.jndn.management.types.Route;
@@ -81,42 +83,56 @@
onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setListAdapter(new RouteListAdapter(getActivity()));
+ setHasOptionsMenu(true);
}
@Override
- public View
- onCreateView(LayoutInflater inflater,
- ViewGroup container,
- Bundle savedInstanceState)
+ public void onViewCreated(View view, Bundle savedInstanceState)
{
- View v = inflater.inflate(R.layout.fragment_route_list, null);
+ super.onViewCreated(view, savedInstanceState);
+ View v = getLayoutInflater(savedInstanceState).inflate(R.layout.fragment_route_list_list_header, null);
+ getListView().addHeaderView(v, null, false);
+ getListView().setDivider(getResources().getDrawable(R.drawable.list_item_divider));
+
m_routeListInfoUnavailableView = v.findViewById(R.id.route_list_info_unavailable);
// Get progress bar spinner view
- m_reloadingListProgressBar
- = (ProgressBar)v.findViewById(R.id.route_list_reloading_list_progress_bar);
+ m_reloadingListProgressBar = (ProgressBar)v.findViewById(R.id.route_list_reloading_list_progress_bar);
+ }
- Button refreshRouteListButton = (Button) v.findViewById(R.id.route_list_refresh_button);
- refreshRouteListButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState)
+ {
+ super.onActivityCreated(savedInstanceState);
+ if (m_routeListAdapter == null) {
+ m_routeListAdapter = new RouteListAdapter(getActivity());
+ }
+ // setListAdapter must be called after addHeaderView. Otherwise, there is an exception on some platforms.
+ // http://stackoverflow.com/a/8141537/2150331
+ setListAdapter(m_routeListAdapter);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
+ {
+ super.onCreateOptionsMenu(menu, inflater);
+ inflater.inflate(R.menu.menu_route_list, menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ switch (item.getItemId()) {
+ case R.id.route_list_refresh:
retrieveRouteList();
- }
- });
-
- Button addRouteButton = (Button)v.findViewById(R.id.route_list_add_button);
- addRouteButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view)
- {
+ return true;
+ case R.id.route_list_add:
RouteCreateDialogFragment dialog = RouteCreateDialogFragment.newInstance();
dialog.setTargetFragment(RouteListFragment.this, 0);
dialog.show(getFragmentManager(), "RouteCreateFragment");
- }
- });
-
- return v;
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
}
@Override
@@ -139,10 +155,17 @@
}
@Override
+ public void onDestroyView()
+ {
+ super.onDestroyView();
+ setListAdapter(null);
+ }
+
+ @Override
public void onListItemClick(ListView l, View v, int position, long id)
{
if (m_callbacks != null) {
- RibEntry ribEntry = ((RouteListAdapter)l.getAdapter()).getItem(position);
+ RibEntry ribEntry = (RibEntry)l.getAdapter().getItem(position);
m_callbacks.onRouteItemSelected(ribEntry);
}
}
@@ -409,4 +432,6 @@
/** Reference to the most recent AsyncTask that was created for creating a route */
private RouteCreateAsyncTask m_routeCreateAsyncTask;
+
+ private RouteListAdapter m_routeListAdapter;
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable-hdpi/ic_action_discard.png b/app/src/main/res/drawable-hdpi/ic_action_discard.png
new file mode 100644
index 0000000..703b31f
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_action_discard.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_action_edit.png b/app/src/main/res/drawable-hdpi/ic_action_edit.png
new file mode 100644
index 0000000..756db31
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_action_edit.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_action_new.png b/app/src/main/res/drawable-hdpi/ic_action_new.png
new file mode 100644
index 0000000..d866d61
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_action_new.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_action_refresh.png b/app/src/main/res/drawable-hdpi/ic_action_refresh.png
new file mode 100644
index 0000000..dae2790
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_action_refresh.png
Binary files differ
diff --git a/app/src/main/res/drawable-hdpi/ic_action_settings.png b/app/src/main/res/drawable-hdpi/ic_action_settings.png
new file mode 100644
index 0000000..54eecde
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/ic_action_settings.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_discard.png b/app/src/main/res/drawable-mdpi/ic_action_discard.png
new file mode 100644
index 0000000..248fb09
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_action_discard.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_edit.png b/app/src/main/res/drawable-mdpi/ic_action_edit.png
new file mode 100644
index 0000000..68a4532
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_action_edit.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_new.png b/app/src/main/res/drawable-mdpi/ic_action_new.png
new file mode 100644
index 0000000..f17e798
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_action_new.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_refresh.png b/app/src/main/res/drawable-mdpi/ic_action_refresh.png
new file mode 100644
index 0000000..94ab6f4
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_action_refresh.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/ic_action_settings.png b/app/src/main/res/drawable-mdpi/ic_action_settings.png
new file mode 100644
index 0000000..25c36db
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/ic_action_settings.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_discard.png b/app/src/main/res/drawable-xhdpi/ic_action_discard.png
new file mode 100644
index 0000000..9eeeed1
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_action_discard.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_edit.png b/app/src/main/res/drawable-xhdpi/ic_action_edit.png
new file mode 100644
index 0000000..67e056f
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_action_edit.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_new.png b/app/src/main/res/drawable-xhdpi/ic_action_new.png
new file mode 100644
index 0000000..dde2141
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_action_new.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_refresh.png b/app/src/main/res/drawable-xhdpi/ic_action_refresh.png
new file mode 100644
index 0000000..ab4ab9d
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_action_refresh.png
Binary files differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_action_settings.png b/app/src/main/res/drawable-xhdpi/ic_action_settings.png
new file mode 100644
index 0000000..425a8bc
--- /dev/null
+++ b/app/src/main/res/drawable-xhdpi/ic_action_settings.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_discard.png b/app/src/main/res/drawable-xxhdpi/ic_action_discard.png
new file mode 100644
index 0000000..cb1260a
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_action_discard.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_edit.png b/app/src/main/res/drawable-xxhdpi/ic_action_edit.png
new file mode 100644
index 0000000..3a241ea
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_action_edit.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_new.png b/app/src/main/res/drawable-xxhdpi/ic_action_new.png
new file mode 100644
index 0000000..c42c2bf
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_action_new.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_refresh.png b/app/src/main/res/drawable-xxhdpi/ic_action_refresh.png
new file mode 100644
index 0000000..44ee117
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_action_refresh.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_settings.png b/app/src/main/res/drawable-xxhdpi/ic_action_settings.png
new file mode 100644
index 0000000..fe5fec4
--- /dev/null
+++ b/app/src/main/res/drawable-xxhdpi/ic_action_settings.png
Binary files differ
diff --git a/app/src/main/res/drawable/item_background_activated.xml b/app/src/main/res/drawable/list_item_background_activated.xml
similarity index 100%
rename from app/src/main/res/drawable/item_background_activated.xml
rename to app/src/main/res/drawable/list_item_background_activated.xml
diff --git a/app/src/main/res/drawable/list_item_divider.xml b/app/src/main/res/drawable/list_item_divider.xml
new file mode 100644
index 0000000..f41aabe
--- /dev/null
+++ b/app/src/main/res/drawable/list_item_divider.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+ android:insetLeft="@dimen/default_padding_left"
+ android:insetRight="@dimen/default_padding_right" >
+
+ <shape>
+ <solid android:color="@color/android_color_gray" />
+ <size android:height="1dp" />
+ </shape>
+
+</inset>
\ No newline at end of file
diff --git a/app/src/main/res/layout/create_face.xml b/app/src/main/res/layout/dialog_create_face.xml
similarity index 100%
rename from app/src/main/res/layout/create_face.xml
rename to app/src/main/res/layout/dialog_create_face.xml
diff --git a/app/src/main/res/layout/create_route.xml b/app/src/main/res/layout/dialog_create_route.xml
similarity index 100%
rename from app/src/main/res/layout/create_route.xml
rename to app/src/main/res/layout/dialog_create_route.xml
diff --git a/app/src/main/res/layout/fragment_face_detail.xml b/app/src/main/res/layout/fragment_face_detail_list_header.xml
similarity index 81%
rename from app/src/main/res/layout/fragment_face_detail.xml
rename to app/src/main/res/layout/fragment_face_detail_list_header.xml
index c251036..227891f 100644
--- a/app/src/main/res/layout/fragment_face_detail.xml
+++ b/app/src/main/res/layout/fragment_face_detail_list_header.xml
@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
style="@style/default_linear_layout_padding"
>
@@ -14,8 +14,4 @@
style="?android:listSeparatorTextViewStyle"
/>
- <include
- layout="@android:layout/list_content"
- />
-
</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_face_list.xml b/app/src/main/res/layout/fragment_face_list_list_header.xml
similarity index 64%
rename from app/src/main/res/layout/fragment_face_list.xml
rename to app/src/main/res/layout/fragment_face_list_list_header.xml
index f7c2388..d44726c 100644
--- a/app/src/main/res/layout/fragment_face_list.xml
+++ b/app/src/main/res/layout/fragment_face_list_list_header.xml
@@ -3,35 +3,13 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
style="@style/default_linear_layout_padding"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/face_list_actions_title"
- style="?android:listSeparatorTextViewStyle"
- />
-
- <Button
- android:id="@+id/face_list_refresh_button"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/face_list_refresh_face_list"
- style="@style/default_custom_white_button"
- />
- <Button
- android:id="@+id/face_list_add_button"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/face_list_add_face"
- style="@style/default_custom_white_button"
- />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
android:text="@string/face_list_list_of_faces_title"
style="?android:listSeparatorTextViewStyle"
/>
@@ -71,10 +49,6 @@
</LinearLayout>
- <include
- layout="@android:layout/list_content"
- />
-
</FrameLayout>
</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_logcat_tags_list.xml b/app/src/main/res/layout/fragment_logcat_tags_list.xml
deleted file mode 100644
index 2688e0d..0000000
--- a/app/src/main/res/layout/fragment_logcat_tags_list.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- style="@style/default_linear_layout_padding"
- >
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/fragment_logcat_general_operations_category"
- style="?android:listSeparatorTextViewStyle"
- />
-
- <Button
- android:id="@+id/logcat_reset_loglevel_defaults"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/logcat_reset_log_level_defaults"
- style="@style/default_custom_white_button"
- />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/fragment_logcat_tags_n_log_levels"
- style="?android:listSeparatorTextViewStyle"
- />
-
- <include
- layout="@android:layout/list_content"
- />
-
-</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_face_detail.xml b/app/src/main/res/layout/fragment_logcat_tags_list_header.xml
similarity index 71%
copy from app/src/main/res/layout/fragment_face_detail.xml
copy to app/src/main/res/layout/fragment_logcat_tags_list_header.xml
index c251036..9e81844 100644
--- a/app/src/main/res/layout/fragment_face_detail.xml
+++ b/app/src/main/res/layout/fragment_logcat_tags_list_header.xml
@@ -3,19 +3,15 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
style="@style/default_linear_layout_padding"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/fragment_face_details_title"
+ android:text="@string/fragment_logcat_tags_n_log_levels"
style="?android:listSeparatorTextViewStyle"
/>
- <include
- layout="@android:layout/list_content"
- />
-
</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_route_detail.xml b/app/src/main/res/layout/fragment_route_detail_list_header.xml
similarity index 74%
rename from app/src/main/res/layout/fragment_route_detail.xml
rename to app/src/main/res/layout/fragment_route_detail_list_header.xml
index 048b2c5..539e84a 100644
--- a/app/src/main/res/layout/fragment_route_detail.xml
+++ b/app/src/main/res/layout/fragment_route_detail_list_header.xml
@@ -3,22 +3,24 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
style="@style/default_linear_layout_padding"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/fragment_route_details_title"
+ android:text="@string/fragment_route_route_name_title"
style="?android:listSeparatorTextViewStyle"
/>
- <TextView style="@style/default_custom_white_button"
+ <TextView
+ android:id="@+id/route_detail_prefix"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
- android:id="@+id/route_detail_prefix"/>
+ style="@style/default_custom_white_button"
+ />
<TextView
android:layout_width="match_parent"
@@ -27,8 +29,4 @@
style="?android:listSeparatorTextViewStyle"
/>
- <include
- layout="@android:layout/list_content"
- />
-
</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_route_list.xml b/app/src/main/res/layout/fragment_route_list_list_header.xml
similarity index 64%
rename from app/src/main/res/layout/fragment_route_list.xml
rename to app/src/main/res/layout/fragment_route_list_list_header.xml
index b1d481b..361cfa2 100644
--- a/app/src/main/res/layout/fragment_route_list.xml
+++ b/app/src/main/res/layout/fragment_route_list_list_header.xml
@@ -3,35 +3,13 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
style="@style/default_linear_layout_padding"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/route_list_actions_title"
- style="?android:listSeparatorTextViewStyle"
- />
-
- <Button
- android:id="@+id/route_list_refresh_button"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/route_list_refresh_route_list"
- style="@style/default_custom_white_button"
- />
- <Button
- android:id="@+id/route_list_add_button"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/route_list_add_route"
- style="@style/default_custom_white_button"
- />
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
android:text="@string/route_list_list_of_routes_title"
style="?android:listSeparatorTextViewStyle"
/>
@@ -71,10 +49,6 @@
</LinearLayout>
- <include
- layout="@android:layout/list_content"
- />
-
</FrameLayout>
</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_item_face_generic_item.xml b/app/src/main/res/layout/list_item_face_generic_item.xml
index 7683c68..c4d0737 100644
--- a/app/src/main/res/layout/list_item_face_generic_item.xml
+++ b/app/src/main/res/layout/list_item_face_generic_item.xml
@@ -4,6 +4,7 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ style="@style/default_linear_layout_padding"
>
<TextView
diff --git a/app/src/main/res/layout/list_item_face_status_item.xml b/app/src/main/res/layout/list_item_face_status_item.xml
index 0b6a1d0..f6c6440 100644
--- a/app/src/main/res/layout/list_item_face_status_item.xml
+++ b/app/src/main/res/layout/list_item_face_status_item.xml
@@ -4,7 +4,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/item_background_activated"
+ android:background="@drawable/list_item_background_activated"
+ style="@style/default_linear_layout_padding"
>
<TextView
diff --git a/app/src/main/res/layout/list_item_route_info_item.xml b/app/src/main/res/layout/list_item_route_info_item.xml
index 8c2057a..80185a4 100644
--- a/app/src/main/res/layout/list_item_route_info_item.xml
+++ b/app/src/main/res/layout/list_item_route_info_item.xml
@@ -4,7 +4,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/item_background_activated"
+ android:background="@drawable/list_item_background_activated"
+ style="@style/default_linear_layout_padding"
>
<TextView
diff --git a/app/src/main/res/layout/list_item_route_item.xml b/app/src/main/res/layout/list_item_route_item.xml
index baa6da0..af14e24 100644
--- a/app/src/main/res/layout/list_item_route_item.xml
+++ b/app/src/main/res/layout/list_item_route_item.xml
@@ -4,7 +4,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/item_background_activated"
+ android:background="@drawable/list_item_background_activated"
+ style="@style/default_linear_layout_padding"
>
<TextView
diff --git a/app/src/main/res/layout/list_item_setting_item.xml b/app/src/main/res/layout/list_item_setting_item.xml
index 4d8498b..2945775 100644
--- a/app/src/main/res/layout/list_item_setting_item.xml
+++ b/app/src/main/res/layout/list_item_setting_item.xml
@@ -4,7 +4,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/item_background_activated"
+ android:background="@drawable/list_item_background_activated"
+ style="@style/default_linear_layout_padding"
>
<TextView
diff --git a/app/src/main/res/layout/status_item.xml b/app/src/main/res/layout/status_item.xml
deleted file mode 100644
index 549de06..0000000
--- a/app/src/main/res/layout/status_item.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/main_fragment_linear_layout">
- <TextView style="@style/main_fragment_list_title"
- android:id="@+id/title" />
-
- <TextView style="@style/main_fragment_list_value"
- android:id="@+id/value" />
-</LinearLayout>
diff --git a/app/src/main/res/menu/menu_face_list.xml b/app/src/main/res/menu/menu_face_list.xml
new file mode 100644
index 0000000..963dee0
--- /dev/null
+++ b/app/src/main/res/menu/menu_face_list.xml
@@ -0,0 +1,20 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <item
+ android:id="@+id/face_list_refresh"
+ android:icon="@drawable/ic_action_refresh"
+ android:title="@string/face_list_refresh_face_list"
+ android:orderInCategory="100"
+ app:showAsAction="always"
+ />
+
+ <item
+ android:id="@+id/face_list_add"
+ android:icon="@drawable/ic_action_new"
+ android:title="@string/face_list_add_face"
+ android:orderInCategory="100"
+ app:showAsAction="always"
+ />
+
+</menu>
diff --git a/app/src/main/res/menu/menu_face_list_multiple_modal_menu.xml b/app/src/main/res/menu/menu_face_list_multiple_modal_menu.xml
index 1664611..a6b91be 100644
--- a/app/src/main/res/menu/menu_face_list_multiple_modal_menu.xml
+++ b/app/src/main/res/menu/menu_face_list_multiple_modal_menu.xml
@@ -4,9 +4,9 @@
<item
android:id="@+id/menu_item_delete_face_item"
- android:icon="@android:drawable/ic_menu_delete"
+ android:icon="@drawable/ic_action_discard"
android:title="@string/menu_item_delete_face_item"
- app:showAsAction="ifRoom|withText"
+ app:showAsAction="always"
/>
</menu>
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_log.xml b/app/src/main/res/menu/menu_log.xml
index a530929..2f7c0a3 100644
--- a/app/src/main/res/menu/menu_log.xml
+++ b/app/src/main/res/menu/menu_log.xml
@@ -1,13 +1,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools"
- tools:context=".NfdLogActivity">
+ xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_log_settings"
+ android:icon="@drawable/ic_action_settings"
android:title="@string/log_settings"
android:orderInCategory="100"
- app:showAsAction="never"
+ app:showAsAction="always"
/>
</menu>
diff --git a/app/src/main/res/menu/menu_logcat_settings.xml b/app/src/main/res/menu/menu_logcat_settings.xml
new file mode 100644
index 0000000..86679ea
--- /dev/null
+++ b/app/src/main/res/menu/menu_logcat_settings.xml
@@ -0,0 +1,12 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <item
+ android:id="@+id/action_log_settings"
+ android:icon="@drawable/ic_action_edit"
+ android:title="@string/logcat_reset_log_level_defaults"
+ android:orderInCategory="100"
+ app:showAsAction="always"
+ />
+
+</menu>
diff --git a/app/src/main/res/menu/menu_logcat_settings_multiple_modal_menu.xml b/app/src/main/res/menu/menu_logcat_settings_multiple_modal_menu.xml
index 2bbf336..11aa3d1 100644
--- a/app/src/main/res/menu/menu_logcat_settings_multiple_modal_menu.xml
+++ b/app/src/main/res/menu/menu_logcat_settings_multiple_modal_menu.xml
@@ -4,9 +4,9 @@
<item
android:id="@+id/menu_item_delete_setting_item"
- android:icon="@android:drawable/ic_menu_delete"
+ android:icon="@drawable/ic_action_discard"
android:title="@string/menu_item_delete_setting_item"
- app:showAsAction="ifRoom|withText"
+ app:showAsAction="always"
/>
</menu>
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_route_list.xml b/app/src/main/res/menu/menu_route_list.xml
new file mode 100644
index 0000000..4ab170a
--- /dev/null
+++ b/app/src/main/res/menu/menu_route_list.xml
@@ -0,0 +1,20 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+
+ <item
+ android:id="@+id/route_list_refresh"
+ android:icon="@drawable/ic_action_refresh"
+ android:title="@string/route_list_refresh_route_list"
+ android:orderInCategory="100"
+ app:showAsAction="always"
+ />
+
+ <item
+ android:id="@+id/route_list_add"
+ android:icon="@drawable/ic_action_new"
+ android:title="@string/route_list_add_route"
+ android:orderInCategory="100"
+ app:showAsAction="always"
+ />
+
+</menu>
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 92b2b4b..0c82fa3 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -2,4 +2,5 @@
<resources>
<item name="ndn_color_fire_bush" type="color">#DB9710</item>
<item name="ndn_color_grenadier" type="color">#C04818</item>
+ <item name="android_color_gray" type="color">#C6C6C6</item>
</resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 87899fe..9f65d2d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -35,6 +35,19 @@
<string name="fragment_face_details_title">Face Details</string>
<string name="menu_item_delete_face_item">Delete</string>
<string name="expire_never">Never</string>
+ <string name="face_id">Face ID</string>
+ <string name="local_face_uri">Local FaceURI</string>
+ <string name="remote_face_uri">Remote FaceURI</string>
+ <string name="expires_in">Expires in</string>
+ <string name="face_scope">Face scope</string>
+ <string name="face_persistency">Face persistency</string>
+ <string name="link_type">Link type</string>
+ <string name="in_interests">In interests</string>
+ <string name="out_interests">Out interests</string>
+ <string name="in_data">In data</string>
+ <string name="out_data">Out data</string>
+ <string name="in_bytes">In bytes</string>
+ <string name="out_bytes">Out bytes</string>
<string-array name="face_scopes">
<item>Local</item>
@@ -56,4 +69,5 @@
<string name="route_add_dialog_create_route">Create route</string>
<string name="fragment_route_details_title">Route Details</string>
<string name="fragment_route_details_next_hops">List of next hops</string>
+ <string name="fragment_route_route_name_title">Route Name</string>
</resources>
diff --git a/app/src/main/res/values/strings_main_activity.xml b/app/src/main/res/values/strings_main_activity.xml
index 8b67095..490efd9 100644
--- a/app/src/main/res/values/strings_main_activity.xml
+++ b/app/src/main/res/values/strings_main_activity.xml
@@ -10,10 +10,6 @@
<string name="pit_entries">PIT Entries</string>
<string name="measurement_entries">Measurement entries</string>
<string name="cs_entries">CS entries</string>
- <string name="in_interests">In interests</string>
- <string name="out_interests">Out interests</string>
- <string name="in_data">In data</string>
- <string name="out_data">Out data</string>
<string-array name="pref_sync_face_titles">
<item>localhost</item>