1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-23 08:43:15 +02:00

Remove redundant casts

This commit is contained in:
Erik Johansson
2018-04-16 20:14:56 +02:00
parent 2a7020a27c
commit 8396dd3296
8 changed files with 35 additions and 35 deletions

View File

@@ -91,7 +91,7 @@ public class BluetoothExingtechY1 extends BluetoothCommunication {
} }
private void parseBytes(byte[] weightBytes) { 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 gender = (int)(weightBytes[1]); // 0x00 male; 0x01 female
int age = (int)(weightBytes[2]); // 10 ~ 99 int age = (int)(weightBytes[2]); // 10 ~ 99
int height = (int)(weightBytes[3]); // 0 ~ 255 int height = (int)(weightBytes[3]); // 0 ~ 255

View File

@@ -111,12 +111,12 @@ public class MainActivity extends BaseAppCompatActivity
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Find our drawer view // Find our drawer view
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerLayout = findViewById(R.id.drawer_layout);
// Find our drawer view // 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() { navBottomDrawer.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override @Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) { public boolean onNavigationItemSelected(@NonNull MenuItem item) {

View File

@@ -82,7 +82,7 @@ public class DataEntryActivity extends BaseAppCompatActivity {
setContentView(R.layout.activity_dataentry); setContentView(R.layout.activity_dataentry);
Toolbar toolbar = (Toolbar) findViewById(R.id.dataEntryToolbar); Toolbar toolbar = findViewById(R.id.dataEntryToolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@@ -95,9 +95,9 @@ public class DataEntryActivity extends BaseAppCompatActivity {
dataEntryMeasurements = MeasurementView.getMeasurementList( dataEntryMeasurements = MeasurementView.getMeasurementList(
context, MeasurementView.DateTimeOrder.LAST); context, MeasurementView.DateTimeOrder.LAST);
txtDataNr = (TextView) findViewById(R.id.txtDataNr); txtDataNr = findViewById(R.id.txtDataNr);
btnLeft = (Button) findViewById(R.id.btnLeft); btnLeft = findViewById(R.id.btnLeft);
btnRight = (Button) findViewById(R.id.btnRight); btnRight = findViewById(R.id.btnRight);
btnLeft.setVisibility(View.INVISIBLE); btnLeft.setVisibility(View.INVISIBLE);
btnRight.setVisibility(View.INVISIBLE); btnRight.setVisibility(View.INVISIBLE);

View File

@@ -74,21 +74,21 @@ public class UserSettingsActivity extends BaseAppCompatActivity {
setContentView(R.layout.activity_usersettings); setContentView(R.layout.activity_usersettings);
context = this; context = this;
Toolbar toolbar = (Toolbar) findViewById(R.id.userEntryToolbar); Toolbar toolbar = findViewById(R.id.userEntryToolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(R.string.label_add_user); getSupportActionBar().setTitle(R.string.label_add_user);
txtUserName = (EditText) findViewById(R.id.txtUserName); txtUserName = findViewById(R.id.txtUserName);
txtBodyHeight = (EditText) findViewById(R.id.txtBodyHeight); txtBodyHeight = findViewById(R.id.txtBodyHeight);
radioScaleUnit = (RadioGroup) findViewById(R.id.groupScaleUnit); radioScaleUnit = findViewById(R.id.groupScaleUnit);
radioGender = (RadioGroup) findViewById(R.id.groupGender); radioGender = findViewById(R.id.groupGender);
txtInitialWeight = (EditText) findViewById(R.id.txtInitialWeight); txtInitialWeight = findViewById(R.id.txtInitialWeight);
txtGoalWeight = (EditText) findViewById(R.id.txtGoalWeight); txtGoalWeight = findViewById(R.id.txtGoalWeight);
txtBirthday = (EditText) findViewById(R.id.txtBirthday); txtBirthday = findViewById(R.id.txtBirthday);
txtGoalDate = (EditText) findViewById(R.id.txtGoalDate); txtGoalDate = findViewById(R.id.txtGoalDate);
Calendar birthdayCal = Calendar.getInstance(); Calendar birthdayCal = Calendar.getInstance();
birthdayCal.setTime(birthday); birthdayCal.setTime(birthday);

View File

@@ -123,8 +123,8 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
graphView = inflater.inflate(R.layout.fragment_graph, container, false); graphView = inflater.inflate(R.layout.fragment_graph, container, false);
chartBottom = (LineChartView) graphView.findViewById(R.id.chart_bottom); chartBottom = graphView.findViewById(R.id.chart_bottom);
chartTop = (ColumnChartView) graphView.findViewById(R.id.chart_top); chartTop = graphView.findViewById(R.id.chart_top);
chartBottom.setOnTouchListener(new chartBottomListener()); chartBottom.setOnTouchListener(new chartBottomListener());
chartBottom.setOnValueTouchListener(new chartBottomValueTouchListener()); 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 // HACK: get default text color from hidden text view to set the correct axis colors
textColor = ((TextView)graphView.findViewById(R.id.colorHack)).getCurrentTextColor(); 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))); 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); ImageView optionMenu = graphView.findViewById(R.id.optionMenu);
optionMenu.setOnClickListener(new View.OnClickListener() { optionMenu.setOnClickListener(new View.OnClickListener() {

View File

@@ -102,13 +102,13 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
context = overviewView.getContext(); context = overviewView.getContext();
txtTitleUser = (TextView) overviewView.findViewById(R.id.txtTitleUser); txtTitleUser = overviewView.findViewById(R.id.txtTitleUser);
txtTitleLastMeasurement = (TextView) overviewView.findViewById(R.id.txtTitleLastMeasurment); txtTitleLastMeasurement = overviewView.findViewById(R.id.txtTitleLastMeasurment);
pieChartLast = (PieChartView) overviewView.findViewById(R.id.pieChartLast); pieChartLast = overviewView.findViewById(R.id.pieChartLast);
lineChartLast = (LineChartView) overviewView.findViewById(R.id.lineChartLast); lineChartLast = overviewView.findViewById(R.id.lineChartLast);
spinUser = (Spinner) overviewView.findViewById(R.id.spinUser); spinUser = overviewView.findViewById(R.id.spinUser);
lineChartLast.setOnValueTouchListener(new LineChartTouchListener()); lineChartLast.setOnValueTouchListener(new LineChartTouchListener());

View File

@@ -80,13 +80,13 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen
image.setColorFilter(color); image.setColorFilter(color);
} }
txtGoalWeight = (TextView) statisticsView.findViewById(R.id.txtGoalWeight); txtGoalWeight = statisticsView.findViewById(R.id.txtGoalWeight);
txtGoalDiff = (TextView) statisticsView.findViewById(R.id.txtGoalDiff); txtGoalDiff = statisticsView.findViewById(R.id.txtGoalDiff);
txtGoalDayLeft = (TextView) statisticsView.findViewById(R.id.txtGoalDayLeft); txtGoalDayLeft = statisticsView.findViewById(R.id.txtGoalDayLeft);
txtLabelGoalWeight = (TextView) statisticsView.findViewById(R.id.txtLabelGoalWeight); txtLabelGoalWeight = statisticsView.findViewById(R.id.txtLabelGoalWeight);
txtLabelGoalDiff = (TextView) statisticsView.findViewById(R.id.txtLabelGoalDiff); txtLabelGoalDiff = statisticsView.findViewById(R.id.txtLabelGoalDiff);
txtLabelDayLeft = (TextView) statisticsView.findViewById(R.id.txtLabelDayLeft); txtLabelDayLeft = statisticsView.findViewById(R.id.txtLabelDayLeft);
TableLayout tableWeekAveragesLayoutColumnA = statisticsView.findViewById(R.id.tableWeekAveragesLayoutColumnA); TableLayout tableWeekAveragesLayoutColumnA = statisticsView.findViewById(R.id.tableWeekAveragesLayoutColumnA);
TableLayout tableWeekAveragesLayoutColumnB = statisticsView.findViewById(R.id.tableWeekAveragesLayoutColumnB); TableLayout tableWeekAveragesLayoutColumnB = statisticsView.findViewById(R.id.tableWeekAveragesLayoutColumnB);

View File

@@ -70,10 +70,10 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
{ {
tableView = inflater.inflate(R.layout.fragment_table, container, false); 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); tableDataView = tableView.findViewById(R.id.tableDataView);
tableHeaderView = (LinearLayout) tableView.findViewById(R.id.tableHeaderView); tableHeaderView = tableView.findViewById(R.id.tableHeaderView);
tableDataView.setAdapter(new ListViewAdapter()); tableDataView.setAdapter(new ListViewAdapter());
tableDataView.setOnItemClickListener(new onClickListenerRow()); tableDataView.setOnItemClickListener(new onClickListenerRow());