style: Redefine package
This commit is contained in:
@@ -36,6 +36,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.preference:preference:1.2.1'
|
||||
def room_version = "2.5.0"
|
||||
|
||||
implementation "androidx.room:room-runtime:$room_version"
|
||||
|
||||
@@ -23,17 +23,13 @@
|
||||
android:resource="@xml/file_paths">
|
||||
</meta-data>
|
||||
</provider>
|
||||
<activity
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_settings" />
|
||||
|
||||
<service
|
||||
android:name=".service.DownloadService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:name=".ui.activity.MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.lsp.view.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.lsp.view.R
|
||||
|
||||
class SettingsActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.settings_activity)
|
||||
|
||||
val toolbar = findViewById<Toolbar>(R.id.toolbar)
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
supportFragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.settings, SettingsFragment())
|
||||
.commit()
|
||||
}
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
|
||||
}
|
||||
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,4 +1,4 @@
|
||||
package com.lsp.view.model
|
||||
package com.lsp.view.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
@@ -8,7 +8,7 @@ import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.lsp.view.fragment.adapter.PostAdapter
|
||||
import com.lsp.view.ui.fragment.adapter.PostAdapter
|
||||
import com.lsp.view.repository.network.PostRepository
|
||||
import androidx.savedstate.SavedStateRegistryOwner
|
||||
import com.lsp.view.YandViewApplication
|
||||
@@ -18,7 +18,6 @@ import com.lsp.view.repository.datasource.CollectRepository
|
||||
import com.lsp.view.repository.datasource.CollectRepositoryImpl
|
||||
import com.lsp.view.repository.datasource.model.Collect
|
||||
import com.lsp.view.repository.exception.NetworkErrorException
|
||||
import com.lsp.view.ui.UiState
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.async
|
||||
+2
-8
@@ -1,4 +1,4 @@
|
||||
package com.lsp.view.activity
|
||||
package com.lsp.view.ui.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
@@ -8,7 +8,7 @@ import androidx.navigation.fragment.NavHostFragment
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import com.lsp.view.R
|
||||
import com.lsp.view.model.MainViewModel
|
||||
import com.lsp.view.ui.MainViewModel
|
||||
import com.lsp.view.repository.network.PostRepository
|
||||
|
||||
|
||||
@@ -31,12 +31,6 @@ class MainActivity : AppCompatActivity() {
|
||||
Toast.makeText(this,it,Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
//接收来自PicActivity的快捷搜索Tag
|
||||
val stringExtra = intent.getStringExtra("searchTag")
|
||||
if (stringExtra!=null){
|
||||
viewModel.uiState.value.nowSearchText.value = stringExtra
|
||||
}
|
||||
|
||||
val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
|
||||
val navController = navHostFragment.navController
|
||||
bottomNav.setupWithNavController(navController)
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.lsp.view.fragment
|
||||
package com.lsp.view.ui.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
@@ -9,9 +9,9 @@ import android.view.animation.AnimationUtils
|
||||
import androidx.navigation.Navigation
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import com.lsp.view.fragment.adapter.PostAdapter
|
||||
import com.lsp.view.ui.fragment.adapter.PostAdapter
|
||||
import com.lsp.view.R
|
||||
import com.lsp.view.activity.MainActivity
|
||||
import com.lsp.view.ui.activity.MainActivity
|
||||
import com.lsp.view.bean.Post
|
||||
|
||||
/**
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.lsp.view.fragment
|
||||
package com.lsp.view.ui.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@@ -23,7 +23,7 @@ import com.google.android.material.bottomappbar.BottomAppBar
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import com.lsp.view.R
|
||||
import com.lsp.view.YandViewApplication
|
||||
import com.lsp.view.activity.MainActivity
|
||||
import com.lsp.view.ui.activity.MainActivity
|
||||
import com.lsp.view.bean.Post
|
||||
import com.lsp.view.repository.datasource.model.Collect
|
||||
import com.lsp.view.repository.datasource.model.Collect.Companion.toCollect
|
||||
+7
-5
@@ -1,4 +1,4 @@
|
||||
package com.lsp.view.fragment
|
||||
package com.lsp.view.ui.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
@@ -13,15 +13,17 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import com.google.android.material.search.SearchBar
|
||||
import com.google.android.material.search.SearchView
|
||||
import com.lsp.view.fragment.adapter.PostAdapter
|
||||
import com.lsp.view.ui.fragment.adapter.PostAdapter
|
||||
import com.lsp.view.R
|
||||
import com.lsp.view.activity.MainActivity
|
||||
import com.lsp.view.ui.activity.MainActivity
|
||||
import com.lsp.view.bean.Post
|
||||
import com.lsp.view.model.MainViewModel
|
||||
import com.lsp.view.ui.MainViewModel
|
||||
|
||||
class PostListFragment:Fragment() {
|
||||
private val viewModel: MainViewModel by lazy {
|
||||
ViewModelProvider(requireActivity(),MainViewModel.provideFactory(activityContext.repository,requireContext(),this)).get(MainViewModel::class.java)
|
||||
ViewModelProvider(requireActivity(),
|
||||
MainViewModel.provideFactory(activityContext.repository,requireContext(),this)).get(
|
||||
MainViewModel::class.java)
|
||||
}
|
||||
private lateinit var activityContext: MainActivity
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.lsp.view.fragment.adapter
|
||||
package com.lsp.view.ui.fragment.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.MainActivity">
|
||||
tools:context=".ui.activity.MainActivity">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/nav_host_fragment"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.CollectFragment">
|
||||
tools:context=".ui.fragment.CollectFragment">
|
||||
|
||||
<include layout="@layout/post_list_layout"/>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".fragment.ImageFragment">
|
||||
tools:context=".ui.fragment.ImageFragment">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<fragment
|
||||
android:id="@+id/postListFragment"
|
||||
android:name="com.lsp.view.fragment.PostListFragment"
|
||||
android:name="com.lsp.view.ui.fragment.PostListFragment"
|
||||
android:label="PostListFragment" >
|
||||
<action
|
||||
android:id="@+id/action_postListFragment_to_imageFragment"
|
||||
@@ -17,19 +17,16 @@
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/slide_out_bottom" >
|
||||
</action>
|
||||
<action
|
||||
android:id="@+id/action_postListFragment_to_collectFragment"
|
||||
app:destination="@id/collectFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/imageFragment"
|
||||
android:name="com.lsp.view.fragment.ImageFragment"
|
||||
android:name="com.lsp.view.ui.fragment.ImageFragment"
|
||||
android:label="fragment_pic"
|
||||
tools:layout="@layout/fragment_image" >
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/collectFragment"
|
||||
android:name="com.lsp.view.fragment.CollectFragment"
|
||||
android:name="com.lsp.view.ui.fragment.CollectFragment"
|
||||
android:label="fragment_collect"
|
||||
tools:layout="@layout/fragment_collect" >
|
||||
<action
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceScreen
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory app:title="@string/title_setting_load_source"
|
||||
>
|
||||
<PreferenceCategory app:title="@string/title_setting_load_source">
|
||||
|
||||
<ListPreference
|
||||
app:defaultValue="yande.re"
|
||||
@@ -16,8 +15,8 @@
|
||||
<PreferenceCategory app:title="@string/title_setting_safe_check">
|
||||
<CheckBoxPreference
|
||||
app:defaultValue="true"
|
||||
app:title="@string/setting_item_safe_model"
|
||||
app:key="safe_mode"/>
|
||||
app:key="safe_mode"
|
||||
app:title="@string/setting_item_safe_model" />
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ buildscript {
|
||||
|
||||
plugins {
|
||||
id 'com.google.devtools.ksp' version '1.9.20-1.0.14' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
||||
Reference in New Issue
Block a user