diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java | 41 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java | 16 | ||||
-rw-r--r-- | app/src/main/res/drawable/ic_menu_color_point.png | bin | 0 -> 2454 bytes | |||
-rw-r--r-- | app/src/main/res/drawable/ic_menu_default.png | bin | 0 -> 2454 bytes |
4 files changed, 51 insertions, 6 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index e7a5e460..f9adede7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -24,6 +24,7 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; +import android.os.Handler; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; @@ -103,6 +104,7 @@ public class NavigationDrawerFragment extends Fragment { private View mFragmentContainerView; private ArrayAdapter<String> accountListAdapter; private DrawerSettingsAdapter settingsListAdapter; + private Toolbar mToolbar; private boolean mFromSavedInstanceState; private boolean mUserLearnedDrawer; @@ -157,7 +159,14 @@ public class NavigationDrawerFragment extends Fragment { */ public void setUp(int fragmentId, DrawerLayout drawerLayout) { AppCompatActivity activity = (AppCompatActivity) getActivity(); - ActionBar actionBar = activity.getSupportActionBar(); + mDrawerLayout = drawerLayout; + + mToolbar = mDrawerLayout.findViewById(R.id.toolbar); + activity.setSupportActionBar(mToolbar); + + final ActionBar actionBar = activity.getSupportActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setHomeButtonEnabled(true); mDrawerSettingsListView = mDrawerView.findViewById(R.id.settingsList); mDrawerSettingsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @@ -186,7 +195,6 @@ public class NavigationDrawerFragment extends Fragment { settingsListAdapter.addItem(getSimpleTextInstance(getString(about_fragment_title), ABOUT)); mDrawerSettingsListView.setAdapter(settingsListAdapter); - mDrawerAccountsListView = mDrawerView.findViewById(R.id.accountList); mDrawerAccountsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override @@ -204,13 +212,10 @@ public class NavigationDrawerFragment extends Fragment { mDrawerAccountsListView.setAdapter(accountListAdapter); mFragmentContainerView = activity.findViewById(fragmentId); - mDrawerLayout = drawerLayout; // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); - actionBar.setDisplayHomeAsUpEnabled(true); - actionBar.setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the navigation drawer and the action bar app icon. mDrawerToggle = new ActionBarDrawerToggle( @@ -242,16 +247,40 @@ public class NavigationDrawerFragment extends Fragment { // the navigation drawer automatically in the future. mUserLearnedDrawer = true; preferences.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); + mToolbar.setNavigationIcon(R.drawable.ic_menu_default); } getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu() } }; + Handler navigationDrawerHandler = new Handler(); // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, // per the navigation drawer design guidelines. if (!mUserLearnedDrawer && !mFromSavedInstanceState) { - mDrawerLayout.openDrawer(mFragmentContainerView); + mDrawerLayout.openDrawer(mFragmentContainerView, false); + navigationDrawerHandler.postDelayed(new Runnable() { + @Override + public void run() { + mDrawerLayout.closeDrawer(mFragmentContainerView, true); + } + }, 1500); + navigationDrawerHandler.postDelayed(new Runnable() { + @Override + public void run() { + mToolbar.setNavigationIcon(R.drawable.ic_menu_color_point); + mToolbar.playSoundEffect(android.view.SoundEffectConstants.CLICK); + } + }, 3000); + + } else if (!mUserLearnedDrawer) { + navigationDrawerHandler.postDelayed(new Runnable() { + @Override + public void run() { + mToolbar.setNavigationIcon(R.drawable.ic_menu_color_point); + mToolbar.playSoundEffect(android.view.SoundEffectConstants.CLICK); + } + }, 1500); } // Defer code dependent on restoration of previous instance state. diff --git a/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java b/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java index 2efd83d6..86761642 100644 --- a/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java +++ b/app/src/main/java/se/leap/bitmaskclient/views/VpnStateImage.java @@ -1,3 +1,19 @@ +/** + * Copyright (c) 2018 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ package se.leap.bitmaskclient.views; import android.content.Context; diff --git a/app/src/main/res/drawable/ic_menu_color_point.png b/app/src/main/res/drawable/ic_menu_color_point.png Binary files differnew file mode 100644 index 00000000..ef4b0e51 --- /dev/null +++ b/app/src/main/res/drawable/ic_menu_color_point.png diff --git a/app/src/main/res/drawable/ic_menu_default.png b/app/src/main/res/drawable/ic_menu_default.png Binary files differnew file mode 100644 index 00000000..e0d29163 --- /dev/null +++ b/app/src/main/res/drawable/ic_menu_default.png |