Commit dda923a9 authored by Bruno Belarmino's avatar Bruno Belarmino

custom accordion

parent 016ce127
### Android ###
# Built application files # Built application files
*.apk *.apk
*.ap_ *.ap_
...@@ -28,5 +29,353 @@ proguard/ ...@@ -28,5 +29,353 @@ proguard/
# Android Studio Navigation editor temp files # Android Studio Navigation editor temp files
.navigation/ .navigation/
# Android Studio captures folder ### Android Patch ###
captures/ gen-external-apklibs
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
### Linux ###
*~
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
### Gradle ###
.gradle
build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
### Java ###
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
uploads
\ No newline at end of file
apply plugin: 'com.android.library'
android {
compileSdkVersion 8
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sentaca.android.accordion"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".AccordionWidgetDemoActivity"
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
You may use the materials in this file without restriction to develop your apps and to use in your apps.
\ No newline at end of file
/**
* Copyright (c) 2011, 2012 Sentaca Communications Ltd.
*/
package com.sentaca.android.accordion;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.sentaca.android.accordion.utils.FontUtils;
import com.sentaca.android.accordion.widget.AccordionView;
public class AccordionWidgetDemoActivity extends Activity {
private static final String TAG = "AccordionWidgetDemoActivity";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final AccordionView v = (AccordionView) findViewById(R.id.accordion_view);
LinearLayout ll = (LinearLayout) v.findViewById(R.id.example_get_by_id);
TextView tv = new TextView(this);
tv.setText("Added in runtime...");
FontUtils.setCustomFont(tv, getAssets());
ll.addView(tv);
}
}
\ No newline at end of file
/**
* Copyright (c) 2011, 2012 Sentaca Communications Ltd.
*/
package com.sentaca.android.accordion.utils;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class FontUtils {
public static final String TAG_LIGHT = "light";
public static final String TAG_CONDENSED = "condensed";
public static final String TAG_BOLD = "bold";
private static final int ICE_CREAM_SANDWITCH = 14;
private static Typeface normal;
private static Typeface bold;
private static Typeface condensed;
private static Typeface light;
private static void processsViewGroup(ViewGroup v, final int len) {
for (int i = 0; i < len; i++) {
final View c = v.getChildAt(i);
if (c instanceof TextView) {
setCustomFont((TextView) c);
} else if (c instanceof ViewGroup) {
setCustomFont((ViewGroup) c);
}
}
}
private static void setCustomFont(TextView c) {
Object tag = c.getTag();
if (tag instanceof String) {
final String tagString = (String) tag;
if (tagString.contains(TAG_BOLD) && bold != null) {
c.setTypeface(bold);
return;
}
if (tagString.contains(TAG_CONDENSED) && condensed != null) {
c.setTypeface(condensed);
return;
}
if (tagString.contains(TAG_LIGHT) && light != null) {
c.setTypeface(light);
return;
}
}
if(normal != null) {
c.setTypeface(normal);
}
}
public static void setCustomFont(View topView, AssetManager assetsManager) {
if (Build.VERSION.SDK_INT >= ICE_CREAM_SANDWITCH) {
return;
}
initTypefaces(assetsManager);
if (topView instanceof ViewGroup) {
setCustomFont((ViewGroup) topView);
} else if (topView instanceof TextView) {
setCustomFont((TextView) topView);
}
}
private static void initTypefaces(AssetManager assetsManager) {
if (normal == null || bold == null || condensed == null || light == null) {
normal = loadTypeface(assetsManager, "fonts/roboto/Roboto-Regular.ttf");
bold = loadTypeface(assetsManager, "fonts/roboto/Roboto-Bold.ttf");
condensed = loadTypeface(assetsManager, "fonts/roboto/Roboto-Condensed.ttf");
light = loadTypeface(assetsManager, "fonts/roboto/Roboto-Light.ttf");
}
}
private static Typeface loadTypeface(AssetManager assetsManager, String path) {
try {
return Typeface.createFromAsset(assetsManager, "fonts/roboto/Roboto-Regular.ttf");
} catch(RuntimeException e) {
// May occur rarely, on a few devices
Log.d("SentacaAccordionView", "Unable to load Typeface from " + path, e);
}
return null;
}
private static void setCustomFont(ViewGroup v) {
final int len = v.getChildCount();
processsViewGroup(v, len);
}
public static Typeface getTypefaceNormal(AssetManager assetsManager) {
initTypefaces(assetsManager);
return normal;
}
}
/**
* Copyright (c) 2011, 2012 Sentaca Communications Ltd.
*/
package com.sentaca.android.accordion.widget;
import java.util.HashMap;
import java.util.Map;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.sentaca.android.accordion.R;
import com.sentaca.android.accordion.utils.FontUtils;
public class AccordionView extends LinearLayout {
private boolean initialized = false;
// -- from xml parameter
private int headerLayoutId;
private int headerFoldButton;
private int headerLabel;
private int sectionContainer;
private int sectionContainerParent;
private int sectionBottom;
private String[] sectionHeaders;
private View[] children;
private View[] wrappedChildren;
private View[] headers;
private View[] footers;
private View[] sectionContainers;
private Map<Integer, View> sectionByChildId = new HashMap<Integer, View>();
private int[] sectionVisibilities = new int[0];
public AccordionView(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.accordion);
headerLayoutId = a.getResourceId(R.styleable.accordion_header_layout_id, 0);
headerFoldButton = a.getResourceId(R.styleable.accordion_header_layout_fold_button_id, 0);
headerLabel = a.getResourceId(R.styleable.accordion_header_layout_label_id, 0);
sectionContainer = a.getResourceId(R.styleable.accordion_section_container, 0);
sectionContainerParent = a.getResourceId(R.styleable.accordion_section_container_parent, 0);
sectionBottom = a.getResourceId(R.styleable.accordion_section_bottom, 0);
int sectionHeadersResourceId = a.getResourceId(R.styleable.accordion_section_headers, 0);
int sectionVisibilityResourceId = a.getResourceId(R.styleable.accordion_section_visibility, 0);
if (sectionHeadersResourceId == 0) {
throw new IllegalArgumentException("Please set section_headers as reference to strings array.");
}
sectionHeaders = getResources().getStringArray(sectionHeadersResourceId);
if (sectionVisibilityResourceId != 0) {
sectionVisibilities = getResources().getIntArray(sectionVisibilityResourceId);
}
}
if (headerLayoutId == 0 || headerLabel == 0 || sectionContainer == 0 || sectionContainerParent == 0 || sectionBottom == 0) {
throw new IllegalArgumentException(
"Please set all header_layout_id, header_layout_label_id, section_container, section_container_parent and section_bottom attributes.");
}
setOrientation(VERTICAL);
}
private void assertWrappedChildrenPosition(int position) {
if (wrappedChildren == null || position >= wrappedChildren.length) {
throw new IllegalArgumentException("Cannot toggle section " + position + ".");
}
}
public View getChildById(int id) {
for (int i = 0; i < wrappedChildren.length; i++) {
View v = wrappedChildren[i].findViewById(id);
if (v != null) {
return v;
}
}
return null;
}
public View getSectionByChildId(int id) {
return sectionByChildId.get(id);
}
private View getView(final LayoutInflater inflater, int i, boolean hide) {
final View container = inflater.inflate(sectionContainer, null);
container.setLayoutParams(new ListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0));
final ViewGroup newParent = (ViewGroup) container.findViewById(sectionContainerParent);
newParent.addView(children[i]);
FontUtils.setCustomFont(container, AccordionView.this.getContext().getAssets());
if (container.getId() == -1) {
container.setId(i);
}
if (hide) {
container.setVisibility(GONE);
}
return container;
}
private View getViewFooter(LayoutInflater inflater) {
return inflater.inflate(sectionBottom, null);
}
private View getViewHeader(LayoutInflater inflater, final int position, boolean hide) {
final View view = inflater.inflate(headerLayoutId, null);
((TextView) view.findViewById(headerLabel)).setText(sectionHeaders[position]);
FontUtils.setCustomFont(view, AccordionView.this.getContext().getAssets());
// -- support for no fold button
if (headerFoldButton == 0) {
return view;
}
final View foldButton = view.findViewById(headerFoldButton);
if (foldButton instanceof ToggleImageLabeledButton) {
final ToggleImageLabeledButton toggleButton = (ToggleImageLabeledButton) foldButton;
toggleButton.setState(wrappedChildren[position].getVisibility() == VISIBLE);
}
final OnClickListener onClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
toggleSection(position);
}
};
foldButton.setOnClickListener(onClickListener);
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onClickListener.onClick(v);
if (foldButton instanceof ToggleImageLabeledButton) {
final ToggleImageLabeledButton toggleButton = (ToggleImageLabeledButton) foldButton;
toggleButton.setState(wrappedChildren[position].getVisibility() == VISIBLE);
}
}
});
return view;
}
@Override
protected void onFinishInflate() {
if (initialized) {
super.onFinishInflate();
return;
}
final int childCount = getChildCount();
sectionContainers = new View[childCount];
children = new View[childCount];
headers = new View[childCount];
footers = new View[childCount];
wrappedChildren = new View[childCount];
if (sectionHeaders.length != childCount) {
throw new IllegalArgumentException("Section headers string array length must be equal to accordion view child count.");
}
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (int i = 0; i < childCount; i++) {
children[i] = getChildAt(i);
}
removeAllViews();
for (int i = 0; i < childCount; i++) {
final boolean hide = sectionVisibilities.length > 0 && sectionVisibilities[i] == 0;
wrappedChildren[i] = getView(inflater, i, hide);
headers[i] = getViewHeader(inflater, i, hide);
footers[i] = getViewFooter(inflater);
final LinearLayout section = new LinearLayout(getContext());
sectionContainers[i]=section;
section.setOrientation(LinearLayout.VERTICAL);
section.addView(headers[i]);
section.addView(wrappedChildren[i]);
section.addView(footers[i]);
sectionByChildId.put(children[i].getId(), section);
addView(section);
}
initialized = true;
super.onFinishInflate();
}
/**
*
* @param position
* @return visibility
* {@link View#GONE} and {@link View#VISIBLE}
*/
public int getSectionVisibility(int position) {
assertWrappedChildrenPosition(position);
return wrappedChildren[position].getVisibility();
}
/**
*
* @param position
* @param visibility
* {@link View#GONE} and {@link View#VISIBLE}
*/
public void setSectionVisibility(int position, int visibility) {
assertWrappedChildrenPosition(position);
wrappedChildren[position].setVisibility(visibility);
if (headerFoldButton != 0) {
final View foldButton = headers[position].findViewById(headerFoldButton);
if (foldButton instanceof ToggleImageLabeledButton) {
final ToggleImageLabeledButton toggleButton = (ToggleImageLabeledButton) foldButton;
toggleButton.setState(wrappedChildren[position].getVisibility() == VISIBLE);
}
}
}
public void toggleSection(int position) {
assertWrappedChildrenPosition(position);
if (wrappedChildren[position].getVisibility() == VISIBLE) {
setSectionVisibility(position, GONE);
} else {
setSectionVisibility(position, VISIBLE);
}
}
/**
*
* @param position
* @param visibility
* {@link View#GONE} and {@link View#VISIBLE}
*/
public void setChildVisibility(int position, int visibility) {
assertWrappedChildrenPosition(position);
sectionContainers[position].setVisibility(visibility);
}
}
/**
* Copyright (c) 2011, 2012 Sentaca Communications Ltd.
*/
package com.sentaca.android.accordion.widget;
import java.util.concurrent.atomic.AtomicBoolean;
import com.sentaca.android.accordion.R;
import com.sentaca.android.accordion.R.styleable;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
public class ToggleImageLabeledButton extends ImageView {
private int imageOn;
private int imageOff;
private AtomicBoolean on = new AtomicBoolean(false);
public ToggleImageLabeledButton(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.image_labeled_button, 0, 0);
imageOn = a.getResourceId(R.styleable.image_labeled_button_icon_resource, 0);
a = context.obtainStyledAttributes(attrs, R.styleable.toggle_image_labeled_button, 0, 0);
imageOff = a.getResourceId(R.styleable.toggle_image_labeled_button_icon_resource_off, 0);
setImageResource(imageOff);
}
}
private void handleNewState(boolean newState) {
if (newState) {
setImageResource(imageOn);
} else {
setImageResource(imageOff);
}
}
@Override
public void setOnClickListener(final OnClickListener l) {
OnClickListener wrappingListener = new OnClickListener() {
public void onClick(View v) {
boolean newState = !on.get();
on.set(newState);
handleNewState(newState);
l.onClick(v);
}
};
super.setOnClickListener(wrappingListener);
}
public void setState(boolean b) {
on.set(b);
handleNewState(b);
}
}
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/footer_border"/>
<item
android:bottom="5dp"
android:drawable="@drawable/footer_solid"
android:left="1dp"
android:right="1dp"
android:top="0dp"/>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/section_color" />
<stroke
android:width="1dp"
android:color="@color/border_color" />
<corners
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/section_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/header_solid"
android:top="10dp"/>
<item
android:bottom="1dp"
android:drawable="@drawable/header_border"
android:left="0dp"
android:right="0dp"
android:top="0dp"/>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/header_color" />
<stroke
android:width="1dp"
android:color="@color/border_color" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/header_solid_outer"/>
<item
android:bottom="0dp"
android:drawable="@drawable/header_solid_inner"
android:left="1dp"
android:right="1dp"
android:top="0dp"/>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/header_border_shadow" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/border_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/section_border"/>
<item
android:bottom="0dp"
android:drawable="@drawable/section_solid"
android:left="1dp"
android:right="1dp"
android:top="0dp"/>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/border_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/section_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/white" >
<RelativeLayout
android:minHeight="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_marginRight="10sp"
android:background="@drawable/footer_bg"
android:gravity="center_horizontal"
android:orientation="horizontal" >
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:accordion="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/white">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:layout_marginLeft="10sp"
android:layout_marginRight="10sp"
android:background="@drawable/header_bg"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<com.sentaca.android.accordion.widget.ToggleImageLabeledButton
android:id="@+id/foldButton"
android:layout_width="24dip"
android:layout_height="24dip"
android:layout_marginLeft="8sp"
android:layout_marginTop="4sp"
accordion:icon_resource="@drawable/down"
accordion:icon_resource_off="@drawable/up" />
<!-- paddingRight added to center text correctly -->
<TextView
android:id="@+id/foldText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#0075ca"
android:textSize="14sp"
android:paddingTop="7sp"
android:paddingBottom="7sp"
android:text="Section Name" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/white" >
<RelativeLayout
android:id="@+id/section_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10sp"
android:layout_marginRight="10sp"
android:padding="5sp"
android:background="@drawable/section"
android:gravity="center_horizontal"
android:orientation="horizontal" >
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:accordion="http://schemas.android.com/apk/res-auto/com.sentaca.android.accordion"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.sentaca.android.accordion.widget.AccordionView
android:id="@+id/accordion_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
accordion:header_layout_fold_button_id="@id/foldButton"
accordion:header_layout_id="@layout/accordion_header"
accordion:header_layout_label_id="@id/foldText"
accordion:section_bottom="@layout/accordion_footer"
accordion:section_container="@layout/accordion_section"
accordion:section_container_parent="@id/section_content"
accordion:section_headers="@array/accordion_sections"
accordion:section_visibility="@array/accordion_visibility"
android:background="#fff5f5f5"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 1" />
<LinearLayout
android:id="@+id/example_get_by_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 3" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 4" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RatingBar
android:id="@+id/ratingBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item 4" />
</com.sentaca.android.accordion.widget.AccordionView>
</ScrollView>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="image_labeled_button">
<attr name="icon_resource" format="reference" />
<attr name="icon_label" format="reference" />
</declare-styleable>
<declare-styleable name="toggle_image_labeled_button">
<attr name="icon_resource_off" format="reference" />
</declare-styleable>
<declare-styleable name="accordion">
<attr name="header_layout_id" format="reference" />
<attr name="header_layout_fold_button_id" format="reference" />
<attr name="header_layout_label_id" format="reference" />
<attr name="custom_font" format="string" />
<attr name="section_headers" format="reference" />
<attr name="section_container" format="reference" />
<attr name="section_container_parent" format="reference" />
<attr name="section_bottom" format="reference" />
<attr name="section_visibility" format="reference"/>
</declare-styleable>
</resources>
\ No newline at end of file
<resources>
<color name="border_color">#dedede</color>
<color name="header_color">#f6f6f6</color>
<color name="header_border_shadow">#ffffff</color>
<color name="section_color">#f0f0f0</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Accordion View</string>
<string-array name="accordion_sections">
<item>Section A</item>
<item>Section B</item>
<item>Section C</item>
<item>Section D</item>
<item>Section E</item>
</string-array>
<integer-array name="accordion_visibility">
<item>1</item>
<item>1</item>
<item>0</item>
<item>0</item>
<item>0</item>
</integer-array>
</resources>
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
}
}
allprojects {
repositories {
jcenter()
}
}
#Wed Oct 21 11:34:03 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
ECLIPSE ANDROID PROJECT IMPORT SUMMARY
======================================
Ignored Files:
--------------
The following files were *not* copied into the new Gradle project; you
should evaluate whether these are still needed in your project and if
so manually move them:
* .gitignore
* README.markdown
* dev\
* dev\header.txt
* pom.xml
* proguard-project.txt
* screenshot.png
Moved Files:
------------
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:
* AndroidManifest.xml => app\src\main\AndroidManifest.xml
* assets\ => app\src\main\assets\
* res\ => app\src\main\res\
* src\ => app\src\main\java\
Next Steps:
-----------
You can now build the project. The Gradle project needs network
connectivity to download dependencies.
Bugs:
-----
If for some reason your project does not build, and you determine that
it is due to a bug or limitation of the Eclipse to Gradle importer,
please file a bug at http://b.android.com with category
Component-Tools.
(This import summary is for your information only, and can be deleted
after import once you are satisfied with the results.)
include ':app'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment