BVB Source Codes

android-viewflow Show AndroidVersionAdapter.java Source code

Return Download android-viewflow: download AndroidVersionAdapter.java Source code - Download android-viewflow Source code - Type:.java
  1. /*
  2.  * Copyright (C) 2011 Patrik 乲erfeldt
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */
  16. package org.taptwo.android.widget.viewflow.example;
  17.  
  18. import org.taptwo.android.widget.TitleProvider;
  19. import org.taptwo.android.widget.viewflow.example.R;
  20. import android.content.Context;
  21. import android.view.LayoutInflater;
  22. import android.view.View;
  23. import android.view.ViewGroup;
  24. import android.widget.BaseAdapter;
  25. import android.widget.TextView;
  26.  
  27. public class AndroidVersionAdapter extends BaseAdapter implements TitleProvider {
  28.  
  29.         private LayoutInflater mInflater;
  30.  
  31.         private static final String[] versions = {"1.5","1.6","2.1","2.2","2.3","3.0","x.y" };
  32.         private static final String[] names = {"Cupcake","Donut","Eclair","Froyo","Gingerbread","Honeycomb","IceCream Sandwich" };
  33.        
  34.         public AndroidVersionAdapter(Context context) {
  35.                 mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  36. }
  37.        
  38.         @Override
  39.         public int getCount() {
  40.                 return names.length;
  41.         }
  42.  
  43.         @Override
  44.         public Object getItem(int position) {
  45.                 return position;
  46.         }
  47.  
  48.         @Override
  49.         public long getItemId(int position) {
  50.                 return position;
  51.         }
  52.  
  53.         @Override
  54.         public View getView(int position, View convertView, ViewGroup parent) {
  55.                 if(convertView == null) {
  56.                         convertView = mInflater.inflate(R.layout.flow_item, null);
  57.                 }
  58.                 ((TextView) convertView.findViewById(R.id.textLabel)).setText(versions[position]);
  59.                 return convertView;
  60.         }
  61.  
  62.         /* (non-Javadoc)
  63.          * @see org.taptwo.android.widget.TitleProvider#getTitle(int)
  64.          */
  65.         @Override
  66.         public String getTitle(int position) {
  67.                 return names[position];
  68.         }
  69.  
  70. }
  71.  
downloadAndroidVersionAdapter.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