BVB Source Codes

android-viewflow Show DiffAdapter.java Source code

Return Download android-viewflow: download DiffAdapter.java Source code - Download android-viewflow Source code - Type:.java
  1. package org.taptwo.android.widget.viewflow.example;
  2.  
  3. import org.taptwo.android.widget.TitleProvider;
  4.  
  5. import android.content.Context;
  6. import android.view.LayoutInflater;
  7. import android.view.View;
  8. import android.view.ViewGroup;
  9. import android.widget.BaseAdapter;
  10.  
  11. public class DiffAdapter extends BaseAdapter implements TitleProvider {
  12.  
  13.         private static final int VIEW1 = 0;
  14.         private static final int VIEW2 = 1;
  15.         private static final int VIEW_MAX_COUNT = VIEW2 + 1;
  16.         private final String[] names = {"View1","View2"};
  17.  
  18.     private LayoutInflater mInflater;
  19.  
  20.     public DiffAdapter(Context context) {
  21.         mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  22.     }
  23.  
  24.     @Override
  25.     public int getItemViewType(int position) {
  26.         return position;
  27.     }
  28.  
  29.     @Override
  30.     public int getViewTypeCount() {
  31.         return VIEW_MAX_COUNT;
  32.     }
  33.  
  34.     @Override
  35.     public int getCount() {
  36.         return 2;
  37.     }
  38.  
  39.     @Override
  40.     public Object getItem(int position) {
  41.         return position;
  42.     }
  43.  
  44.     @Override
  45.     public long getItemId(int position) {
  46.         return position;
  47.     }
  48.  
  49.     @Override
  50.     public View getView(int position, View convertView, ViewGroup parent) {
  51.         int view = getItemViewType(position);
  52.         if (convertView == null) {
  53.             switch (view) {
  54.                 case VIEW1:
  55.                     convertView = mInflater.inflate(R.layout.diff_view1, null);
  56.                     break;
  57.                 case VIEW2:
  58.                     convertView = mInflater.inflate(R.layout.diff_view2, null);
  59.                     break;
  60.             }
  61.         }
  62.         return convertView;
  63.     }
  64.  
  65.  
  66.  
  67.     /* (non-Javadoc)
  68.          * @see org.taptwo.android.widget.TitleProvider#getTitle(int)
  69.          */
  70.         public String getTitle(int position) {
  71.                 return names[position];
  72.         }
  73.  
  74. }
  75.  
downloadDiffAdapter.java Source code - Download android-viewflow Source code
Related Source Codes/Software:
onionshare - Securely and anonymously share a file of any size ... 2017-04-16
Android-ItemTouchHelper-Demo - Basic example of using ItemTouchHelper to add drag... 2017-04-16
later - A javascript library for defining recurring schedu... 2017-04-16
x64dbg - An open-source x64/x32 debugger for windows. ... 2017-04-16
pencil - Multiplatform GUI Prototyping/Wireframing 2017-04-16
css-in-js - React: CSS in JS techniques comparison. 2017-04-16
st2 - StackStorm (aka IFTTT for Ops) is event-driven aut... 2017-04-16
WNXHuntForCity - City find By Objective - C 2017-04-16
tmate - Instant Terminal Sharing ht... 2017-04-16
dat.gui - dat.gui is a lightweight controller library for Ja... 2017-04-16
EventStore - The open-source, functional database with Complex ... 2017-04-23
screencat - 2017-04-23
viz.js - A hack to put Graphviz on the web. ... 2017-04-23
JKeyboardPanelSwitch - For resolve the layout conflict when keybord & amp... 2017-04-23
mama2 - Mother plan - all firewood high flame 2017-04-23
BlurEffectForAndroidDesign - Sample to show how to implement blur graphical tri... 2017-04-23
sphinx_rtd_theme - Sphinx theme for readthedocs.org 2017-04-23
rouge - A pure-ruby code highlighter that is compatible wi... 2017-04-23
spring-security-oauth - Support for adding OAuth1(a) and OAuth2 features (... 2017-04-23
Toucan - Fabulous Image Processing in Swift 2017-04-23

 Back to top