From 0f7ae23da4154c6c8a4a74883d2bb4da994f98c1 Mon Sep 17 00:00:00 2001 From: OliE Date: Mon, 1 Jan 2018 15:20:56 +0100 Subject: [PATCH] added drawer header --- .../health/openscale/gui/MainActivity.java | 15 +++++++----- .../drawable-hdpi/ic_preferences_settings.png | Bin 0 -> 593 bytes .../drawable-ldpi/ic_preferences_settings.png | Bin 0 -> 310 bytes .../drawable-mdpi/ic_preferences_settings.png | Bin 0 -> 409 bytes .../ic_preferences_settings.png | Bin 0 -> 815 bytes .../ic_preferences_settings.png | Bin 0 -> 1385 bytes .../ic_preferences_settings.png | Bin 0 -> 1920 bytes .../app/src/main/res/layout/activity_main.xml | 1 + .../app/src/main/res/layout/drawer_header.xml | 23 ++++++++++++++++++ .../app/src/main/res/menu/action_menu.xml | 6 ----- .../app/src/main/res/menu/drawer_view.xml | 13 ++++++++-- 11 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 android_app/app/src/main/res/drawable-hdpi/ic_preferences_settings.png create mode 100644 android_app/app/src/main/res/drawable-ldpi/ic_preferences_settings.png create mode 100644 android_app/app/src/main/res/drawable-mdpi/ic_preferences_settings.png create mode 100644 android_app/app/src/main/res/drawable-xhdpi/ic_preferences_settings.png create mode 100644 android_app/app/src/main/res/drawable-xxhdpi/ic_preferences_settings.png create mode 100644 android_app/app/src/main/res/drawable-xxxhdpi/ic_preferences_settings.png create mode 100644 android_app/app/src/main/res/layout/drawer_header.xml 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 0000000000000000000000000000000000000000..784025d11fb511cd9eeb5c52deb08de2e95922fd GIT binary patch literal 593 zcmV-X03;u!!@q02{*ALnePnQU*QybbYde-6X3U z;TRTIIj{6<_cb zyYK-UV!;D^PmEu{XW4~!i*pu)p z7FxMh(Gk%W{Av{iT*Hq00000NkvXXu0mjf%6}5B literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..57e4889cb71d258dd84653795d1a34106edbff37 GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kwj^(N7l!{JxM1({$v~0Uo-U3d z8WU45*?KuUO0+&yH}5om#K+<&{(z}PU~7r6m|0j@)J<-|EgLs)C}kEiOHz(_A;-h< zP9f=0yp9dC_}>Qx#_4J2c;5S*{x6lF`?vazsd{u~_=aY^dj&%O89x6w!s?d#*ifs) zXr1!MTM}718LE5RYxg9#StL*$7(Kq$MDBGF4Gp3?XkLEr8DILbG+l7 z+={sZvqk6pvAdJ^Yw`k-Bdo_P-BO)5v)%A|wADWTG5ef2Ba;hijP=GxCQhFHx=44)Z;e__<<4BCVVYMgDc=yc<%5ST@ReP&N%&Wxp13kzEmrI*@oMRC$a1?P4(VOV{ za3K3|#}Q!>XSZ(~h$!<>58@PU!SA6dOlz1x39GjewlN&_3YPIML?wK{QkcoEc{`2r z>_MuRjc2#VN4ZBf_GP2Y6Mv?%E4hamyo$Oci&=pitUpGJkt=-#00000NkvXXu0mjf DxDT&C literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..7fef9f53cff7a6c66f1d0968176d9fe73f0fd987 GIT binary patch literal 815 zcmV+~1JL}5P)YD z9~JRdhG<09?~-_J{{)GI@FtD$T0g3^+EUe0Z3iJFbv>+glWX5|&pmfY?l;*l>-Roq zt?%BO;W2}KIE!|!v-ljB4;$>9B@}Q!j$;;Ua?RqW)D4AmYjoqeektTDa0CYm`C&{~ z#F@mOxf){~zQ^BKzy!A7)0FL~@Y#{Ny?8Wz7E*Q;*ELPP9w+eVC{ZCh?*mtBE4kBlx0B zdQ}G4EgIyqLjSbj`7wNe4{=dN@yoF%ix|tzJXzSR%pAKj=bBa;9v6*uLa#`I%ED$_+RaMpZVT$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*ul)ZUf+>aX(tw( z{el}Qf}2JTVGFV*w literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..42d5e3a20e84789ba8e350d8aa7a2990c7517f1a GIT binary patch literal 1920 zcmV-`2Y>j9P)6v-&Wf%X+WZuqJS69_^S65Z{KzYy!co^6Rv;z5%s});OP)q z-UliZYZ(H+@@s(6z;^4|Zp6FWN;e=*tvW%U)xa!ZJzis+Q+?^bw*j@lT1sRDzw)av zzN5PmztDvE4`wv^ZCj;!yefrTV{+peev9#nm8 z#VD_l1y)<~zDEipxG1mD9T<|dqXZZNbPM@k(TuPXH|5(S{6<(2m%$*+Qn!YVrMyNK z;}~;DMCyzw80%eHY{|-qu^2tB2_gtfhWY|6h#&Y2xDjzYX^{o4K$g(qKxg&*A0!Rl zqpn;L`sx9E3|x%_O9POk%o&ehthYlkOp5D}nBW-RWi06W9ax83)EI^y$cxiFgQ8U@ zJZUlc3Q14nV3JP|JE}Vje5W&$rGLDnu{r~3U8;w$VL zKyTn3i(eCPfrA{~fJ3Uy8xHh=xCApV7dX&&!6Yd;WbWxzrV<$iM~HTUhk&`55t9X; zz>LH%a0|B|!1$Zt4)g_h3^Vs#3LkbNvev zC9>;{@db+`XaliNHD2vNJIfO873=x6NO4n-inoyJO&G=iZ)4u}abTMDf7{5@9priq zW6Vfo5HCLrxZdi>rI5J`GkkTDG76*oNhFwZ#ZAB|j1hD++5aF^BJln5SOkg}a$uVcuRssO3C zg*l{890c8b67;drn%u~-gV+tb;4m>s!uHQm{pVS{)fXRsE^))zx zd1u5)=7Hzbvr5eR{jP(6QTR~tI*Q31UcgMPija01gYoJ#8TeGS-wVd!%t;{JB#bq+ zv$Fk1Z33QtOtkpv{J^dpUzLF89Mv|L#jMr&1dJ}X+U``pXRCWN@MQv?e(XY=tIhlK z02$&y>zYYh=oqT*$AG`oZyj{(B$-kDu#G!H-OplD+oApjagf#kIz>KYJsS}4EG=5p zePF;dmmn<^X$=rmP)ReTiY0?H(i-5Dy4&@(ptqG4npaD}vy*8Ur!~Lm>kWsuqEn7&vp^y5#KMnINmPbs`zR7BQS>I(&gp+EBPb(Y9dX^-_kyRY(mn zk7RpMhzx~`nGDUfgtU{Pu?~XzF`nRLXr9$yV6ESRQ!=EHK^#jTydiF!bodCt>F{ab zRtG*Bw_%j`r^81{mJUzC=;wqc)o{H7Z7t?d#3sz@Vi!d8l$uI-Rd^cWi!{Am5b1>R z2Y(|QEK$&zYNG>f0pga#mSY5uDv2GWuq4*(qiL%o_Kbr(c1i3}2l@iUEs9oCzM`nh zIiS=9~ia)?plJtV2>@QqDXb|Cn5T5+;?%aZ?u~wC978sgBH65p9I_d{nk*=Y_+JaNZx5 z)(AQ-UrYNwE?@KyC)(Qw6U#zmDT(qLL7&V7MOo$gWM)35 \ 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