From 8efe4aa708a38e002bf6c7634a305e0806168188 Mon Sep 17 00:00:00 2001 From: Amr Hossam Date: Sun, 14 Jul 2024 22:10:08 +0300 Subject: [PATCH 01/52] Added a showcase MVP for Survey UI Signed-off-by: Amr Hossam --- .../io/request/survey/ObaSurveyRequest.java | 49 +++++ .../request/survey/SurveyRequestListener.java | 8 + .../io/request/survey/SurveyRequestTask.java | 34 ++++ .../android/ui/ArrivalsListFragment.java | 157 ++++++++++++++- .../android/ui/survey/SurveyUtils.java | 126 ++++++++++++ .../ui/survey/adapter/SurveyAdapter.kt | 74 +++++++ .../ui/survey/model/StudyResponse.java | 189 ++++++++++++++++++ .../background_radio_checked_background.xml | 8 + .../background_radio_unchecked_background.xml | 8 + .../src/main/res/drawable/check_circle_24.xml | 10 + .../main/res/drawable/round_custom_button.xml | 5 + .../survey_button_custom_background.xml | 4 + .../res/drawable/survey_custom_button.xml | 5 + .../main/res/drawable/uncheck_circle_24.xml | 10 + .../src/main/res/layout/item_survey.xml | 147 ++++++++++++++ .../main/res/layout/survey_questions_view.xml | 116 +++++++++++ .../src/main/res/values/donottranslate.xml | 3 + .../src/main/res/values/strings.xml | 5 + 18 files changed, 955 insertions(+), 3 deletions(-) create mode 100644 onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/ObaSurveyRequest.java create mode 100644 onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/SurveyRequestListener.java create mode 100644 onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/SurveyRequestTask.java create mode 100644 onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/SurveyUtils.java create mode 100644 onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/adapter/SurveyAdapter.kt create mode 100644 onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/model/StudyResponse.java create mode 100644 onebusaway-android/src/main/res/drawable/background_radio_checked_background.xml create mode 100644 onebusaway-android/src/main/res/drawable/background_radio_unchecked_background.xml create mode 100644 onebusaway-android/src/main/res/drawable/check_circle_24.xml create mode 100644 onebusaway-android/src/main/res/drawable/round_custom_button.xml create mode 100644 onebusaway-android/src/main/res/drawable/survey_button_custom_background.xml create mode 100644 onebusaway-android/src/main/res/drawable/survey_custom_button.xml create mode 100644 onebusaway-android/src/main/res/drawable/uncheck_circle_24.xml create mode 100644 onebusaway-android/src/main/res/layout/item_survey.xml create mode 100644 onebusaway-android/src/main/res/layout/survey_questions_view.xml diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/ObaSurveyRequest.java b/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/ObaSurveyRequest.java new file mode 100644 index 000000000..710766816 --- /dev/null +++ b/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/ObaSurveyRequest.java @@ -0,0 +1,49 @@ +package org.onebusaway.android.io.request.survey; + +import android.net.Uri; + +import androidx.annotation.NonNull; + +import org.onebusaway.android.R; +import org.onebusaway.android.app.Application; +import org.onebusaway.android.io.request.RequestBase; +import org.onebusaway.android.ui.survey.model.StudyResponse; + +import java.util.concurrent.Callable; + + +public final class ObaSurveyRequest extends RequestBase implements Callable { + + private ObaSurveyRequest(Uri uri) { + super(uri); + } + + public static class Builder { + + private static Uri URI = null; + + public Builder() { + String weatherAPIURL = Application.get().getResources().getString(R.string.survey_api_url); + URI = Uri.parse(weatherAPIURL); + } + + public ObaSurveyRequest build() { + return new ObaSurveyRequest(URI); + } + } + + public static ObaSurveyRequest newRequest() { + return new Builder().build(); + } + + @Override + public StudyResponse call() { + return call(StudyResponse.class); + } + + @NonNull + @Override + public String toString() { + return "ObaSurveyRequest [mUri=" + mUri + "]"; + } +} diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/SurveyRequestListener.java b/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/SurveyRequestListener.java new file mode 100644 index 000000000..505d103e6 --- /dev/null +++ b/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/SurveyRequestListener.java @@ -0,0 +1,8 @@ +package org.onebusaway.android.io.request.survey; + +import org.onebusaway.android.ui.survey.model.StudyResponse; + +public interface SurveyRequestListener { + void onSurveyResponseReceived(StudyResponse response); + void onSurveyFail(); +} \ No newline at end of file diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/SurveyRequestTask.java b/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/SurveyRequestTask.java new file mode 100644 index 000000000..16b2079c9 --- /dev/null +++ b/onebusaway-android/src/main/java/org/onebusaway/android/io/request/survey/SurveyRequestTask.java @@ -0,0 +1,34 @@ +package org.onebusaway.android.io.request.survey; + +import android.os.AsyncTask; +import android.util.Log; + +import org.onebusaway.android.ui.survey.model.StudyResponse; + +public class SurveyRequestTask extends AsyncTask { + private static final String TAG = "Survey Request"; + private SurveyRequestListener mListener; + + public SurveyRequestTask(SurveyRequestListener listener) { + mListener = listener; + } + + @Override + protected StudyResponse doInBackground(ObaSurveyRequest... requests) { + try { + return requests[0].call(); + } catch (Exception e) { + Log.e(TAG, "Error executing survey request", e); + return null; + } + } + + @Override + protected void onPostExecute(StudyResponse response) { + if (response != null) { + mListener.onSurveyResponseReceived(response); + } else { + mListener.onSurveyFail(); + } + } +} \ No newline at end of file diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListFragment.java b/onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListFragment.java index 13b275ebb..0e6c4d700 100644 --- a/onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListFragment.java +++ b/onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListFragment.java @@ -41,7 +41,9 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.WindowManager; import android.widget.Button; +import android.widget.ImageButton; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; @@ -54,7 +56,11 @@ import androidx.loader.app.LoaderManager; import androidx.loader.content.CursorLoader; import androidx.loader.content.Loader; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.bottomsheet.BottomSheetBehavior; +import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.firebase.analytics.FirebaseAnalytics; import org.onebusaway.android.R; @@ -70,10 +76,16 @@ import org.onebusaway.android.io.elements.Occupancy; import org.onebusaway.android.io.elements.OccupancyState; import org.onebusaway.android.io.request.ObaArrivalInfoResponse; +import org.onebusaway.android.io.request.survey.ObaSurveyRequest; +import org.onebusaway.android.io.request.survey.SurveyRequestListener; +import org.onebusaway.android.io.request.survey.SurveyRequestTask; import org.onebusaway.android.map.MapParams; import org.onebusaway.android.provider.ObaContract; import org.onebusaway.android.report.ui.InfrastructureIssueActivity; import org.onebusaway.android.travelbehavior.TravelBehaviorManager; +import org.onebusaway.android.ui.survey.SurveyUtils; +import org.onebusaway.android.ui.survey.adapter.SurveyAdapter; +import org.onebusaway.android.ui.survey.model.StudyResponse; import org.onebusaway.android.util.ArrayAdapterWithIcon; import org.onebusaway.android.util.ArrivalInfoUtils; import org.onebusaway.android.util.BuildFlavorUtils; @@ -94,9 +106,8 @@ // We don't use the ListFragment because the support library's version of // the ListFragment doesn't work well with our header. // -public class ArrivalsListFragment extends ListFragment - implements LoaderManager.LoaderCallbacks, - ArrivalsListHeader.Controller { +public class ArrivalsListFragment extends ListFragment implements LoaderManager.LoaderCallbacks, ArrivalsListHeader.Controller, + SurveyRequestListener { private static final String TAG = "ArrivalsListFragment"; @@ -134,6 +145,7 @@ public class ArrivalsListFragment extends ListFragment private ArrivalsListHeader mHeader; private View mHeaderView; + private View surveyHeaderView; private View mFooter; @@ -175,6 +187,8 @@ public class ArrivalsListFragment extends ListFragment private FirebaseAnalytics mFirebaseAnalytics; + private RecyclerView surveyRecycleView; + public interface Listener { /** @@ -284,6 +298,7 @@ public View onCreateView(LayoutInflater inflater, mFirebaseAnalytics = FirebaseAnalytics.getInstance(getContext()); initArrivalInfoViews(inflater); + initSurveyHeaderView(inflater); return inflater.inflate(R.layout.fragment_arrivals_list, null); } @@ -344,6 +359,8 @@ public void onActivityCreated(Bundle savedInstanceState) { UIUtils.getNoArrivalsMessage(getActivity(), getArrivalsLoader().getMinutesAfter(), false, false) ); + + requestSurveyData(); } @Override @@ -1752,4 +1769,138 @@ private Dialog createOccupancyDialog() { builder.setNeutralButton(R.string.main_help_close, (dialogInterface, i) -> dialogInterface.dismiss()); return builder.create(); } + + + @Override + public void onSurveyResponseReceived(StudyResponse response) { + setSurveyData(response); + } + + public void requestSurveyData() { + ObaSurveyRequest surveyRequest = ObaSurveyRequest.newRequest(); + SurveyRequestTask task = new SurveyRequestTask(this); + task.execute(surveyRequest); + Log.d(TAG, "Survey requested"); + } + + @Override + public void onSurveyFail() { + Log.d(TAG, "Survey Fail"); + } + + private void updateData(StudyResponse response) { + if (getView() == null || surveyHeaderView == null) return; + + ImageButton closeBtn = surveyHeaderView.findViewById(R.id.close_btn); + Button next = surveyHeaderView.findViewById(R.id.nextBtn); + closeBtn.setVisibility(View.VISIBLE); + next.setVisibility(View.VISIBLE); + + StudyResponse.Surveys.Questions heroQuestion = response.getSurveys().get(0).getQuestions().get(0); + String type = heroQuestion.getContent().getType(); + switch (type) { + case "radio": + SurveyUtils.showRadioGroupQuestion(getContext(), surveyHeaderView, heroQuestion); + break; + case "text": + SurveyUtils.showTextInputQuestion(getContext(), surveyHeaderView, heroQuestion); + break; + case "checkbox": + SurveyUtils.showCheckBoxQuestion(getContext(), surveyHeaderView, heroQuestion); + break; + case "label": + break; + } + + } + + + private void setSurveyData(StudyResponse studyResponse) { + if (getView() == null || studyResponse.getSurveys().isEmpty()) return; + updateData(studyResponse); + // Add the hero question to the arrival list header + getListView().addHeaderView(surveyHeaderView); + Button next = getView().findViewById(R.id.nextBtn); + List surveyQuestions = studyResponse.getSurveys().get(0).getQuestions(); + // Remove the hero question + surveyQuestions.remove(0); + next.setOnClickListener(view -> { + showAllSurveyQuestions(studyResponse); + initSurveyAdapter(surveyQuestions); + }); + + } + + private void initSurveyAdapter(List questions) { + SurveyAdapter surveyAdapter = new SurveyAdapter(requireContext(), questions); + surveyRecycleView.setAdapter(surveyAdapter); + } + + private void showAllSurveyQuestions(StudyResponse response) { + BottomSheetDialog bottomSheet = createBottomSheetDialog(); + setupBottomSheetContent(bottomSheet, response); + setupBottomSheetBehavior(bottomSheet); + setupCloseButton(bottomSheet); + bottomSheet.show(); + } + + private BottomSheetDialog createBottomSheetDialog() { + BottomSheetDialog bottomSheet = new BottomSheetDialog(requireContext()); + bottomSheet.setContentView(R.layout.survey_questions_view); + return bottomSheet; + } + + private void setupBottomSheetContent(BottomSheetDialog bottomSheet, StudyResponse response) { + if (response == null || response.getSurveys() == null || response.getSurveys().isEmpty()) { + return; + } + + StudyResponse.Surveys firstSurvey = response.getSurveys().get(0); + if (firstSurvey == null || firstSurvey.getStudy() == null) { + return; + } + + surveyRecycleView = bottomSheet.findViewById(R.id.recycleView); + TextView surveyTitle = bottomSheet.findViewById(R.id.surveyTitle); + TextView surveyDescription = bottomSheet.findViewById(R.id.surveyDescription); + + if (surveyTitle != null) { + surveyTitle.setText(firstSurvey.getStudy().getName()); + } + if (surveyDescription != null) { + surveyDescription.setText(firstSurvey.getStudy().getDescription()); + } + if (surveyRecycleView != null) { + surveyRecycleView.setLayoutManager(new LinearLayoutManager(getContext())); + } + } + + + private void setupBottomSheetBehavior(BottomSheetDialog bottomSheet) { + bottomSheet.setOnShowListener(dialog -> { + BottomSheetDialog bottomSheetDialog = (BottomSheetDialog) dialog; + View parentLayout = bottomSheetDialog.findViewById(com.google.android.material.R.id.design_bottom_sheet); + if (parentLayout != null) { + BottomSheetBehavior behavior = BottomSheetBehavior.from(parentLayout); + ViewGroup.LayoutParams layoutParams = parentLayout.getLayoutParams(); + layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT; + parentLayout.setLayoutParams(layoutParams); + behavior.setState(BottomSheetBehavior.STATE_EXPANDED); + } + }); + } + + private void setupCloseButton(BottomSheetDialog bottomSheet) { + ImageButton closeBtn = bottomSheet.findViewById(R.id.close_btn); + if (closeBtn != null) { + closeBtn.setOnClickListener(v -> bottomSheet.dismiss()); + } + } + + + void initSurveyHeaderView(LayoutInflater inflater) { + surveyHeaderView = inflater.inflate(R.layout.item_survey, null); + } + + } diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/SurveyUtils.java b/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/SurveyUtils.java new file mode 100644 index 000000000..7a35b659b --- /dev/null +++ b/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/SurveyUtils.java @@ -0,0 +1,126 @@ +package org.onebusaway.android.ui.survey; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.util.TypedValue; +import android.view.View; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; + +import org.onebusaway.android.R; +import org.onebusaway.android.ui.survey.model.StudyResponse; + +import java.util.ArrayList; +import java.util.List; + +public class SurveyUtils { + + public static void showRadioGroupQuestion(Context ctx, View view, StudyResponse.Surveys.Questions question) { + TextView surveyTitle = view.findViewById(R.id.survey_question_tv); + RadioGroup radio = view.findViewById(R.id.radioGroup); + radio.setVisibility(View.VISIBLE); + for (int i = 0; i < question.getContent().getOptions().size(); ++i) { + RadioButton radioButton = createRadioButton(ctx, question, i); + radio.addView(radioButton); + } + surveyTitle.setText(question.getContent().getLabel_text()); + } + + + public static void showCheckBoxQuestion(Context ctx, View view, StudyResponse.Surveys.Questions question) { + LinearLayout checkboxContainer = view.findViewById(R.id.checkBoxContainer); + TextView checkBoxLabel = view.findViewById(R.id.checkBoxLabel); + checkBoxLabel.setVisibility(View.VISIBLE); + + for (String item : question.getContent().getOptions()) { + CheckBox checkBox = createCheckBox(ctx, question, question.getContent().getOptions().indexOf(item)); + checkBox.setText(item); + checkBox.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); + checkboxContainer.addView(checkBox); + } + } + + public static void showTextInputQuestion(Context ctx, View view, StudyResponse.Surveys.Questions question) { + EditText lableEditText = view.findViewById(R.id.editText); + lableEditText.setVisibility(View.VISIBLE); + + } + + @NonNull + private static T createButton(Context ctx, StudyResponse.Surveys.Questions question, int position, Class buttonClass) { + T button; + try { + button = buttonClass.getDeclaredConstructor(Context.class).newInstance(ctx); + } catch (Exception e) { + throw new RuntimeException("Error creating button instance", e); + } + + button.setText(question.getContent().getOptions().get(position)); + button.setId(position); + + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); + int marginInDp = 4, paddingInDp = 4; + + // Set margin + float scale = ctx.getResources().getDisplayMetrics().density; + int marginInPx = (int) (marginInDp * scale + 0.5f); + params.setMargins(0, marginInPx, 0, marginInPx); + + // Set padding + int paddingInPx = (int) (paddingInDp * scale + 0.5f); + int extraPadding = (int) ((paddingInDp + 2) * scale + 0.5f); + button.setPadding(paddingInPx + extraPadding, paddingInPx, paddingInPx, paddingInPx); + button.setLayoutParams(params); + + // Remove default button drawable + button.setButtonDrawable(null); + + // Set custom drawable to the right + Drawable customCheckIcon = ContextCompat.getDrawable(ctx, R.drawable.survey_custom_button); + if (customCheckIcon != null) { + customCheckIcon.setBounds(0, 0, customCheckIcon.getIntrinsicWidth(), customCheckIcon.getIntrinsicHeight()); + } + button.setCompoundDrawablesWithIntrinsicBounds(null, null, customCheckIcon, null); + + // Change button text size + button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); + + // Set custom background for the drawable + button.setBackgroundResource(R.drawable.survey_button_custom_background); + + return button; + } + + @NonNull + private static RadioButton createRadioButton(Context ctx, StudyResponse.Surveys.Questions question, int position) { + return createButton(ctx, question, position, RadioButton.class); + } + + @NonNull + private static CheckBox createCheckBox(Context ctx, StudyResponse.Surveys.Questions question, int position) { + return createButton(ctx, question, position, CheckBox.class); + } + + private static List getSelectedCheckBoxes(LinearLayout container) { + List selectedItems = new ArrayList<>(); + for (int i = 0; i < container.getChildCount(); i++) { + if (container.getChildAt(i) instanceof CheckBox) { + CheckBox checkBox = (CheckBox) container.getChildAt(i); + if (checkBox.isChecked()) { + selectedItems.add(checkBox.getText().toString()); + } + } + } + return selectedItems; + } + + +} diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/adapter/SurveyAdapter.kt b/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/adapter/SurveyAdapter.kt new file mode 100644 index 000000000..d2db9b04f --- /dev/null +++ b/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/adapter/SurveyAdapter.kt @@ -0,0 +1,74 @@ +package org.onebusaway.android.ui.survey.adapter + +import android.content.Context +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.EditText +import android.widget.LinearLayout +import android.widget.RadioGroup +import android.widget.TextView +import androidx.cardview.widget.CardView +import androidx.core.content.ContextCompat +import androidx.recyclerview.widget.RecyclerView +import org.onebusaway.android.R +import org.onebusaway.android.ui.survey.SurveyUtils +import org.onebusaway.android.ui.survey.model.StudyResponse + + +class SurveyAdapter( + private val context:Context, + private val surveyQuestions: MutableList +) : RecyclerView.Adapter() { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SurveyViewHolder { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_survey, parent, false) + return SurveyViewHolder(view) + } + + override fun onBindViewHolder(holder: SurveyViewHolder, position: Int) { + val surveyQuestion = surveyQuestions[position] + holder.bind(surveyQuestion) + } + + override fun getItemCount(): Int = surveyQuestions.size + + inner class SurveyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + private val surveyQuestionTv: TextView = itemView.findViewById(R.id.survey_question_tv) + private val editText: EditText = itemView.findViewById(R.id.editText) + private val radioGroup: RadioGroup = itemView.findViewById(R.id.radioGroup) + private val checkBox: LinearLayout = itemView.findViewById(R.id.checkBoxContainer) + private val surveyCard : CardView = itemView.findViewById(R.id.surveyCard) + private val checkBoxLabel : TextView = itemView.findViewById(R.id.checkBoxLabel) + + fun bind(surveyQuestion: StudyResponse.Surveys.Questions) { + + surveyQuestionTv.text = surveyQuestion.content.label_text + checkBoxLabel.visibility = View.GONE + when (surveyQuestion.content.type) { + "text" -> { + SurveyUtils.showTextInputQuestion(context, itemView, surveyQuestion) + setVisibility(editText, radioGroup, checkBox, editTextVisible = true, radioGroupVisible = false, checkBoxVisible = false) + } + "radio" -> { + SurveyUtils.showRadioGroupQuestion(context, itemView, surveyQuestion) + setVisibility(editText, radioGroup, checkBox, editTextVisible = false, radioGroupVisible = true, checkBoxVisible = false) + } + "checkbox" -> { + SurveyUtils.showCheckBoxQuestion(context, itemView, surveyQuestion) + setVisibility(editText, radioGroup, checkBox, editTextVisible = false, radioGroupVisible = false, checkBoxVisible = true) + } + "label" -> { + surveyCard.setCardBackgroundColor(ContextCompat.getColor(context, R.color.quantum_yellow50)) + setVisibility(editText, radioGroup, checkBox, editTextVisible = false, radioGroupVisible = false, checkBoxVisible = false) + } + } + + } + } + fun setVisibility(editText: View, radioGroup: View, checkBox: View, editTextVisible: Boolean, radioGroupVisible: Boolean, checkBoxVisible: Boolean) { + editText.visibility = if (editTextVisible) View.VISIBLE else View.GONE + radioGroup.visibility = if (radioGroupVisible) View.VISIBLE else View.GONE + checkBox.visibility = if (checkBoxVisible) View.VISIBLE else View.GONE + } +} diff --git a/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/model/StudyResponse.java b/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/model/StudyResponse.java new file mode 100644 index 000000000..1b3ec8dca --- /dev/null +++ b/onebusaway-android/src/main/java/org/onebusaway/android/ui/survey/model/StudyResponse.java @@ -0,0 +1,189 @@ +package org.onebusaway.android.ui.survey.model; + +import java.io.Serializable; +import java.lang.Integer; +import java.lang.String; +import java.util.List; + +public class StudyResponse implements Serializable { + private List surveys; + + private Region region; + + public List getSurveys() { + return this.surveys; + } + + public void setSurveys(List surveys) { + this.surveys = surveys; + } + + public Region getRegion() { + return this.region; + } + + public void setRegion(Region region) { + this.region = region; + } + + public static class Surveys implements Serializable { + private Study study; + + private String name; + + private List questions; + + private String created_at; + + private Integer id; + + public Study getStudy() { + return this.study; + } + + public void setStudy(Study study) { + this.study = study; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public List getQuestions() { + return this.questions; + } + + + + public String getCreated_at() { + return this.created_at; + } + + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public static class Study implements Serializable { + private String name; + + private String description; + + private Integer id; + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + } + + public static class Questions implements Serializable { + private Integer id; + + private Integer position; + + private Content content; + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getPosition() { + return this.position; + } + + public void setPosition(Integer position) { + this.position = position; + } + + public Content getContent() { + return this.content; + } + + public void setContent(Content content) { + this.content = content; + } + + public static class Content implements Serializable { + private String label_text; + + private List options; + + private String type; + + public String getLabel_text() { + return this.label_text; + } + + public List getOptions() { + return this.options; + } + + public void setOptions(List options) { + this.options = options; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + } + } + } + + public static class Region implements Serializable { + private String name; + + private Integer id; + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + } +} diff --git a/onebusaway-android/src/main/res/drawable/background_radio_checked_background.xml b/onebusaway-android/src/main/res/drawable/background_radio_checked_background.xml new file mode 100644 index 000000000..a32de6108 --- /dev/null +++ b/onebusaway-android/src/main/res/drawable/background_radio_checked_background.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/onebusaway-android/src/main/res/drawable/background_radio_unchecked_background.xml b/onebusaway-android/src/main/res/drawable/background_radio_unchecked_background.xml new file mode 100644 index 000000000..8d6371434 --- /dev/null +++ b/onebusaway-android/src/main/res/drawable/background_radio_unchecked_background.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/onebusaway-android/src/main/res/drawable/check_circle_24.xml b/onebusaway-android/src/main/res/drawable/check_circle_24.xml new file mode 100644 index 000000000..1fabee38c --- /dev/null +++ b/onebusaway-android/src/main/res/drawable/check_circle_24.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/onebusaway-android/src/main/res/drawable/round_custom_button.xml b/onebusaway-android/src/main/res/drawable/round_custom_button.xml new file mode 100644 index 000000000..7f1d39463 --- /dev/null +++ b/onebusaway-android/src/main/res/drawable/round_custom_button.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/onebusaway-android/src/main/res/drawable/survey_button_custom_background.xml b/onebusaway-android/src/main/res/drawable/survey_button_custom_background.xml new file mode 100644 index 000000000..4f9cb22cb --- /dev/null +++ b/onebusaway-android/src/main/res/drawable/survey_button_custom_background.xml @@ -0,0 +1,4 @@ + + + + diff --git a/onebusaway-android/src/main/res/drawable/survey_custom_button.xml b/onebusaway-android/src/main/res/drawable/survey_custom_button.xml new file mode 100644 index 000000000..582a03c16 --- /dev/null +++ b/onebusaway-android/src/main/res/drawable/survey_custom_button.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/onebusaway-android/src/main/res/drawable/uncheck_circle_24.xml b/onebusaway-android/src/main/res/drawable/uncheck_circle_24.xml new file mode 100644 index 000000000..a4a81b1c6 --- /dev/null +++ b/onebusaway-android/src/main/res/drawable/uncheck_circle_24.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/onebusaway-android/src/main/res/layout/item_survey.xml b/onebusaway-android/src/main/res/layout/item_survey.xml new file mode 100644 index 000000000..9b92a0181 --- /dev/null +++ b/onebusaway-android/src/main/res/layout/item_survey.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + +