mirror of https://github.com/FongMi/TV.git
parent
03aed75826
commit
ef065ac077
@ -0,0 +1,34 @@ |
||||
package com.fongmi.bear.model; |
||||
|
||||
import androidx.lifecycle.MutableLiveData; |
||||
import androidx.lifecycle.ViewModel; |
||||
|
||||
import com.fongmi.bear.ApiConfig; |
||||
import com.fongmi.bear.bean.Result; |
||||
import com.fongmi.bear.bean.Site; |
||||
import com.github.catvod.crawler.Spider; |
||||
|
||||
import java.util.concurrent.ExecutorService; |
||||
import java.util.concurrent.Executors; |
||||
|
||||
public class SiteViewModel extends ViewModel { |
||||
|
||||
public static final ExecutorService service = Executors.newFixedThreadPool(5); |
||||
|
||||
public MutableLiveData<Result> result; |
||||
|
||||
public SiteViewModel() { |
||||
this.result = new MutableLiveData<>(); |
||||
} |
||||
|
||||
public void homeContent(String key) { |
||||
Site site = ApiConfig.get().getSite(key); |
||||
int type = site.getType(); |
||||
if (type == 3) { |
||||
service.execute(() -> { |
||||
Spider spider = ApiConfig.get().getCSP(site); |
||||
result.postValue(Result.objectFrom(spider.homeContent(false))); |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
@ -1,5 +1,6 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<item android:drawable="@drawable/shape_item_selected" android:state_selected="true" /> |
||||
<item android:drawable="@drawable/shape_item_selected" android:state_focused="true" /> |
||||
<item android:drawable="@drawable/shape_item_normal" /> |
||||
</selector> |
||||
@ -1,5 +1,6 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<item android:drawable="@drawable/shape_vod_selected" android:state_selected="true" /> |
||||
<item android:drawable="@drawable/shape_vod_selected" android:state_focused="true" /> |
||||
<item android:drawable="@drawable/shape_vod_normal" /> |
||||
</selector> |
||||
@ -0,0 +1,17 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:shape="rectangle"> |
||||
|
||||
<solid android:color="#CC177535" /> |
||||
|
||||
<corners |
||||
android:bottomRightRadius="4dp" |
||||
android:topRightRadius="4dp" /> |
||||
|
||||
<padding |
||||
android:bottom="4dp" |
||||
android:left="4dp" |
||||
android:right="4dp" |
||||
android:top="4dp" /> |
||||
|
||||
</shape> |
||||
Loading…
Reference in new issue