制作分享功能
This commit is contained in:
parent
3f1eccd007
commit
b3385adf4a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -37,6 +37,7 @@ class ThanksActivity : BaseActivity<ActivityThanksBinding>() {
|
|||
list.add(ThanksDataBean("空调大郎", "帮助翻译俄语版本。", 1491779490))
|
||||
list.add(ThanksDataBean("Ling ASDJ", "制作助手新手模板,已被整合至助手内置模版。跟随助手更新。", 2735951230))
|
||||
list.add(ThanksDataBean("Alice's Dream", "帮助薄荷优化代码表。", 3372003670))
|
||||
list.add(ThanksDataBean("克鲁鲁.采佩西", "帮助薄荷制作教程。", 2275140013))
|
||||
viewBinding.recyclerView.adapter = ThanksAdapter(this, list)
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.bumptech.glide.request.RequestOptions
|
|||
import com.coldmint.dialog.CoreDialog
|
||||
import com.coldmint.rust.core.ModClass
|
||||
import com.coldmint.rust.core.dataBean.ApiResponse
|
||||
import com.coldmint.rust.core.dataBean.AppUpdateData
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModCommentData
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModInfoData
|
||||
import com.coldmint.rust.core.dataBean.mod.WebModUpdateLogData
|
||||
|
@ -52,6 +53,7 @@ import com.coldmint.rust.pro.tool.TextStyleMaker
|
|||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.google.gson.Gson
|
||||
import com.youth.banner.adapter.BannerImageAdapter
|
||||
import com.youth.banner.holder.BannerImageHolder
|
||||
import com.youth.banner.indicator.CircleIndicator
|
||||
|
@ -130,151 +132,10 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
|
|||
}
|
||||
|
||||
}
|
||||
// viewBinding.modCommentRecyclerView.layoutManager =
|
||||
// LinearLayoutManager(this@WebModInfoActivity)
|
||||
// viewBinding.modCommentRecyclerView.addItemDecoration(
|
||||
// DividerItemDecoration(this@WebModInfoActivity, DividerItemDecoration.VERTICAL)
|
||||
// )
|
||||
tip = getString(R.string.file_download_progress)
|
||||
}
|
||||
}
|
||||
|
||||
// private fun initData() {
|
||||
//
|
||||
// if (token.isBlank()) {
|
||||
// viewBinding.progressBar.isVisible = false
|
||||
// viewBinding.tipView.isVisible = true
|
||||
// viewBinding.tipView.setText(R.string.please_login_first)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// loadModCommentList(modId)
|
||||
//
|
||||
//
|
||||
// WebMod.instance.getInfo(token, modId, object : ApiCallBack<WebModInfoData> {
|
||||
// override fun onResponse(t: WebModInfoData) {
|
||||
// if (t.code == ServerConfiguration.Success_Code) {
|
||||
// developer = t.data.developer
|
||||
// isOpen = t.data.hidden == 0
|
||||
// viewBinding.loadLayout.isVisible = false
|
||||
// viewBinding.relativeLayout.isVisible = true
|
||||
// val icon = t.data.icon
|
||||
// if (icon != null && icon.isNotBlank()) {
|
||||
// Glide.with(this@WebModInfoActivity)
|
||||
// .load(ServerConfiguration.getRealLink(icon))
|
||||
// .apply(GlobalMethod.getRequestOptions())
|
||||
// .into(viewBinding.iconView)
|
||||
// }
|
||||
// title = t.data.name
|
||||
// val screenshotListData = t.data.screenshots
|
||||
// if (screenshotListData != null && screenshotListData.isNotBlank()) {
|
||||
// val list = ArrayList<String>()
|
||||
// val lineParser = LineParser()
|
||||
// lineParser.symbol = ","
|
||||
// lineParser.text = screenshotListData
|
||||
// lineParser.analyse { lineNum, lineData, isEnd ->
|
||||
// list.add(lineData)
|
||||
// true
|
||||
// }
|
||||
// val adapter = object : BannerImageAdapter<String>(list) {
|
||||
// override fun onBindView(
|
||||
// holder: BannerImageHolder?,
|
||||
// data: String?,
|
||||
// position: Int,
|
||||
// size: Int
|
||||
// ) {
|
||||
// if (data != null && holder != null) {
|
||||
// Glide.with(this@WebModInfoActivity)
|
||||
// .load(ServerConfiguration.getRealLink(data))
|
||||
// .apply(GlobalMethod.getRequestOptions())
|
||||
// .into(holder.imageView)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// viewBinding.banner.setAdapter(adapter)
|
||||
// viewBinding.banner.addBannerLifecycleObserver(this@WebModInfoActivity)
|
||||
// viewBinding.banner.indicator = CircleIndicator(this@WebModInfoActivity)
|
||||
// viewBinding.banner.setIndicatorSelectedColorRes(R.color.blue_500)
|
||||
// viewBinding.banner.isAutoLoop(false)
|
||||
// } else {
|
||||
// viewBinding.banner.isVisible = false
|
||||
// }
|
||||
// val tags = t.data.tags
|
||||
// val lineParser = LineParser(tags)
|
||||
// val tagList = ArrayList<String>()
|
||||
// lineParser.symbol = ","
|
||||
// lineParser.analyse { lineNum, lineData, isEnd ->
|
||||
// val tag = lineData.subSequence(1, lineData.length - 1).toString()
|
||||
// tagList.add(tag)
|
||||
// true
|
||||
// }
|
||||
// if (tagList.size > 0) {
|
||||
// viewBinding.belongStackLabelView.labels = tagList
|
||||
// viewBinding.belongStackLabelView.setOnLabelClickListener { index, v, s ->
|
||||
// val bundle = Bundle()
|
||||
// bundle.putString("tag", s)
|
||||
// bundle.putString(
|
||||
// "title",
|
||||
// String.format(getString(R.string.tag_title), s)
|
||||
// )
|
||||
// bundle.putString("action", "tag")
|
||||
// val thisIntent =
|
||||
// Intent(this@WebModInfoActivity, TagActivity::class.java)
|
||||
// thisIntent.putExtra("data", bundle)
|
||||
// startActivity(thisIntent)
|
||||
// }
|
||||
// } else {
|
||||
// viewBinding.belongStackLabelView.isVisible = false
|
||||
// }
|
||||
// viewBinding.titleView.text = t.data.name
|
||||
// TextStyleMaker.instance.load(
|
||||
// viewBinding.modInfoView,
|
||||
// t.data.describe
|
||||
// ) { type, data ->
|
||||
// TextStyleMaker.instance.clickEvent(this@WebModInfoActivity, type, data)
|
||||
// }
|
||||
// viewBinding.numView.text =
|
||||
// String.format(
|
||||
// getString(R.string.unit_and_downloadnum),
|
||||
// t.data.unitNumber,
|
||||
// t.data.downloadNumber,
|
||||
// t.data.versionName
|
||||
// )
|
||||
// viewBinding.updateTimeView.text =
|
||||
// String.format(getString(R.string.recent_update), t.data.updateTime)
|
||||
// viewBinding.button.isVisible = true
|
||||
// if (t.data.hidden == 0) {
|
||||
// viewBinding.auditLayout.isVisible = false
|
||||
// }
|
||||
// loadDeveloperInfo(t.data.developer)
|
||||
//
|
||||
// viewBinding.button.setOnClickListener {
|
||||
// val type = viewBinding.button.text
|
||||
// val installation = getString(R.string.installation)
|
||||
// when (type) {
|
||||
// installation -> {
|
||||
// downloadAction(t)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// } else {
|
||||
// viewBinding.tipView.isVisible = true
|
||||
// viewBinding.tipView.text = t.message
|
||||
// viewBinding.progressBar.isVisible = false
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onFailure(e: Exception) {
|
||||
// viewBinding.progressBar.isVisible = false
|
||||
// viewBinding.tipView.isVisible = true
|
||||
// viewBinding.tipView.setText(R.string.network_error)
|
||||
// }
|
||||
//
|
||||
// })
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* 下载事件
|
||||
* @param t WebModInfoData
|
||||
|
@ -339,6 +200,23 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
|
|||
).show()
|
||||
}
|
||||
}
|
||||
R.id.share_item -> {
|
||||
val link = AppSettings.getValue(AppSettings.Setting.ServerAddress, "")
|
||||
val updateData = AppSettings.getValue(AppSettings.Setting.UpdateData, "")
|
||||
var appUpdateLink = ""
|
||||
if (!updateData.isNullOrBlank()) {
|
||||
val gson = Gson()
|
||||
val updateDataObj = gson.fromJson(updateData, AppUpdateData.Data::class.java)
|
||||
appUpdateLink = updateDataObj.link
|
||||
}
|
||||
val s = String.format(
|
||||
getString(R.string.share_mod_msg),
|
||||
title,
|
||||
link + "website/pages/modPage.php?&modId=" + modId, appUpdateLink
|
||||
)
|
||||
|
||||
AppOperator.shareText(this,getString(R.string.share_mod),s)
|
||||
}
|
||||
R.id.update_record -> {
|
||||
GlobalMethod.showUpdateLog(this, modId)
|
||||
}
|
||||
|
@ -346,11 +224,6 @@ class WebModInfoActivity : BaseActivity<ActivityWebModInfoBinding>() {
|
|||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
// override fun onResume() {
|
||||
// super.onResume()
|
||||
// loadModCommentList(modId)
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 下载工作
|
||||
|
|
|
@ -39,7 +39,8 @@ class InsertCoinsAdapter(context: Context, dataList: MutableList<InsertCoinHisto
|
|||
) {
|
||||
val icon = data.headIcon
|
||||
if (icon == null) {
|
||||
Glide.with(context).load(R.drawable.head_icon).into(viewBinding.imageView)
|
||||
viewBinding.imageView.setImageResource(R.drawable.head_icon)
|
||||
|
||||
} else {
|
||||
Glide.with(context).load(ServerConfiguration.getRealLink(icon))
|
||||
.apply(GlobalMethod.getRequestOptions(true)).into(viewBinding.imageView)
|
||||
|
|
|
@ -53,14 +53,6 @@ class InsertCoinsFragment(val modId: String) : BaseFragment<FragmentInsertCoinsB
|
|||
loadList()
|
||||
}
|
||||
}.show()
|
||||
// InputDialog(requireContext()).setTitle(R.string.insert_coins)
|
||||
// .setMessage(R.string.insert_coins_num_tip)
|
||||
// .setPositiveButton(R.string.dialog_ok) { it ->
|
||||
// WebMod.instance.insertCoins(token, modId)
|
||||
// false
|
||||
// }.setNegativeButton(R.string.dialog_cancel) {
|
||||
//
|
||||
// }.show()
|
||||
}
|
||||
loadButton()
|
||||
}
|
||||
|
|
|
@ -12,33 +12,44 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mod_icon"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/iconCardView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="8dp"
|
||||
style="@style/Widget.Material3.CardView.Filled"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/image" />
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mod_icon"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/image" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/infoLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_toEndOf="@id/mod_icon"
|
||||
android:layout_toEndOf="@id/iconCardView"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mod_name_View"
|
||||
style="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/name"
|
||||
style="@style/TextAppearance.Material3.TitleMedium" />
|
||||
android:text="@string/name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/modInfo"
|
||||
|
@ -49,38 +60,38 @@
|
|||
android:text="@string/publisher_information" />
|
||||
|
||||
<TextView
|
||||
android:singleLine="true"
|
||||
android:id="@+id/mod_introduction_view"
|
||||
style="@style/TextAppearance.Material3.BodySmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/describe" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/infoLayout"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:layout_marginRight="8dp"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:id="@+id/refusedView"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@string/refused" />
|
||||
|
||||
<Button
|
||||
android:layout_marginLeft="8dp"
|
||||
android:id="@+id/consentView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/consent" />
|
||||
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/share_item"
|
||||
android:icon="@drawable/ic_outline_share_24"
|
||||
android:title="@string/share"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/update_record"
|
||||
android:title="@string/update_record" />
|
||||
|
|
|
@ -932,5 +932,6 @@
|
|||
<string name="simple_display_of_auto_complete_menu_describe">隐藏自动完成菜单内的描述和图像。</string>
|
||||
<string name="simple_display_of_auto_complete_menu">简版自动完成菜单</string>
|
||||
<string name="search_key">搜索关键字</string>
|
||||
<string name="share_mod_msg">我分享模组了 %1$s,下载链接:%2$s\n下载铁锈助手即可参与评论,给作品投币。App下载链接:%3$s</string>
|
||||
|
||||
</resources>
|
|
@ -1,24 +1,24 @@
|
|||
package com.coldmint.rust.core.tool
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.pm.PackageManager
|
||||
import android.R
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.pm.ResolveInfo
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.*
|
||||
import android.os.Build
|
||||
import android.provider.MediaStore
|
||||
import android.provider.Settings
|
||||
import android.text.TextUtils
|
||||
import androidx.core.content.ContextCompat.getSystemService
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import java.io.File
|
||||
import java.lang.Exception
|
||||
import java.security.MessageDigest
|
||||
import java.util.*
|
||||
|
||||
|
||||
/**
|
||||
* 程序交互类
|
||||
*
|
||||
|
@ -227,6 +227,21 @@ object AppOperator {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向其他App分享内容
|
||||
* @param context Context
|
||||
* @param title String
|
||||
* @param content String
|
||||
*/
|
||||
fun shareText(context: Context, title: String, content: String) {
|
||||
DebugHelper.printLog("分享文本", content, "分享")
|
||||
val sendIntent = Intent()
|
||||
sendIntent.action = Intent.ACTION_SEND
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, content)
|
||||
sendIntent.type = "text/plain"
|
||||
context.startActivity(Intent.createChooser(sendIntent, title))
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取应用签名(MD5)
|
||||
|
|
Loading…
Reference in New Issue
Block a user