diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java index 88e2072a..39d5b2d8 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothExingtechY1.java @@ -91,7 +91,7 @@ public class BluetoothExingtechY1 extends BluetoothCommunication { } private void parseBytes(byte[] weightBytes) { - int userId = (int)(weightBytes[0] & 0x0F); + int userId = weightBytes[0] & 0x0F; int gender = (int)(weightBytes[1]); // 0x00 male; 0x01 female int age = (int)(weightBytes[2]); // 10 ~ 99 int height = (int)(weightBytes[3]); // 0 ~ 255 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 73c59255..d2727f13 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 @@ -111,12 +111,12 @@ public class MainActivity extends BaseAppCompatActivity getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Find our drawer view - drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); + drawerLayout = findViewById(R.id.drawer_layout); // Find our drawer view - navDrawer = (NavigationView) findViewById(R.id.navigation_view); + navDrawer = findViewById(R.id.navigation_view); - navBottomDrawer = (BottomNavigationView) findViewById(R.id.navigation_bottom_view); + navBottomDrawer = findViewById(R.id.navigation_bottom_view); navBottomDrawer.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { diff --git a/android_app/app/src/main/java/com/health/openscale/gui/activities/DataEntryActivity.java b/android_app/app/src/main/java/com/health/openscale/gui/activities/DataEntryActivity.java index f8fead5e..7cd5c9bd 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/activities/DataEntryActivity.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/activities/DataEntryActivity.java @@ -82,7 +82,7 @@ public class DataEntryActivity extends BaseAppCompatActivity { setContentView(R.layout.activity_dataentry); - Toolbar toolbar = (Toolbar) findViewById(R.id.dataEntryToolbar); + Toolbar toolbar = findViewById(R.id.dataEntryToolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -95,9 +95,9 @@ public class DataEntryActivity extends BaseAppCompatActivity { dataEntryMeasurements = MeasurementView.getMeasurementList( context, MeasurementView.DateTimeOrder.LAST); - txtDataNr = (TextView) findViewById(R.id.txtDataNr); - btnLeft = (Button) findViewById(R.id.btnLeft); - btnRight = (Button) findViewById(R.id.btnRight); + txtDataNr = findViewById(R.id.txtDataNr); + btnLeft = findViewById(R.id.btnLeft); + btnRight = findViewById(R.id.btnRight); btnLeft.setVisibility(View.INVISIBLE); btnRight.setVisibility(View.INVISIBLE); diff --git a/android_app/app/src/main/java/com/health/openscale/gui/activities/UserSettingsActivity.java b/android_app/app/src/main/java/com/health/openscale/gui/activities/UserSettingsActivity.java index 3627a6b4..4e819644 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/activities/UserSettingsActivity.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/activities/UserSettingsActivity.java @@ -74,21 +74,21 @@ public class UserSettingsActivity extends BaseAppCompatActivity { setContentView(R.layout.activity_usersettings); context = this; - Toolbar toolbar = (Toolbar) findViewById(R.id.userEntryToolbar); + Toolbar toolbar = findViewById(R.id.userEntryToolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.label_add_user); - txtUserName = (EditText) findViewById(R.id.txtUserName); - txtBodyHeight = (EditText) findViewById(R.id.txtBodyHeight); - radioScaleUnit = (RadioGroup) findViewById(R.id.groupScaleUnit); - radioGender = (RadioGroup) findViewById(R.id.groupGender); - txtInitialWeight = (EditText) findViewById(R.id.txtInitialWeight); - txtGoalWeight = (EditText) findViewById(R.id.txtGoalWeight); + txtUserName = findViewById(R.id.txtUserName); + txtBodyHeight = findViewById(R.id.txtBodyHeight); + radioScaleUnit = findViewById(R.id.groupScaleUnit); + radioGender = findViewById(R.id.groupGender); + txtInitialWeight = findViewById(R.id.txtInitialWeight); + txtGoalWeight = findViewById(R.id.txtGoalWeight); - txtBirthday = (EditText) findViewById(R.id.txtBirthday); - txtGoalDate = (EditText) findViewById(R.id.txtGoalDate); + txtBirthday = findViewById(R.id.txtBirthday); + txtGoalDate = findViewById(R.id.txtGoalDate); Calendar birthdayCal = Calendar.getInstance(); birthdayCal.setTime(birthday); diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/GraphFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/GraphFragment.java index 06b05814..e9ed0ed0 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/GraphFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/GraphFragment.java @@ -123,8 +123,8 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener { graphView = inflater.inflate(R.layout.fragment_graph, container, false); - chartBottom = (LineChartView) graphView.findViewById(R.id.chart_bottom); - chartTop = (ColumnChartView) graphView.findViewById(R.id.chart_top); + chartBottom = graphView.findViewById(R.id.chart_bottom); + chartTop = graphView.findViewById(R.id.chart_top); chartBottom.setOnTouchListener(new chartBottomListener()); chartBottom.setOnValueTouchListener(new chartBottomValueTouchListener()); @@ -133,10 +133,10 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener { // HACK: get default text color from hidden text view to set the correct axis colors textColor = ((TextView)graphView.findViewById(R.id.colorHack)).getCurrentTextColor(); - txtYear = (TextView) graphView.findViewById(R.id.txtYear); + txtYear = graphView.findViewById(R.id.txtYear); txtYear.setText(Integer.toString(calYears.get(Calendar.YEAR))); - floatingActionBar = (LinearLayout) graphView.findViewById(R.id.floatingActionBar); + floatingActionBar = graphView.findViewById(R.id.floatingActionBar); ImageView optionMenu = graphView.findViewById(R.id.optionMenu); optionMenu.setOnClickListener(new View.OnClickListener() { diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java index b251f41d..707fd88d 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/OverviewFragment.java @@ -102,13 +102,13 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener context = overviewView.getContext(); - txtTitleUser = (TextView) overviewView.findViewById(R.id.txtTitleUser); - txtTitleLastMeasurement = (TextView) overviewView.findViewById(R.id.txtTitleLastMeasurment); + txtTitleUser = overviewView.findViewById(R.id.txtTitleUser); + txtTitleLastMeasurement = overviewView.findViewById(R.id.txtTitleLastMeasurment); - pieChartLast = (PieChartView) overviewView.findViewById(R.id.pieChartLast); - lineChartLast = (LineChartView) overviewView.findViewById(R.id.lineChartLast); + pieChartLast = overviewView.findViewById(R.id.pieChartLast); + lineChartLast = overviewView.findViewById(R.id.lineChartLast); - spinUser = (Spinner) overviewView.findViewById(R.id.spinUser); + spinUser = overviewView.findViewById(R.id.spinUser); lineChartLast.setOnValueTouchListener(new LineChartTouchListener()); diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java index 8a4020ab..361fea93 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/StatisticsFragment.java @@ -80,13 +80,13 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen image.setColorFilter(color); } - txtGoalWeight = (TextView) statisticsView.findViewById(R.id.txtGoalWeight); - txtGoalDiff = (TextView) statisticsView.findViewById(R.id.txtGoalDiff); - txtGoalDayLeft = (TextView) statisticsView.findViewById(R.id.txtGoalDayLeft); + txtGoalWeight = statisticsView.findViewById(R.id.txtGoalWeight); + txtGoalDiff = statisticsView.findViewById(R.id.txtGoalDiff); + txtGoalDayLeft = statisticsView.findViewById(R.id.txtGoalDayLeft); - txtLabelGoalWeight = (TextView) statisticsView.findViewById(R.id.txtLabelGoalWeight); - txtLabelGoalDiff = (TextView) statisticsView.findViewById(R.id.txtLabelGoalDiff); - txtLabelDayLeft = (TextView) statisticsView.findViewById(R.id.txtLabelDayLeft); + txtLabelGoalWeight = statisticsView.findViewById(R.id.txtLabelGoalWeight); + txtLabelGoalDiff = statisticsView.findViewById(R.id.txtLabelGoalDiff); + txtLabelDayLeft = statisticsView.findViewById(R.id.txtLabelDayLeft); TableLayout tableWeekAveragesLayoutColumnA = statisticsView.findViewById(R.id.tableWeekAveragesLayoutColumnA); TableLayout tableWeekAveragesLayoutColumnB = statisticsView.findViewById(R.id.tableWeekAveragesLayoutColumnB); 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 455ec1a5..8c97d678 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 @@ -70,10 +70,10 @@ public class TableFragment extends Fragment implements FragmentUpdateListener { { tableView = inflater.inflate(R.layout.fragment_table, container, false); - subpageView = (LinearLayout) tableView.findViewById(R.id.subpageView); + subpageView = tableView.findViewById(R.id.subpageView); - tableDataView = (ListView) tableView.findViewById(R.id.tableDataView); - tableHeaderView = (LinearLayout) tableView.findViewById(R.id.tableHeaderView); + tableDataView = tableView.findViewById(R.id.tableDataView); + tableHeaderView = tableView.findViewById(R.id.tableHeaderView); tableDataView.setAdapter(new ListViewAdapter()); tableDataView.setOnItemClickListener(new onClickListenerRow());