-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
why
committed
Dec 10, 2023
1 parent
76e5cc5
commit f6e09f0
Showing
28 changed files
with
402 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
app/src/main/java/com/xiaoyv/bangumi/ui/feature/scheme/SchemeActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.xiaoyv.bangumi.ui.feature.scheme | ||
|
||
import android.content.Intent | ||
import android.net.Uri | ||
import android.os.Bundle | ||
import com.blankj.utilcode.util.ActivityUtils | ||
import com.blankj.utilcode.util.EncodeUtils | ||
import com.xiaoyv.bangumi.databinding.ActivitySchemeBinding | ||
import com.xiaoyv.bangumi.helper.RouteHelper | ||
import com.xiaoyv.blueprint.base.binding.BaseBindingActivity | ||
import com.xiaoyv.common.kts.debugLog | ||
import com.xiaoyv.widget.callback.setOnFastLimitClickListener | ||
|
||
/** | ||
* Class: [SchemeActivity] | ||
* | ||
* @author why | ||
* @since 12/10/23 | ||
*/ | ||
class SchemeActivity : BaseBindingActivity<ActivitySchemeBinding>() { | ||
|
||
override fun initIntentData(intent: Intent, bundle: Bundle, isNewIntent: Boolean) { | ||
val scheme = intent.scheme ?: return | ||
val uri = intent.data ?: return | ||
handleDeepLink(scheme, uri) | ||
} | ||
|
||
override fun initView() { | ||
|
||
} | ||
|
||
override fun initData() { | ||
|
||
} | ||
|
||
override fun initListener() { | ||
binding.btnJump.setOnFastLimitClickListener { | ||
ActivityUtils.startActivity( | ||
Intent.createChooser( | ||
Intent.parseUri("https://bgm.tv/subject_search/", Intent.URI_ALLOW_UNSAFE), | ||
"跳转" | ||
) | ||
) | ||
} | ||
} | ||
|
||
private fun handleDeepLink(scheme: String, uri: Uri) { | ||
debugLog { "Scheme: $scheme, uri: $uri" } | ||
|
||
when (scheme) { | ||
"bgm" -> { | ||
val routeData = uri.getQueryParameter("data").orEmpty().let { | ||
EncodeUtils.base64Decode(it).decodeToString() | ||
} | ||
if (routeData.isNotBlank()) { | ||
RouteHelper.handleUrl(routeData) | ||
} | ||
} | ||
|
||
else -> RouteHelper.handleUrl(uri.toString()) | ||
} | ||
finish() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.