-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lihuichao
committed
Sep 30, 2017
1 parent
cb33131
commit 53922be
Showing
25 changed files
with
408 additions
and
16 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
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
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
61 changes: 61 additions & 0 deletions
61
addresspickerlibrary/src/main/java/com/addresspicker/huichao/addresspickerlibrary/Util.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,61 @@ | ||
package com.addresspicker.huichao.addresspickerlibrary; | ||
|
||
import android.app.Dialog; | ||
import android.content.Context; | ||
import android.text.TextUtils; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.animation.Animation; | ||
import android.view.animation.AnimationUtils; | ||
import android.widget.ImageView; | ||
import android.widget.LinearLayout; | ||
import android.widget.TextView; | ||
|
||
public class Util { | ||
/** | ||
* 显示进度加载框 | ||
* | ||
* @param context | ||
* @param msg | ||
* @param isAnimation | ||
* @param imageId | ||
* @return | ||
*/ | ||
public static Dialog createLoadingDialog(Context context, String msg, | ||
boolean isAnimation, int imageId) { | ||
|
||
LayoutInflater inflater = LayoutInflater.from(context); | ||
View v = inflater.inflate(R.layout.loading_dialog, null);// 得到加载view | ||
LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view);// 加载布局 | ||
// main.xml中的ImageView | ||
ImageView spaceshipImage = (ImageView) v.findViewById(R.id.img); | ||
TextView tipTextView = (TextView) v.findViewById(R.id.tipTextView);// 提示文字 | ||
|
||
if (imageId != 0) { | ||
spaceshipImage.setImageResource(imageId); | ||
} | ||
if (isAnimation) { | ||
// 加载动画 | ||
Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation( | ||
context, R.anim.loading_animation); | ||
// 使用ImageView显示动画 | ||
spaceshipImage.startAnimation(hyperspaceJumpAnimation); | ||
} | ||
|
||
if (TextUtils.isEmpty(msg)) { | ||
tipTextView.setVisibility(View.GONE); | ||
} else { | ||
tipTextView.setVisibility(View.VISIBLE); | ||
tipTextView.setText(msg);// 设置加载信息 | ||
} | ||
|
||
Dialog loadingDialog = new Dialog(context, R.style.loading_dialog);// 创建自定义样式dialog | ||
|
||
loadingDialog.setCancelable(false);// 不可以用“返回键”取消 | ||
loadingDialog.setContentView(layout, new LinearLayout.LayoutParams( | ||
LinearLayout.LayoutParams.MATCH_PARENT, | ||
LinearLayout.LayoutParams.MATCH_PARENT));// 设置布局 | ||
return loadingDialog; | ||
|
||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
addresspickerlibrary/src/main/res/anim/loading_animation.xml
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set android:shareInterpolator="false" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<rotate | ||
android:interpolator="@android:anim/linear_interpolator" | ||
android:pivotX="50%" | ||
android:pivotY="50%" | ||
android:fromDegrees="0" | ||
android:toDegrees="+360" | ||
android:duration="3000" | ||
android:startOffset="-1" | ||
android:repeatMode="restart" | ||
android:repeatCount="-1"/> | ||
</set> |
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,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- 上下滑入式 --> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android" > | ||
|
||
<translate | ||
android:duration="200" | ||
android:fromYDelta="50%p" | ||
android:toYDelta="0" /> | ||
|
||
|
||
|
||
</set> |
13 changes: 13 additions & 0 deletions
13
addresspickerlibrary/src/main/res/anim/push_bottom_out.xml
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- 上下滑入式 --> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android" > | ||
|
||
|
||
<translate | ||
android:duration="200" | ||
android:fromYDelta="0" | ||
android:toYDelta="50%p" /> | ||
|
||
|
||
|
||
</set> |
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_enabled="false" android:color="#cccccc"/> | ||
<item android:state_enabled="true" android:color="#000000"/> | ||
</selector> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
addresspickerlibrary/src/main/res/drawable/progress_dialog_bg.xml
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="#aa000000"/> | ||
<corners android:radius="10dp"/> | ||
|
||
</shape> |
17 changes: 17 additions & 0 deletions
17
addresspickerlibrary/src/main/res/drawable/wheel_hight_bg.xml
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,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | ||
|
||
<item> | ||
<shape android:shape="rectangle" > | ||
<solid android:color="#cccccc" /> | ||
</shape> | ||
</item> | ||
<item | ||
android:bottom="1px" | ||
android:top="1px"> | ||
<shape android:shape="rectangle" > | ||
<solid android:color="#ffffff" /> | ||
</shape> | ||
</item> | ||
|
||
</layer-list> |
23 changes: 23 additions & 0 deletions
23
addresspickerlibrary/src/main/res/layout/activity_main.xml
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,23 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin"> | ||
|
||
<Button | ||
android:id="@+id/single_picker" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="单选框" /> | ||
|
||
<Button | ||
android:id="@+id/select_area_btn" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="20dp" | ||
android:layout_below="@+id/single_picker" | ||
android:text="选择地区" /> | ||
|
||
</RelativeLayout> |
59 changes: 59 additions & 0 deletions
59
addresspickerlibrary/src/main/res/layout/dialog_city_picker.xml
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,59 @@ | ||
<?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="wrap_content" | ||
android:background="#ffffff" | ||
android:orientation="vertical" > | ||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="44dp" > | ||
|
||
<TextView | ||
android:id="@+id/cancel" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentLeft="true" | ||
android:layout_centerVertical="true" | ||
android:layout_marginLeft="10dp" | ||
android:text="取消" | ||
android:textColor="#aa0000" | ||
android:textSize="18sp" /> | ||
|
||
<TextView | ||
android:id="@+id/done" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentRight="true" | ||
android:layout_centerVertical="true" | ||
android:layout_marginRight="10dp" | ||
android:text="完成" | ||
android:textColor="#aa0000" | ||
android:textSize="18sp" /> | ||
</RelativeLayout> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal" > | ||
|
||
<com.addresspicker.huichao.addresspickerlibrary.wheel.WheelView | ||
android:id="@+id/provinceWheel" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" /> | ||
|
||
<com.addresspicker.huichao.addresspickerlibrary.wheel.WheelView | ||
android:id="@+id/citiesWheel" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" /> | ||
|
||
<com.addresspicker.huichao.addresspickerlibrary.wheel.WheelView | ||
android:id="@+id/countiesWheel" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" /> | ||
</LinearLayout> | ||
|
||
</LinearLayout> |
34 changes: 34 additions & 0 deletions
34
addresspickerlibrary/src/main/res/layout/loading_dialog.xml
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,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/dialog_view" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:gravity="center" | ||
android:orientation="vertical" | ||
android:paddingBottom="22dp" | ||
android:minHeight="87dp" | ||
android:minWidth="104dp" | ||
android:paddingLeft="20dp" | ||
android:paddingRight="20dp" | ||
android:paddingTop="26dp" > | ||
|
||
<ImageView | ||
android:id="@+id/img" | ||
android:layout_width="38dp" | ||
android:layout_height="38dp" | ||
android:src="@drawable/loading" /> | ||
|
||
<TextView | ||
android:id="@+id/tipTextView" | ||
android:layout_width="wrap_content" | ||
android:layout_marginTop="10dp" | ||
android:layout_height="wrap_content" | ||
android:maxWidth="208dp" | ||
android:layout_gravity="center_horizontal" | ||
android:text="" | ||
android:textSize="16sp" | ||
android:includeFontPadding="false" | ||
android:textColor="#ffffff" | ||
android:visibility="visible" /> | ||
|
||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TextView xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="45dp" | ||
android:textColor="@color/text_color" | ||
android:textSize="17sp" | ||
android:enabled="false" | ||
android:gravity="center"/> | ||
|
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,7 @@ | ||
<resources> | ||
|
||
<!-- Default screen margins, per the Android Design guidelines. --> | ||
<dimen name="activity_horizontal_margin">16dp</dimen> | ||
<dimen name="activity_vertical_margin">16dp</dimen> | ||
|
||
</resources> |
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">AddressPickerLibrary</string> | ||
|
||
<string name="app_name">Picker</string> | ||
<string name="hello_world">Hello world!</string> | ||
<string name="action_settings">Settings</string> | ||
|
||
</resources> |
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.