| | |
| | | |
| | | 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() { |
| | |
| | | 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 { |
| | |
| | | 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) |
| | | ) |
| | | |