From ea3303d802592a65ae71ed1cec0f0862112a18b4 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Fri, 23 Feb 2018 20:47:09 +0100 Subject: [PATCH 1/2] Move import/export/share to toolbar menu --- .../health/openscale/gui/MainActivity.java | 129 ++++++++++++- .../gui/fragments/TableFragment.java | 169 ------------------ .../src/main/res/drawable-hdpi/ic_share.png | Bin 261 -> 0 bytes .../src/main/res/drawable-ldpi/ic_share.png | Bin 215 -> 0 bytes .../src/main/res/drawable-mdpi/ic_share.png | Bin 189 -> 0 bytes .../src/main/res/drawable-xhdpi/ic_share.png | Bin 301 -> 0 bytes .../src/main/res/drawable-xxhdpi/ic_share.png | Bin 393 -> 0 bytes .../main/res/drawable-xxxhdpi/ic_share.png | Bin 478 -> 0 bytes .../src/main/res/layout/fragment_table.xml | 7 - .../app/src/main/res/menu/action_menu.xml | 15 ++ .../app/src/main/res/menu/table_menu.xml | 16 -- 11 files changed, 141 insertions(+), 195 deletions(-) delete mode 100644 android_app/app/src/main/res/drawable-hdpi/ic_share.png delete mode 100644 android_app/app/src/main/res/drawable-ldpi/ic_share.png delete mode 100644 android_app/app/src/main/res/drawable-mdpi/ic_share.png delete mode 100644 android_app/app/src/main/res/drawable-xhdpi/ic_share.png delete mode 100644 android_app/app/src/main/res/drawable-xxhdpi/ic_share.png delete mode 100644 android_app/app/src/main/res/drawable-xxxhdpi/ic_share.png delete mode 100644 android_app/app/src/main/res/menu/table_menu.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 dcd57915..b95509de 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 @@ -26,6 +26,7 @@ import android.content.pm.PackageManager; import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; +import android.os.Environment; import android.os.Handler; import android.os.Message; import android.preference.PreferenceManager; @@ -36,6 +37,7 @@ import android.support.design.widget.BottomNavigationView; import android.support.design.widget.NavigationView; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; +import android.support.v4.content.FileProvider; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; @@ -45,12 +47,15 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.widget.EditText; import android.widget.Toast; +import com.health.openscale.BuildConfig; import com.health.openscale.R; import com.health.openscale.core.OpenScale; import com.health.openscale.core.bluetooth.BluetoothCommunication; import com.health.openscale.core.datatypes.ScaleMeasurement; +import com.health.openscale.core.datatypes.ScaleUser; import com.health.openscale.gui.activities.DataEntryActivity; import com.health.openscale.gui.activities.SettingsActivity; import com.health.openscale.gui.activities.UserSettingsActivity; @@ -60,6 +65,7 @@ import com.health.openscale.gui.fragments.StatisticsFragment; import com.health.openscale.gui.fragments.TableFragment; import com.health.openscale.gui.utils.PermissionHelper; +import java.io.File; import java.lang.reflect.Field; import cat.ereza.customactivityoncrash.config.CaocConfig; @@ -71,6 +77,8 @@ public class MainActivity extends AppCompatActivity private static int bluetoothStatusIcon = R.drawable.ic_bluetooth_disabled; private static MenuItem bluetoothStatus; + private static final int IMPORT_DATA_REQUEST = 100; + private Fragment currentFragment; private DrawerLayout drawerLayout; private Toolbar toolbar; @@ -383,6 +391,17 @@ public class MainActivity extends AppCompatActivity case R.id.action_bluetooth_status: invokeSearchBluetoothDevice(); return true; + case R.id.importData: + importCsvFile(); + return true; + case R.id.exportData: + if (PermissionHelper.requestWritePermission(this)) { + exportCsvFile(); + } + return true; + case R.id.shareData: + shareCsvFile(); + return true; } return super.onOptionsItemSelected(item); @@ -507,24 +526,128 @@ public class MainActivity extends AppCompatActivity bluetoothStatus.setIcon(getResources().getDrawable(bluetoothStatusIcon)); } + private void importCsvFile() { + int selectedUserId = OpenScale.getInstance(getApplicationContext()).getSelectedScaleUserId(); + + if (selectedUserId == -1) { + AlertDialog.Builder infoDialog = new AlertDialog.Builder(this); + + infoDialog.setMessage(getResources().getString(R.string.info_no_selected_user)); + infoDialog.setPositiveButton(getResources().getString(R.string.label_ok), null); + + infoDialog.show(); + } + else { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setType("text/*"); + + startActivityForResult( + Intent.createChooser(intent, getResources().getString(R.string.label_import)), + IMPORT_DATA_REQUEST); + } + } + + private void exportCsvFile() { + AlertDialog.Builder filenameDialog = new AlertDialog.Builder(this); + + filenameDialog.setTitle(getResources().getString(R.string.info_set_filename) + " " + + Environment.getExternalStorageDirectory().getPath()); + + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + + final ScaleUser selectedScaleUser = OpenScale.getInstance(getApplicationContext()).getSelectedScaleUser(); + String exportFilename = prefs.getString("exportFilename" + selectedScaleUser.getId(), + "openScale_data_" + selectedScaleUser.getUserName() + ".csv"); + + final EditText txtFilename = new EditText(this); + txtFilename.setText(exportFilename); + + filenameDialog.setView(txtFilename); + + filenameDialog.setPositiveButton(getResources().getString(R.string.label_export), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + String fullPath = Environment.getExternalStorageDirectory().getPath() + "/" + txtFilename.getText().toString(); + + if (OpenScale.getInstance(getApplicationContext()).exportData(fullPath)) { + prefs.edit().putString("exportFilename" + selectedScaleUser.getId(), txtFilename.getText().toString()).commit(); + Toast.makeText(getApplicationContext(), getResources().getString( + R.string.info_data_exported) + " " + fullPath, Toast.LENGTH_SHORT).show(); + } + } + }); + + filenameDialog.setNegativeButton(getResources().getString(R.string.label_cancel), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); + + filenameDialog.show(); + } + + private void shareCsvFile() { + final ScaleUser selectedScaleUser = OpenScale.getInstance(getApplicationContext()).getSelectedScaleUser(); + + File shareFile = new File(getApplicationContext().getCacheDir(), + String.format("openScale %s.csv", selectedScaleUser.getUserName())); + if (!OpenScale.getInstance(getApplicationContext()).exportData(shareFile.getPath())) { + return; + } + + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.setType("text/csv"); + + final Uri uri = FileProvider.getUriForFile( + getApplicationContext(), BuildConfig.APPLICATION_ID + ".fileprovider", shareFile); + intent.putExtra(Intent.EXTRA_STREAM, uri); + + intent.putExtra(Intent.EXTRA_SUBJECT, + getResources().getString(R.string.label_share_subject, selectedScaleUser.getUserName())); + + startActivity(Intent.createChooser(intent, getResources().getString(R.string.label_share))); + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + if (requestCode == IMPORT_DATA_REQUEST && resultCode == RESULT_OK && data != null) { + OpenScale.getInstance(getApplicationContext()).importData(data.getData()); + } + } + @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { + boolean permissionGranted = true; switch (requestCode) { case PermissionHelper.PERMISSIONS_REQUEST_ACCESS_COARSE_LOCATION: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { invokeSearchBluetoothDevice(); } else { setBluetoothStatusIcon(R.drawable.ic_bluetooth_disabled); - Toast.makeText(getApplicationContext(), getResources().getString(R.string.permission_not_granted), Toast.LENGTH_SHORT).show(); + permissionGranted = false; } - break; + break; + case PermissionHelper.PERMISSIONS_REQUEST_ACCESS_WRITE_STORAGE: + if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + exportCsvFile(); + } else { + permissionGranted = false; + } + break; + } + + if (!permissionGranted) { + Toast.makeText(getApplicationContext(), getResources().getString( + R.string.permission_not_granted), Toast.LENGTH_SHORT).show(); } currentFragment.onRequestPermissionsResult(requestCode, permissions, grantResults); super.onRequestPermissionsResult(requestCode, permissions, grantResults); } - @SuppressLint("RestrictedApi") public static void disableShiftMode(BottomNavigationView view) { BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0); diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/TableFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/TableFragment.java index 21b1c849..3485a41e 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/TableFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/TableFragment.java @@ -15,75 +15,52 @@ */ package com.health.openscale.gui.fragments; -import android.app.AlertDialog; -import android.content.DialogInterface; import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.Color; import android.graphics.Typeface; -import android.net.Uri; import android.os.Bundle; -import android.os.Environment; -import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; -import android.support.v4.content.FileProvider; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.view.Gravity; import android.view.LayoutInflater; -import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Button; -import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; -import android.widget.PopupMenu; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; -import android.widget.Toast; -import com.health.openscale.BuildConfig; import com.health.openscale.R; import com.health.openscale.core.OpenScale; import com.health.openscale.core.datatypes.ScaleMeasurement; -import com.health.openscale.core.datatypes.ScaleUser; import com.health.openscale.gui.activities.DataEntryActivity; -import com.health.openscale.gui.utils.PermissionHelper; import com.health.openscale.gui.views.MeasurementView; -import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import static android.app.Activity.RESULT_OK; import static android.util.TypedValue.COMPLEX_UNIT_DIP; public class TableFragment extends Fragment implements FragmentUpdateListener { private View tableView; private ListView tableDataView; private LinearLayout tableHeaderView; - private SharedPreferences prefs; private LinearLayout subpageView; - private ImageView optionMenu; - private PopupMenu popup; - private List measurementViews; private int selectedSubpageNr; private static final String SELECTED_SUBPAGE_NR_KEY = "selectedSubpageNr"; - private static final int IMPORT_DATA_REQUEST = 100; - public TableFragment() { } @@ -101,10 +78,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener { tableDataView.setAdapter(new ListViewAdapter()); tableDataView.setOnItemClickListener(new onClickListenerRow()); - optionMenu = (ImageView) tableView.findViewById(R.id.optionMenu); - - prefs = PreferenceManager.getDefaultSharedPreferences(tableView.getContext()); - if (savedInstanceState == null) { selectedSubpageNr = 0; } @@ -119,37 +92,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener { measurement.setUpdateViews(false); } - optionMenu.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - popup.show(); - } - }); - - popup = new PopupMenu(getContext(), optionMenu); - popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - - switch (item.getItemId()) { - case R.id.importData: - importTable(); - return true; - case R.id.exportData: - if (PermissionHelper.requestWritePermission(getActivity())) { - exportTable(); - } - return true; - case R.id.shareData: - shareTable(); - return true; - default: - return false; - } - } - }); - popup.getMenuInflater().inflate(R.menu.table_menu, popup.getMenu()); - OpenScale.getInstance(getContext()).registerFragment(this); return tableView; @@ -254,117 +196,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener { } } - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - if (requestCode == IMPORT_DATA_REQUEST && resultCode == RESULT_OK && data != null) { - OpenScale.getInstance(getContext()).importData(data.getData()); - } - } - - private void importTable() { - int selectedUserId = OpenScale.getInstance(getContext()).getSelectedScaleUserId(); - - if (selectedUserId == -1) { - AlertDialog.Builder infoDialog = new AlertDialog.Builder(getContext()); - - infoDialog.setMessage(getResources().getString(R.string.info_no_selected_user)); - - infoDialog.setPositiveButton(getResources().getString(R.string.label_ok), null); - - infoDialog.show(); - } - else { - Intent intent = new Intent(Intent.ACTION_GET_CONTENT); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setType("text/*"); - - startActivityForResult( - Intent.createChooser(intent, getResources().getString(R.string.label_import)), - IMPORT_DATA_REQUEST); - } - } - - private void exportTable() { - AlertDialog.Builder filenameDialog = new AlertDialog.Builder(getActivity()); - - filenameDialog.setTitle(getResources().getString(R.string.info_set_filename) + " " + Environment.getExternalStorageDirectory().getPath()); - - final ScaleUser selectedScaleUser = OpenScale.getInstance(getContext()).getSelectedScaleUser(); - String exportFilename = prefs.getString("exportFilename" + selectedScaleUser.getId(), "openScale_data_" + selectedScaleUser.getUserName() + ".csv"); - - final EditText txtFilename = new EditText(tableView.getContext()); - txtFilename.setText(exportFilename); - - filenameDialog.setView(txtFilename); - - filenameDialog.setPositiveButton(getResources().getString(R.string.label_export), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - String fullPath = Environment.getExternalStorageDirectory().getPath() + "/" + txtFilename.getText().toString(); - - if (OpenScale.getInstance(getContext()).exportData(fullPath)) { - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(tableView.getContext()); - prefs.edit().putString("exportFilename" + selectedScaleUser.getId(), txtFilename.getText().toString()).commit(); - Toast.makeText(getContext(), getResources().getString(R.string.info_data_exported) + " " + fullPath, Toast.LENGTH_SHORT).show(); - } - } - }); - - filenameDialog.setNegativeButton(getResources().getString(R.string.label_cancel), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - } - }); - - filenameDialog.show(); - } - - private void shareTable() { - final ScaleUser selectedScaleUser = OpenScale.getInstance(getContext()).getSelectedScaleUser(); - - File shareFile = new File(getContext().getCacheDir(), - String.format("openScale %s.csv", selectedScaleUser.getUserName())); - if (!OpenScale.getInstance(getContext()).exportData(shareFile.getPath())) { - return; - } - - Intent intent = new Intent(Intent.ACTION_SEND); - intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - intent.setType("text/csv"); - - final Uri uri = FileProvider.getUriForFile( - getContext(), BuildConfig.APPLICATION_ID + ".fileprovider", shareFile); - intent.putExtra(Intent.EXTRA_STREAM, uri); - - intent.putExtra(Intent.EXTRA_SUBJECT, - getResources().getString(R.string.label_share_subject, selectedScaleUser.getUserName())); - - startActivity(Intent.createChooser(intent, getResources().getString(R.string.label_share))); - } - - @Override - public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { - switch (requestCode) { - case PermissionHelper.PERMISSIONS_REQUEST_ACCESS_READ_STORAGE: - if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - importTable(); - } else { - Toast.makeText(getContext(), getResources().getString(R.string.permission_not_granted), Toast.LENGTH_SHORT).show(); - } - break; - case PermissionHelper.PERMISSIONS_REQUEST_ACCESS_WRITE_STORAGE: - if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - exportTable(); - } else { - Toast.makeText(getContext(), getResources().getString(R.string.permission_not_granted), Toast.LENGTH_SHORT).show(); - } - break; - } - - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - } - private class onClickListenerMoveSubpageLeft implements View.OnClickListener { @Override public void onClick(View v) { diff --git a/android_app/app/src/main/res/drawable-hdpi/ic_share.png b/android_app/app/src/main/res/drawable-hdpi/ic_share.png deleted file mode 100644 index 50a469175394aaf69f10f5a061ab6202a807addd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 261 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k1|%Oc%$NbB*pj^6T^Rm@;DWu&Cj&)xdAc}; zM6|xW=F8V)AmH$D`9rZ?Ule58q)QG9MpUr$KbtnST)^CHrAo;b*|}=xygB}VXcb|q znCH9KRN*a;&iS2{g2L*-SEQ1=ZXKGjK&3}(mGC$DMri}J+sjfaYi#E*8(eQFV|}hO z^?Ca3?D!34?4F*@yS6+kymm*pXu_1{C0_T8zOFBhD)v9&7$g<{O4uOfoB!&s+y$XK z^0ytRwl92mdxC#}{ZS7M;WJ{VM1;8y%yl!^cu(rV-*o;1k6nsCz7{S3`hvmJ)z4*} HQ$iB}GF)hZ diff --git a/android_app/app/src/main/res/drawable-ldpi/ic_share.png b/android_app/app/src/main/res/drawable-ldpi/ic_share.png deleted file mode 100644 index 904015511dc814ea5b8eb9f8f78be230660a7652..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 215 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|wj^(N7l!{JxM1({$v}}FPZ!4! zi{7i347r#L1z0b%ccgC+O!VHkdFvhNl^K~Ud-t+m3a()APuOk7ne=eiNw$Oh&P<&7 z%Ow73W{1>H6qdSU_`3VZsY7lNEm;M8-!tEZFl~ANt8xOvb&Dwt({4;_h%(Npy!|kU z$*N55Ik$-M@f+EvUl+uE^vEzW9Ka>leo0XY%9p644$rj JF6*2UngAhuQ?>vA diff --git a/android_app/app/src/main/res/drawable-mdpi/ic_share.png b/android_app/app/src/main/res/drawable-mdpi/ic_share.png deleted file mode 100644 index 01f1adc5c4b16dc3fa663a6c2c18a74c03e9003e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjY)RhkE)4%caKYZ?lYt^do-U3d z9-YYv609K%Qv-a2FC0B^;DdbE?iINe{F5FU+;P@D>@6uFanI54Oo7DyDN)l7Fq~o9 z#2_pxYxG4&LF)zER(`g2RvniWiA#<&EtGdz5_REV!%UmRKYUr1s~Q#q?+{Q4Kt%KpuH(2=0T{-qj9Ze`nBsM6)1m|o-s5!|!>&bIe2&*?&FW@!n2*=# zj2fc~06mt+>-0IJ_6cV%0L}m&!5o8g_u%srUW?p*jg2W*xW91kL zpz|w%<9H=-9Iph9iI56!oaY@Vm8tGZWZUZvr+Nq+M;Yu#IF9shVs;@A04C zCzgFGyp_{kremz?H#_#^GS+Xi-+j*J}>AGc)DJ-yT#bAHGTfuWmS#$1WzbTa8zh^U~A-I zl4LP@w@Q4*f+vlWtx<(JQUt&P%8z5;DE*rwe@GT80M}T>xn(vd=2o~<)HIF^;w9ku8yW+P7){MA;ZqvH$Q4FMK>NgZMz}C zOUZMRisz&yJ1Z9Ge>j^x>A6b&7uRPQQ=e2=dH>Mc{JHecvo#l_&z`WdKW=`=;h)rg z%j`F0=6RF9eeAt3S?{rVdh?wxY`K?fYm{S7ssg#zKi1|S(VO0%-%`Kp*^jd~d4KV! z<;;H#@UXy&t-F^H|pv^DXbU)$F&mdFDOIbyC0a{r@YUzI|?Y zPU&Q|+PB!x5_ZXby7}^lWvh$*;}hQTFc>qOVK87mfWlbQFMq7}?27tpPr|XtqN+dk z;djIAf49$@)v=-)0#}yP#W?NdH~BBQyKJWEFRu)e{I^sftKqq+rs(nGp)&H}g*7op kKNb?;#Dl_A#dCuHYJ~?FVdQ&MBb@0MO0J^#A|> diff --git a/android_app/app/src/main/res/layout/fragment_table.xml b/android_app/app/src/main/res/layout/fragment_table.xml index 8470832a..bebd0020 100644 --- a/android_app/app/src/main/res/layout/fragment_table.xml +++ b/android_app/app/src/main/res/layout/fragment_table.xml @@ -38,13 +38,6 @@ android:gravity="right" android:layout_weight="0.9" android:orientation="horizontal"> - 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 b7ade228..216342be 100644 --- a/android_app/app/src/main/res/menu/action_menu.xml +++ b/android_app/app/src/main/res/menu/action_menu.xml @@ -15,4 +15,19 @@ android:title="+" app:showAsAction="always" /> + + + + + + diff --git a/android_app/app/src/main/res/menu/table_menu.xml b/android_app/app/src/main/res/menu/table_menu.xml deleted file mode 100644 index 2f27f337..00000000 --- a/android_app/app/src/main/res/menu/table_menu.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - From 49fb2fab4f5ed558c0a87f5be5aee0f8116d44ce Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Fri, 23 Feb 2018 20:50:53 +0100 Subject: [PATCH 2/2] Hide subpage view when there is only one page --- .../java/com/health/openscale/gui/fragments/TableFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/TableFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/TableFragment.java index 3485a41e..da5f5376 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/TableFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/TableFragment.java @@ -157,6 +157,8 @@ public class TableFragment extends Fragment implements FragmentUpdateListener { moveSubpageRight.setEnabled(selectedSubpageNr + 1 < subpageCount); subpageView.addView(moveSubpageRight); + subpageView.setVisibility(subpageCount > 1 ? View.VISIBLE : View.GONE); + tableHeaderView.removeAllViews(); ArrayList visibleMeasurements = new ArrayList<>();