├── .gitignore
├── .idea
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── mzw
│ │ └── giftscrawlto
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── mzw
│ │ │ └── giftscrawlto
│ │ │ ├── GiftAdapter.java
│ │ │ ├── GiftBean.java
│ │ │ ├── GiftData.java
│ │ │ ├── GiftPagerAdapter.java
│ │ │ ├── GiftPopupWindow.java
│ │ │ ├── LogUtils.java
│ │ │ ├── MainActivity.java
│ │ │ ├── RoundRectImageView.java
│ │ │ ├── ScrawlPlayView.java
│ │ │ ├── ScrawlView.java
│ │ │ └── SyncThread.java
│ └── res
│ │ ├── anim
│ │ ├── gift_ins.xml
│ │ ├── gift_scale.xml
│ │ ├── push_bottom_in_2.xml
│ │ └── slide_left_in.xml
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── bg_06.xml
│ │ ├── bg_16.xml
│ │ ├── bg_17.xml
│ │ ├── bg_33.xml
│ │ ├── bg_35.xml
│ │ ├── btn_a.xml
│ │ ├── btn_h.xml
│ │ ├── ic_launcher_background.xml
│ │ └── transparent_selector.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── gift_broadcast_layout.xml
│ │ ├── gift_item.xml
│ │ ├── gift_popup_window.xml
│ │ └── gifttion_gridview.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── g000.png
│ │ ├── g001.png
│ │ ├── g002.png
│ │ ├── g003.png
│ │ ├── g004.png
│ │ ├── g005.png
│ │ ├── g006.png
│ │ ├── g007.png
│ │ ├── g008.png
│ │ ├── g009.png
│ │ ├── g010.png
│ │ ├── g011.png
│ │ ├── g012.png
│ │ ├── g013.png
│ │ ├── g014.png
│ │ ├── gift_icon.png
│ │ ├── guide_page_dot_checked.png
│ │ ├── guide_page_dot_unchecked.png
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── icon_game_manage_del.png
│ │ ├── money.png
│ │ └── more_a.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── raw
│ │ └── qwe.gif
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── mzw
│ └── giftscrawlto
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # giftScrawlTo
2 | 直播礼物涂鸦
3 |
4 |
5 | 废话不多说直接上效果图
6 |
7 | 
8 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | applicationId "com.mzw.giftscrawlto"
7 | minSdkVersion 15
8 | targetSdkVersion 26
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
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(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:26.1.0'
24 | implementation 'com.android.support.constraint:constraint-layout:1.1.0'
25 | testImplementation 'junit:junit:4.12'
26 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
27 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
28 | }
29 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/mzw/giftscrawlto/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.mzw.giftscrawlto", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/GiftAdapter.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Color;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.BaseAdapter;
10 | import android.widget.ImageView;
11 | import android.widget.LinearLayout;
12 | import android.widget.LinearLayout.LayoutParams;
13 | import android.widget.TextView;
14 |
15 | import java.util.List;
16 |
17 | public class GiftAdapter extends BaseAdapter {
18 | private List emojiList;
19 | private LayoutInflater mInflater;
20 | private Context mContext;
21 | private int mWidth = 0;
22 |
23 | public GiftAdapter(Context context, List emojiList, int width) {
24 | super();
25 | this.emojiList = emojiList;
26 | this.mInflater = LayoutInflater.from(context);
27 | this.mContext = context;
28 | mWidth = width - dip2px(mContext, 10);
29 | }
30 |
31 | @Override
32 | public int getCount() {
33 | return emojiList.size();
34 | }
35 |
36 | @Override
37 | public GiftBean getItem(int position) {
38 | return emojiList.get(position);
39 | }
40 |
41 | @Override
42 | public long getItemId(int position) {
43 | return 0;
44 | }
45 |
46 | @Override
47 | public View getView(int position, View convertView, ViewGroup parent) {
48 |
49 | ViewHolder holder;
50 | if (convertView==null) {
51 | convertView=mInflater.inflate(R.layout.gift_item, null);
52 | holder=new ViewHolder();
53 | holder.mImageView = (ImageView) convertView.findViewById(R.id.gifttion);
54 | holder.price = (TextView) convertView.findViewById(R.id.id_price);
55 | holder.mPicLayout = (LinearLayout) convertView.findViewById(R.id.giftlayout);
56 | LayoutParams params = new LayoutParams(mWidth / 5, mWidth / 5);
57 | holder.mPicLayout.setLayoutParams(params);
58 | int paddding = dip2px(mContext, 5);
59 | holder.mPicLayout.setPadding(paddding, paddding, paddding, paddding);
60 | convertView.setTag(holder);
61 | }else {
62 | holder=(ViewHolder) convertView.getTag();
63 | }
64 |
65 | try {
66 | GiftBean bean = getItem(position);
67 | String fileName = bean.fileName;
68 | // Field field = R.drawable.class.getDeclaredField(fileName);
69 | // int resId = field.getInt(null);
70 | //Bitmap bm = BitmapFactory.decodeResource(context.getResources(), resId);
71 |
72 | Bitmap mBitmap = GiftData.getGiftBitmap(mContext,fileName);
73 |
74 | if(bean.sign == 1){
75 | holder.mPicLayout.setBackgroundColor(Color.parseColor("#50A2A2A2"));
76 | }else{
77 | holder.mPicLayout.setBackgroundColor(Color.parseColor("#00000000"));
78 | }
79 | holder.mImageView.setImageBitmap(mBitmap);
80 | // holder.mImageView.setImageResource(resId);
81 | holder.price.setText(bean.price + " 钱币");
82 | } catch (Exception e) {
83 | }
84 |
85 | return convertView;
86 | }
87 |
88 |
89 | final static class ViewHolder {
90 | ImageView mImageView;
91 | TextView price;
92 | LinearLayout mPicLayout;
93 |
94 | @Override
95 | public int hashCode() {
96 | return this.mImageView.hashCode() + mPicLayout.hashCode();
97 | }
98 | }
99 |
100 |
101 |
102 | public int dip2px(Context context, int dipValue) {
103 | final float scale = context.getResources().getDisplayMetrics().density;
104 | return (int) (dipValue * scale + 0.5f);
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/GiftBean.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.graphics.Bitmap;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by think on 2018/4/15.
9 | */
10 |
11 | public class GiftBean implements Serializable {
12 |
13 | private static final long serialVersionUID = 1L;
14 |
15 | public int id;
16 | public String fileName;
17 | public int price;
18 | public int sign = 0;
19 | public float currentX = 0;
20 | public float currentY = 0;
21 | public Bitmap mBitmap;
22 | public String name;
23 |
24 | public GiftBean(int id, String fileName, int price, float currentX, float currentY, String name) {
25 | this.id = id;
26 | this.fileName = fileName;
27 | this.price = price;
28 | this.currentX = currentX;
29 | this.currentY = currentY;
30 | this.name = name;
31 | }
32 | public GiftBean(int id, String fileName, int price, int sign, String name) {
33 | this.id = id;
34 | this.fileName = fileName;
35 | this.price = price;
36 | this.sign = sign;
37 | this.name = name;
38 | }
39 |
40 | public GiftBean(int id, String fileName, int price) {
41 | this.id = id;
42 | this.fileName = fileName;
43 | this.price = price;
44 | }
45 |
46 | public GiftBean(float currentX, float currentY) {
47 | this.currentX = currentX;
48 | this.currentY = currentY;
49 | }
50 |
51 | public GiftBean(int id, String fileName, int price, float currentX, float currentY, Bitmap mBitmap) {
52 | this.id = id;
53 | this.fileName = fileName;
54 | this.price = price;
55 | this.currentX = currentX;
56 | this.currentY = currentY;
57 | this.mBitmap = mBitmap;
58 | }
59 |
60 | @Override
61 | public String toString() {
62 | return "GiftBean{" +
63 | "id=" + id +
64 | ", fileName='" + fileName + '\'' +
65 | ", price=" + price +
66 | ", sign=" + sign +
67 | ", currentX=" + currentX +
68 | ", currentY=" + currentY +
69 | ", mBitmap=" + mBitmap +
70 | ", name='" + name + '\'' +
71 | '}';
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/GiftData.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.text.TextUtils;
7 |
8 | import org.json.JSONArray;
9 | import org.json.JSONObject;
10 |
11 | import java.lang.reflect.Field;
12 | import java.util.ArrayList;
13 | import java.util.HashMap;
14 | import java.util.List;
15 | import java.util.Map;
16 |
17 | /**
18 | * Created by think on 2018/4/15.
19 | */
20 |
21 | public class GiftData {
22 |
23 | private static int count = 10;
24 | private static String giftFileName = "";
25 | private static Bitmap mBitmap = null;
26 | /**
27 | * 获取礼物列表 数据 图片不可删除,用于记录收到和送出流水,
28 | */
29 | public static List getGiftData() {
30 | List list = new ArrayList();
31 | list.add(new GiftBean(0,"g000",1,1,"棒棒糖"));
32 | list.add(new GiftBean(1,"g001",2,0,"奶瓶儿"));
33 | list.add(new GiftBean(2,"g002",3,0,"啤酒"));
34 | list.add(new GiftBean(3,"g003",4,0,"咖啡"));
35 | list.add(new GiftBean(4,"g004",5,0,"兰州拉面"));
36 | list.add(new GiftBean(5,"g005",6,0,"生日蛋糕"));
37 | list.add(new GiftBean(6,"g006",7,0,"大礼包"));
38 | list.add(new GiftBean(7,"g007",8,0,"新年爆竹"));
39 | list.add(new GiftBean(8,"g008",9,0,"发发发"));
40 | list.add(new GiftBean(9,"g009",10,0,"猪头"));
41 | list.add(new GiftBean(10,"g010",11,0,"麦克风"));
42 | list.add(new GiftBean(11,"g011",12,0,"炸弹"));
43 | list.add(new GiftBean(12,"g012",13,0,"鄙视你"));
44 | list.add(new GiftBean(13,"g013",14,0,"玫瑰花"));
45 | list.add(new GiftBean(14,"g014",15,0,"万花筒"));
46 | return list;
47 | }
48 |
49 |
50 | //获取礼物列表数据 分组
51 | public static List> getGiftList() {
52 | List list = getGiftData();
53 |
54 | List> totalList = new ArrayList>();
55 |
56 | int page = list.size() % count ==0 ? list.size() / count : list.size() / count + 1;
57 | for (int i = 0; i < page; i++) {
58 | int startIndex = i * count;
59 | List singleList = new ArrayList();
60 | if(singleList != null){
61 | singleList.clear();
62 | }
63 | int endIndex = 0;
64 | if(i < page - 1){
65 | endIndex = startIndex + count;
66 | }else if(i == page - 1){
67 | endIndex = list.size();
68 | }
69 | singleList.addAll(list.subList(startIndex, endIndex));
70 | totalList.add(singleList);
71 | }
72 | return totalList;
73 | }
74 |
75 | public static JSONArray toJson(List list,int screenWidth, int screenHeight,String uPic){
76 |
77 | try{
78 | if(list != null && list.size() > 0){
79 | //将礼物发出去
80 | JSONArray jsonArray = new JSONArray();
81 | JSONObject json = null;
82 | if(screenWidth > 0 || screenHeight > 0){//添加 送礼物人信息
83 | json = new JSONObject();
84 | json.put("id",-1);//
85 | json.put("fileName",uPic);// 送礼物人头像 地址
86 | json.put("currentX",screenWidth);//送礼物人 手机屏幕宽高
87 | json.put("currentY",screenHeight);
88 | json.put("price",0);
89 | jsonArray.put(json);
90 | }
91 | for(int i = 0; i < list.size(); i++){// 将礼物 转为 json
92 | GiftBean bean = list.get(i);
93 | json = new JSONObject();
94 | json.put("id",bean.id);
95 | json.put("fileName",bean.fileName);//礼物文件名
96 | json.put("currentX",bean.currentX);//礼物 在屏幕上的坐标
97 | json.put("currentY",bean.currentY);
98 | json.put("price",bean.price);// 礼物单价
99 | jsonArray.put(json);
100 | }
101 | return jsonArray;
102 | // handler.sendEmptyMessage(QianMiGoCommon.B);
103 | // mScrawlPlayView.setListBitmap(list);
104 | }
105 | }catch (Exception e){
106 | e.printStackTrace();
107 | }
108 | return null;
109 | }
110 |
111 | public static List toList(String str){
112 | Map map = getGiftMap();//
113 | try{
114 | List list = new ArrayList();
115 | if(!TextUtils.isEmpty(str) && str.startsWith("[")){
116 | JSONArray jsonArray = new JSONArray(str);
117 | if(jsonArray != null && jsonArray.length()>0){
118 | for (int i = 0; i < jsonArray.length(); i++) {
119 | JSONObject json = jsonArray.getJSONObject(i);
120 | int id = 0;
121 | String name = "礼物";
122 | String fileName = "";
123 | int price = 0;
124 | float currentX = 0;
125 | float currentY = 0;
126 | if(json != null){
127 | if(!json.isNull("id")){
128 | id = json.getInt("id");
129 | }
130 | if(!json.isNull("fileName")){
131 | fileName = json.getString("fileName");
132 | }
133 | if(!json.isNull("price")){
134 | price = json.getInt("price");
135 | }
136 | if(!json.isNull("currentX")){
137 | currentX = json.getInt("currentX");
138 | }
139 | if(!json.isNull("currentY")){
140 | currentY = json.getInt("currentY");
141 | }
142 | }
143 | if(!TextUtils.isEmpty(fileName)){// 礼物信息传递时 为了节省网络开销,没有传递 礼物中文名称,在此获取
144 | GiftBean bean = map.get(fileName);
145 | if(bean != null){
146 | name = bean.name;
147 | }
148 | }
149 | // 封装
150 | GiftBean _GiftBean = new GiftBean(id,fileName,price,currentX,currentY,name);
151 | list.add(_GiftBean);
152 | }
153 | }
154 | }
155 | if(list != null){
156 | return list;
157 | }
158 | }catch (Exception e){e.printStackTrace();}
159 |
160 | return null;
161 | }
162 |
163 | // 当数据字典使用,key为fileName
164 | public static Map getGiftMap() {
165 | List list = getGiftData();
166 | Map map = new HashMap();
167 | for (GiftBean bean:list) {
168 | map.put(bean.fileName,bean);
169 | }
170 | return map;
171 | }
172 |
173 | //避免 反复加载相同图片
174 | public static Bitmap getGiftBitmap(Context mContext, String _giftFileName) {
175 | if(!TextUtils.isEmpty(_giftFileName)){
176 | if(mBitmap != null && _giftFileName.equals(giftFileName)){
177 | return mBitmap;
178 | }else{
179 | try{
180 | Field field = R.mipmap.class.getDeclaredField(_giftFileName);
181 | int resId = field.getInt(null);
182 | mBitmap = BitmapFactory.decodeResource(mContext.getResources(),resId);
183 | giftFileName = _giftFileName;
184 | return mBitmap;
185 | }catch (Exception e){
186 | e.printStackTrace();
187 | }
188 | }
189 | }
190 | return null;
191 | }
192 | }
193 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/GiftPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.os.Parcelable;
4 | import android.support.v4.view.PagerAdapter;
5 | import android.support.v4.view.ViewPager;
6 | import android.view.View;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by think on 2018/4/20.
12 | */
13 |
14 | public class GiftPagerAdapter extends PagerAdapter {
15 | private List views;
16 | public GiftPagerAdapter(List views) {
17 | this.views = views;
18 | }
19 | @Override
20 | public void destroyItem(View arg0, int arg1, Object arg2) {
21 | // TODO Auto-generated method stub
22 | ( (ViewPager) arg0).removeView(views.get(arg1));
23 | }
24 | @Override
25 | public void finishUpdate(View arg0) {
26 | // TODO Auto-generated method stub
27 | }
28 | @Override
29 | public int getCount() {
30 | // TODO Auto-generated method stub
31 | return views.size();
32 | }
33 | @Override
34 | public Object instantiateItem(View arg0, int arg1) {
35 | // TODO Auto-generated method stub
36 | if(arg0 == null || views == null || views.get(arg1) == null){
37 | return null;
38 | }
39 | ( (ViewPager) arg0).addView(views.get(arg1), 0);
40 | return views.get(arg1);
41 | }
42 | @Override
43 | public boolean isViewFromObject(View arg0, Object arg1) {
44 | // TODO Auto-generated method stub
45 | return arg0 == arg1;
46 | }
47 | @Override
48 | public void restoreState(Parcelable arg0, ClassLoader arg1) {
49 | // TODO Auto-generated method stub
50 | }
51 | @Override
52 | public Parcelable saveState() {
53 | // TODO Auto-generated method stub
54 | return null;
55 | }
56 | @Override
57 | public void startUpdate(View arg0) {
58 | // TODO Auto-generated method stub
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/GiftPopupWindow.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.BitmapDrawable;
5 | import android.graphics.drawable.Drawable;
6 | import android.os.Handler;
7 | import android.os.Message;
8 | import android.support.v4.view.ViewPager;
9 | import android.util.DisplayMetrics;
10 | import android.view.Gravity;
11 | import android.view.LayoutInflater;
12 | import android.view.View;
13 | import android.view.WindowManager;
14 | import android.view.animation.AnimationUtils;
15 | import android.widget.AdapterView;
16 | import android.widget.GridView;
17 | import android.widget.ImageView;
18 | import android.widget.LinearLayout;
19 | import android.widget.PopupWindow;
20 | import android.widget.RelativeLayout;
21 | import android.widget.TextView;
22 |
23 | import java.util.ArrayList;
24 | import java.util.LinkedList;
25 | import java.util.List;
26 |
27 | /**
28 | * Created by think on 2018/4/20.
29 | */
30 |
31 | public class GiftPopupWindow extends PopupWindow implements ViewPager.OnPageChangeListener,View.OnClickListener {
32 |
33 | List> mGiftList;
34 | private int screenWidth, screenHeight;
35 |
36 | ViewPager mViewPager;
37 | LinearLayout mLayoutCircle;
38 | RelativeLayout mEmotionLayout;
39 | GiftPagerAdapter mEmotionAdapter;
40 | private LinkedList mViewList = new LinkedList();
41 | private LinkedList mScrawlAdapterList = new LinkedList();
42 | Context mContext;
43 | public int mPageIndxe = 0;
44 |
45 | public int selectI= 0,selectJ= 0;
46 |
47 | ScrawlView mScrawlView;
48 | ImageView clear_view;
49 | ImageView hide_view;
50 | TextView total_price_view;
51 | private int totalPrice = 0;
52 | TextView chongzhi_view;
53 | TextView my_coins;//钱币总额
54 | TextView send_view;
55 | private PopupWindowScrawlListener mPopupWindowScrawlListener;
56 | private int myCoins = 0;
57 | private Handler mHandler = new Handler(){
58 | @Override
59 | public void handleMessage(Message msg) {
60 | super.handleMessage(msg);
61 | switch (msg.what){
62 | case 0:
63 | totalPrice = msg.arg1;
64 | if(totalPrice > 0){
65 | total_price_view.setText("价值"+totalPrice+"钱币");
66 | }else{
67 | total_price_view.setText("可在上方画出图案");
68 | }
69 | break;
70 | }
71 | }
72 | };
73 |
74 |
75 |
76 | public GiftPopupWindow(Context mContext, View parent, List> mGiftList, PopupWindowScrawlListener mPopupWindowScrawlListener, int myCoins) {
77 | this.mGiftList = mGiftList;
78 | this.mContext = mContext;
79 | this.mPopupWindowScrawlListener = mPopupWindowScrawlListener;
80 | this.myCoins = myCoins;
81 |
82 | LogUtils.i("-----","我有钱币:" + myCoins + " 个");
83 | View view = View.inflate(mContext, R.layout.gift_popup_window, null);
84 | view.startAnimation(AnimationUtils.loadAnimation(mContext,R.anim.gift_ins));
85 | LinearLayout ll_popup = (LinearLayout) view.findViewById(R.id.ll_popup);
86 | ll_popup.startAnimation(AnimationUtils.loadAnimation(mContext,R.anim.push_bottom_in_2));
87 |
88 | mScrawlView = (ScrawlView)view.findViewById(R.id.id_ScrawlView);
89 | mScrawlView.setGiftBean(mGiftList.get(0).get(0));
90 | mScrawlView.setOnScrawlChangedListener(onScrawlChangedListener);
91 |
92 | clear_view = (ImageView) view.findViewById(R.id.id_clear_view);
93 | hide_view = (ImageView) view.findViewById(R.id.id_hide_view);
94 | total_price_view = (TextView) view.findViewById(R.id.id_total_price_view);
95 | chongzhi_view = (TextView) view.findViewById(R.id.id_chongzhi_view);
96 | my_coins = (TextView) view.findViewById(R.id.id_my_coins);
97 | send_view = (TextView) view.findViewById(R.id.id_send_view);
98 |
99 | my_coins.setText(""+myCoins);
100 | clear_view.setOnClickListener(this);
101 | hide_view.setOnClickListener(this);
102 | chongzhi_view.setOnClickListener(this);
103 | send_view.setOnClickListener(this);
104 |
105 | WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
106 | DisplayMetrics outMetrics = new DisplayMetrics();
107 | wm.getDefaultDisplay().getMetrics(outMetrics);
108 | this.screenWidth = outMetrics.widthPixels;
109 | this.screenHeight = outMetrics.heightPixels;
110 |
111 | mViewPager = (ViewPager) view.findViewById(R.id.imagepager);
112 | mViewPager.setOnPageChangeListener(this);
113 | mLayoutCircle = (LinearLayout) view.findViewById(R.id.circlelayout);
114 | mEmotionLayout = (RelativeLayout) view.findViewById(R.id.emotionlayout);
115 |
116 | for (int i = 0; i < mGiftList.size(); i++) {
117 | addView(i);
118 | }
119 | mEmotionAdapter = new GiftPagerAdapter(mViewList);
120 | mViewPager.setAdapter(mEmotionAdapter);
121 | mViewPager.setCurrentItem(0);
122 | showCircle(mViewList.size());
123 |
124 |
125 | setWidth(RelativeLayout.LayoutParams.FILL_PARENT);
126 | setHeight(RelativeLayout.LayoutParams.FILL_PARENT);
127 | setBackgroundDrawable(new BitmapDrawable());
128 | setFocusable(true);
129 | setOutsideTouchable(true);
130 | setContentView(view);
131 | showAtLocation(parent, Gravity.BOTTOM, 0, 0);
132 | update();
133 | }
134 |
135 |
136 | /**
137 | * 添加表情滑动控件
138 | * @param i 添加的位置
139 | */
140 | private void addView(final int i){
141 | View view = LayoutInflater.from(mContext).inflate(R.layout.gifttion_gridview, null);
142 | GridView gridView = (GridView) view.findViewById(R.id.gift_grid);
143 | gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
144 |
145 | @Override
146 | public void onItemClick(AdapterView> parent, View view,int position, long id) {
147 | ImageView imageView = (ImageView)view.findViewById(R.id.gifttion);
148 | if(imageView != null){
149 | Drawable drawable = imageView.getDrawable();
150 | if(drawable instanceof BitmapDrawable){
151 | GiftBean mGiftBean = mGiftList.get(i).get(position);
152 | String fileName = mGiftBean.fileName;
153 | mGiftList.get(selectI).get(selectJ).sign = 0;
154 | mScrawlAdapterList.get(selectI).notifyDataSetChanged();
155 |
156 | mGiftList.get(i).get(position).sign = 1;
157 | selectI = i;
158 | selectJ = position;
159 | LogUtils.i("-----","点击:" + fileName);
160 | mScrawlAdapterList.get(i).notifyDataSetChanged();
161 | // mPopupWindowScrawlListener.gift(mGiftBean);
162 | mScrawlView.setGiftBean(mGiftBean);
163 | }
164 | }
165 | }
166 | });
167 | GiftAdapter mScrawlAdapter = new GiftAdapter(mContext, mGiftList.get(i), screenWidth);
168 | gridView.setAdapter(mScrawlAdapter);
169 | mScrawlAdapterList.add(mScrawlAdapter);
170 | mViewList.add(view);
171 | }
172 |
173 |
174 | /**
175 | * 显示表情处于第几页标志
176 | * @param size
177 | */
178 | private void showCircle(int size){
179 | mLayoutCircle.removeAllViews();
180 |
181 | for( int i = 0; i < size; i++){
182 | ImageView img = new ImageView(mContext);
183 | img.setLayoutParams(new LinearLayout.LayoutParams(dip2px(mContext, 5), dip2px(mContext, 5)));
184 | LinearLayout layout = new LinearLayout(mContext);
185 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
186 | int margin = dip2px(mContext, 5);
187 | params.setMargins(margin, 0, margin, 0);
188 | layout.setLayoutParams(params);
189 | layout.addView(img);
190 | //img.setLayoutParams()
191 | if ( mPageIndxe == i){
192 | img.setImageResource(R.mipmap.guide_page_dot_checked);
193 | } else{
194 | img.setImageResource(R.mipmap.guide_page_dot_unchecked);
195 | }
196 | mLayoutCircle.addView(layout);
197 | }
198 | }
199 |
200 | @Override
201 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
202 |
203 | }
204 |
205 | @Override
206 | public void onPageSelected(int position) {
207 | mPageIndxe = position;
208 | showCircle(mViewList.size());
209 | }
210 |
211 | @Override
212 | public void onPageScrollStateChanged(int state) {
213 |
214 | }
215 |
216 | public int dip2px(Context context, int dipValue) {
217 | final float scale = context.getResources().getDisplayMetrics().density;
218 | return (int) (dipValue * scale + 0.5f);
219 | }
220 |
221 | @Override
222 | public void onClick(View v) {
223 | switch (v.getId()){
224 | case R.id.id_clear_view:
225 | // mPopupWindowScrawlListener.clear();
226 | mScrawlView.clear();
227 | break;
228 | case R.id.id_hide_view:
229 | mDismiss();
230 | break;
231 | case R.id.id_chongzhi_view:
232 | LogUtils.i("-----","充值...");
233 | mPopupWindowScrawlListener.chongZhiYouBi();
234 | mDismiss();
235 | break;
236 | case R.id.id_send_view:
237 | // mPopupWindowScrawlListener.send();
238 | List list = new ArrayList<>();
239 | List _list = mScrawlView.getListBitmap();
240 | for (GiftBean bean : _list) {
241 | list.add(bean);
242 | }
243 | mScrawlView.clear();
244 | // if(list != null && list.size() > 0){
245 | // mScrawlView.setListBitmap(list);
246 | // }
247 |
248 | mPopupWindowScrawlListener.send(list,mScrawlView.getScreenWidth(), mScrawlView.getScreenHeight(),totalPrice);
249 | mDismiss();
250 | break;
251 | }
252 | }
253 |
254 | private void mDismiss(){
255 | mGiftList.get(selectI).get(selectJ).sign = 0;
256 | mGiftList.get(0).get(0).sign = 1;
257 | dismiss();
258 | }
259 |
260 | private ScrawlView.OnScrawlChangedListener onScrawlChangedListener = new ScrawlView.OnScrawlChangedListener(){
261 | @Override
262 | public void onChanged(List listGift) {
263 | int arg1 = 0;
264 | if(listGift != null && listGift.size() > 0){
265 | for (GiftBean bean:listGift) {
266 | arg1 += bean.price;
267 | }
268 | }
269 | Message msg = new Message();
270 | msg.what = 0;
271 | msg.arg1 = arg1;
272 | mHandler.dispatchMessage(msg);
273 | }
274 | };
275 |
276 | public interface PopupWindowScrawlListener{
277 | //礼物集合 。 画板宽高 --- 用以计算 在不同屏幕尺寸上播放动画
278 | public void send(List list, int screenWidth, int screenHeight, int totalPrice);
279 | //充值钱币
280 | public void chongZhiYouBi();
281 | }
282 |
283 | }
284 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/LogUtils.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Created by think on 2018/5/15.
7 | */
8 |
9 | public class LogUtils {
10 | public final static int B = 0x00011;
11 | public final static int C = 0x00012;
12 | public final static int D = 0x00013;
13 |
14 | public static void i(String s, String s1) {
15 | Log.i(s,s1);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.graphics.Bitmap;
7 | import android.os.Bundle;
8 | import android.os.Handler;
9 | import android.os.Message;
10 | import android.text.TextUtils;
11 | import android.util.Log;
12 | import android.view.View;
13 | import android.view.animation.Animation;
14 | import android.view.animation.AnimationUtils;
15 | import android.view.inputmethod.InputMethodManager;
16 | import android.widget.ImageView;
17 | import android.widget.LinearLayout;
18 | import android.widget.PopupWindow;
19 | import android.widget.TextView;
20 | import android.widget.Toast;
21 |
22 | import org.json.JSONArray;
23 |
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | //入口类
28 | public class MainActivity extends Activity {
29 |
30 | private Context mContext;
31 | private ImageView gift_btn;
32 | private LinearLayout mScrawlPlayView_layout;
33 | private ScrawlPlayView mScrawlPlayView;
34 | private LinearLayout gift_broadcast_layout;// 礼物layout
35 |
36 | private RoundRectImageView broadcast_user_pic;//送礼物人图片
37 | private TextView broadcast_user_name;//送礼物人名
38 | private TextView broadcast_gift_info;//礼物名称
39 | private ImageView broadcast_gift_icon;//礼物图片
40 | private TextView broadcast_gift_num;//礼物数量
41 | private Animation myAnimationIn;
42 | private Animation scaleAnimation;
43 |
44 | private SyncThread syncThread;
45 |
46 | private List> mGiftList = new ArrayList>();
47 |
48 | private int myCoins = 100;//测试使用 用户余额
49 |
50 | private boolean isScaleing = false;// 放大执行中
51 | private int giftNum = 1;
52 | private String giftFileName_temp = "";// 记录,当改变时 重置数量为1
53 |
54 | private Handler handler = new Handler(){
55 | @Override
56 | public void handleMessage(Message msg) {
57 | switch (msg.what){
58 | case LogUtils.B:
59 | mScrawlPlayView.clear();
60 | //打开 礼物播放
61 | mScrawlPlayView_layout.setVisibility(View.VISIBLE);
62 | break;
63 | case LogUtils.C:
64 | //关闭播报
65 | giftNum = 1;
66 | gift_broadcast_layout.setVisibility(View.GONE);
67 | //关闭 礼物播放
68 | mScrawlPlayView_layout.setVisibility(View.GONE);
69 | break;
70 | case LogUtils.D:
71 | // 打开播报
72 | // GiftBean mGiftBean = (GiftBean)msg.obj;
73 | Bundle mBundle = msg.getData();
74 | String id = mBundle.getString("id");
75 | String name = mBundle.getString("name");
76 | String pic = mBundle.getString("pic");
77 |
78 | String giftFileName = mBundle.getString("giftFileName");
79 | String giftName = mBundle.getString("giftName");
80 |
81 | if(TextUtils.isEmpty(giftFileName) || !giftFileName.equals(giftFileName_temp)){
82 | giftFileName_temp = giftFileName;
83 | giftNum = 1;
84 | }
85 |
86 | // bitmapUtils.display(broadcast_user_pic,pic);// 加载网络图片
87 | // broadcast_user_pic.setImageResource(R.mipmap.ic_launcher);//发送者头像
88 | Bitmap mBitmap1 = GiftData.getGiftBitmap(mContext,pic);// 通过文件名反射获取图片
89 | broadcast_user_pic.setImageBitmap(mBitmap1);//发送者头像
90 |
91 | broadcast_user_name.setText(""+name);
92 | broadcast_gift_info.setText("送给主播 "+giftName);
93 |
94 | Bitmap mBitmap = GiftData.getGiftBitmap(mContext,giftFileName);
95 | // try{
96 | // Field field = R.drawable.class.getDeclaredField(giftFileName);
97 | // int resId = field.getInt(null);
98 | // Bitmap mBitmap = BitmapFactory.decodeResource(getResources(),resId);
99 | broadcast_gift_icon.setImageBitmap(mBitmap);
100 | // }catch (Exception e){
101 | // e.printStackTrace();
102 | // }
103 |
104 | if(gift_broadcast_layout.getVisibility() == View.GONE){
105 | gift_broadcast_layout.setVisibility(View.VISIBLE);
106 | gift_broadcast_layout.startAnimation(myAnimationIn);
107 | }else{
108 | giftNum++;
109 | }
110 | if(!isScaleing){
111 | broadcast_gift_num.setText("x"+giftNum);
112 | broadcast_gift_num.startAnimation(scaleAnimation);
113 | }
114 | break;
115 | default:
116 | break;
117 | }
118 | }
119 | };
120 |
121 | @Override
122 | protected void onCreate(Bundle savedInstanceState) {
123 | super.onCreate(savedInstanceState);
124 | setContentView(R.layout.activity_main);
125 | mContext = this;
126 |
127 |
128 | gift_btn = (ImageView) findViewById(R.id.id_gift_btn);
129 | mScrawlPlayView_layout = (LinearLayout) findViewById(R.id.id_ScrawlPlayView_layout);
130 | mScrawlPlayView = (ScrawlPlayView) findViewById(R.id.id_ScrawlPlayView);
131 | gift_broadcast_layout = (LinearLayout)findViewById(R.id.id_gift_broadcast_layout);
132 | broadcast_user_pic = (RoundRectImageView) findViewById(R.id.id_broadcast_user_pic);
133 | broadcast_gift_icon = (ImageView) findViewById(R.id.id_broadcast_gift_icon);
134 | broadcast_user_name = (TextView) findViewById(R.id.id_broadcast_user_name);
135 | broadcast_gift_info = (TextView) findViewById(R.id.id_broadcast_gift_info);
136 | broadcast_gift_num = (TextView) findViewById(R.id.id_broadcast_gift_num);
137 |
138 | syncThread = new SyncThread(mScrawlPlayView,handler);//刷礼物 播放 线程
139 | myAnimationIn = AnimationUtils.loadAnimation(mContext, R.anim.slide_left_in);
140 | scaleAnimation = AnimationUtils.loadAnimation(mContext, R.anim.gift_scale);
141 |
142 | init();
143 | }
144 |
145 | public void init(){
146 | mScrawlPlayView_layout.setVisibility(View.GONE);
147 | gift_broadcast_layout.setVisibility(View.GONE);
148 |
149 | mGiftList = GiftData.getGiftList();
150 | gift_btn.setOnClickListener(new View.OnClickListener(){
151 | @Override
152 | public void onClick(View v) {
153 | // ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
154 | gift_btn.setVisibility(View.INVISIBLE);
155 | new GiftPopupWindow(mContext,gift_btn,mGiftList,mPopupWindowScrawlListener,myCoins).setOnDismissListener(new PopupWindow.OnDismissListener(){
156 | @Override
157 | public void onDismiss() {
158 | gift_btn.setVisibility(View.VISIBLE);
159 | }
160 | });
161 | }
162 | });
163 | }
164 | private GiftPopupWindow.PopupWindowScrawlListener mPopupWindowScrawlListener = new GiftPopupWindow.PopupWindowScrawlListener(){
165 | @Override
166 | public void send(List list,int screenWidth, int screenHeight,int totalPrice) {
167 | //发送礼物,将头像url带过去
168 | if(myCoins >= totalPrice){
169 | JSONArray jsonArray = GiftData.toJson(list,screenWidth, screenHeight,"ic_launcher");
170 | if(jsonArray != null){
171 | String msgBody = jsonArray.toString();
172 | syncThread.setToid("qwe001");//_to name
173 | syncThread.setTo_name("qwe002");//_from name
174 | syncThread.setMsgBody(msgBody);
175 |
176 | Thread thread = new Thread(syncThread, ""+System.currentTimeMillis());
177 | thread.start();
178 |
179 | //添加并发
180 | // Thread thread1 = new Thread(syncThread, ""+System.currentTimeMillis());
181 | // thread1.start();
182 | }
183 | }else{
184 | Toast.makeText(mContext,"钱币不足,请先充值!!",Toast.LENGTH_SHORT).show();
185 | }
186 | }
187 | @Override
188 | public void chongZhiYouBi(){
189 | Toast.makeText(mContext,"正在研发中...",Toast.LENGTH_SHORT).show();
190 | }
191 | };
192 | }
193 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/RoundRectImageView.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapShader;
7 | import android.graphics.Canvas;
8 | import android.graphics.Matrix;
9 | import android.graphics.Paint;
10 | import android.graphics.RectF;
11 | import android.graphics.Shader;
12 | import android.graphics.drawable.Drawable;
13 | import android.os.Build;
14 | import android.util.AttributeSet;
15 | import android.util.TypedValue;
16 | import android.widget.ImageView;
17 |
18 |
19 | /**
20 | * 自定义的圆角矩形ImageView,可以直接当组件在布局中使用。
21 | * Created by admin on 2017/11/15.
22 | */
23 | public class RoundRectImageView extends ImageView {
24 | /**
25 | * 圆形模式
26 | */
27 | private static final int MODE_CIRCLE = 1;
28 | /**
29 | * 普通模式
30 | */
31 | private static final int MODE_NONE = 0;
32 | /**
33 | * 圆角模式
34 | */
35 | private static final int MODE_ROUND = 2;
36 | private Paint mPaint;
37 | private int currMode = 0;
38 | /**
39 | * 圆角半径
40 | */
41 | private int currRound = dp2px(10);
42 |
43 | public RoundRectImageView(Context context) {
44 | super(context);
45 | initViews();
46 | }
47 |
48 | public RoundRectImageView(Context context, AttributeSet attrs) {
49 | this(context, attrs, 0);
50 | }
51 |
52 | public RoundRectImageView(Context context, AttributeSet attrs, int defStyleAttr) {
53 | super(context, attrs, defStyleAttr);
54 | obtainStyledAttrs(context, attrs, defStyleAttr);
55 | initViews();
56 | }
57 |
58 | private void obtainStyledAttrs(Context context, AttributeSet attrs, int defStyleAttr) {
59 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundImageView, defStyleAttr, 0);
60 | currMode = a.hasValue(R.styleable.RoundImageView_type) ? a.getInt(R.styleable.RoundImageView_type, MODE_NONE) : MODE_NONE;
61 | currRound = a.hasValue(R.styleable.RoundImageView_radius_dp) ? a.getDimensionPixelSize(R.styleable.RoundImageView_radius_dp, currRound) : currRound;
62 | a.recycle();
63 | }
64 |
65 | private void initViews() {
66 | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
67 | }
68 |
69 | @Override
70 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
71 | /**
72 | * 当模式为圆形模式的时候,我们强制让宽高一致
73 | */
74 | if (currMode == MODE_CIRCLE) {
75 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
76 | int result = Math.min(getMeasuredHeight(), getMeasuredWidth());
77 | setMeasuredDimension(result, result);
78 | } else {
79 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
80 | }
81 | }
82 |
83 | @Override
84 | protected void onDraw(Canvas canvas) {
85 | Drawable mDrawable = getDrawable();
86 | Matrix mDrawMatrix = getImageMatrix();
87 | if (mDrawable == null) {
88 | return; // couldn't resolve the URI
89 | }
90 |
91 | if (mDrawable.getIntrinsicWidth() == 0 || mDrawable.getIntrinsicHeight() == 0) {
92 | return; // nothing to draw (empty bounds)
93 | }
94 |
95 | if (mDrawMatrix == null && getPaddingTop() == 0 && getPaddingLeft() == 0) {
96 | mDrawable.draw(canvas);
97 | } else {
98 | final int saveCount = canvas.getSaveCount();
99 | canvas.save();
100 |
101 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
102 | if (getCropToPadding()) {
103 | final int scrollX = getScrollX();
104 | final int scrollY = getScrollY();
105 | canvas.clipRect(scrollX + getPaddingLeft(), scrollY + getPaddingTop(),
106 | scrollX + getRight() - getLeft() - getPaddingRight(),
107 | scrollY + getBottom() - getTop() - getPaddingBottom());
108 | }
109 | }
110 | canvas.translate(getPaddingLeft(), getPaddingTop());
111 | if (currMode == MODE_CIRCLE) {//当为圆形模式的时候
112 | Bitmap bitmap = drawable2Bitmap(mDrawable);
113 | mPaint.setShader(new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
114 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, getWidth() / 2, mPaint);
115 | } else if (currMode == MODE_ROUND) {//当为圆角模式的时候
116 | Bitmap bitmap = drawable2Bitmap(mDrawable);
117 | mPaint.setShader(new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
118 | canvas.drawRoundRect(new RectF(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(), getHeight() - getPaddingBottom()),
119 | currRound, currRound, mPaint);
120 | } else {
121 | if (mDrawMatrix != null) {
122 | canvas.concat(mDrawMatrix);
123 | }
124 | mDrawable.draw(canvas);
125 | }
126 | canvas.restoreToCount(saveCount);
127 | }
128 | }
129 |
130 | /**
131 | * drawable转换成bitmap
132 | */
133 | private Bitmap drawable2Bitmap(Drawable drawable) {
134 | if (drawable == null) {
135 | return null;
136 | }
137 | Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
138 | Canvas canvas = new Canvas(bitmap);
139 | //根据传递的scaletype获取matrix对象,设置给bitmap
140 | Matrix matrix = getImageMatrix();
141 | if (matrix != null) {
142 | canvas.concat(matrix);
143 | }
144 | drawable.draw(canvas);
145 | return bitmap;
146 | }
147 |
148 | private int dp2px(float value) {
149 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, getResources().getDisplayMetrics());
150 | }
151 |
152 | public void setCurrMode(int currMode) {
153 | this.currMode = currMode;
154 | }
155 |
156 | public void setCurrRound(int currRound) {
157 | this.currRound = dp2px(currRound);
158 | }
159 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/ScrawlPlayView.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.os.Handler;
8 | import android.support.annotation.Nullable;
9 | import android.util.AttributeSet;
10 | import android.util.Log;
11 | import android.view.View;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | /**
17 | * 刷礼物后 自动播放 涂鸦
18 | * Created by think on 2018/4/20.
19 | */
20 |
21 | public class ScrawlPlayView extends View {
22 |
23 | public ScrawlPlayView(Context context) {
24 | super(context);
25 | init();
26 | }
27 |
28 | public ScrawlPlayView(Context context, @Nullable AttributeSet attrs) {
29 | super(context, attrs);
30 | init();
31 | }
32 |
33 | public ScrawlPlayView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
34 | super(context, attrs, defStyleAttr);
35 | init();
36 | }
37 |
38 | //涂鸦最大尺寸
39 | private int screenWidth, screenHeight;
40 | //画笔
41 | private GiftBean mGiftBean;
42 | //涂鸦图片
43 | private Bitmap mBitmap;
44 | //涂鸦图片尺寸
45 | private int mBitmapW, mBitmapH;
46 | //涂鸦图片集合
47 | private List listGift;
48 |
49 | private Handler handler=null;
50 | // private String currentGiftName = "g000";// 自动播放时画笔
51 |
52 | private OnScrawlPlayStateListener onScrawlPlayStateListener;
53 |
54 |
55 | public void setOnScrawlPlayStateListener(OnScrawlPlayStateListener onScrawlPlayStateListener) {
56 | this.onScrawlPlayStateListener = onScrawlPlayStateListener;
57 | }
58 |
59 | // 一个一个画。调用者控制 并保证 一组画完在画下一组
60 | public void setGiftBean(GiftBean mGiftBean,float _screenWidth, float _screenHeight) {
61 | this.mGiftBean = mGiftBean;
62 | float w = _screenWidth / screenWidth;
63 | float h = _screenHeight / screenHeight;
64 |
65 | if(mGiftBean .id >= 0){
66 | mGiftBean.currentX = mGiftBean.currentX / w;
67 | mGiftBean.currentY = mGiftBean.currentY / h;
68 | //不可以在子线程中更新UI
69 | handler.post(mRunnable);
70 | }
71 | }
72 |
73 | //一组一组画 有可能一组没画完 又来一组 所以不合适,使用 一个一个画
74 | public void setListBitmap(final List _listBitmap, final float _screenWidth, final float _screenHeight) {
75 | clear();
76 | new Thread(){
77 | public void run(){
78 | //计算 原始画板和目标画板比
79 | float w = _screenWidth / screenWidth;
80 | float h = _screenHeight / screenHeight;
81 | try{
82 | //自动播放涂鸦,
83 | for(int i = 0; i < _listBitmap.size(); i++){
84 | if(i == 0){
85 | onScrawlPlayStateListener.onStart();
86 | }
87 | mGiftBean = _listBitmap.get(i);
88 | if(mGiftBean .id >= 0){
89 | mGiftBean.currentX = mGiftBean.currentX / w;
90 | mGiftBean.currentY = mGiftBean.currentY / h;
91 | //不可以在子线程中更新UI
92 | handler.post(mRunnable);
93 | // 睡眠80毫秒
94 | Thread.sleep(50);
95 | }
96 | if(i == _listBitmap.size() - 1){
97 | Thread.sleep(1500);
98 | onScrawlPlayStateListener.onEnd();
99 | }
100 | }
101 | }catch(Exception e){
102 | Log.i("-----","---13---" + e.getMessage());
103 | }
104 | }
105 | }.start();
106 | }
107 | // 构建Runnable对象,在runnable中更新界面
108 | private Runnable mRunnable = new Runnable(){
109 | @Override
110 | public void run() {
111 | //更新界面
112 | if(mGiftBean != null){
113 | mBitmap = GiftData.getGiftBitmap(getContext(),mGiftBean.fileName);
114 | if(mBitmap != null){
115 | mBitmapW = mBitmap.getWidth();
116 | mBitmapH = mBitmap.getHeight();
117 | mGiftBean.mBitmap = mBitmap;
118 | listGift.add(mGiftBean);
119 | invalidate();
120 | }
121 | }
122 | // try {
123 | // if(mGiftBean != null){
124 | // Field field = R.drawable.class.getDeclaredField(mGiftBean.fileName);
125 | // int resId = field.getInt(null);
126 | // mBitmap = BitmapFactory.decodeResource(getResources(),resId);
127 | // mBitmapW = mBitmap.getWidth();
128 | // mBitmapH = mBitmap.getHeight();
129 | // mGiftBean.mBitmap = mBitmap;
130 | // listGift.add(mGiftBean);
131 | //
132 | // invalidate();
133 | // }
134 | // }catch(Exception e){
135 | // Log.i("-----","" + e.getMessage());
136 | // e.printStackTrace();
137 | // }
138 | }
139 |
140 | };
141 |
142 |
143 | private void init() {
144 | listGift = new ArrayList();
145 | //创建属于主线程的handler
146 | handler=new Handler();
147 |
148 | // mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.g000);
149 | // mGiftBean = new GiftBean(0,currentGiftName,0);
150 | // mGiftBean.mBitmap = mBitmap;
151 | // this.mBitmapW = mBitmap.getWidth();
152 | // this.mBitmapH = mBitmap.getHeight();
153 | }
154 | @Override
155 | protected void onDraw(Canvas canvas) {
156 | //画
157 | if(listGift != null && listGift.size() > 0){
158 | for (GiftBean bean : listGift) {
159 | // 除以2 是图片中心
160 | // if(bean.mBitmap != null){
161 | canvas.drawBitmap(bean.mBitmap, bean.currentX - mBitmapW / 2, bean.currentY - mBitmapH / 2, null);
162 | // }else if(mBitmap != null){
163 | // canvas.drawBitmap(mBitmap, bean.currentX - mBitmapW / 2, bean.currentY - mBitmapH / 2, null);
164 | // }
165 | }
166 | } else{
167 | canvas.drawColor(Color.TRANSPARENT);//重置画板
168 | }
169 | }
170 |
171 | public void clear(){
172 | if(listGift != null){
173 | listGift.clear();
174 | }
175 | invalidate();
176 | }
177 | @Override
178 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
179 | super.onLayout(changed, left, top, right, bottom);
180 | //确定子View在父View中的位置 后回调 onLayout。所以在此获取画板尺寸
181 | this.screenWidth = getWidth();
182 | this.screenHeight = getHeight();
183 | }
184 | public int getScreenWidth() {
185 | return screenWidth;
186 | }
187 | public int getScreenHeight() {
188 | return screenHeight;
189 | }
190 | // 播放状态回掉
191 | public interface OnScrawlPlayStateListener{
192 | //播放开始
193 | public void onStart();
194 | //播放完毕
195 | public void onEnd();
196 | }
197 | }
198 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/ScrawlView.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.graphics.Canvas;
7 | import android.graphics.Color;
8 | import android.os.Handler;
9 | import android.support.annotation.Nullable;
10 | import android.util.AttributeSet;
11 | import android.view.MotionEvent;
12 | import android.view.View;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | /**
18 | * 涂鸦view
19 | * 刷礼物
20 | * Created by think on 2018/4/20.
21 | */
22 |
23 | public class ScrawlView extends View {
24 |
25 | public ScrawlView(Context context) {
26 | super(context);
27 | init();
28 | }
29 |
30 | public ScrawlView(Context context, @Nullable AttributeSet attrs) {
31 | super(context, attrs);
32 | init();
33 | }
34 |
35 | public ScrawlView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
36 | super(context, attrs, defStyleAttr);
37 | init();
38 | }
39 |
40 |
41 | private GiftBean mGiftBean;// 画笔
42 | //涂鸦图片
43 | private Bitmap mBitmap;
44 | //涂鸦最大尺寸
45 | private int screenWidth, screenHeight;
46 | //涂鸦图片尺寸
47 | private int mBitmapW, mBitmapH;
48 | //临时记录画笔轨迹
49 | private float currentX = 0, currentY = 0;
50 | //涂鸦图片集合
51 | private List listGift;
52 |
53 | public List getListBitmap() {
54 | return listGift;
55 | }
56 | private Handler handler=null;
57 | private String currentGiftName = "g000";// 自动播放时画笔
58 |
59 | private OnScrawlChangedListener onScrawlChangedListener;
60 |
61 |
62 | public void setOnScrawlChangedListener(OnScrawlChangedListener onScrawlChangedListener) {
63 | this.onScrawlChangedListener = onScrawlChangedListener;
64 | }
65 |
66 | // 改变画笔
67 | public void setGiftBean(GiftBean mGiftBean) {
68 | this.mGiftBean = mGiftBean;
69 | currentGiftName = mGiftBean.fileName;
70 | handler.post(mRunnable);
71 | }
72 | // 构建Runnable对象,在runnable中更新界面
73 | private Runnable mRunnable = new Runnable(){
74 | @Override
75 | public void run() {
76 | //更新界面
77 | mBitmap = GiftData.getGiftBitmap(getContext(),currentGiftName);
78 | if(mBitmap != null){
79 | mBitmapW = mBitmap.getWidth();
80 | mBitmapH = mBitmap.getHeight();
81 | invalidate();
82 | }
83 |
84 | // try {
85 | // Field field = R.drawable.class.getDeclaredField(currentGiftName);
86 | // int resId = field.getInt(null);
87 | // mBitmap = BitmapFactory.decodeResource(getResources(),resId);
88 | // mBitmapW = mBitmap.getWidth();
89 | // mBitmapH = mBitmap.getHeight();
90 | // invalidate();
91 | // }catch(Exception e){
92 | // e.printStackTrace();
93 | // }
94 | }
95 | };
96 |
97 | private void init() {
98 | listGift = new ArrayList();
99 | //创建属于主线程的handler
100 | handler=new Handler();
101 |
102 | mBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.g000);
103 | mGiftBean = GiftData.getGiftList().get(0).get(0);
104 | mGiftBean.mBitmap = mBitmap;
105 | this.mBitmapW = mBitmap.getWidth();
106 | this.mBitmapH = mBitmap.getHeight();
107 | }
108 |
109 | @Override
110 | protected void onDraw(Canvas canvas) {
111 | //画
112 | if(listGift != null && listGift.size() > 0){
113 | for (GiftBean bean : listGift) {
114 | // 除以2 是图片中心
115 | canvas.drawBitmap(bean.mBitmap, bean.currentX - mBitmapW / 2, bean.currentY - mBitmapH / 2, null);
116 | }
117 | } else{
118 | canvas.drawColor(Color.TRANSPARENT);//重置画板
119 | }
120 | onScrawlChangedListener.onChanged(listGift);
121 | }
122 |
123 | @Override
124 | public boolean onTouchEvent(MotionEvent event) {
125 | float x = event.getX();
126 | float y = event.getY();
127 |
128 | switch (event.getAction()) {
129 | case MotionEvent.ACTION_DOWN:
130 | currentX = 0;
131 | currentY = 0;
132 | break;
133 | case MotionEvent.ACTION_MOVE:
134 | break;
135 | case MotionEvent.ACTION_UP:
136 | break;
137 | }
138 |
139 | //不可超越画板界限
140 | if(x > 0 && x < screenWidth && y > 0 && y < screenHeight){
141 | if(currentX <= 0 && currentY <= 0){
142 | currentX = x;
143 | currentY = y;
144 | listGift.add(new GiftBean(mGiftBean.id,mGiftBean.fileName,mGiftBean.price,currentX,currentY,mBitmap));
145 | }else{
146 | //判断
147 | if(Math.abs(currentX - x) >= Math.abs(currentY - y) ){//横
148 | if(Math.abs(currentX - x) - mBitmapW / 3 * 2 > 0){// 滑动距离大于图片宽 记录xy
149 | currentX = x;
150 | currentY = y;
151 | listGift.add(new GiftBean(mGiftBean.id,mGiftBean.fileName,mGiftBean.price,currentX,currentY,mBitmap));
152 | }
153 | }else{//竖
154 | if(Math.abs(currentY - y) - mBitmapH / 3 * 2 > 0){// 滑动距离大于图片高 记录xy
155 | currentX = x;
156 | currentY = y;
157 | listGift.add(new GiftBean(mGiftBean.id,mGiftBean.fileName,mGiftBean.price,currentX,currentY,mBitmap));
158 | }
159 | }
160 | }
161 | invalidate();
162 | }
163 | return true;
164 | }
165 | @Override
166 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
167 | super.onLayout(changed, left, top, right, bottom);
168 | //确定子View在父View中的位置 后回调 onLayout。所以在此获取画板尺寸
169 | this.screenWidth = getWidth();
170 | this.screenHeight = getHeight();
171 | }
172 | public void clear(){
173 | if(listGift != null){
174 | listGift.clear();
175 | }
176 | invalidate();
177 | }
178 |
179 | public int getScreenWidth() {
180 | return screenWidth;
181 | }
182 |
183 | public int getScreenHeight() {
184 | return screenHeight;
185 | }
186 |
187 | // 涂鸦监听
188 | public interface OnScrawlChangedListener{
189 | //涂鸦变化 传入所有涂鸦list 用以计算涂鸦价格
190 | void onChanged(List listGift);
191 | }
192 | }
193 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mzw/giftscrawlto/SyncThread.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import android.os.Bundle;
4 | import android.os.Handler;
5 | import android.os.Message;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * 刷礼物 播放 一个一个画。调用者控制 并保证 一组画完在画下一组
11 | * Created by think on 2018/4/21.
12 | */
13 |
14 | public class SyncThread implements Runnable {
15 | private ScrawlPlayView mScrawlPlayView;
16 | private Handler handler;
17 |
18 | private String toid;
19 | private String to_pic;
20 | private String to_name;
21 | private String msgBody;
22 |
23 | public void setToid(String toid) {
24 | this.toid = toid;
25 | }
26 |
27 | public void setTo_name(String to_name) {
28 | this.to_name = to_name;
29 | }
30 |
31 | public void setMsgBody(String msgBody) {
32 | this.msgBody = msgBody;
33 | }
34 |
35 | public SyncThread(ScrawlPlayView mScrawlPlayView, Handler handler) {
36 | this.mScrawlPlayView = mScrawlPlayView;
37 | this.handler = handler;
38 | }
39 |
40 | public void run() {
41 | synchronized(this) { // 同步的
42 | try{
43 | // String msgBody = Thread.currentThread().getName();
44 | LogUtils.i("-----","msgBody : " + msgBody);
45 | LogUtils.i("-----","from : " + to_name);
46 | List list = GiftData.toList(msgBody);
47 | if(list != null && list.size() > 0){
48 | float screenWidth = mScrawlPlayView.getScreenWidth(), screenHeight = mScrawlPlayView.getScreenHeight();
49 | for (GiftBean bean:list) {
50 | if(bean.id == -1){
51 | to_pic = bean.fileName;
52 | screenWidth = bean.currentX;
53 | screenHeight = bean.currentY;
54 | break;
55 | }
56 | }
57 | handler.sendEmptyMessage(LogUtils.B);
58 | for(int i = 0; i < list.size(); i++){
59 | GiftBean mGiftBean = list.get(i);
60 | if(mGiftBean.id >= 0){
61 | Thread.sleep(100);
62 | Bundle mBundle = new Bundle();
63 | mBundle.putString("id",toid);
64 | mBundle.putString("name",to_name);
65 | mBundle.putString("pic",to_pic);
66 |
67 | mBundle.putString("giftName",mGiftBean.name);
68 | mBundle.putString("giftFileName",mGiftBean.fileName);
69 |
70 | Message msg = new Message();
71 | // msg.obj = mGiftBean;
72 | msg.what = LogUtils.D;
73 | msg.setData(mBundle);
74 | handler.sendMessage(msg);
75 | mScrawlPlayView.setGiftBean(mGiftBean,screenWidth,screenHeight);
76 | }
77 | if(i == list.size() - 1){// 播放完 等待1.5秒 关闭播放
78 | Thread.sleep(1500);
79 | handler.sendEmptyMessage(LogUtils.C);
80 | }
81 | }
82 | }
83 | Thread.sleep(1000);
84 | }catch (Exception e){
85 | e.printStackTrace();
86 | }
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/gift_ins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/gift_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_bottom_in_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_left_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_06.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
10 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_16.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
10 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_17.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
10 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_33.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
9 |
10 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_35.xml:
--------------------------------------------------------------------------------
1 |
3 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_a.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_h.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/transparent_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
22 |
23 |
30 |
34 |
38 |
39 |
40 |
41 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/gift_broadcast_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
19 |
27 |
33 |
40 |
46 |
47 |
52 |
53 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/gift_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
22 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/gift_popup_window.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
13 |
19 |
23 |
28 |
35 |
42 |
50 |
57 |
58 |
62 |
67 |
68 |
75 |
76 |
84 |
85 |
90 |
107 |
115 |
126 |
127 |
128 |
135 |
136 |
137 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/gifttion_gridview.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g000.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g000.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g001.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g002.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g003.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g004.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g005.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g006.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g007.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g008.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g008.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g009.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g009.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g010.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g010.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g011.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g011.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g012.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g012.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g013.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g013.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/g014.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/g014.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/gift_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/gift_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/guide_page_dot_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/guide_page_dot_checked.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/guide_page_dot_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/guide_page_dot_unchecked.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/icon_game_manage_del.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/icon_game_manage_del.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/money.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/money.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/more_a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-hdpi/more_a.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/raw/qwe.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/app/src/main/res/raw/qwe.gif
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 | #99E3E3E3
8 | #00000000
9 |
10 | #99000000
11 | #a9000000
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 礼物涂鸦
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/mzw/giftscrawlto/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.mzw.giftscrawlto;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/think-ing/giftScrawlTo/69d4f965e017d9d923479acb418fb6c42f250d9d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed May 16 10:10:28 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------