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

fix: side navbar rearranged #1942

Merged
merged 1 commit into from
Aug 17, 2019
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
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ android {
flavorDimensions 'default'
productFlavors {
fdroid {
resValue "string", "flavor", "Fdroid version"
dimension = 'default'
}
playstore {
resValue "string", "flavor", "Play Store version"
dimension = 'default'
}
}
Expand Down
29 changes: 12 additions & 17 deletions app/src/main/java/io/pslab/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,11 @@ public void run() {

private Fragment getHomeFragment() throws IOException {
switch (navItemIndex) {
case 1:
return HomeFragment.newInstance(ScienceLabCommon.scienceLab.isConnected(), ScienceLabCommon.scienceLab.isDeviceFound());
case 2:
return null;
case 3:
return HomeFragment.newInstance(ScienceLabCommon.scienceLab.isConnected(), ScienceLabCommon.scienceLab.isDeviceFound());
case 5:
return AboutUsFragment.newInstance();
case 4:
case 7:
return FAQFragment.newInstance();
default:
return InstrumentsFragment.newInstance();
Expand Down Expand Up @@ -228,11 +226,11 @@ private void selectNavMenu() {
case 2:
navigationView.getMenu().getItem(navItemIndex).setChecked(true);
break;
case 3:
navigationView.getMenu().getItem(size_menu-1).getSubMenu().getItem(1).setChecked(true);
case 5:
navigationView.getMenu().getItem(navItemIndex).setChecked(true);
break;
case 4:
navigationView.getMenu().getItem(size_menu-1).getSubMenu().getItem(0).setChecked(true);
case 7:
navigationView.getMenu().getItem(navItemIndex).setChecked(true);
break;
default:
navigationView.getMenu().getItem(0).setChecked(true);
Expand All @@ -250,7 +248,7 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
CURRENT_TAG = TAG_INSTRUMENTS;
break;
case R.id.nav_device:
navItemIndex = 1;
navItemIndex = 2;
CURRENT_TAG = TAG_DEVICE;
break;
case R.id.nav_settings:
Expand All @@ -262,22 +260,19 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
startActivity(intent);
return true;
case R.id.nav_about_us:
navItemIndex = 3;
navItemIndex = 5;
CURRENT_TAG = TAG_ABOUTUS;
break;
case R.id.nav_help_feedback:
navItemIndex = 4;
navItemIndex = 7;
CURRENT_TAG = TAG_FAQ;
break;
case R.id.nav_report_us:
customTabService.launchUrl("https://goo.gl/forms/sHlmRAPFmzcGQ27u2");
case R.id.nav_buy_pslab:
customTabService.launchUrl("https://pslab.io/shop/");
if (drawer != null) {
drawer.closeDrawers();
}
break;
case R.id.nav_app_version:
setTitleColor(R.color.gray);
break;
case R.id.sensor_data_logger:
if (drawer != null) {
drawer.closeDrawers();
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/io/pslab/fragment/AboutUsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import butterknife.BindView;
import butterknife.ButterKnife;
import mehdi.sakout.aboutpage.AboutPage;
import mehdi.sakout.aboutpage.Element;

/**
* Created by Abhinav on 12-05-2018.
Expand Down Expand Up @@ -43,6 +44,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
View aboutPage = new AboutPage(getActivity())
.isRTL(false)
.setImage(R.drawable.logo200x200)
.addWebsite("https://goo.gl/forms/sHlmRAPFmzcGQ27u2", getString(R.string.nav_report))
.addItem(new Element(getString(R.string.version), R.drawable.ic_widgets_black_24dp))
.addItem(new Element(getString(R.string.flavor), R.drawable.ic_android_black_24dp))
.setDescription(getString(R.string.about_us_description))
.addGroup("Connect with us")
.addEmail("pslab-fossasia@googlegroups.com")
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/io/pslab/fragment/FAQFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ public static FAQFragment newInstance() {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

questions = new String[]{getString(R.string.faq_question1), getString(R.string.faq_question2), getString(R.string.faq_question3), getString(R.string.faq_question4), getString(R.string.faq_question5)};
questions = new String[]{getString(R.string.faq_question1), getString(R.string.faq_question2), getString(R.string.faq_question3), getString(R.string.faq_question4)};

answers = new String[][]{
{getString(R.string.faq_answer1)},
{getString(R.string.faq_answer2)},
{getString(R.string.faq_answer3)},
{getString(R.string.faq_answer4)},
{getString(R.string.faq_answer5)}
{getString(R.string.faq_answer4)}
};
}

Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_android_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_shopping_cart_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M7,18c-1.1,0 -1.99,0.9 -1.99,2S5.9,22 7,22s2,-0.9 2,-2 -0.9,-2 -2,-2zM1,2v2h2l3.6,7.59 -1.35,2.45c-0.16,0.28 -0.25,0.61 -0.25,0.96 0,1.1 0.9,2 2,2h12v-2L7.42,15c-0.14,0 -0.25,-0.11 -0.25,-0.25l0.03,-0.12 0.9,-1.63h7.45c0.75,0 1.41,-0.41 1.75,-1.03l3.58,-6.49c0.08,-0.14 0.12,-0.31 0.12,-0.48 0,-0.55 -0.45,-1 -1,-1L5.21,4l-0.94,-2L1,2zM17,18c-1.1,0 -1.99,0.9 -1.99,2s0.89,2 1.99,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_widgets_black_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M13,13v8h8v-8h-8zM3,21h8v-8L3,13v8zM3,3v8h8L11,3L3,3zM16.66,1.69L11,7.34 16.66,13l5.66,-5.66 -5.66,-5.65z"/>
</vector>
5 changes: 0 additions & 5 deletions app/src/main/res/drawable/icon_version.xml

This file was deleted.

1 change: 1 addition & 0 deletions app/src/main/res/layout/fragment_faq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ExpandableListView
android:id="@+id/expListView"
android:layout_margin="@dimen/faq_answer_margin_start"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_zero_dp"
android:layout_weight="0.14"
Expand Down
62 changes: 32 additions & 30 deletions app/src/main/res/menu/activity_main_drawer.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<group
android:id="@+id/group1"
android:checkableBehavior="single">
<item
android:id="@+id/nav_instruments"
android:icon="@drawable/ic_apps_black_24dp"
android:title="@string/nav_instruments" />
<item
android:id="@+id/nav_device"
android:icon="@drawable/ic_developer_board_black_24dp"
android:title="@string/nav_device" />
<item
android:id="@+id/sensor_data_logger"
android:icon="@drawable/ic_wifi_tethering_black_24dp"
android:title="@string/logged_data" />
</group>
<group
android:id="@+id/group2"
android:checkableBehavior="single">
<item
android:id="@+id/nav_device"
android:icon="@drawable/ic_developer_board_black_24dp"
android:title="@string/nav_device" />
<item
android:id="@+id/nav_generate_config"
android:icon="@drawable/create_config_icon"
Expand All @@ -21,33 +27,29 @@
android:id="@+id/nav_settings"
android:icon="@drawable/ic_settings_black_24dp"
android:title="@string/nav_settings" />
</group>

<group
android:id="@+id/group3"
android:checkableBehavior="single">
<item
android:id="@+id/nav_about_us"
android:checkable="true"
android:icon="@drawable/ic_info_black_24dp"
android:title="@string/nav_about_us" />
<item
android:id="@+id/nav_buy_pslab"
android:checkable="true"
android:icon="@drawable/ic_shopping_cart_black_24dp"
android:title="@string/nav_buy_pslab" />
<item
android:id="@+id/nav_help_feedback"
android:checkable="true"
android:icon="@drawable/ic_feedback_black_24dp"
android:title="@string/nav_help_feedback" />
<item
android:id="@+id/nav_share_app"
android:icon="@drawable/share_icon"
android:title="@string/nav_share"
/>
android:title="@string/nav_share" />
</group>

<item android:title="@string/other">
<menu>
<item
android:id="@+id/nav_help_feedback"
android:icon="@drawable/ic_feedback_black_24dp"
android:title="@string/nav_help_feedback"
android:checkable="true" />
<item
android:id="@+id/nav_about_us"
android:icon="@drawable/ic_info_black_24dp"
android:title="@string/nav_about_us"
android:checkable="true" />
<item
android:id="@+id/nav_report_us"
android:icon="@drawable/ic_bug_report_black_24dp"
android:title="@string/nav_report" />
<item
android:id="@+id/nav_app_version"
android:icon="@drawable/icon_version"
android:title="@string/version" />
</menu>
</item>
</menu>
17 changes: 10 additions & 7 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
<string name="Toast_double_tap">Press again to close PSLab</string>
<string name="Toast_magnetic_not_present">"The sensor required for this instrument is not present in your device"</string>

<string name="nav_device">Device</string>
<string name="nav_device">Connect Device</string>
<string name="nav_instruments">Instruments</string>
<string name="nav_settings">Settings</string>
<string name="nav_about_us">About Us</string>
<string name="nav_buy_pslab">Buy PSLab</string>
<string name="nav_report">Feedback &amp; Bugs</string>
<string name="nav_help_feedback">FAQs</string>
<string name="nav_help_feedback">FAQ</string>
<string name="nav_share">Share App</string>
<string name="nav_config">Generate Config File</string>
<string name="pslab_pinlayout">Pin Layout</string>
Expand Down Expand Up @@ -51,10 +52,14 @@

<string-array name="nav_item_activity_titles">
<item>Instruments</item>
<item>Device</item>
<item>Logged Data</item>
<item>Connect Device</item>
<item>Generate Config File</item>
<item>Settings</item>
<item>About Us</item>
<item>Buy PSLab</item>
<item>FAQs</item>
<item>Share App</item>
</string-array>

<string name="application_icon">Application Icon</string>
Expand Down Expand Up @@ -818,15 +823,13 @@
<string name="faq_question1">How can I use this application?</string>
<string name="faq_question2">What are the experiments I can perform?</string>
<string name="faq_question3">Where can I find the schematic for connections of the instruments?</string>
<string name="faq_question4">How can I design my own experiment and save it?</string>
<string name="faq_question5">Can I submit a change request for a particular instrument? If so, how?</string>
<string name="faq_question4">Can I submit a change request for a particular instrument? If so, how?</string>

<string name="answer">A:</string>
<string name="faq_answer1">Each instrument includes a bottomsheet guide which gets open when you slide up from the bottom of your screen. It includes all the necessary details to connect the device along a brief guide to use it.</string>
<string name="faq_answer2">The goal of PSLab is to create an Open Source hardware device (open on all layers) that can be used for experiments by teachers, students and citizen scientists. Our tiny pocket lab provides an array of sensors for doing science and engineering experiments. It provides functions of numerous measurement devices including an oscilloscope, a waveform generator, a frequency counter, a programmable voltage, current source and as a data logger. Hence, you can perform all kind of experiments using these devices.</string>
<string name="faq_answer3">The bottomsheet guide implemented in each instrument has all the schematics for the connection of the device.</string>
<string name="faq_answer4">Right now, we are not having an option to make and save custom experiments. But we will implement it soon.</string>
<string name="faq_answer5">You can submit your reviews, feature requests and feedback through our Feedback and Issues page.</string>
<string name="faq_answer4">You can submit your reviews, feature requests and feedback through our Feedback and Issues page.</string>

<string name="date_of_recording">DATE OF RECORDING</string>
<string name="time_of_recording">TIME OF RECORDING</string>
Expand Down