cshenfu
2024-12-06 ef65b2ba9975f445420b8a7e07f49a9135ad93f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.shsening.autouploadvideos
 
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.WebView
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.fragment.app.Fragment
 
class HelpFragment : Fragment() {
 
    private lateinit var webView: WebView
 
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view = inflater.inflate(R.layout.fragment_help, container, false)
 
        val textView = view.findViewById<TextView>(R.id.androidIdText);
        textView.text = "Android ID: ${AppConfig.CLIENT_ANDROID_ID }"
        textView.setOnClickListener {
            val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
            val clip = ClipData.newPlainText("label", textView.text)
            clipboard.setPrimaryClip(clip)
            Toast.makeText(requireContext(), AppConfig.MSG_MY_TAB_COPY_TO_CLIPBOARD, Toast.LENGTH_SHORT).show()
        }
 
        // 加载图片
        val imageView = view.findViewById<ImageView>(R.id.imageView)
        imageView.setImageResource(R.drawable.qrcode) // 请替换为你的图片
 
        // 设置简介
        view.findViewById<TextView>(R.id.descriptionText).text = AppConfig.MSG_MY_TAB_ADD_WECHAT
 
        webView = view.findViewById(R.id.webView)
        webView.loadUrl("file:///android_asset/help/help.html")
 
        return view
    }
}