From e731775f70703b5b660c073b9f8116551a3c99e2 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 4 Dec 2024 16:27:53 +0300 Subject: [PATCH] android: cleanup unused imports --- .../main/java/su/xash/engine/MainActivity.kt | 5 +---- .../main/java/su/xash/engine/XashActivity.java | 2 -- .../su/xash/engine/XashDocumentsProvider.java | 1 - .../engine/ui/settings/AppSettingsFragment.kt | 8 +------- .../settings/AppSettingsPreferenceFragment.kt | 6 +----- .../engine/ui/settings/GameSettingsFragment.kt | 13 +------------ .../settings/GameSettingsPreferenceFragment.kt | 3 +-- .../su/xash/engine/ui/setup/SetupFragment.kt | 18 +----------------- .../su/xash/engine/ui/setup/SetupViewModel.kt | 6 +----- .../ui/setup/pages/LocationPageFragment.kt | 5 +---- .../ui/setup/pages/WelcomePageFragment.kt | 5 +---- .../su/xash/engine/workers/FileCopyWorker.kt | 5 ----- 12 files changed, 9 insertions(+), 68 deletions(-) diff --git a/android/app/src/main/java/su/xash/engine/MainActivity.kt b/android/app/src/main/java/su/xash/engine/MainActivity.kt index 4e07df528..5ed7fd7de 100644 --- a/android/app/src/main/java/su/xash/engine/MainActivity.kt +++ b/android/app/src/main/java/su/xash/engine/MainActivity.kt @@ -1,15 +1,12 @@ package su.xash.engine import android.os.Bundle -import android.os.PersistableBundle import androidx.appcompat.app.AppCompatActivity import androidx.navigation.NavController -import androidx.navigation.findNavController import androidx.navigation.fragment.NavHostFragment import androidx.navigation.ui.AppBarConfiguration import androidx.navigation.ui.navigateUp import androidx.navigation.ui.setupActionBarWithNavController -import androidx.navigation.ui.setupWithNavController import su.xash.engine.databinding.ActivityMainBinding class MainActivity : AppCompatActivity() { @@ -35,4 +32,4 @@ class MainActivity : AppCompatActivity() { override fun onSupportNavigateUp(): Boolean { return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/XashActivity.java b/android/app/src/main/java/su/xash/engine/XashActivity.java index 281236857..cf9469175 100644 --- a/android/app/src/main/java/su/xash/engine/XashActivity.java +++ b/android/app/src/main/java/su/xash/engine/XashActivity.java @@ -3,13 +3,11 @@ import android.annotation.SuppressLint; import android.content.pm.ActivityInfo; import android.content.res.AssetManager; -import android.graphics.Rect; import android.os.Build; import android.os.Bundle; import android.provider.Settings.Secure; import android.util.Log; import android.view.KeyEvent; -import android.view.View; import android.view.WindowManager; import org.libsdl.app.SDLActivity; diff --git a/android/app/src/main/java/su/xash/engine/XashDocumentsProvider.java b/android/app/src/main/java/su/xash/engine/XashDocumentsProvider.java index f0319285a..0678bc2ed 100644 --- a/android/app/src/main/java/su/xash/engine/XashDocumentsProvider.java +++ b/android/app/src/main/java/su/xash/engine/XashDocumentsProvider.java @@ -12,7 +12,6 @@ import android.provider.DocumentsContract.Root; import android.provider.DocumentsProvider; import android.webkit.MimeTypeMap; - import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; diff --git a/android/app/src/main/java/su/xash/engine/ui/settings/AppSettingsFragment.kt b/android/app/src/main/java/su/xash/engine/ui/settings/AppSettingsFragment.kt index 1d4e5a91b..57dcfe012 100644 --- a/android/app/src/main/java/su/xash/engine/ui/settings/AppSettingsFragment.kt +++ b/android/app/src/main/java/su/xash/engine/ui/settings/AppSettingsFragment.kt @@ -5,13 +5,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment -import androidx.lifecycle.Lifecycle -import androidx.navigation.fragment.findNavController -import su.xash.engine.R -import su.xash.engine.adapters.GameAdapter import su.xash.engine.databinding.FragmentAppSettingsBinding -import su.xash.engine.databinding.FragmentGameSettingsBinding -import su.xash.engine.databinding.FragmentLibraryBinding class AppSettingsFragment : Fragment() { private var _binding: FragmentAppSettingsBinding? = null @@ -34,4 +28,4 @@ class AppSettingsFragment : Fragment() { super.onDestroyView() _binding = null } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/ui/settings/AppSettingsPreferenceFragment.kt b/android/app/src/main/java/su/xash/engine/ui/settings/AppSettingsPreferenceFragment.kt index 1521a79c0..c60513fc8 100644 --- a/android/app/src/main/java/su/xash/engine/ui/settings/AppSettingsPreferenceFragment.kt +++ b/android/app/src/main/java/su/xash/engine/ui/settings/AppSettingsPreferenceFragment.kt @@ -1,16 +1,12 @@ package su.xash.engine.ui.settings import android.os.Bundle -import androidx.preference.ListPreference import androidx.preference.PreferenceFragmentCompat -import androidx.preference.SwitchPreferenceCompat -import su.xash.engine.BuildConfig import su.xash.engine.R -import su.xash.engine.model.Game class AppSettingsPreferenceFragment() : PreferenceFragmentCompat() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { preferenceManager.sharedPreferencesName = "app_preferences"; setPreferencesFromResource(R.xml.app_preferences, rootKey); } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/ui/settings/GameSettingsFragment.kt b/android/app/src/main/java/su/xash/engine/ui/settings/GameSettingsFragment.kt index f6f1cd9ec..eecfa04ae 100644 --- a/android/app/src/main/java/su/xash/engine/ui/settings/GameSettingsFragment.kt +++ b/android/app/src/main/java/su/xash/engine/ui/settings/GameSettingsFragment.kt @@ -1,23 +1,12 @@ package su.xash.engine.ui.settings -import android.content.Intent import android.os.Bundle import android.view.LayoutInflater -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem import android.view.View import android.view.ViewGroup -import androidx.core.view.MenuProvider -import androidx.core.view.get import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels -import androidx.lifecycle.lifecycleScope -import androidx.lifecycle.viewModelScope import androidx.navigation.fragment.findNavController -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext import su.xash.engine.R import su.xash.engine.databinding.FragmentGameSettingsBinding import su.xash.engine.ui.library.LibraryViewModel @@ -72,4 +61,4 @@ class GameSettingsFragment : Fragment() { super.onDestroyView() _binding = null } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/ui/settings/GameSettingsPreferenceFragment.kt b/android/app/src/main/java/su/xash/engine/ui/settings/GameSettingsPreferenceFragment.kt index 7a77e1b87..003167568 100644 --- a/android/app/src/main/java/su/xash/engine/ui/settings/GameSettingsPreferenceFragment.kt +++ b/android/app/src/main/java/su/xash/engine/ui/settings/GameSettingsPreferenceFragment.kt @@ -4,7 +4,6 @@ import android.os.Bundle import androidx.preference.ListPreference import androidx.preference.PreferenceFragmentCompat import androidx.preference.SwitchPreferenceCompat -import su.xash.engine.BuildConfig import su.xash.engine.R import su.xash.engine.model.Game @@ -38,4 +37,4 @@ class GameSettingsPreferenceFragment(val game: Game) : PreferenceFragmentCompat( true } } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/ui/setup/SetupFragment.kt b/android/app/src/main/java/su/xash/engine/ui/setup/SetupFragment.kt index 5ee5d6e9d..8d6a886de 100644 --- a/android/app/src/main/java/su/xash/engine/ui/setup/SetupFragment.kt +++ b/android/app/src/main/java/su/xash/engine/ui/setup/SetupFragment.kt @@ -1,31 +1,15 @@ package su.xash.engine.ui.setup -import android.content.Intent -import android.net.Uri import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.activity.result.contract.ActivityResultContracts import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels -import androidx.navigation.fragment.findNavController -import androidx.viewbinding.ViewBinding import androidx.viewpager2.adapter.FragmentStateAdapter -import androidx.viewpager2.widget.ViewPager2 -import androidx.work.Data -import androidx.work.OneTimeWorkRequestBuilder -import androidx.work.WorkManager -import com.google.android.material.dialog.MaterialAlertDialogBuilder -import su.xash.engine.R -import su.xash.engine.databinding.FragmentLibraryBinding import su.xash.engine.databinding.FragmentSetupBinding -import su.xash.engine.databinding.PageLocationBinding -import su.xash.engine.databinding.PageWelcomeBinding -import su.xash.engine.ui.library.LibraryViewModel import su.xash.engine.ui.setup.pages.LocationPageFragment import su.xash.engine.ui.setup.pages.WelcomePageFragment -import su.xash.engine.workers.FileCopyWorker class SetupFragment : Fragment() { private var _binding: FragmentSetupBinding? = null @@ -61,4 +45,4 @@ class SetupPageAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) { val pages = listOf(WelcomePageFragment(), LocationPageFragment()) override fun getItemCount(): Int = 2 override fun createFragment(position: Int): Fragment = pages[position] -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/ui/setup/SetupViewModel.kt b/android/app/src/main/java/su/xash/engine/ui/setup/SetupViewModel.kt index 9bbdd6691..fbf5025ce 100644 --- a/android/app/src/main/java/su/xash/engine/ui/setup/SetupViewModel.kt +++ b/android/app/src/main/java/su/xash/engine/ui/setup/SetupViewModel.kt @@ -6,12 +6,8 @@ import androidx.documentfile.provider.DocumentFile import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData -import androidx.work.Data -import androidx.work.OneTimeWorkRequestBuilder -import androidx.work.WorkManager import su.xash.engine.MainApplication import su.xash.engine.model.Game -import su.xash.engine.workers.FileCopyWorker class SetupViewModel(application: Application) : AndroidViewModel(application) { val pageNumber: LiveData get() = _pageNumber @@ -26,4 +22,4 @@ class SetupViewModel(application: Application) : AndroidViewModel(application) { fun setPageNumber(pos: Int) { _pageNumber.value = pos } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/ui/setup/pages/LocationPageFragment.kt b/android/app/src/main/java/su/xash/engine/ui/setup/pages/LocationPageFragment.kt index 9f069d9b3..e4204f0ac 100644 --- a/android/app/src/main/java/su/xash/engine/ui/setup/pages/LocationPageFragment.kt +++ b/android/app/src/main/java/su/xash/engine/ui/setup/pages/LocationPageFragment.kt @@ -9,13 +9,10 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.navigation.fragment.findNavController -import androidx.viewbinding.ViewBinding import com.google.android.material.dialog.MaterialAlertDialogBuilder import su.xash.engine.R import su.xash.engine.databinding.PageLocationBinding -import su.xash.engine.databinding.PageWelcomeBinding import su.xash.engine.ui.library.LibraryViewModel -import su.xash.engine.ui.setup.SetupFragment import su.xash.engine.ui.setup.SetupViewModel class LocationPageFragment : Fragment() { @@ -59,4 +56,4 @@ class LocationPageFragment : Fragment() { } } } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/ui/setup/pages/WelcomePageFragment.kt b/android/app/src/main/java/su/xash/engine/ui/setup/pages/WelcomePageFragment.kt index de87bf95d..7b901fb8e 100644 --- a/android/app/src/main/java/su/xash/engine/ui/setup/pages/WelcomePageFragment.kt +++ b/android/app/src/main/java/su/xash/engine/ui/setup/pages/WelcomePageFragment.kt @@ -6,10 +6,7 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels -import androidx.viewbinding.ViewBinding -import su.xash.engine.databinding.PageLocationBinding import su.xash.engine.databinding.PageWelcomeBinding -import su.xash.engine.ui.setup.SetupFragment import su.xash.engine.ui.setup.SetupViewModel class WelcomePageFragment : Fragment() { @@ -35,4 +32,4 @@ class WelcomePageFragment : Fragment() { super.onDestroyView() _binding = null } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/su/xash/engine/workers/FileCopyWorker.kt b/android/app/src/main/java/su/xash/engine/workers/FileCopyWorker.kt index cfcc50aac..fdc284f14 100644 --- a/android/app/src/main/java/su/xash/engine/workers/FileCopyWorker.kt +++ b/android/app/src/main/java/su/xash/engine/workers/FileCopyWorker.kt @@ -2,17 +2,12 @@ package su.xash.engine.workers import android.content.Context import android.net.Uri -import android.provider.DocumentsContract -import android.util.Log import androidx.documentfile.provider.DocumentFile import androidx.work.CoroutineWorker -import androidx.work.Worker import androidx.work.WorkerParameters import androidx.work.workDataOf import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import su.xash.engine.model.Game -import java.io.FileInputStream const val KEY_FILE_URI = "KEY_FILE_URI"