wangzhibo
2024-11-29 e381baaeebc5b34b8c21f0f6d509b37e195af183
app/src/main/java/com/shsening/autouploadvideos/MainActivity.kt
@@ -2,41 +2,22 @@
import android.Manifest
import android.app.AlertDialog
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.view.View
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import android.graphics.Color
import android.net.Uri
import android.provider.Settings
import android.util.Log
import android.webkit.WebView
import android.widget.TextView
import android.widget.Toast
import androidx.core.content.FileProvider
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import com.shsening.autouploadvideos.utils.Utils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import okhttp3.Call
import okhttp3.Callback
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
import java.io.IOException
import kotlinx.coroutines.*
import okhttp3.internal.wait
import java.io.FileOutputStream
import java.util.concurrent.CountDownLatch
class MainActivity : AppCompatActivity() {
@@ -66,20 +47,26 @@
        fragmentManager = supportFragmentManager
        // 默认显示第一个 Fragment
        /*
        setCurrentFragment(UploadFragment())
        findViewById<Button>(R.id.tabUpload).setOnClickListener {
            setCurrentFragment(UploadFragment())
            highlightTab(it)
        }
         */
        setCurrentFragment(UploadListFragment())
        findViewById<Button>(R.id.tabUpload).setOnClickListener {
            setCurrentFragment(UploadListFragment())
            highlightTab(it)
        }
        findViewById<Button>(R.id.tabHelp).setOnClickListener {
            setCurrentFragment(HelpFragment())
        findViewById<Button>(R.id.tabSetting).setOnClickListener {
            setCurrentFragment(SessionProfileListFragment())
            highlightTab(it)
        }
        findViewById<Button>(R.id.tabMy).setOnClickListener {
            setCurrentFragment(MyFragment())
            setCurrentFragment(HelpFragment())
            highlightTab(it)
        }
        CoroutineScope(Dispatchers.IO).launch {
@@ -106,7 +93,7 @@
    private fun highlightTab(selectedButton: View) {
        val tabButtons = listOf(
            findViewById<Button>(R.id.tabUpload),
            findViewById<Button>(R.id.tabHelp),
            findViewById<Button>(R.id.tabSetting),
            findViewById<Button>(R.id.tabMy)
        )