Skip to content

Commit

Permalink
prepare 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
avenwu committed Feb 8, 2016
2 parents 9af1db4 + 6530da2 commit c976bd2
Show file tree
Hide file tree
Showing 20 changed files with 546 additions and 16 deletions.
49 changes: 43 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,54 @@
#Support
Support
========

Custom Android support library, include some useful utils and widget.

support内是自定义的一些东西,sammple中包含support的实现demo样例,

Download
-------
Download the latest repo or grab the stable released version via Maven:

**Maven**
为方便使用和研究,可以通过gradle依赖获取support库
Clone the master branch:

compile 'com.github.avenwu:support:0.1.0'
```
git clone https://github.com/avenwu/support.git
```

or Gradle:

```Groovy
compile 'com.github.avenwu:support:0.1.1'
```


License
=======

Copyright 2014 Chaobin Wu.

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.


---

实战案例
-------

###卡片翻转优化

![device-2016-01-19-162559.mp4.gif](images/device-2016-01-19-162559.mp4.gif)

##实战案例
###TextView缩略
通过控制文本展示实现单击展开和收缩文本,并在收缩状态显示提示图标

Expand Down Expand Up @@ -82,4 +120,3 @@ residemenu是是侧滑菜单的一种,但是视觉效果更特别,此次实




Binary file added images/device-2016-01-19-162559.mp4.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "com.avenwu.deepinandroid"
minSdkVersion 8
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Expand All @@ -31,7 +31,8 @@ dependencies {
compile 'com.jakewharton:butterknife:6.0.0'
compile 'com.github.avenwu:IndexImageView:1.0.1'
compile 'com.drewnoakes:metadata-extractor:2.7.2'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:percent:23.1.0'
compile 'com.squareup.retrofit:retrofit:1.6.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.avenwu.deepinandroid;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
* Created by aven on 1/20/16.
*/
public class CameraMatrixFragmentDemo extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.camera_matrix_layout, null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.avenwu.deepinandroid;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
* Created by aven on 12/25/15.
*/
public class CurtainLayoutFragment extends Fragment {

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return View.inflate(getActivity(), R.layout.curtain_demo, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.text.Spanned;
import android.widget.TextView;

/**
* Created by chaobin on 11/18/15.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.avenwu.deepinandroid;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import net.avenwu.support.widget.FlipLayout;

/**
* Created by aven on 1/19/16.
*/
public class FlipFragmentDemo extends Fragment {
FlipLayout mFlipLayout;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.flip_layout, null);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mFlipLayout = (FlipLayout) view.findViewById(R.id.flip_layout);
mFlipLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mFlipLayout.flip();
}
});
mFlipLayout.setViewOrder(view.findViewById(R.id.iv_image1), view.findViewById(R.id.iv_image2));
}
}
32 changes: 32 additions & 0 deletions sample/src/main/java/com/avenwu/deepinandroid/StackZFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.avenwu.deepinandroid;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


/**
* Created by aven on 1/27/16.
*/
public class StackZFragment extends Fragment {

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_stack_z, null);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
int count = ((ViewGroup) view).getChildCount();
for (int i = 0; i < count; i++) {
View card = ((ViewGroup) view).getChildAt(i);
ViewCompat.setTranslationZ(card, (i + 1) * 8 * getResources().getDisplayMetrics().density);
}
}
}
30 changes: 26 additions & 4 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,36 @@
style="@style/DemoItemStyle"
android:text="字体设置"
android:tag="com.avenwu.deepinandroid.TypefaceActivity"/>
<Button
style="@style/DemoItemStyle"
android:text="Progress"
android:tag="com.avenwu.deepinandroid.CustomProgressActivity"/>
<!--<Button-->
<!--style="@style/DemoItemStyle"-->
<!--android:text="Progress"-->
<!--android:tag="com.avenwu.deepinandroid.CustomProgressActivity"/>-->
<Button
style="@style/DemoItemStyle"
android:text="ExTextView"
android:tag="com.avenwu.deepinandroid.CustomTextViewActivity"/>
<Button
style="@style/DemoItemStyle"
android:text="拉幕弹层"
android:onClick="openFragment"
android:tag="com.avenwu.deepinandroid.CurtainLayoutFragment" />
<Button
style="@style/DemoItemStyle"
android:text="Flip 3D"
android:onClick="openFragment"
android:tag="com.avenwu.deepinandroid.FlipFragmentDemo" />
<Button
style="@style/DemoItemStyle"
android:text="Matrix + Camera"
android:onClick="openFragment"
android:tag="com.avenwu.deepinandroid.CameraMatrixFragmentDemo" />

