From 3ea1fb6153b097ae0911c25eacada9cf4e00e5bf Mon Sep 17 00:00:00 2001 From: Kunal Date: Mon, 20 Jan 2020 19:52:21 +0530 Subject: [PATCH] faq page added --- app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 37 ++--- .../io/neurolab/activities/FAQActivity.java | 139 ++++++++++++++++++ .../main/java/io/neurolab/main/NeuroLab.java | 3 + .../res/drawable/ic_feedback_black_24dp.xml | 9 ++ app/src/main/res/layout/activity_faq.xml | 18 +++ app/src/main/res/layout/list_group.xml | 45 ++++++ app/src/main/res/layout/list_item.xml | 35 +++++ .../main/res/menu/activity_main_drawer.xml | 5 + app/src/main/res/values/dimens.xml | 11 ++ app/src/main/res/values/strings.xml | 26 ++++ 11 files changed, 311 insertions(+), 18 deletions(-) create mode 100644 app/src/main/java/io/neurolab/activities/FAQActivity.java create mode 100644 app/src/main/res/drawable/ic_feedback_black_24dp.xml create mode 100644 app/src/main/res/layout/activity_faq.xml create mode 100644 app/src/main/res/layout/list_group.xml create mode 100644 app/src/main/res/layout/list_item.xml diff --git a/app/build.gradle b/app/build.gradle index 3cc160fc..1f148310 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -68,6 +68,7 @@ dependencies { exclude group: "commons-logging", module: "commons-logging" } // Test + implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation "junit:junit:$rootProject.junitVersion" androidTestImplementation "com.android.support.test:runner:$rootProject.testRunnerRulesVersion" androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 75ec43bd..bf77bebe 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,16 +3,6 @@ xmlns:tools="http://schemas.android.com/tools" package="io.neurolab"> - - - - - - - - - - - + + @@ -62,8 +54,8 @@ + android:configChanges="orientation|keyboardHidden" + android:parentActivityName=".main.NeuroLab" /> @@ -77,6 +69,10 @@ + + - - + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/io/neurolab/activities/FAQActivity.java b/app/src/main/java/io/neurolab/activities/FAQActivity.java new file mode 100644 index 00000000..5459f83b --- /dev/null +++ b/app/src/main/java/io/neurolab/activities/FAQActivity.java @@ -0,0 +1,139 @@ +package io.neurolab.activities; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.text.Html; +import android.text.method.LinkMovementMethod; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseExpandableListAdapter; +import android.widget.ExpandableListAdapter; +import android.widget.ExpandableListView; +import android.widget.TextView; + +import io.neurolab.R; + +public class FAQActivity extends AppCompatActivity { + + private String[] questions; + private String[][] answers; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_faq); + + questions = getResources().getStringArray(R.array.faq_questions); + + String[] ans = getResources().getStringArray(R.array.faq_answers); + answers = new String[ans.length][]; + for (int i = 0; i < ans.length; i++) { + answers[i] = new String[]{ans[i]}; + } + + ExpandableListView listView; + + listView = findViewById(R.id.expListView); + listView.setAdapter(new ExpandableListAdapter(questions, answers)); + listView.setGroupIndicator(null); + } + + public class ExpandableListAdapter extends BaseExpandableListAdapter { + + private final LayoutInflater inf; + private String[] questions; + private String[][] answers; + + public ExpandableListAdapter(String[] questions, String[][] answers) { + this.questions = questions; + this.answers = answers; + inf = LayoutInflater.from(getApplication()); + } + + @Override + public int getGroupCount() { + return questions.length; + } + + @Override + public int getChildrenCount(int questionPosition) { + return answers[questionPosition].length; + } + + @Override + public Object getGroup(int questionPosition) { + return questions[questionPosition]; + } + + @Override + public Object getChild(int questionPosition, int answerPosition) { + return answers[questionPosition][answerPosition]; + } + + @Override + public long getGroupId(int questionPosition) { + return questionPosition; + } + + @Override + public long getChildId(int questionPosition, int answerPosition) { + return answerPosition; + } + + @Override + public boolean hasStableIds() { + return true; + } + + @Override + public View getChildView(int questionPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { + + ViewHolder holder; + View v = convertView; + if (v == null) { + v = inf.inflate(R.layout.list_item, parent, false); + holder = new ViewHolder(); + + holder.text = (TextView) v.findViewById(R.id.lblListItem); + v.setTag(holder); + } else { + holder = (ViewHolder) v.getTag(); + } + + holder.text.setClickable(true); + holder.text.setMovementMethod(LinkMovementMethod.getInstance()); + holder.text.setText(Html.fromHtml(getChild(questionPosition, childPosition).toString())); + + return v; + } + + @Override + public View getGroupView(int questionPosition, boolean isExpanded, View convertView, ViewGroup parent) { + ViewHolder holder; + View v = convertView; + if (v == null) { + v = inf.inflate(R.layout.list_group, parent, false); + + holder = new ViewHolder(); + holder.text = (TextView) v.findViewById(R.id.lblListHeader); + v.setTag(holder); + } else { + holder = (ViewHolder) v.getTag(); + } + + holder.text.setText(getGroup(questionPosition).toString()); + + return v; + } + + @Override + public boolean isChildSelectable(int questionPosition, int answerPosition) { + return true; + } + + private class ViewHolder { + private TextView text; + } + } +} diff --git a/app/src/main/java/io/neurolab/main/NeuroLab.java b/app/src/main/java/io/neurolab/main/NeuroLab.java index 1863e091..10d4cb98 100644 --- a/app/src/main/java/io/neurolab/main/NeuroLab.java +++ b/app/src/main/java/io/neurolab/main/NeuroLab.java @@ -41,6 +41,7 @@ import io.neurolab.activities.AboutUsActivity; import io.neurolab.activities.DataLoggerActivity; import io.neurolab.activities.DeviceInstructionsActivity; +import io.neurolab.activities.FAQActivity; import io.neurolab.activities.FocusParentActivity; import io.neurolab.activities.MeditationHome; import io.neurolab.activities.MemoryGraphParent; @@ -368,6 +369,8 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) { startActivity(new Intent(this, SettingsActivity.class)); } else if (id == R.id.nav_about_us) { startActivity(new Intent(this, AboutUsActivity.class)); + } else if (id == R.id.nav_faq) { + startActivity(new Intent(this, FAQActivity.class)); } else if (id == R.id.nav_share) { startActivity(new Intent(this, ShareDataActivity.class)); } else if (id == R.id.nav_data_logger) { diff --git a/app/src/main/res/drawable/ic_feedback_black_24dp.xml b/app/src/main/res/drawable/ic_feedback_black_24dp.xml new file mode 100644 index 00000000..29f9baab --- /dev/null +++ b/app/src/main/res/drawable/ic_feedback_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_faq.xml b/app/src/main/res/layout/activity_faq.xml new file mode 100644 index 00000000..25ab5627 --- /dev/null +++ b/app/src/main/res/layout/activity_faq.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/list_group.xml b/app/src/main/res/layout/list_group.xml new file mode 100644 index 00000000..0167e3ef --- /dev/null +++ b/app/src/main/res/layout/list_group.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml new file mode 100644 index 00000000..89e78769 --- /dev/null +++ b/app/src/main/res/layout/list_item.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml index f37e7b8e..cce77fe6 100644 --- a/app/src/main/res/menu/activity_main_drawer.xml +++ b/app/src/main/res/menu/activity_main_drawer.xml @@ -44,6 +44,11 @@ android:icon="@drawable/ic_info" android:title="@string/about_us" /> + + 16dp 8dp 12dp + 15dp + 0dp + 14sp + 5dp + 10dp + 20dp + 20dp + 10dp + 17sp + 52dp + 52dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1c5ecf8e..5a29706d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -178,4 +178,30 @@ A difference to existing projects like OpenBCI is that it will not be necessary Enable received data display Send + FAQ + + Q: + + What is NeuroLab? What can I do with it? + Where can I download the desktop app for NeuroLab for Windows, Linux and Mac? + Do you have an iOS app for Apple devices? + How can I connect to the device? What kind of USB cable do I need? What is an OTG USB cable? + I found a bug in one of your apps or hardware. What to do? Where should I report it? + Can I record or save data in the apps and export or import it? + Who develops NeuroLab? When did you start it? What is the story behind it? + I found a mistake on the website, where can I submit the issue? + + + A: + + NeuroLab is a small USB powered hardware board that can be used for focus, meditation and in dealing with depression. It works as an extension for Android phones or PCs. + We are developing a desktop app for Windows, Linux and Mac in <a href = \"https://github.com/fossasia/neurolab">our desktop Git repository. You can find it in the install branch of the project here</a>. The app is still under development. We are using technologies like Electron and Python, that work on all platforms. However, to make the final installer work everywhere requires some tweaks and improvements here and there. So, please expect some glitches. You can use the tracker in the repository to submit issues, bugs and feature requests. + Unfortunately Apple has tight restrictions and controls users in a way that prevents them to connect other hardware to their own Apple devices. Many people argue that this is against the freedom of users. The majority of hardware producers are not able to provide options to connect their products with Apple devices. Apple in many cases simply does not permit non-Apple products to be connected with its phones, pads and other hardware. It is only sometimes possible after a long and expensive process, but even if we would try to go through such a process it is not sure, that it would be possible to get Apple’s cooperation to connect a Pocket Science Lab. Due to Apple’s restrictive policies and proprietary approach that restricts the freedom of users of Apple products we are not currently able to provide an iOS app. The community regularly discusses new approaches, but unfortunately we have not found a solution yet. Apple does not have an interest to support users due to its main objective of profit generation instead of allowing users to use their devices in a way that they want. Apple’s behavior is seen by some in a way that it restricts basic human rights and the freedom of people who happen to be users of Apple products. + To connect to the device you need an OTG USB cable (<a href = \"https://en.wikipedia.org/wiki/USB_On-The-Go\">OTG = On the go</a>) which is a USB cable that allows connected devices to switch back and forth between the roles of host and device. <u>USB cables that are not OTG compatible will NOT work</u>. It is also possible to extend the PSLab with an ESP WiFi chip or a Bluetooth chip and communicate through these gateways using the Android app. You can refer to the <a href = \"https://github.com/fossasia/pslab-hardware\">hardware developer documentation and code on GitHub for more details here</a>. + We have issue trackers in all our projects. They are currently hosted on GitHub. In order to submit a bug or feature request you need to login to the service. <a href = \"https://github.com/fossasia?utf8=%E2%9C%93&q=pslab\">A list of our PSLab repositories is here</a> (scroll down a bit, when you access this page). + Yes, we have implemented a record and play function or a way to save and open configurations in the instruments on the Android and desktop app. Data you record can be imported into the apps and viewed. This feature is still under heavy development, but works well in most places. You can find it in the top bar of the apps. There are buttons to record, play, save and open data. + NeuroLab is developed with a community at <a href = \"https://fossasia.org/\">FOSSASIA</a>. There are over 100 developers who have contributed to the project across different repositories. + We use issue trackers for most of our work. You can submit <a href = \"https://github.com/fossasia/neurolab-android/issues\">issues you find regarding the website on our issue tracker here</a>. + +