1
1
package com .rae .cnblogs .home ;
2
2
3
+ import android .content .Intent ;
4
+ import android .net .Uri ;
3
5
import android .os .Bundle ;
4
6
import android .support .annotation .NonNull ;
5
7
import android .support .annotation .Nullable ;
6
8
import android .view .View ;
7
- import android .widget .CompoundButton ;
8
9
import android .widget .ImageView ;
9
10
import android .widget .TextView ;
10
11
11
12
import com .alibaba .android .arouter .facade .annotation .Route ;
12
- import com .kyleduo .switchbutton .SwitchButton ;
13
13
import com .rae .cnblogs .AppRoute ;
14
14
import com .rae .cnblogs .UICompat ;
15
15
import com .rae .cnblogs .basic .AppImageLoader ;
16
16
import com .rae .cnblogs .basic .AppMobclickAgent ;
17
17
import com .rae .cnblogs .basic .BasicFragment ;
18
+ import com .rae .cnblogs .dialog .ShareDialogFragment ;
18
19
import com .rae .cnblogs .home .mine .MineContract ;
19
20
import com .rae .cnblogs .home .mine .MinePresenterImpl ;
20
21
import com .rae .cnblogs .sdk .UserProvider ;
@@ -40,20 +41,23 @@ public static MineFragment newInstance() {
40
41
41
42
@ BindView (R2 .id .tv_mine_name )
42
43
TextView mDisplayNameView ;
44
+
43
45
@ BindView (R2 .id .tv_follow_count )
44
46
TextView mFollowCountView ;
45
47
@ BindView (R2 .id .tv_fans_count )
46
48
TextView mFansCountView ;
47
- @ BindView (R2 .id .tv_no_login )
48
- View mNoLoginTextView ;
49
+
49
50
@ BindView (R2 .id .ll_follow_fans )
50
51
View mFansAndFollowLayout ;
51
52
@ BindView (R2 .id .img_system_message_badge )
52
53
View mSystemMessageBadgeView ;
53
54
@ BindView (R2 .id .img_feedback_badge )
54
55
View mFeedbackBadgeView ;
55
- @ BindView (R2 .id .sb_night_mode )
56
- SwitchButton mNightModeButton ;
56
+ // @BindView(R2.id.sb_night_mode)
57
+ // SwitchButton mNightModeButton;
58
+
59
+ @ BindView (R2 .id .tv_night_mode )
60
+ TextView mNightModeView ;
57
61
58
62
private MineContract .Presenter mPresenter ;
59
63
@@ -73,20 +77,9 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
73
77
public void onStart () {
74
78
super .onStart ();
75
79
// 夜间模式处理
76
- mNightModeButton . setCheckedNoEvent (ThemeCompat .isNight ());
80
+ mNightModeView . setSelected (ThemeCompat .isNight ());
77
81
}
78
82
79
- @ Override
80
- public void onViewCreated (@ NonNull View view , @ Nullable Bundle savedInstanceState ) {
81
- super .onViewCreated (view , savedInstanceState );
82
- // 夜间模式切换
83
- mNightModeButton .setOnCheckedChangeListener (new CompoundButton .OnCheckedChangeListener () {
84
- @ Override
85
- public void onCheckedChanged (CompoundButton buttonView , boolean isChecked ) {
86
- ThemeCompat .switchNightMode ();
87
- }
88
- });
89
- }
90
83
91
84
@ Override
92
85
protected void onLoadData () {
@@ -111,7 +104,6 @@ public void onLoadFansCount(String fans, String follows) {
111
104
@ Override
112
105
public void onLoadUserInfo (@ NonNull UserInfoBean user ) {
113
106
mDisplayNameView .setVisibility (View .VISIBLE );
114
- mNoLoginTextView .setVisibility (View .GONE );
115
107
mFansAndFollowLayout .setVisibility (View .VISIBLE );
116
108
AppImageLoader .displayAvatar (user .getAvatar (), mAvatarView );
117
109
mDisplayNameView .setText (user .getDisplayName ());
@@ -127,14 +119,18 @@ public void onLoginExpired() {
127
119
public void onNotLogin () {
128
120
// 没有登录的UI
129
121
mAvatarView .setImageResource (R .drawable .boy );
130
- mDisplayNameView .setVisibility (View .GONE );
131
- mNoLoginTextView .setVisibility (View .VISIBLE );
132
122
mFansAndFollowLayout .setVisibility (View .GONE );
133
123
mFansCountView .setText ("0" );
134
124
mFollowCountView .setText ("0" );
135
125
}
136
126
137
127
128
+ @ OnClick (R2 .id .tv_night_mode )
129
+ public void onNightModeClick () {
130
+ AppMobclickAgent .onClickEvent (getContext (), "NightMode" );
131
+ ThemeCompat .switchNightMode ();
132
+ }
133
+
138
134
@ OnClick (R2 .id .layout_account_fans )
139
135
public void onFansClick () {
140
136
AppRoute .routeToFans (this .getContext (), getString (R .string .me ), UserProvider .getInstance ().getLoginUserInfo ().getBlogApp ());
@@ -149,7 +145,7 @@ public void onFollowClick() {
149
145
/**
150
146
* 登录
151
147
*/
152
- @ OnClick ({R2 .id .img_blog_avatar , R2 .id .tv_mine_name , R2 . id . tv_no_login })
148
+ @ OnClick ({R2 .id .img_blog_avatar , R2 .id .tv_mine_name })
153
149
public void onLoginClick () {
154
150
if (mPresenter .isLogin ())
155
151
AppRoute .routeToBlogger (getContext (), UserProvider .getInstance ().getLoginUserInfo ().getBlogApp ());
@@ -160,26 +156,16 @@ public void onLoginClick() {
160
156
/**
161
157
* 我的收藏
162
158
*/
163
- @ OnClick (R2 .id .ll_favorites )
159
+ @ OnClick (R2 .id .tv_favorites )
164
160
public void onFavoritesClick () {
165
161
AppMobclickAgent .onClickEvent (getContext (), "Favorites" );
166
162
AppRoute .routeToFavorites (this .getActivity ());
167
163
}
168
164
169
- /**
170
- * 问题反馈
171
- */
172
- @ OnClick (R2 .id .ll_feedback )
173
- public void onFeedbackClick () {
174
- mFeedbackBadgeView .setVisibility (View .INVISIBLE );
175
- AppMobclickAgent .onClickEvent (getContext (), "Feedback" );
176
- AppRoute .routeToFeedback (getContext ());
177
- }
178
-
179
165
/**
180
166
* 浏览记录
181
167
*/
182
- @ OnClick (R2 .id .ll_history )
168
+ @ OnClick (R2 .id .tv_history )
183
169
public void onHistoryClick () {
184
170
AppMobclickAgent .onClickEvent (getContext (), "History" );
185
171
AppRoute .routeToHistory (getContext ());
@@ -197,20 +183,55 @@ public void onSystemMessageClick() {
197
183
}
198
184
199
185
/**
200
- * 设置
186
+ * 字体设置
201
187
*/
202
- @ OnClick (R2 .id .ll_setting )
203
- public void onSettingClick () {
204
- AppRoute .routeToSetting (this .getContext ());
188
+ @ OnClick (R2 .id .ll_font_setting )
189
+ public void onFontSettingClick () {
190
+ AppRoute .routeToFontSetting (this .getContext ());
205
191
}
206
192
207
193
/**
208
- * 夜间模式
194
+ * 意见反馈
209
195
*/
210
- @ OnClick (R2 .id .ll_night )
211
- public void onNightClick () {
212
- AppMobclickAgent .onClickEvent (getContext (), "NightMode" );
213
- mNightModeButton .performClick ();
196
+ @ OnClick (R2 .id .ll_feedback )
197
+ public void onFeedbackClick () {
198
+ mFeedbackBadgeView .setVisibility (View .INVISIBLE );
199
+ AppMobclickAgent .onClickEvent (getContext (), "Feedback" );
200
+ AppRoute .routeToFeedback (getContext ());
201
+ }
202
+
203
+ /**
204
+ * 分享
205
+ */
206
+ @ OnClick (R2 .id .ll_share )
207
+ public void onShareClick () {
208
+ AppMobclickAgent .onClickEvent (getContext (), "ShareApp" );
209
+ String url = getString (R .string .share_app_url );
210
+ String title = getString (R .string .share_app_title );
211
+ String desc = getString (R .string .share_app_desc );
212
+ ShareDialogFragment fragment = ShareDialogFragment .newInstance (url , title , desc , null , R .drawable .ic_share_app , false , false );
213
+ fragment .show (getChildFragmentManager (), "shareApp" );
214
+ }
215
+
216
+ /**
217
+ * 好评
218
+ */
219
+ @ OnClick (R2 .id .ll_praises )
220
+ public void onPraisesClick () {
221
+ AppMobclickAgent .onClickEvent (getContext (), "Praises" );
222
+ try {
223
+ startActivity (new Intent (Intent .ACTION_VIEW , Uri .parse (getString (R .string .market_url ))));
224
+ } catch (Exception e ) {
225
+ UICompat .failed (getContext (), getString (R .string .praises_error ));
226
+ }
227
+ }
228
+
229
+ /**
230
+ * 设置
231
+ */
232
+ @ OnClick (R2 .id .ll_setting )
233
+ public void onSettingClick () {
234
+ AppRoute .routeToSetting (this .getContext ());
214
235
}
215
236
216
237
0 commit comments