QuestionnaireView


Source link: https://github.com/alfredayibonte/QuestionnaireView

QuestionnaireView

A simple view to be able to display question and various field (Radio, EditText, checkbox ) for answers

Including in your project

allprojects {
  repositories {

maven {
 url 'https://jitpack.io' 
}
  
}
 
}
 dependencies {
  compile 'com.github.alfredayibonte:QuestionnaireView:0.1.1' 
}

Usage

public class MainActivity extends AppCompatActivity implements

RadioListAdapter.OnRadioItemClickListener {

@Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

QuestionnaireView questionnaireView = (QuestionnaireView)findViewById(R.id.questionnaire);

questionnaireView.setQuestion("What is the name of this library ?");

questionnaireView.setViewType(AnswerType.RADIO);

CharSequence[] answers = new CharSequence[]{

 "Questionnaire", "QuestionnaireView", "Question"
}
;

questionnaireView.setAnswers(answers);

questionnaireView.addRadioItemListener(this);

  
}

@Override
  public void onRadioItemClick(List<Answer> answers) {

Log.e("radio answers: ", answers.toString());

  
}
 
}
public class MainActivity extends AppCompatActivity implements TextWatcher {

@Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

QuestionnaireView questionnaireView = (QuestionnaireView)findViewById(R.id.questionnaire);

questionnaireView.setQuestion("<h1 style='color: red;'>What is the name of this library ?</h1>");

questionnaireView.setViewType(AnswerType.EDITTEXT);

questionnaireView.addTextChangedListener(this);

  
}

@Override
  public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
  public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

Log.e(MainActivity.class.getSimpleName(), charSequence.toString());

  
}

@Override
  public void afterTextChanged(Editable editable) {

}
 
}

APIs offered by QuestionnaireView.

APIs Usage
setQuestion(String text) Set the question on a webview
setViewType(int viewType) Set the viewType to either RADIO, EDITTEXT or CHECKLIST
addRadioItemListener(OnRadioItemClickListener listener) Sets a listener for radioButton
addCheckItemListener(OnCheckItemClickListener listener) Sets a listener for check list
addOnEditorActionListener(OnEditorActionListener listener) Sets a listener for EditText
addTextChangedListener(TextWatcher watcher) Sets a watcher for EditText
setAnswers(CharSequence[] answers) Sets all possible answers for radio and checklist

Resources

A helper class to write files in external android storage.

Android library for streamlining SharedPreferences.

A very simple color picker.

Android ImageViews animated by Ken Burns Effect.

Provides the Floating Action Button Toolbar as specified in the Material Design Guide in a simple library.

Emmet is an protocol based data-transfer for Android Wear.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes