add gradle setting · greenjava1/AndroidStudy@5c7db1e · GitHub
Skip to content

Commit 5c7db1e

Browse files
committed
add gradle setting
1 parent 19b7835 commit 5c7db1e

5 files changed

Lines changed: 141 additions & 12 deletions

File tree

app/build.gradle

Lines changed: 34 additions & 11 deletions

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
android:label="@string/app_name"
99
android:supportsRtl="true"
1010
android:theme="@style/AppTheme">
11+
<meta-data
12+
android:name="UMENG_CHANNEL"
13+
android:value="${UMENG_CHANNEL_VALUE}" />
14+
1115
<activity
1216
android:name=".MainActivity"
1317
android:screenOrientation="portrait">

app/src/main/java/org/ninetripods/mq/study/MainActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public void setContentView() {
3535

3636
@Override
3737
public void initViews() {
38+
toast("" + BuildConfig.IS_SHOW_LOG);
3839
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
3940
initToolBar(toolbar, getResources().getString(R.string.app_name), false);
4041
recycle_view = (RecyclerView) findViewById(R.id.recycle_view);
@@ -53,7 +54,7 @@ private void initBeans() {
5354
{"属性动画+Path", "PathMeasure", "Path+SVG", "", ""},
5455
{"贝塞尔曲线", "基本用法示例", "", "", ""},
5556
{"进程间通信", "Intent", "AIDL", "Messenger", "Binder"},
56-
{"图片加载", "Volley(TODO)","Glide(TODO)", "", "", ""},
57+
{"图片加载", "Volley(TODO)", "Glide(TODO)", "", "", ""},
5758
{"JNI", "", "", "", ""}
5859
};
5960
for (String[] anArray : array) {
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package org.ninetripods.mq.study.util;
2+
3+
import android.util.Log;
4+
5+
import org.ninetripods.mq.study.BuildConfig;
6+
7+
/**
8+
* Created by MQ on 2017/3/28.
9+
*/
10+
11+
public class MyLog {
12+
public static int v(String tag, String msg) {
13+
if (BuildConfig.IS_SHOW_LOG) {
14+
return Log.v(tag, msg);
15+
} else {
16+
return -1;
17+
}
18+
}
19+
20+
public static int v(String tag, String msg, Throwable tr) {
21+
if (BuildConfig.IS_SHOW_LOG) {
22+
return Log.v(tag, msg, tr);
23+
} else {
24+
return -1;
25+
}
26+
}
27+
28+
public static int d(String tag, String msg) {
29+
if (BuildConfig.IS_SHOW_LOG) {
30+
return Log.d(tag, msg);
31+
} else {
32+
return -1;
33+
}
34+
}
35+
36+
public static int d(String tag, String msg, Throwable tr) {
37+
if (BuildConfig.IS_SHOW_LOG) {
38+
return Log.d(tag, msg, tr);
39+
} else {
40+
return -1;
41+
}
42+
}
43+
44+
public static int i(String tag, String msg) {
45+
if (BuildConfig.IS_SHOW_LOG) {
46+
return Log.i(tag, msg);
47+
} else {
48+
return -1;
49+
}
50+
}
51+
52+
public static int i(String tag, String msg, Throwable tr) {
53+
if (BuildConfig.IS_SHOW_LOG) {
54+
return Log.i(tag, msg, tr);
55+
} else {
56+
return -1;
57+
}
58+
}
59+
60+
public static int w(String tag, String msg) {
61+
if (BuildConfig.IS_SHOW_LOG) {
62+
return Log.w(tag, msg);
63+
} else {
64+
return -1;
65+
}
66+
}
67+
68+
public static int w(String tag, String msg, Throwable tr) {
69+
if (BuildConfig.IS_SHOW_LOG) {
70+
return Log.w(tag, msg, tr);
71+
} else {
72+
return -1;
73+
}
74+
}
75+
76+
public static int w(String tag, Throwable tr) {
77+
if (BuildConfig.IS_SHOW_LOG) {
78+
return Log.w(tag, tr);
79+
} else {
80+
return -1;
81+
}
82+
}
83+
84+
public static int e(String tag, String msg) {
85+
if (BuildConfig.IS_SHOW_LOG) {
86+
return Log.e(tag, msg);
87+
} else {
88+
return -1;
89+
}
90+
}
91+
92+
public static int e(String tag, String msg, Throwable tr) {
93+
if (BuildConfig.IS_SHOW_LOG) {
94+
return Log.e(tag, msg, tr);
95+
} else {
96+
return -1;
97+
}
98+
}
99+
}

gradle.properties

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)