Log.e("i***-",i+"");
|
283
|
|
ProfileManager.getInstance().setCount(getApplicationContext(),i);
|
|
284
|
|
count = i;
|
|
285
|
|
}
|
|
286
|
|
}
|
|
287
|
|
|
|
288
|
|
private void setFestival(){
|
|
289
|
|
int time = (int) (System.currentTimeMillis() / 1000);
|
|
290
|
|
if (time >= 1484841600 && time <= 1486569599 ){
|
|
291
|
|
MainApplication.festival_time = "1";
|
|
292
|
|
}else if (time >= 1486569600 && time <= 1486915199){
|
|
293
|
|
MainApplication.festival_time = "2";
|
|
294
|
|
}
|
|
295
|
|
}
|
|
296
|
|
|
|
297
|
|
/**
|
|
298
|
|
* 设置greenDao
|
|
299
|
|
*/
|
|
300
|
|
private void setDatabase() {
|
|
301
|
|
// 通过 DaoMaster 的内部类 DevOpenHelper,你可以得到一个便利的 SQLiteOpenHelper 对象。
|
|
302
|
|
// 可能你已经注意到了,你并不需要去编写「CREATE TABLE」这样的 SQL 语句,因为 greenDAO 已经帮你做了。
|
|
303
|
|
// 注意:默认的 DaoMaster.DevOpenHelper 会在数据库升级时,删除所有的表,意味着这将导致数据的丢失。
|
|
304
|
|
// 所以,在正式的项目中,你还应该做一层封装,来实现数据库的安全升级。
|
|
305
|
|
mHelper = new DaoMaster.DevOpenHelper(this, "my-search-text-db", null);
|
|
306
|
|
db = mHelper.getWritableDatabase();
|
|
307
|
|
// 注意:该数据库连接属于 DaoMaster,所以多个 Session 指的是相同的数据库连接。
|
|
308
|
|
mDaoMaster = new DaoMaster(db);
|
|
309
|
|
mDaoSession = mDaoMaster.newSession();
|
|
310
|
|
}
|
|
311
|
|
public DaoSession getDaoSession() {
|
|
312
|
|
return mDaoSession;
|
|
313
|
|
}
|
|
314
|
|
public SQLiteDatabase getDb() {
|
|
315
|
|
return db;
|
|
316
|
|
}
|
|
|
263
|
public static boolean isLogin() {
|
|
|
264
|
if ("".equals(userPhone)) {
|
|
|
265
|
return false;
|
|
|
266
|
}
|
|
|
267
|
|
|
|
268
|
return true;
|
|
|
269
|
|
|
|
270
|
}
|
|
|
271
|
|
|
|
272
|
private void loginRemind() {
|
|
|
273
|
round = ProfileManager.getInstance().getRound(getApplicationContext());
|
|
|
274
|
count = ProfileManager.getInstance().getCount(getApplicationContext());
|
|
|
275
|
if (!MainApplication.isLogin()) {
|
|
|
276
|
int i = count + 1;
|
|
|
277
|
Log.e("i***-", i + "");
|
|
|
278
|
ProfileManager.getInstance().setCount(getApplicationContext(), i);
|
|
|
279
|
count = i;
|
|
|
280
|
}
|
|
|
281
|
}
|
|
|
282
|
|
|
|
283
|
private void setFestival() {
|
|
|
284
|
int time = (int) (System.currentTimeMillis() / 1000);
|
|
|
285
|
if (time >= 1484841600 && time <= 1486569599) {
|
|
|
286
|
MainApplication.festival_time = "1";
|
|
|
287
|
} else if (time >= 1486569600 && time <= 1486915199) {
|
|
|
288
|
MainApplication.festival_time = "2";
|
|
|
289
|
}
|
|
|
290
|
}
|
|
|
291
|
|
|
|
292
|
/**
|
|
|
293
|
* 设置greenDao
|
|
|
294
|
*/
|
|
|
295
|
private void setDatabase() {
|
|
|
296
|
// 通过 DaoMaster 的内部类 DevOpenHelper,你可以得到一个便利的 SQLiteOpenHelper 对象。
|
|
|
297
|
// 可能你已经注意到了,你并不需要去编写「CREATE TABLE」这样的 SQL 语句,因为 greenDAO 已经帮你做了。
|
|
|
298
|
// 注意:默认的 DaoMaster.DevOpenHelper 会在数据库升级时,删除所有的表,意味着这将导致数据的丢失。
|
|
|
299
|
// 所以,在正式的项目中,你还应该做一层封装,来实现数据库的安全升级。
|
|
|
300
|
mHelper = new DaoMaster.DevOpenHelper(this, "my-search-text-db", null);
|
|
|
301
|
db = mHelper.getWritableDatabase();
|
|
|
302
|
// 注意:该数据库连接属于 DaoMaster,所以多个 Session 指的是相同的数据库连接。
|
|
|
303
|
mDaoMaster = new DaoMaster(db);
|
|
|
304
|
mDaoSession = mDaoMaster.newSession();
|
|
|
305
|
}
|
|
|
306
|
|
|
|
307
|
public DaoSession getDaoSession() {
|
|
|
308
|
return mDaoSession;
|
|
|
309
|
}
|
|
|
310
|
|
|
|
311
|
public SQLiteDatabase getDb() {
|
|
|
312
|
return db;
|
|
|
313
|
}
|
|
317
|
314
|
|
|
318
|
315
|
}
|
|
319
|
316
|
|
|
|
@ -7,7 +7,9 @@
|
|
7
|
7
|
android:id="@+id/publishtopic_back"
|
|
8
|
8
|
android:layout_width="44dp"
|
|
9
|
9
|
android:layout_height="44dp"
|
|
10
|
|
android:background="#000" />
|
|
|
10
|
android:padding="13dp"
|
|
|
11
|
android:rotation="90"
|
|
|
12
|
android:src="@drawable/icon_edit_down" />
|
|
11
|
13
|
|
|
12
|
14
|
<TextView
|
|
13
|
15
|
android:layout_width="wrap_content"
|
|
|
@ -56,7 +58,7 @@
|
|
56
|
58
|
android:background="@null"
|
|
57
|
59
|
android:gravity="top"
|
|
58
|
60
|
android:hint="聊聊你的想法......"
|
|
59
|
|
android:minHeight="120dp"
|
|
|
61
|
android:minHeight="260dp"
|
|
60
|
62
|
android:textColorHint="#555555"
|
|
61
|
63
|
android:textSize="14sp" />
|
|
62
|
64
|
|
|
|
@ -68,21 +70,39 @@
|
|
68
|
70
|
</ScrollView>
|
|
69
|
71
|
|
|
70
|
72
|
|
|
71
|
|
<TextView
|
|
72
|
|
android:id="@+id/publishtopic_choose_topic"
|
|
|
73
|
<LinearLayout
|
|
73
|
74
|
android:layout_width="wrap_content"
|
|
74
|
75
|
android:layout_height="30dp"
|
|
75
|
76
|
android:layout_alignParentBottom="true"
|
|
76
|
77
|
android:layout_marginStart="15dp"
|
|
77
|
78
|
android:layout_marginBottom="10dp"
|
|
78
|
|
android:background="#EE12E812"
|
|
|
79
|
android:background="#f5f5f5"
|
|
79
|
80
|
android:gravity="center_vertical"
|
|
80
|
|
android:orientation="horizontal"
|
|
81
|
|
android:paddingStart="@dimen/ui_10_dip"
|
|
82
|
|
android:paddingEnd="@dimen/ui_10_dip"
|
|
83
|
|
android:text="# 选择话题"
|
|
84
|
|
android:textColor="#555"
|
|
85
|
|
android:textSize="14sp" />
|
|
|
81
|
android:orientation="horizontal">
|
|
|
82
|
|
|
|
83
|
|
|
|
84
|
<TextView
|
|
|
85
|
android:id="@+id/publishtopic_choose_topic"
|
|
|
86
|
android:layout_width="wrap_content"
|
|
|
87
|
android:layout_height="wrap_content"
|
|
|
88
|
android:ellipsize="end"
|
|
|
89
|
android:lines="1"
|
|
|
90
|
android:maxWidth="180dp"
|
|
|
91
|
android:paddingStart="@dimen/ui_10_dip"
|
|
|
92
|
android:paddingEnd="@dimen/ui_10_dip"
|
|
|
93
|
android:text="# 选择话题"
|
|
|
94
|
android:textColor="#555"
|
|
|
95
|
android:textSize="14sp" />
|
|
|
96
|
|
|
|
97
|
<ImageView
|
|
|
98
|
android:id="@+id/publishtopic_choose_topic_de"
|
|
|
99
|
android:layout_width="30dp"
|
|
|
100
|
android:layout_height="30dp"
|
|
|
101
|
android:padding="3dp"
|
|
|
102
|
android:src="@drawable/icon_close"
|
|
|
103
|
android:visibility="gone" />
|
|
|
104
|
|
|
|
105
|
</LinearLayout>
|
|
86
|
106
|
|
|
87
|
107
|
<TextView
|
|
88
|
108
|
android:id="@+id/publishtopic_choose_preview"
|
|
|
@ -8,14 +8,16 @@
|
|
8
|
8
|
android:id="@+id/topic_back"
|
|
9
|
9
|
android:layout_width="44dp"
|
|
10
|
10
|
android:layout_height="44dp"
|
|
11
|
|
android:background="#000" />
|
|
|
11
|
android:padding="13dp"
|
|
|
12
|
android:rotation="90"
|
|
|
13
|
android:src="@drawable/icon_edit_down" />
|
|
12
|
14
|
|
|
13
|
15
|
<TextView
|
|
14
|
16
|
android:layout_width="wrap_content"
|
|
15
|
17
|
android:layout_height="44dp"
|
|
16
|
18
|
android:layout_centerHorizontal="true"
|
|
17
|
19
|
android:gravity="center_vertical"
|
|
18
|
|
android:text="发布"
|
|
|
20
|
android:text="话题"
|
|
19
|
21
|
android:textColor="#222"
|
|
20
|
22
|
android:textSize="18sp" />
|
|
21
|
23
|
|
|
|
@ -46,7 +48,7 @@
|
|
46
|
48
|
android:layout_centerVertical="true"
|
|
47
|
49
|
android:layout_marginStart="8dp"
|
|
48
|
50
|
android:layout_marginEnd="4dp"
|
|
49
|
|
android:background="#b2de" />
|
|
|
51
|
android:background="@drawable/icon_search_list" />
|
|
50
|
52
|
|
|
51
|
53
|
<View
|
|
52
|
54
|
android:id="@+id/topic_input_end"
|
|
|
@ -56,7 +58,8 @@
|
|
56
|
58
|
android:layout_centerVertical="true"
|
|
57
|
59
|
android:layout_marginStart="4dp"
|
|
58
|
60
|
android:layout_marginEnd="8dp"
|
|
59
|
|
android:background="#b2de" />
|
|
|
61
|
android:background="@drawable/icon_tuijian_close"
|
|
|
62
|
android:visibility="gone" />
|
|
60
|
63
|
|
|
61
|
64
|
<EditText
|
|
62
|
65
|
android:id="@+id/topic_con"
|
|
|
@ -67,6 +70,7 @@
|
|
67
|
70
|
android:background="@null"
|
|
68
|
71
|
android:gravity="center_vertical"
|
|
69
|
72
|
android:hint="请输入你感兴趣的话题"
|
|
|
73
|
android:lines="1"
|
|
70
|
74
|
android:textColorHint="#555555"
|
|
71
|
75
|
android:textSize="14sp" />
|
|
72
|
76
|
</RelativeLayout>
|
|
|
@ -1,28 +1,57 @@
|
|
1
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
2
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
3
|
android:layout_width="match_parent"
|
|
4
|
|
android:layout_height="60dp"
|
|
5
|
|
android:paddingStart="15dp"
|
|
6
|
|
android:paddingEnd="15dp">
|
|
|
4
|
android:layout_height="wrap_content"
|
|
|
5
|
android:orientation="vertical">
|
|
7
|
6
|
|
|
8
|
|
<ImageView
|
|
9
|
|
android:id="@+id/item_topic_img"
|
|
10
|
|
android:layout_width="50dp"
|
|
11
|
|
android:layout_height="43dp"
|
|
12
|
|
android:layout_centerVertical="true"
|
|
13
|
|
android:background="#000" />
|
|
14
|
|
|
|
15
|
|
<TextView
|
|
16
|
|
android:id="@+id/item_topic_name"
|
|
|
7
|
<LinearLayout
|
|
|
8
|
android:id="@+id/item_topic_title"
|
|
17
|
9
|
android:layout_width="match_parent"
|
|
18
|
10
|
android:layout_height="wrap_content"
|
|
19
|
|
android:layout_centerVertical="true"
|
|
20
|
|
android:layout_marginStart="10dp"
|
|
21
|
|
android:layout_toEndOf="@+id/item_topic_img"
|
|
22
|
|
android:ellipsize="end"
|
|
23
|
|
android:maxLines="2"
|
|
24
|
|
android:text="adadasd"
|
|
25
|
|
android:textColor="#444444"
|
|
26
|
|
android:textSize="14sp" />
|
|
|
11
|
android:visibility="gone"
|
|
|
12
|
android:orientation="vertical">
|
|
|
13
|
|
|
|
14
|
<TextView
|
|
|
15
|
android:layout_width="wrap_content"
|
|
|
16
|
android:layout_height="50dp"
|
|
|
17
|
android:layout_marginStart="15dp"
|
|
|
18
|
android:gravity="center_vertical"
|
|
|
19
|
android:text="推荐话题"
|
|
|
20
|
android:textColor="#444444"
|
|
|
21
|
android:textSize="15sp" />
|
|
|
22
|
|
|
|
23
|
<View
|
|
|
24
|
android:layout_width="match_parent"
|
|
|
25
|
android:layout_height="1dp"
|
|
|
26
|
android:background="#ddd" />
|
|
|
27
|
</LinearLayout>
|
|
|
28
|
|
|
|
29
|
<RelativeLayout
|
|
|
30
|
android:id="@+id/item_topic_rl"
|
|
|
31
|
android:layout_width="match_parent"
|
|
|
32
|
android:layout_height="60dp"
|
|
|
33
|
android:paddingStart="15dp"
|
|
|
34
|
android:paddingEnd="15dp">
|
|
|
35
|
|
|
|
36
|
<ImageView
|
|
|
37
|
android:id="@+id/item_topic_img"
|
|
|
38
|
android:layout_width="50dp"
|
|
|
39
|
android:layout_height="43dp"
|
|
|
40
|
android:layout_centerVertical="true"
|
|
|
41
|
android:background="#000" />
|
|
|
42
|
|
|
|
43
|
<TextView
|
|
|
44
|
android:id="@+id/item_topic_name"
|
|
|
45
|
android:layout_width="match_parent"
|
|
|
46
|
android:layout_height="wrap_content"
|
|
|
47
|
android:layout_centerVertical="true"
|
|
|
48
|
android:layout_marginStart="10dp"
|
|
|
49
|
android:layout_toEndOf="@+id/item_topic_img"
|
|
|
50
|
android:ellipsize="end"
|
|
|
51
|
android:maxLines="2"
|
|
|
52
|
android:text="adadasd"
|
|
|
53
|
android:textColor="#444444"
|
|
|
54
|
android:textSize="14sp" />
|
|
27
|
55
|
|
|
28
|
|
</RelativeLayout>
|
|
|
56
|
</RelativeLayout>
|
|
|
57
|
</LinearLayout>
|
|
|
@ -4,14 +4,4 @@
|
|
4
|
4
|
android:layout_width="match_parent"
|
|
5
|
5
|
android:layout_height="50dp">
|
|
6
|
6
|
|
|
7
|
|
<TextView
|
|
8
|
|
android:layout_width="wrap_content"
|
|
9
|
|
android:layout_height="wrap_content"
|
|
10
|
|
android:layout_marginStart="15dp"
|
|
11
|
|
android:text="推荐话题"
|
|
12
|
|
android:textColor="#444444"
|
|
13
|
|
android:textSize="15sp"
|
|
14
|
|
app:layout_constraintBottom_toTopOf="parent"
|
|
15
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
16
|
|
app:layout_constraintTop_toBottomOf="parent" />
|
|
17
|
7
|
</android.support.constraint.ConstraintLayout>
|