Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2166 faq section selection of navigation drawer #2266

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions app/src/main/java/io/pslab/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private Fragment getHomeFragment() throws IOException {
return HomeFragment.newInstance(ScienceLabCommon.scienceLab.isConnected(), ScienceLabCommon.scienceLab.isDeviceFound());
case 5:
return AboutUsFragment.newInstance();
case 7:
case 8:
return FAQFragment.newInstance();
default:
return InstrumentsFragment.newInstance();
Expand Down Expand Up @@ -229,7 +229,7 @@ private void selectNavMenu() {
case 5:
navigationView.getMenu().getItem(navItemIndex).setChecked(true);
break;
case 7:
case 8:
navigationView.getMenu().getItem(navItemIndex).setChecked(true);
break;
default:
Expand Down Expand Up @@ -263,14 +263,14 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
navItemIndex = 5;
CURRENT_TAG = TAG_ABOUTUS;
break;
case R.id.nav_rate:
case R.id.nav_rate:
customTabService.launchUrl("https://play.google.com/store/apps/details?id=io.pslab");
if (drawer != null) {
drawer.closeDrawers();
}
break;
case R.id.nav_help_feedback:
navItemIndex = 7;
navItemIndex = 8;
CURRENT_TAG = TAG_FAQ;
break;
case R.id.nav_buy_pslab:
Expand Down Expand Up @@ -360,7 +360,7 @@ public void onBackPressed() {
return;
} else {
CustomSnackBar.showSnackBar(findViewById(android.R.id.content),
getString(R.string.Toast_double_tap),null,null, Snackbar.LENGTH_SHORT);
getString(R.string.Toast_double_tap), null, null, Snackbar.LENGTH_SHORT);
}
mBackPressed = System.currentTimeMillis();
}
Expand All @@ -378,7 +378,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_pslab_connected:
CustomSnackBar.showSnackBar(findViewById(android.R.id.content),
getString(R.string.device_connected_successfully),null,null, Snackbar.LENGTH_SHORT);
getString(R.string.device_connected_successfully), null, null, Snackbar.LENGTH_SHORT);
break;
case R.id.menu_pslab_disconnected:
attemptToConnectPSLab();
Expand All @@ -403,15 +403,15 @@ private void attemptToConnectPSLab() {
if (communicationHandler.isConnected()) {
initialisationDialog.dismiss();
CustomSnackBar.showSnackBar(findViewById(android.R.id.content),
getString(R.string.device_connected_successfully),null,null, Snackbar.LENGTH_SHORT);
getString(R.string.device_connected_successfully), null, null, Snackbar.LENGTH_SHORT);
} else {
communicationHandler = new CommunicationHandler(usbManager);
if (communicationHandler.isDeviceFound()) {
attemptToGetUSBPermission();
} else {
initialisationDialog.dismiss();
CustomSnackBar.showSnackBar(findViewById(android.R.id.content),
getString(R.string.device_not_found),null,null, Snackbar.LENGTH_SHORT);
getString(R.string.device_not_found), null, null, Snackbar.LENGTH_SHORT);
navItemIndex = 2;
CURRENT_TAG = TAG_DEVICE;
loadHomeFragment();
Expand Down Expand Up @@ -494,21 +494,21 @@ public void onReceive(Context context, Intent intent) {
initialisationDialog.dismiss();
invalidateOptionsMenu();
CustomSnackBar.showSnackBar(findViewById(android.R.id.content),
getString(R.string.device_connected_successfully),null,null, Snackbar.LENGTH_SHORT);
getString(R.string.device_connected_successfully), null, null, Snackbar.LENGTH_SHORT);
if (navItemIndex == 0) {
getSupportFragmentManager().beginTransaction().replace(R.id.frame, InstrumentsFragment.newInstance()).commit();
} else if (navItemIndex == 1) {
getSupportFragmentManager().beginTransaction().replace(R.id.frame, HomeFragment.newInstance(true, true)).commitAllowingStateLoss();
} else {
CustomSnackBar.showSnackBar(findViewById(android.R.id.content),
getString(R.string.device_connected_successfully),null,null, Snackbar.LENGTH_SHORT);
getString(R.string.device_connected_successfully), null, null, Snackbar.LENGTH_SHORT);
}
}
} else {
initialisationDialog.dismiss();
Log.d(TAG, "permission denied for device " + device);
CustomSnackBar.showSnackBar(findViewById(android.R.id.content),
getString(R.string.device_not_found),null,null, Snackbar.LENGTH_SHORT);
getString(R.string.device_not_found), null, null, Snackbar.LENGTH_SHORT);
}
}
}
Expand All @@ -531,7 +531,7 @@ protected void onNewIntent(Intent intent) {
getSupportFragmentManager().beginTransaction().replace(R.id.frame, HomeFragment.newInstance(true, true)).commitAllowingStateLoss();
}
CustomSnackBar.showSnackBar(findViewById(android.R.id.content),
getString(R.string.device_connected_successfully),null,null, Snackbar.LENGTH_SHORT);
getString(R.string.device_connected_successfully), null, null, Snackbar.LENGTH_SHORT);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<item>Generate Config File</item>
<item>Settings</item>
<item>About Us</item>
<item>Rate App</item>
<item>Buy PSLab</item>
<item>FAQs</item>
<item>Share App</item>
Expand Down