<Button
style="@style/DemoItemStyle"
android:text="Translation Z"
android:onClick="openFragment"
android:tag="com.avenwu.deepinandroid.StackZFragment" />

</LinearLayout>
</ScrollView>

Expand Down
27 changes: 27 additions & 0 deletions sample/src/main/res/layout/camera_matrix_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:clickable="true"
android:background="#fff">

<net.avenwu.support.widget.MatrixFrameLayout
android:layout_width="300dp"
android:layout_height="450dp"
android:layout_gravity="center"
android:layout_marginTop="30dp">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/image2" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="This is label"
android:textSize="40sp" />
</net.avenwu.support.widget.MatrixFrameLayout>
</LinearLayout>
10 changes: 10 additions & 0 deletions sample/src/main/res/layout/curtain_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical">
<net.avenwu.support.widget.CurtainLayout
android:layout_width="match_parent"
android:layout_height="match_parent"></net.avenwu.support.widget.CurtainLayout>
</LinearLayout>
27 changes: 27 additions & 0 deletions sample/src/main/res/layout/flip_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<net.avenwu.support.widget.FlipLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flip_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/iv_image1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/image1" />

<ImageView
android:id="@+id/iv_image2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/image2" />
</net.avenwu.support.widget.FlipLayout>
</FrameLayout>
64 changes: 64 additions & 0 deletions sample/src/main/res/layout/fragment_stack_z.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:clickable="true">

<TextView
android:id="@+id/tv_card_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#009688"
android:gravity="center"
android:text="Card Label"
android:textColor="@android:color/black"
android:textSize="24sp"
app:layout_heightPercent="40%"
app:layout_marginLeftPercent="5%"
app:layout_marginTopPercent="10%"
app:layout_widthPercent="90%" />

<TextView
android:id="@+id/tv_card_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#4CAF50"
android:gravity="center"
android:text="Card Label"
android:textColor="@android:color/black"
android:textSize="24sp"
app:layout_heightPercent="40%"
app:layout_marginLeftPercent="5%"
app:layout_marginTopPercent="25%"
app:layout_widthPercent="90%" />

<TextView
android:id="@+id/tv_card_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#8BC34A"
android:gravity="center"
android:text="Card Label"
android:textColor="@android:color/black"
android:textSize="24sp"
app:layout_heightPercent="40%"
app:layout_marginLeftPercent="5%"
app:layout_marginTopPercent="40%"
app:layout_widthPercent="90%" />

<TextView
android:id="@+id/tv_card_4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CDDC39"
android:gravity="center"
android:text="Card Label"
android:textColor="@android:color/black"
android:textSize="24sp"
app:layout_heightPercent="40%"
app:layout_marginLeftPercent="5%"
app:layout_marginTopPercent="55%"
app:layout_widthPercent="90%" />
</android.support.percent.PercentFrameLayout>
1 change: 1 addition & 0 deletions sample/src/main/res/layout/textview_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
app:expand_indicator="@drawable/ic_arrow"
app:expand_style="end"/>


<net.avenwu.support.widget.ExTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
Loading

0 comments on commit c976bd2

Please sign in to comment.