Skip to content

Commit d5a5eb6

Browse files
committed
init
0 parents  commit d5a5eb6

48 files changed

Lines changed: 2232 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Built application files
2+
3+
# Files for the ART/Dalvik VM
4+
*.dex
5+
6+
# Java class files
7+
*.class
8+
9+
# Generated files
10+
bin/
11+
gen/
12+
out/
13+
14+
# Gradle files
15+
.gradle/
16+
build/
17+
18+
# Local configuration file (sdk path, etc)
19+
local.properties
20+
21+
# Proguard folder generated by Eclipse
22+
proguard/
23+
24+
# Log Files
25+
*.log
26+
27+
# Android Studio Navigation editor temp files
28+
.navigation/
29+
30+
# Android Studio captures folder
31+
pictures/
32+
33+
# IntelliJ
34+
*.iml
35+
.idea/
36+
.idea
37+
captures/
38+
# Keystore files
39+
# Uncomment the following line if you do not want to check your keystore files in.
40+
#*.jks
41+
42+
# External native build folder generated in Android Studio 2.2 and later
43+
.externalNativeBuild
44+
45+
# Google Services (e.g. APIs or Firebase)
46+
google-services.json
47+
48+
# Freeline
49+
freeline.py
50+
freeline/
51+
freeline_project_description.json
52+
53+
# fastlane
54+
fastlane/
55+
.DS_Store/

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# android-pile-layout
2+
An abnormal horizontal ListView-like pile layout.
3+
4+
### captured images
5+
The following pictures were captured earlier. Since the source code and the outputted-apk have changed some params, you will have a different UI when you directly run the code or install the apk file. Hope there has no confusions later. <br><br>
6+
<img src="capture/capture1.gif" width="360" height="645"/> <img src="capture/capture2.gif" width="360" height="645"/>
7+
8+
### design
9+
Recently I have seen this kind of UI design, and at the first sight I was trying to implement it by using RecyclerView's LayoutManager. Unfortunately, I am unable to contrust a clear Math model while sliding the PileView. After several tries, I gave up LayoutManager, and find another way for this implementation. If you make LayoutManager works well for this UI design, please tell me later.
10+
11+
### how to use
12+
1. declare PileLayout in your xml file
13+
``` xml
14+
<com.stone.pile.libs.PileLayout
15+
android:id="@+id/pileLayout"
16+
android:layout_width="match_parent"
17+
android:layout_height="wrap_content"
18+
android:paddingBottom="5dp"
19+
android:paddingTop="5dp"
20+
pile:displayCount="1.5"
21+
pile:interval="10dp"
22+
pile:scaleStep="0.22"
23+
pile:widthHeightRate="1.22" />
24+
```
25+
Meanwhile, pileLayout is able to be customized by these 4 params:
26+
27+
|name|format|description|
28+
|:---:|:---:|:---:|
29+
| interval | dimension |items-margin each other
30+
| sizeRatio | float |each item's height/witdth
31+
| scaleStep | float |size scale step when needed
32+
| displayCount | float |number of items that may display
33+
34+
2. in Java files:
35+
``` java
36+
pileLayout = (PileLayout) findViewById(R.id.pileLayout);
37+
pileLayout.setAdapter(new PileLayout.Adapter() {
38+
@Override
39+
public int getLayoutId() {
40+
// item's layout resource id
41+
return R.layout.item_layout;
42+
}
43+
44+
@Override
45+
public void bindView(View view, int position) {
46+
ViewHolder viewHolder = (ViewHolder) view.getTag();
47+
if (viewHolder == null) {
48+
viewHolder = new ViewHolder();
49+
viewHolder.imageView = (ImageView) view.findViewById(R.id.imageView);
50+
view.setTag(viewHolder);
51+
}
52+
// recycled view bind new position
53+
}
54+
55+
@Override
56+
public int getItemCount() {
57+
// item count
58+
return dataList.size();
59+
}
60+
61+
@Override
62+
public void displaying(int position) {
63+
// right displaying the left biggest itemView's position
64+
}
65+
66+
@Override
67+
public void onItemClick(View view, int position) {
68+
// on item click
69+
}
70+
});
71+
```
72+
73+
### demo apk
74+
[download](capture/app-debug.apk)
75+
76+
## License
77+
78+
Copyright 2017, xmuSistone
79+
80+
Licensed under the Apache License, Version 2.0 (the "License");
81+
you may not use this file except in compliance with the License.
82+
You may obtain a copy of the License at
83+
84+
http://www.apache.org/licenses/LICENSE-2.0
85+
86+
Unless required by applicable law or agreed to in writing, software
87+
distributed under the License is distributed on an "AS IS" BASIS,
88+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89+
See the License for the specific language governing permissions and
90+
limitations under the License.

build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
6+
jcenter()
7+
google()
8+
}
9+
dependencies {
10+
classpath 'com.android.tools.build:gradle:3.2.1'
11+
12+
// NOTE: Do not place your application dependencies here; they belong
13+
// in the individual module build.gradle files
14+
}
15+
}
16+
17+
allprojects {
18+
repositories {
19+
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
20+
jcenter()
21+
google()
22+
}
23+
}
24+
25+
task clean(type: Delete) {
26+
delete rootProject.buildDir
27+
}
28+
29+
ext{
30+
androidx = '1.0.0'
31+
}

demo/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

demo/build.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
buildToolsVersion "28.0.3"
6+
defaultConfig {
7+
applicationId "com.stone.pile"
8+
minSdkVersion 14
9+
targetSdkVersion 28
10+
versionCode 1
11+
versionName "1.0"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(include: ['*.jar'], dir: 'libs')
23+
implementation "androidx.appcompat:appcompat:${androidx}"
24+
implementation 'com.github.bumptech.glide:glide:3.8.0'
25+
implementation 'com.makeramen:roundedimageview:2.3.0'
26+
implementation project(':library')
27+
}

demo/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in D:\adt-bundle-windows-x86-20130917\sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

demo/src/main/AndroidManifest.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.stone.pile">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:hardwareAccelerated="true"
8+
android:icon="@mipmap/ic_launcher"
9+
android:label="@string/app_name"
10+
android:largeHeap="true"
11+
android:supportsRtl="true"
12+
android:theme="@style/AppTheme">
13+
<activity android:name=".activity.MainActivity">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN" />
16+
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
23+
<uses-permission android:name="android.permission.INTERNET" />
24+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
25+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
26+
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
27+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
28+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
29+
30+
</manifest>

0 commit comments

Comments
 (0)