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

Lollipop ViewAnimationUtils.createCircularReveal for everyone 2.3+

Android specific bindings for RxJava.

This module adds a number of classes to RxJava that make writing reactive components in Android applications easy and hassle free.

String operators for RxJava.

advanced-textview is a companion app for Advanced Android TextView talk, demonstrating:

  • Animated CompoundDrawable
  • Text shadow
  • Custom font
  • Gradient text
  • Patterned text
  • HTML.fromHtml()
  • setFontFeatureSettings()
  • Styled string
  • AlignmentSpan
  • ClickableSpan
  • Rainbow span, animated
  • Lined paper
  • Emoji

Views and Drawable for animated GIFs in Android.

Bundled GIFLib via JNI is used to render frames. This way should be more efficient than WebView or Movie classes.
Animation starts automatically and run only if View with attached GifDrawable is visible.

Gradle plugin for Android which lets you use Java generics in your XML layouts.

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