diff --git a/app/build.gradle b/app/build.gradle index 3bb1290..2f27775 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { applicationId "com.yj1211.justlive" minSdk 21 targetSdk 30 - versionCode 19 - versionName "0.2.8" + versionCode 20 + versionName "0.2.9" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index cc433b6..e90f9a3 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 1, - "versionName": "1.0", + "versionCode": 20, + "versionName": "0.2.9", "outputFile": "app-release.apk" } ], diff --git a/app/src/main/java/com/sunnyweather/android/logic/Repository.kt b/app/src/main/java/com/sunnyweather/android/logic/Repository.kt index 8e4e6cc..de1fbf4 100644 --- a/app/src/main/java/com/sunnyweather/android/logic/Repository.kt +++ b/app/src/main/java/com/sunnyweather/android/logic/Repository.kt @@ -180,9 +180,9 @@ object Repository { } emit(result) } - fun search(platform: String, keyWords: String, isLive: String) = liveData(Dispatchers.IO){ + fun search(platform: String, keyWords: String, uid: String) = liveData(Dispatchers.IO){ val result = try { - val liveResponse = LiveNetwork.Search(platform, keyWords, isLive) + val liveResponse = LiveNetwork.Search(platform, keyWords, uid) when (liveResponse.code) { "200" -> { val rooms = liveResponse.data diff --git a/app/src/main/java/com/sunnyweather/android/logic/network/LiveNetwork.kt b/app/src/main/java/com/sunnyweather/android/logic/network/LiveNetwork.kt index 2f7abb1..e1458c6 100644 --- a/app/src/main/java/com/sunnyweather/android/logic/network/LiveNetwork.kt +++ b/app/src/main/java/com/sunnyweather/android/logic/network/LiveNetwork.kt @@ -19,7 +19,7 @@ object LiveNetwork { suspend fun getRealUrl(platform: String, roomId: String) = liveService.getRealUrl(platform, roomId).await() suspend fun getRoomInfo(uid: String, platform: String, roomId: String) = liveService.getRoomInfo(uid, platform, roomId).await() suspend fun getRoomsOn(uid: String) = liveService.getRoomsOn(uid).await() - suspend fun Search(platform: String, keyWords: String, isLive: String) = liveService.search(platform, keyWords, isLive).await() + suspend fun Search(platform: String, keyWords: String, uid: String) = liveService.search(platform, keyWords, uid).await() suspend fun getAllAreas() = liveService.getAllAreas().await() suspend fun login(username: String, password: String) = liveService.login(username, password).await() suspend fun register(username: String, nickname: String, password: String) = liveService.register(username, nickname, password).await() diff --git a/app/src/main/java/com/sunnyweather/android/logic/network/LiveService.kt b/app/src/main/java/com/sunnyweather/android/logic/network/LiveService.kt index 593f71f..1b2233b 100644 --- a/app/src/main/java/com/sunnyweather/android/logic/network/LiveService.kt +++ b/app/src/main/java/com/sunnyweather/android/logic/network/LiveService.kt @@ -23,7 +23,7 @@ interface LiveService { @GET("/api/live/getRoomsOn") fun getRoomsOn(@Query("uid") uid: String): Call @GET("/api/live/search") - fun search(@Query("platform") platform: String, @Query("keyWords") keyWords: String, @Query("isLive") isLive: String): Call + fun search(@Query("platform") platform: String, @Query("keyWords") keyWords: String, @Query("uid") uid: String): Call @GET("/api/live/getAllAreas") fun getAllAreas(): Call @GET("/api/live/follow") diff --git a/app/src/main/java/com/sunnyweather/android/logic/network/ServiceCreator.kt b/app/src/main/java/com/sunnyweather/android/logic/network/ServiceCreator.kt index 54508df..707d5da 100644 --- a/app/src/main/java/com/sunnyweather/android/logic/network/ServiceCreator.kt +++ b/app/src/main/java/com/sunnyweather/android/logic/network/ServiceCreator.kt @@ -4,7 +4,7 @@ import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory object ServiceCreator { - private const val BASE_URL = "http://124.222.5.131:8013" + private const val BASE_URL = "http://yj1211.work:8013" private val retrofit = Retrofit.Builder() .baseUrl(BASE_URL) diff --git a/app/src/main/java/com/sunnyweather/android/ui/about/AboutActvity.kt b/app/src/main/java/com/sunnyweather/android/ui/about/AboutActvity.kt index a5f5115..8cd9bd6 100644 --- a/app/src/main/java/com/sunnyweather/android/ui/about/AboutActvity.kt +++ b/app/src/main/java/com/sunnyweather/android/ui/about/AboutActvity.kt @@ -60,10 +60,7 @@ class AboutActvity: AppCompatActivity(){ } } about_weibo.setOnClickListener { - val intent = Intent(Intent.ACTION_VIEW) - intent.addCategory(Intent.CATEGORY_DEFAULT) - intent.addCategory(Intent.CATEGORY_BROWSABLE) - intent.data = Uri.parse("sinaweibo://userinfo?uid=5211151565") + var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://weibo.com/u/5211151565")) startActivity(intent) } about_qq.setOnClickListener { @@ -81,21 +78,5 @@ class AboutActvity: AppCompatActivity(){ about_back.setOnClickListener { this.onBackPressed() } - about_bug.setOnClickListener { - var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.wolai.com/f/PjHjXcBVzyMs237mDLbrh")) - this.startActivity(intent) - } - about_new.setOnClickListener { - var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.wolai.com/f/eR8bqaBKPQeCDzyJWhBTNC")) - this.startActivity(intent) - } - about_progress.setOnClickListener { - var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.wolai.com/fpajKKnFwFiiai92UHd1Kk")) - this.startActivity(intent) - } - about_forum.setOnClickListener { - var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.9rai.com")) - this.startActivity(intent) - } } } \ No newline at end of file diff --git a/app/src/main/java/com/sunnyweather/android/ui/home/HomeFragment.kt b/app/src/main/java/com/sunnyweather/android/ui/home/HomeFragment.kt index b23c52f..e299cb0 100644 --- a/app/src/main/java/com/sunnyweather/android/ui/home/HomeFragment.kt +++ b/app/src/main/java/com/sunnyweather/android/ui/home/HomeFragment.kt @@ -40,8 +40,8 @@ class HomeFragment : Fragment() { 1 -> RecommendFragment("douyu") 2 -> RecommendFragment("huya") 3 -> RecommendFragment("bilibili") - 4 -> RecommendFragment("egame") - 5 -> RecommendFragment("cc") +// 4 -> RecommendFragment("egame") + 4 -> RecommendFragment("cc") else -> Fragment() } } diff --git a/app/src/main/java/com/sunnyweather/android/ui/search/SearchActivity.kt b/app/src/main/java/com/sunnyweather/android/ui/search/SearchActivity.kt index 150695d..2ac0746 100644 --- a/app/src/main/java/com/sunnyweather/android/ui/search/SearchActivity.kt +++ b/app/src/main/java/com/sunnyweather/android/ui/search/SearchActivity.kt @@ -94,7 +94,7 @@ class SearchActivity : AppCompatActivity(), View.OnClickListener { } }) intent.getStringExtra("query")?.also { query -> - viewModel.search("all", query, "0") + SunnyWeatherApplication.userInfo?.uid?.let { viewModel.search("all", query, it) } } } @@ -160,7 +160,7 @@ class SearchActivity : AppCompatActivity(), View.OnClickListener { isClearInputButtonEnabled = true setSuggestionsDisabled(false) setQueryInputGravity(Gravity.START or Gravity.CENTER) - setQueryInputHint("斗鱼用房间号搜") + setQueryInputHint("搜索功能需登录") } //选择历史记录或删除 private val mOnSuggestionChangeListener = object : OnSuggestionChangeListener { @@ -230,7 +230,7 @@ class SearchActivity : AppCompatActivity(), View.OnClickListener { viewModel.clearList() persistentSearchView.hideProgressBar(false) persistentSearchView.showLeftButton() - viewModel.search("all", query, "0") + SunnyWeatherApplication.userInfo?.uid?.let { viewModel.search("all", query, it) } } //保存历史记录 diff --git a/app/src/main/java/com/sunnyweather/android/ui/search/SearchViewModel.kt b/app/src/main/java/com/sunnyweather/android/ui/search/SearchViewModel.kt index ac057a3..61697bf 100644 --- a/app/src/main/java/com/sunnyweather/android/ui/search/SearchViewModel.kt +++ b/app/src/main/java/com/sunnyweather/android/ui/search/SearchViewModel.kt @@ -7,12 +7,12 @@ import com.sunnyweather.android.logic.Repository import com.sunnyweather.android.logic.model.Owner class SearchViewModel : ViewModel(){ - class SearchRequest (val platform: String, val keyWords: String, val isLive: String) + class SearchRequest (val platform: String, val keyWords: String, val uid: String) private val searchWordLiveData = MutableLiveData() var ownersList = ArrayList() val ownerListLiveData = Transformations.switchMap(searchWordLiveData) { - value -> Repository.search(value.platform, value.keyWords, value.isLive) + value -> Repository.search(value.platform, value.keyWords, value.uid) } fun search(platform: String, keyWords: String, isLive: String) { diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index bc2cbdd..7ea53d4 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -63,120 +63,9 @@ android:layout_marginTop="5dp" android:text="意见反馈" android:textColor="?attr/colorOnPrimary" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -268,7 +157,7 @@ - - - - - - - - - - diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index e4adef5..d2c9fa4 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -5,54 +5,61 @@ android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"> + + - + android:text="所有平台" /> + - + android:text="斗鱼直播" /> + + android:layout_height="wrap_content" + android:gravity="center" + android:text="虎牙直播" /> + + + + + + + + + + android:layout_height="wrap_content" + android:gravity="center" + android:text="网易CC" />