diff --git a/android_app/app/src/main/java/com/health/openscale/gui/MainActivity.java b/android_app/app/src/main/java/com/health/openscale/gui/MainActivity.java index e735d147..3559a744 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/MainActivity.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/MainActivity.java @@ -57,13 +57,13 @@ public class MainActivity extends AppCompatActivity { private static boolean firstAppStart = true; private static int bluetoothStatusIcon = R.drawable.ic_bluetooth_disabled; private static MenuItem bluetoothStatus; + private static CharSequence fragmentTitle; private DrawerLayout drawerLayout; private Toolbar toolbar; private NavigationView navDrawer; private ActionBarDrawerToggle drawerToggle; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -104,8 +104,11 @@ public class MainActivity extends AppCompatActivity { // Initial first fragment if(savedInstanceState == null) { getSupportFragmentManager().beginTransaction().replace(R.id.fragment_content,new OverviewFragment()).commit(); + fragmentTitle = getString(R.string.title_overview); } + setTitle(fragmentTitle); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (prefs.getBoolean("firstStart", true)) { @@ -149,6 +152,9 @@ public class MainActivity extends AppCompatActivity { case R.id.nav_statistic: fragmentClass = StatisticsFragment.class; break; + case R.id.nav_settings: + startActivityForResult(new Intent(this, SettingsActivity.class), 1); + return; default: fragmentClass = OverviewFragment.class; } @@ -168,7 +174,8 @@ public class MainActivity extends AppCompatActivity { menuItem.setChecked(true); // Set action bar title - //setTitle(menuItem.getTitle()); + setTitle(menuItem.getTitle()); + fragmentTitle = menuItem.getTitle(); // Close the navigation drawer drawerLayout.closeDrawers(); @@ -185,10 +192,6 @@ public class MainActivity extends AppCompatActivity { case android.R.id.home: drawerLayout.openDrawer(GravityCompat.START); return true; - case R.id.action_general_settings: - Intent intent = new Intent(this, SettingsActivity.class); - startActivityForResult(intent, 1); - return true; case R.id.action_bluetooth_status: invokeSearchBluetoothDevice(); return true; diff --git a/android_app/app/src/main/res/drawable-hdpi/ic_preferences_settings.png b/android_app/app/src/main/res/drawable-hdpi/ic_preferences_settings.png new file mode 100644 index 00000000..784025d1 Binary files /dev/null and b/android_app/app/src/main/res/drawable-hdpi/ic_preferences_settings.png differ diff --git a/android_app/app/src/main/res/drawable-ldpi/ic_preferences_settings.png b/android_app/app/src/main/res/drawable-ldpi/ic_preferences_settings.png new file mode 100644 index 00000000..57e4889c Binary files /dev/null and b/android_app/app/src/main/res/drawable-ldpi/ic_preferences_settings.png differ diff --git a/android_app/app/src/main/res/drawable-mdpi/ic_preferences_settings.png b/android_app/app/src/main/res/drawable-mdpi/ic_preferences_settings.png new file mode 100644 index 00000000..0ba16f88 Binary files /dev/null and b/android_app/app/src/main/res/drawable-mdpi/ic_preferences_settings.png differ diff --git a/android_app/app/src/main/res/drawable-xhdpi/ic_preferences_settings.png b/android_app/app/src/main/res/drawable-xhdpi/ic_preferences_settings.png new file mode 100644 index 00000000..7fef9f53 Binary files /dev/null and b/android_app/app/src/main/res/drawable-xhdpi/ic_preferences_settings.png differ diff --git a/android_app/app/src/main/res/drawable-xxhdpi/ic_preferences_settings.png b/android_app/app/src/main/res/drawable-xxhdpi/ic_preferences_settings.png new file mode 100644 index 00000000..951fa7cb Binary files /dev/null and b/android_app/app/src/main/res/drawable-xxhdpi/ic_preferences_settings.png differ diff --git a/android_app/app/src/main/res/drawable-xxxhdpi/ic_preferences_settings.png b/android_app/app/src/main/res/drawable-xxxhdpi/ic_preferences_settings.png new file mode 100644 index 00000000..42d5e3a2 Binary files /dev/null and b/android_app/app/src/main/res/drawable-xxxhdpi/ic_preferences_settings.png differ diff --git a/android_app/app/src/main/res/layout/activity_main.xml b/android_app/app/src/main/res/layout/activity_main.xml index ee7381f6..5404c9af 100644 --- a/android_app/app/src/main/res/layout/activity_main.xml +++ b/android_app/app/src/main/res/layout/activity_main.xml @@ -39,6 +39,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" + app:headerLayout="@layout/drawer_header" app:menu="@menu/drawer_view" /> \ No newline at end of file diff --git a/android_app/app/src/main/res/layout/drawer_header.xml b/android_app/app/src/main/res/layout/drawer_header.xml new file mode 100644 index 00000000..df2a6016 --- /dev/null +++ b/android_app/app/src/main/res/layout/drawer_header.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/android_app/app/src/main/res/menu/action_menu.xml b/android_app/app/src/main/res/menu/action_menu.xml index 44cc8cb2..c3bdd814 100644 --- a/android_app/app/src/main/res/menu/action_menu.xml +++ b/android_app/app/src/main/res/menu/action_menu.xml @@ -8,10 +8,4 @@ android:icon="@drawable/ic_bluetooth_disabled" android:title="@string/action_bluetooth_status" app:showAsAction="ifRoom"/> - - diff --git a/android_app/app/src/main/res/menu/drawer_view.xml b/android_app/app/src/main/res/menu/drawer_view.xml index 47d78e08..d204da48 100644 --- a/android_app/app/src/main/res/menu/drawer_view.xml +++ b/android_app/app/src/main/res/menu/drawer_view.xml @@ -1,6 +1,7 @@ - + - \ No newline at end of file + + + + + \ No newline at end of file