diff options
Diffstat (limited to 'libraries/pinned-section-listview/example')
18 files changed, 0 insertions, 446 deletions
diff --git a/libraries/pinned-section-listview/example/AndroidManifest.xml b/libraries/pinned-section-listview/example/AndroidManifest.xml deleted file mode 100644 index 56621893d..000000000 --- a/libraries/pinned-section-listview/example/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.hb.examples.pinnedsection" - android:versionCode="1" - android:versionName="1.0" > - - <uses-sdk - android:minSdkVersion="8" - android:targetSdkVersion="19" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@style/AppTheme" > - - <activity - android:name="com.hb.examples.PinnedSectionListActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> - -</manifest>
\ No newline at end of file diff --git a/libraries/pinned-section-listview/example/assets/.gitignore b/libraries/pinned-section-listview/example/assets/.gitignore deleted file mode 100644 index fdffa2a0f..000000000 --- a/libraries/pinned-section-listview/example/assets/.gitignore +++ /dev/null @@ -1 +0,0 @@ -# placeholder diff --git a/libraries/pinned-section-listview/example/ic_launcher-web.png b/libraries/pinned-section-listview/example/ic_launcher-web.png Binary files differdeleted file mode 100644 index 8bd40412e..000000000 --- a/libraries/pinned-section-listview/example/ic_launcher-web.png +++ /dev/null diff --git a/libraries/pinned-section-listview/example/libs/android-support-v4.jar b/libraries/pinned-section-listview/example/libs/android-support-v4.jar Binary files differdeleted file mode 100644 index 65ebaf8dc..000000000 --- a/libraries/pinned-section-listview/example/libs/android-support-v4.jar +++ /dev/null diff --git a/libraries/pinned-section-listview/example/proguard-project.txt b/libraries/pinned-section-listview/example/proguard-project.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/libraries/pinned-section-listview/example/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/libraries/pinned-section-listview/example/project.properties b/libraries/pinned-section-listview/example/project.properties deleted file mode 100644 index 1561d7a9a..000000000 --- a/libraries/pinned-section-listview/example/project.properties +++ /dev/null @@ -1,15 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-17 -android.library.reference.1=../library diff --git a/libraries/pinned-section-listview/example/res/drawable-hdpi/ic_launcher.png b/libraries/pinned-section-listview/example/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 3841c3408..000000000 --- a/libraries/pinned-section-listview/example/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/libraries/pinned-section-listview/example/res/drawable-mdpi/ic_launcher.png b/libraries/pinned-section-listview/example/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index e65953cce..000000000 --- a/libraries/pinned-section-listview/example/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/libraries/pinned-section-listview/example/res/drawable-xhdpi/ic_launcher.png b/libraries/pinned-section-listview/example/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 4ea093d86..000000000 --- a/libraries/pinned-section-listview/example/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/libraries/pinned-section-listview/example/res/drawable-xxhdpi/ic_launcher.png b/libraries/pinned-section-listview/example/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 87e928a35..000000000 --- a/libraries/pinned-section-listview/example/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/libraries/pinned-section-listview/example/res/layout/activity_main.xml b/libraries/pinned-section-listview/example/res/layout/activity_main.xml deleted file mode 100644 index b641f4c80..000000000 --- a/libraries/pinned-section-listview/example/res/layout/activity_main.xml +++ /dev/null @@ -1,8 +0,0 @@ -<com.hb.views.PinnedSectionListView xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@android:id/list" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:headerDividersEnabled="false" - android:footerDividersEnabled="false" - android:divider="@null" - />
\ No newline at end of file diff --git a/libraries/pinned-section-listview/example/res/menu/main.xml b/libraries/pinned-section-listview/example/res/menu/main.xml deleted file mode 100644 index 091b6c770..000000000 --- a/libraries/pinned-section-listview/example/res/menu/main.xml +++ /dev/null @@ -1,27 +0,0 @@ -<menu xmlns:android="http://schemas.android.com/apk/res/android" > - - <item - android:id="@+id/action_fastscroll" - android:showAsAction="never" - android:title="@string/action_fastscroll" - android:checkable="true"/> - - <item - android:id="@+id/action_addpadding" - android:showAsAction="never" - android:title="@string/action_addpadding" - android:checkable="true"/> - - <item - android:id="@+id/action_showShadow" - android:showAsAction="never" - android:title="@string/action_showShadow" - android:checkable="true"/> - - <item - android:id="@+id/action_showHeaderAndFooter" - android:showAsAction="never" - android:title="@string/action_showHeaderAndFooter" - android:checkable="true"/> - -</menu>
\ No newline at end of file diff --git a/libraries/pinned-section-listview/example/res/values-v11/styles.xml b/libraries/pinned-section-listview/example/res/values-v11/styles.xml deleted file mode 100644 index 541752f6e..000000000 --- a/libraries/pinned-section-listview/example/res/values-v11/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ -<resources> - - <!-- - Base application theme for API 11+. This theme completely replaces - AppBaseTheme from res/values/styles.xml on API 11+ devices. - --> - <style name="AppBaseTheme" parent="android:Theme.Holo.Light"> - <!-- API 11 theme customizations can go here. --> - </style> - -</resources>
\ No newline at end of file diff --git a/libraries/pinned-section-listview/example/res/values-v14/styles.xml b/libraries/pinned-section-listview/example/res/values-v14/styles.xml deleted file mode 100644 index f20e01501..000000000 --- a/libraries/pinned-section-listview/example/res/values-v14/styles.xml +++ /dev/null @@ -1,12 +0,0 @@ -<resources> - - <!-- - Base application theme for API 14+. This theme completely replaces - AppBaseTheme from BOTH res/values/styles.xml and - res/values-v11/styles.xml on API 14+ devices. - --> - <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> - <!-- API 14 theme customizations can go here. --> - </style> - -</resources>
\ No newline at end of file diff --git a/libraries/pinned-section-listview/example/res/values/colors.xml b/libraries/pinned-section-listview/example/res/values/colors.xml deleted file mode 100644 index b4da27c93..000000000 --- a/libraries/pinned-section-listview/example/res/values/colors.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <color name="red_light">#ffff4444</color> - <color name="green_light">#ff99cc00</color> - <color name="orange_light">#ffffbb33</color> - <color name="blue_light">#ff33b5e5</color> - - <!-- Went to: $android-sdk > Android:v14 > res > values > colors.xml and copied the colors--> - -</resources>
\ No newline at end of file diff --git a/libraries/pinned-section-listview/example/res/values/strings.xml b/libraries/pinned-section-listview/example/res/values/strings.xml deleted file mode 100644 index e9d43a4aa..000000000 --- a/libraries/pinned-section-listview/example/res/values/strings.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <string name="app_name">Pinned Section Demo</string> - <string name="action_fastscroll">Fast scroll</string> - <string name="action_addpadding">Add padding</string> - <string name="action_showShadow">Show shadow</string> - <string name="action_showHeaderAndFooter">Show Header & Footer</string> - -</resources>
\ No newline at end of file diff --git a/libraries/pinned-section-listview/example/res/values/styles.xml b/libraries/pinned-section-listview/example/res/values/styles.xml deleted file mode 100644 index 4a10ca492..000000000 --- a/libraries/pinned-section-listview/example/res/values/styles.xml +++ /dev/null @@ -1,20 +0,0 @@ -<resources> - - <!-- - Base application theme, dependent on API level. This theme is replaced - by AppBaseTheme from res/values-vXX/styles.xml on newer devices. - --> - <style name="AppBaseTheme" parent="android:Theme.Light"> - <!-- - Theme customizations available in newer API levels can go in - res/values-vXX/styles.xml, while customizations related to - backward-compatibility can go here. - --> - </style> - - <!-- Application theme. --> - <style name="AppTheme" parent="AppBaseTheme"> - <!-- All customizations that are NOT specific to a particular API-level can go here. --> - </style> - -</resources>
\ No newline at end of file diff --git a/libraries/pinned-section-listview/example/src/com/hb/examples/PinnedSectionListActivity.java b/libraries/pinned-section-listview/example/src/com/hb/examples/PinnedSectionListActivity.java deleted file mode 100644 index 223718a06..000000000 --- a/libraries/pinned-section-listview/example/src/com/hb/examples/PinnedSectionListActivity.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (C) 2013 Sergej Shafarenka, halfbit.de - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hb.examples; - -import java.util.Locale; - -import android.annotation.SuppressLint; -import android.app.ListActivity; -import android.content.Context; -import android.graphics.Color; -import android.os.Build; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.SectionIndexer; -import android.widget.TextView; -import android.widget.Toast; - -import com.hb.examples.pinnedsection.R; -import com.hb.views.PinnedSectionListView; -import com.hb.views.PinnedSectionListView.PinnedSectionListAdapter; - -public class PinnedSectionListActivity extends ListActivity implements OnClickListener { - - static class SimpleAdapter extends ArrayAdapter<Item> implements PinnedSectionListAdapter { - - private static final int[] COLORS = new int[] { - R.color.green_light, R.color.orange_light, - R.color.blue_light, R.color.red_light }; - - public SimpleAdapter(Context context, int resource, int textViewResourceId) { - super(context, resource, textViewResourceId); - - final int sectionsNumber = 'Z' - 'A' + 1; - prepareSections(sectionsNumber); - - int sectionPosition = 0, listPosition = 0; - for (char i=0; i<sectionsNumber; i++) { - Item section = new Item(Item.SECTION, String.valueOf((char)('A' + i))); - section.sectionPosition = sectionPosition; - section.listPosition = listPosition++; - onSectionAdded(section, sectionPosition); - add(section); - - final int itemsNumber = (int) Math.abs((Math.cos(2f*Math.PI/3f * sectionsNumber / (i+1f)) * 25f)); - for (int j=0;j<itemsNumber;j++) { - Item item = new Item(Item.ITEM, section.text.toUpperCase(Locale.ENGLISH) + " - " + j); - item.sectionPosition = sectionPosition; - item.listPosition = listPosition++; - add(item); - } - - sectionPosition++; - } - } - - protected void prepareSections(int sectionsNumber) { } - protected void onSectionAdded(Item section, int sectionPosition) { } - - @Override public View getView(int position, View convertView, ViewGroup parent) { - TextView view = (TextView) super.getView(position, convertView, parent); - view.setTextColor(Color.DKGRAY); - view.setTag("" + position); - Item item = getItem(position); - if (item.type == Item.SECTION) { - //view.setOnClickListener(PinnedSectionListActivity.this); - view.setBackgroundColor(parent.getResources().getColor(COLORS[item.sectionPosition % COLORS.length])); - } - return view; - } - - @Override public int getViewTypeCount() { - return 2; - } - - @Override public int getItemViewType(int position) { - return getItem(position).type; - } - - @Override - public boolean isItemViewTypePinned(int viewType) { - return viewType == Item.SECTION; - } - - } - - static class FastScrollAdapter extends SimpleAdapter implements SectionIndexer { - - private Item[] sections; - - public FastScrollAdapter(Context context, int resource, int textViewResourceId) { - super(context, resource, textViewResourceId); - } - - @Override protected void prepareSections(int sectionsNumber) { - sections = new Item[sectionsNumber]; - } - - @Override protected void onSectionAdded(Item section, int sectionPosition) { - sections[sectionPosition] = section; - } - - @Override public Item[] getSections() { - return sections; - } - - @Override public int getPositionForSection(int section) { - if (section >= sections.length) { - section = sections.length - 1; - } - return sections[section].listPosition; - } - - @Override public int getSectionForPosition(int position) { - if (position >= getCount()) { - position = getCount() - 1; - } - return getItem(position).sectionPosition; - } - - } - - static class Item { - - public static final int ITEM = 0; - public static final int SECTION = 1; - - public final int type; - public final String text; - - public int sectionPosition; - public int listPosition; - - public Item(int type, String text) { - this.type = type; - this.text = text; - } - - @Override public String toString() { - return text; - } - - } - - private boolean hasHeaderAndFooter; - private boolean isFastScroll; - private boolean addPadding; - private boolean isShadowVisible = true; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - if (savedInstanceState != null) { - isFastScroll = savedInstanceState.getBoolean("isFastScroll"); - addPadding = savedInstanceState.getBoolean("addPadding"); - isShadowVisible = savedInstanceState.getBoolean("isShadowVisible"); - hasHeaderAndFooter = savedInstanceState.getBoolean("hasHeaderAndFooter"); - } - initializeHeaderAndFooter(); - initializeAdapter(); - initializePadding(); - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putBoolean("isFastScroll", isFastScroll); - outState.putBoolean("addPadding", addPadding); - outState.putBoolean("isShadowVisible", isShadowVisible); - outState.putBoolean("hasHeaderAndFooter", hasHeaderAndFooter); - } - - @Override - protected void onListItemClick(ListView l, View v, int position, long id) { - Item item = (Item) getListView().getAdapter().getItem(position); - if (item != null) { - Toast.makeText(this, "Item " + position + ": " + item.text, Toast.LENGTH_SHORT).show(); - } else { - Toast.makeText(this, "Item " + position, Toast.LENGTH_SHORT).show(); - } - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.main, menu); - menu.getItem(0).setChecked(isFastScroll); - menu.getItem(1).setChecked(addPadding); - menu.getItem(2).setChecked(isShadowVisible); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.action_fastscroll: - isFastScroll = !isFastScroll; - item.setChecked(isFastScroll); - initializeAdapter(); - break; - case R.id.action_addpadding: - addPadding = !addPadding; - item.setChecked(addPadding); - initializePadding(); - break; - case R.id.action_showShadow: - isShadowVisible = !isShadowVisible; - item.setChecked(isShadowVisible); - ((PinnedSectionListView)getListView()).setShadowVisible(isShadowVisible); - break; - case R.id.action_showHeaderAndFooter: - hasHeaderAndFooter = !hasHeaderAndFooter; - item.setChecked(hasHeaderAndFooter); - initializeHeaderAndFooter(); - break; - } - return true; - } - - private void initializePadding() { - float density = getResources().getDisplayMetrics().density; - int padding = addPadding ? (int) (16 * density) : 0; - getListView().setPadding(padding, padding, padding, padding); - } - - private void initializeHeaderAndFooter() { - setListAdapter(null); - if (hasHeaderAndFooter) { - ListView list = getListView(); - - LayoutInflater inflater = LayoutInflater.from(this); - TextView header1 = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false); - header1.setText("First header"); - list.addHeaderView(header1); - - TextView header2 = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false); - header2.setText("Second header"); - list.addHeaderView(header2); - - TextView footer = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false); - footer.setText("Single footer"); - list.addFooterView(footer); - } - initializeAdapter(); - } - - @SuppressLint("NewApi") - private void initializeAdapter() { - getListView().setFastScrollEnabled(isFastScroll); - if (isFastScroll) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - getListView().setFastScrollAlwaysVisible(true); - } - setListAdapter(new FastScrollAdapter(this, android.R.layout.simple_list_item_1, android.R.id.text1)); - } else { - setListAdapter(new SimpleAdapter(this, android.R.layout.simple_list_item_1, android.R.id.text1)); - } - } - - @Override - public void onClick(View v) { - Toast.makeText(this, "Item: " + v.getTag() , Toast.LENGTH_SHORT).show(); - } - -}
\ No newline at end of file |