20
20
import com .stupidbeauty .farmingbookapp .PreferenceManagerUtil ;
21
21
import com .stupidbeauty .hxlauncher .application .HxLauncherApplication ;
22
22
import com .stupidbeauty .ftpserver .lib .DocumentTreeBrowseRequest ;
23
- // import butterknife.Bind ;
23
+ import android . widget . Button ;
24
24
import butterknife .ButterKnife ;
25
25
import android .os .Debug ;
26
26
import butterknife .OnCheckedChanged ;
64
64
import android .annotation .SuppressLint ;
65
65
import android .app .Activity ;
66
66
import android .widget .CheckBox ;
67
+ import android .widget .ImageView ;
67
68
import com .stupidbeauty .farmingbookapp .PreferenceManagerUtil ;
68
69
import com .stupidbeauty .hxlauncher .application .HxLauncherApplication ;
69
70
import butterknife .BindView ;
@@ -74,24 +75,22 @@ public class LauncherActivity extends Activity
74
75
private static final String TAG ="LauncherActivity" ; //!< 输出调试信息时使用的标记
75
76
private VoiceUi voiceUi =null ; //!< 语音交互对象。
76
77
private Timer timerObj = null ; //!< 用于报告下载完毕的定时器。
77
-
78
78
private ActiveUserReportManager activeUserReportManager =null ; //!< 活跃用户统计管理器。陈欣。
79
79
private BuiltinFtpServer builtinFtpServer =null ; //!< The builtin ftp server.
80
-
80
+ @ BindView (R .id .stopServerlButton ) Button stopServerlButton ; //!< the stop server button.
81
+ @ BindView (R .id .startServerlButton ) Button startServerlButton ; //!< the start server button.
81
82
@ BindView (R .id .statustextView ) TextView statustextView ; //!< Label to show status text.
83
+ @ BindView (R .id .maskUrlLineImagecon ) ImageView maskUrlLineImagecon ; //!< The mask on the url line.
82
84
@ BindView (R .id .availableSpaceView ) TextView availableSpaceView ; //!< 可用空间。
83
85
@ BindView (R .id .allowAnonymousetei ) CheckBox allowAnonymousetei ; //!< Allow anonymous check box.
84
86
@ BindView (R .id .userNamePassWordayout ) RelativeLayout userNamePassWordayout ; //!< User name pass word layout.
85
87
86
88
@ OnClick (R .id .shareIcon )
87
89
public void shareViaText ()
88
90
{
89
- Log .d (TAG , "gotoLoginActivity, 119." ); //Debug.
90
91
Intent launchIntent =new Intent (this , SettingsActivity .class ); // 启动意图。
91
92
92
93
startActivity (launchIntent ); //启动活动。
93
-
94
- Log .d (TAG , "gotoLoginActivity, 122." ); //Debug.
95
94
} // public void shareViaText()
96
95
97
96
@ OnClick (R .id .feedbackIcon )
@@ -101,6 +100,30 @@ public void showFeedbackUit()
101
100
102
101
feedback .showFeedbackUi (); // Show feedback ui.
103
102
} // public void shareViaText()
103
+
104
+ @ OnClick (R .id .stopServerlButton )
105
+ public void stopServerlButton ()
106
+ {
107
+ builtinFtpServer .stop (); // Stop the ftp server.
108
+
109
+ stopServerlButton .setVisibility (View .INVISIBLE ); // Hide the stop server button.
110
+ startServerlButton .setVisibility (View .VISIBLE ); // Show the start server button.
111
+ maskUrlLineImagecon .setVisibility (View .VISIBLE ); // Mask the url line.
112
+
113
+ stopPersistantNotification (); // Stop the persistent notification.
114
+ } // public void stopServerlButton()
115
+
116
+ @ OnClick (R .id .startServerlButton )
117
+ public void startServerlButton ()
118
+ {
119
+ builtinFtpServer .start (); // Start the ftp server.
120
+
121
+ stopServerlButton .setVisibility (View .VISIBLE ); // Hide the stop server button.
122
+ startServerlButton .setVisibility (View .INVISIBLE ); // Show the start server button.
123
+ maskUrlLineImagecon .setVisibility (View .INVISIBLE ); // Mask the url line.
124
+
125
+ startTimeCheckService (); // Show persistent notification.
126
+ } // public void stopServerlButton()
104
127
105
128
@ OnClick (R .id .copyUrlButton )
106
129
public void copyUrlButton ()
@@ -114,8 +137,6 @@ public void copyUrlButton()
114
137
115
138
String downloadFinished = getResources ().getString (R .string .urlCopiedged ); // Load the text content.
116
139
117
- Log .d (TAG , "notifyDownloadFinish, text: " + downloadFinished ); // Debug.
118
-
119
140
voiceUi .say (downloadFinished ); // 发声。
120
141
} // public void copyUrlButton()
121
142
@@ -147,11 +168,8 @@ protected void onCreate(Bundle savedInstanceState)
147
168
148
169
voiceUi =new VoiceUi (this ); // 创建语音交互对象。
149
170
150
- // WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
151
- // String ipAddress = Formatter.formatIpAddress(wifiManager.getConnectionInfo().getIpAddress());
152
-
153
171
HxLauncherApplication hxLauncherApplication = HxLauncherApplication .getInstance () ; // 获取应用程序实例。
154
- builtinFtpServer = hxLauncherApplication .getBuiltinFtpServer (); // 获取FTP服务器实例对象。
172
+ builtinFtpServer = hxLauncherApplication .getBuiltinFtpServer (); // 获取FTP服务器实例对象。
155
173
156
174
showFtpUrl (); // Show ftp url.
157
175
@@ -200,7 +218,6 @@ public void toggleAllowAnonymouse(boolean isChecked)
200
218
builtinFtpServer .setAllowAnonymous (isChecked ); // SEt whether aloow anonymous.
201
219
202
220
toggleUserNamePassWordVisibility (isChecked ); // Toggle user name pass word visibility.
203
-
204
221
} //public void toggleBuiltinShortcuts()
205
222
206
223
/**
@@ -212,6 +229,16 @@ private void startTimeCheckService()
212
229
213
230
startService (serviceIntent ); //启动服务。
214
231
} //private void startTimeCheckService()
232
+
233
+ /**
234
+ * Stop the persistent notification.
235
+ */
236
+ private void stopPersistantNotification ()
237
+ {
238
+ Intent serviceIntent = new Intent (this , DownloadNotificationService .class ); //创建意图。
239
+
240
+ stopService (serviceIntent ); // Stop the service.
241
+ } // private void stopPersistantNotification()
215
242
216
243
@ Override
217
244
/**
0 commit comments