-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
添加VonPhotoUtils使用实例,调用UZrop裁剪库
- Loading branch information
秋逸
committed
Nov 14, 2016
1 parent
fb1dae5
commit 29aa5cb
Showing
20 changed files
with
820 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
VonTools/src/main/java/com/vondear/vontools/VonRecyclerViewUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.vondear.vontools; | ||
|
||
import android.graphics.Rect; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.View; | ||
|
||
/** | ||
* Created by vonde on 2016/11/13. | ||
*/ | ||
|
||
public class VonRecyclerViewUtils { | ||
|
||
public static class SpaceItemDecoration extends RecyclerView.ItemDecoration { | ||
|
||
private int space; | ||
private boolean isTop = false; | ||
|
||
public SpaceItemDecoration(int space, boolean isTop) { | ||
this.space = space; | ||
this.isTop = isTop; | ||
} | ||
|
||
public SpaceItemDecoration(int space) { | ||
this.space = space; | ||
} | ||
|
||
@Override | ||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { | ||
//不是第一个的格子都设一个左边和底部的间距 | ||
outRect.left = space; | ||
outRect.right = space; | ||
outRect.bottom = space; | ||
outRect.top = space; | ||
if (isTop) { | ||
if (parent.getChildLayoutPosition(view) == 0) { | ||
outRect.top = 0; | ||
} | ||
outRect.left = 0; | ||
outRect.right = 0; | ||
} | ||
} | ||
} | ||
|
||
} |
143 changes: 143 additions & 0 deletions
143
VonTools/src/main/java/com/vondear/vontools/view/TransparentDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
package com.vondear.vontools.view; | ||
|
||
|
||
import android.app.Activity; | ||
import android.app.Dialog; | ||
import android.content.Context; | ||
import android.os.Build; | ||
import android.view.Gravity; | ||
import android.view.Window; | ||
import android.view.WindowManager.LayoutParams; | ||
|
||
import com.vondear.vontools.R; | ||
|
||
|
||
public class TransparentDialog extends Dialog { | ||
private LayoutParams attr; | ||
|
||
public LayoutParams getAttr() { | ||
return attr; | ||
} | ||
|
||
public TransparentDialog(Context context, int themeResId) { | ||
super(context, themeResId); | ||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
this.getWindow().setBackgroundDrawableResource(R.drawable.transparent_bg); | ||
Window window = this.getWindow(); | ||
LayoutParams lp = window.getAttributes(); | ||
lp.alpha = 1f; | ||
window.setAttributes(lp); | ||
attr = window.getAttributes(); | ||
if (attr != null) { | ||
attr.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; | ||
attr.gravity = Gravity.CENTER; | ||
} | ||
} | ||
|
||
public TransparentDialog(Context context, boolean cancelable, OnCancelListener cancelListener) { | ||
super(context, cancelable, cancelListener); | ||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
this.getWindow().setBackgroundDrawableResource(R.drawable.transparent_bg); | ||
Window window = this.getWindow(); | ||
LayoutParams lp = window.getAttributes(); | ||
lp.alpha = 1f; | ||
window.setAttributes(lp); | ||
attr = window.getAttributes(); | ||
if (attr != null) { | ||
attr.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; | ||
attr.gravity = Gravity.CENTER; | ||
} | ||
} | ||
|
||
public TransparentDialog(Context context) { | ||
super(context); | ||
// TODO Auto-generated constructor stub | ||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
this.getWindow().setBackgroundDrawableResource( | ||
R.drawable.transparent_bg); | ||
Window window = this.getWindow(); | ||
LayoutParams lp = window.getAttributes(); | ||
lp.alpha = 1f; | ||
window.setAttributes(lp); | ||
attr = window.getAttributes(); | ||
if (attr != null) { | ||
attr.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; | ||
attr.gravity = Gravity.CENTER; | ||
} | ||
} | ||
|
||
public TransparentDialog(Activity context) { | ||
super(context); | ||
// TODO Auto-generated constructor stub | ||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
this.getWindow().setBackgroundDrawableResource( | ||
R.drawable.transparent_bg); | ||
Window window = this.getWindow(); | ||
LayoutParams lp = window.getAttributes(); | ||
lp.alpha = 1f; | ||
window.setAttributes(lp); | ||
attr = window.getAttributes(); | ||
if (attr != null) { | ||
attr.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; | ||
attr.gravity = Gravity.CENTER; | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* @param context | ||
* @param alpha 透明度 0.0f--1f(不透明) | ||
* @param gravity 方向(Gravity.BOTTOM,Gravity.TOP,Gravity.LEFT,Gravity.RIGHT) | ||
*/ | ||
public TransparentDialog(Context context, float alpha, int gravity) { | ||
super(context); | ||
// TODO Auto-generated constructor stub | ||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
this.getWindow().setBackgroundDrawableResource( | ||
R.drawable.transparent_bg); | ||
Window window = this.getWindow(); | ||
LayoutParams lp = window.getAttributes(); | ||
lp.alpha = alpha; | ||
window.setAttributes(lp); | ||
attr = window.getAttributes(); | ||
if (attr != null) { | ||
attr.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; | ||
attr.gravity = gravity; | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* @param context | ||
* @param alpha 透明度 0.0f--1f(不透明) | ||
* @param gravity 方向(Gravity.BOTTOM,Gravity.TOP,Gravity.LEFT,Gravity.RIGHT) | ||
*/ | ||
public TransparentDialog(Context context, float alpha, int gravity, boolean isOnScreen) { | ||
super(context, android.R.style.Theme); | ||
setOwnerActivity((Activity)context); | ||
// TODO Auto-generated constructor stub | ||
this.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
this.getWindow().setBackgroundDrawableResource(R.drawable.transparent_bg); | ||
Window window = this.getWindow(); | ||
LayoutParams lp = window.getAttributes(); | ||
lp.alpha = alpha; | ||
window.setAttributes(lp); | ||
attr = window.getAttributes(); | ||
if (attr != null) { | ||
attr.height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; | ||
attr.gravity = gravity; | ||
} | ||
} | ||
|
||
/** | ||
* 隐藏头部导航栏状态栏 | ||
*/ | ||
public void skipTools() { | ||
if (Build.VERSION.SDK_INT < 19) { | ||
return; | ||
} | ||
getWindow().setFlags( | ||
LayoutParams.FLAG_FULLSCREEN, | ||
LayoutParams.FLAG_FULLSCREEN); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<!--<gradient android:angle="270" android:endColor="#A8C3B0" | ||
android:startColor="#C6CFCE"/>--> | ||
<!--<size android:height="60dp" android:width="320dp" />--> | ||
<solid android:color="#aa000000"/> | ||
<corners android:radius="15dp" /> | ||
<!-- <stroke android:width="1dp" android:color="#000000" />--> | ||
|
||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<!--<gradient android:angle="270" android:endColor="#A8C3B0" | ||
android:startColor="#C6CFCE"/>--> | ||
<!--<size android:height="60dp" android:width="320dp" />--> | ||
<solid android:color="#FFFFFF"/> | ||
<corners android:radius="5dp" /> | ||
<!-- <stroke android:width="1dp" android:color="#000000" />--> | ||
|
||
</shape> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?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:layout_gravity="bottom" | ||
android:layout_marginBottom="10dp" | ||
android:layout_marginLeft="10dp" | ||
android:layout_marginRight="10dp" | ||
android:background="@drawable/transparent_bg" | ||
android:orientation="vertical"> | ||
|
||
<LinearLayout | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@drawable/shape_round_white" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:layout_width="fill_parent" | ||
android:layout_height="45dp" | ||
android:gravity="center" | ||
android:text="请选择图片来源" | ||
android:textColor="#b9b9b9" /> | ||
|
||
<View | ||
android:layout_width="fill_parent" | ||
android:layout_height="0.1dp" | ||
android:background="#b9b9b9" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_camera" | ||
android:layout_width="fill_parent" | ||
android:layout_height="60dp" | ||
android:gravity="center" | ||
android:text="照相机" | ||
android:textColor="#FF4081" | ||
android:textSize="20sp" /> | ||
|
||
<View | ||
android:layout_width="fill_parent" | ||
android:layout_height="0.1dp" | ||
android:background="#cccccc" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_file" | ||
android:layout_width="fill_parent" | ||
android:layout_height="60dp" | ||
android:gravity="center" | ||
android:text="相册" | ||
android:textColor="#009EE7" | ||
android:textSize="20sp" /> | ||
|
||
|
||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="10dp" | ||
android:background="@drawable/shape_round_white" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:id="@+id/tv_cancelid" | ||
android:layout_width="fill_parent" | ||
android:layout_height="60dp" | ||
android:gravity="center" | ||
android:text="取消" | ||
android:textColor="#cccccc" | ||
android:textSize="20sp" | ||
android:textStyle="bold" /> | ||
|
||
</LinearLayout> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.