@@ -63,24 +63,24 @@ protected void onCreate(Bundle savedInstanceState) {
6363 inputTextView = findViewById (R .id .inputText );
6464// inputTextView.setText("ss25696");//调试用
6565 infoListView = findViewById (R .id .infoListView );
66- infoListView .setAdapter (new ArrayAdapter <EpInfo >(MainActivity .this , R .layout .support_simple_spinner_dropdown_item , seriesInfo .epInfo ){
66+ infoListView .setAdapter (new ArrayAdapter <EpInfo >(MainActivity .this , R .layout .support_simple_spinner_dropdown_item , seriesInfo .epInfo ) {
6767 @ Override
68- public @ NonNull View getView (int position , View convertView ,@ NonNull ViewGroup parent ){
69- View view =super .getView (position ,convertView ,parent );
70- if (position ==HistoryList .get (0 ).position ){//永远是最前面的那个
71- ((TextView )view ).setTextColor (Color .BLUE );
72- }else ((TextView )view ).setTextColor (Color .BLACK );
68+ public @ NonNull
69+ View getView (int position , View convertView , @ NonNull ViewGroup parent ) {
70+ View view = super .getView (position , convertView , parent );
71+ if (position == HistoryList .get (0 ).position ) {//永远是最前面的那个
72+ ((TextView ) view ).setTextColor (Color .BLUE );
73+ } else ((TextView ) view ).setTextColor (Color .BLACK );
7374 return view ;
7475 }
7576 });
7677 titleTextView = findViewById (R .id .titleTextView );
7778 LoadCookies ();
7879 if (HistoryList .size () == 0 ) LoadHistory ();
7980 Settings .videoQuality = VideoQuality .values ()[Arrays .asList (VideoQuality .getEntries ()).indexOf (Objects .requireNonNull (getSharedPreferences ("Settings" , Context .MODE_PRIVATE ).getString ("quality" , VideoQuality ._2 .description )))];
80- Settings .clientType = Stream .of (ClientType .values ()).filter (item -> Objects .equals (item .packageName , getSharedPreferences ("Settings" , Context .MODE_PRIVATE ).getString ("clientType" , ClientType .release .packageName ))).findFirst ().get ();
81+ Settings .clientType = Stream .of (ClientType .values ()).filter (item -> Objects .equals (item .packageName , getSharedPreferences ("Settings" , Context .MODE_PRIVATE ).getString ("clientType" , ClientType .release .packageName ))).findFirst ().get ();
8182 Settings .clientDownload = getSharedPreferences ("Settings" , Context .MODE_PRIVATE ).getBoolean ("clientDown" , true );
8283 searchButton .setOnClickListener (v -> {
83- // sendBroadcast(new Intent("com.github.shadowsocks.CLOSE"));
8484 String URL = inputTextView .getText ().toString ();
8585 new getList ().execute (URL );
8686 });
@@ -109,17 +109,17 @@ protected void onPostExecute(String successMsg) {
109109 if (successMsg .contains ("成功" )) {
110110 Toast .makeText (MainActivity .this , successMsg , Toast .LENGTH_LONG ).show ();
111111 //重启哔哩哔哩
112- Intent intent = getPackageManager ().getLaunchIntentForPackage (Settings .clientType .packageName );
112+ Intent intent = getPackageManager ().getLaunchIntentForPackage (Settings .clientType .packageName );
113113 intent .addFlags (Intent .FLAG_ACTIVITY_CLEAR_TOP );
114- // startActivity(intent);
115- }
116- else {//创建下载任务, 返回值是创建文件的路径
114+ startActivity (intent );
115+ } else {//创建下载任务, 返回值是创建文件的路径
116+ Toast .makeText (MainActivity .this , "成功: 正在下载文件\n 关闭VPN" , Toast .LENGTH_LONG ).show ();
117+ sendBroadcast (new Intent ("in.zhaoj.shadowsocksr.CLOSE" ));//关闭SSR
117118 for (int i = 0 ; i < seriesInfo .downloadSegmentInfo .size (); i ++) {
118119 DownloadSegmentInfo downSegInfo = seriesInfo .downloadSegmentInfo .get (i );
119120 EpInfo epInfo = seriesInfo .epInfo .get (seriesInfo .position );
120- DownloadTask (downSegInfo .url , successMsg + i + ".blv" , seriesInfo .title + epInfo .index + epInfo .index_title + i ,MainActivity .this );
121+ DownloadTask (downSegInfo .url , successMsg + i + ".blv" , seriesInfo .title + epInfo .index + epInfo .index_title + i , MainActivity .this );
121122 }
122- Toast .makeText (MainActivity .this , "成功: 正在下载文件\n 需要关闭VPN" , Toast .LENGTH_LONG ).show ();
123123 }
124124 int position = HistoryList .get (0 ).position ;//历史记录中的位置
125125 if (position != seriesInfo .position ) {
@@ -221,7 +221,7 @@ protected void onPostExecute(String HTMLBody) {
221221 HistoryInfo info = new HistoryInfo (seriesInfo .title , url + seriesInfo .season_id , -1 );
222222 int position = HistoryList .indexOf (info );
223223 if (position > -1 ) {
224- info .position = HistoryList .get (position ).position ;
224+ info .position = HistoryList .get (position ).position ;
225225 HistoryList .remove (position );
226226 }
227227 HistoryList .add (0 , info );
@@ -315,7 +315,7 @@ static void StoreHistory(Context context) {
315315 sharedPref .edit ().putStringSet ("HistoryList" , HistoryStrSet ).apply ();
316316 }
317317
318- static Long DownloadTask (String url , String filePath , String title ,Context context ) {
318+ static Long DownloadTask (String url , String filePath , String title , Context context ) {
319319 //关闭VPN
320320 DownloadManager downloadManager = (DownloadManager ) context .getSystemService (Context .DOWNLOAD_SERVICE );
321321 DownloadManager .Request request = new DownloadManager .Request (Uri .parse (url ));
@@ -348,5 +348,4 @@ protected void onResume() {
348348 Intent intent = getIntent ();
349349 onNewIntent (intent );
350350 }
351-
352351}
0 commit comments