diff --git a/app/build.gradle b/app/build.gradle index 040ec03..e56b2ce 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -56,7 +56,7 @@ dependencies { implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" implementation 'androidx.preference:preference-ktx:1.1.1' - implementation 'androidx.recyclerview:recyclerview:1.2.0' + implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" implementation "androidx.cardview:cardview:1.0.0" diff --git a/app/src/main/java/dev/lowrespalmtree/comet/HistoryFragment.kt b/app/src/main/java/dev/lowrespalmtree/comet/HistoryFragment.kt index b4bbfb2..a6f955c 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/HistoryFragment.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/HistoryFragment.kt @@ -47,7 +47,7 @@ class HistoryFragment : Fragment(), HistoryItemAdapterListener { override fun onItemClick(url: String) { val bundle = bundleOf("url" to url) - findNavController().navigate(R.id.action_global_pageViewFragment, bundle) + findNavController().navigate(R.id.action_global_pageFragment, bundle) } @ExperimentalCoroutinesApi diff --git a/app/src/main/java/dev/lowrespalmtree/comet/MainActivity.kt b/app/src/main/java/dev/lowrespalmtree/comet/MainActivity.kt index b6ac562..dccf628 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/MainActivity.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/MainActivity.kt @@ -6,7 +6,6 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.os.bundleOf import androidx.navigation.fragment.NavHostFragment import androidx.navigation.ui.setupWithNavController -import androidx.preference.PreferenceManager import dev.lowrespalmtree.comet.databinding.ActivityMainBinding import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -27,10 +26,10 @@ class MainActivity : AppCompatActivity() { } /** Navigate to the PageViewFragment; this will automatically use the home URL if any. */ - fun goHome(item: MenuItem) { + fun goHome(@Suppress("unused_parameter") item: MenuItem) { val bundle = bundleOf() Preferences.getHomeUrl(this)?.let { bundle.putString("url", it) } - nhf?.navController?.navigate(R.id.action_global_pageViewFragment, bundle) + nhf?.navController?.navigate(R.id.action_global_pageFragment, bundle) binding.drawerLayout.closeDrawers() } } \ No newline at end of file diff --git a/app/src/main/java/dev/lowrespalmtree/comet/ContentAdapter.kt b/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt similarity index 97% rename from app/src/main/java/dev/lowrespalmtree/comet/ContentAdapter.kt rename to app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt index 062b43f..c9c1e01 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/ContentAdapter.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/PageAdapter.kt @@ -19,8 +19,8 @@ import dev.lowrespalmtree.comet.databinding.* * it could be a n-to-1 relation: many lines belong to the same block. This of course changes a bit * the way we have to render things. */ -class ContentAdapter(private val listener: ContentAdapterListener) : - RecyclerView.Adapter() { +class PageAdapter(private val listener: ContentAdapterListener) : + RecyclerView.Adapter() { private var lines = listOf() private var currentLine = 0 @@ -161,7 +161,7 @@ class ContentAdapter(private val listener: ContentAdapterListener) : override fun getItemCount(): Int = blocks.size companion object { - private const val TAG = "ContentRecycler" + private const val TAG = "PageAdapter" private const val TYPE_EMPTY = 0 private const val TYPE_TITLE_1 = 1 private const val TYPE_TITLE_2 = 2 diff --git a/app/src/main/java/dev/lowrespalmtree/comet/PageViewFragment.kt b/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt similarity index 97% rename from app/src/main/java/dev/lowrespalmtree/comet/PageViewFragment.kt rename to app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt index 2956152..00a550d 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/PageViewFragment.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt @@ -22,15 +22,15 @@ import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider import androidx.preference.PreferenceManager import androidx.recyclerview.widget.LinearLayoutManager -import dev.lowrespalmtree.comet.ContentAdapter.ContentAdapterListener +import dev.lowrespalmtree.comet.PageAdapter.ContentAdapterListener import dev.lowrespalmtree.comet.databinding.FragmentPageViewBinding import kotlinx.coroutines.ExperimentalCoroutinesApi @ExperimentalCoroutinesApi -class PageViewFragment : Fragment(), ContentAdapterListener { +class PageFragment : Fragment(), ContentAdapterListener { private lateinit var binding: FragmentPageViewBinding private lateinit var pageViewModel: PageViewModel - private lateinit var adapter: ContentAdapter + private lateinit var adapter: PageAdapter /** Property to access and set the current address bar URL value. */ private var currentUrl @@ -51,7 +51,7 @@ class PageViewFragment : Fragment(), ContentAdapterListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { pageViewModel = ViewModelProvider(this)[PageViewModel::class.java] - adapter = ContentAdapter(this) + adapter = PageAdapter(this) binding.contentRecycler.layoutManager = LinearLayoutManager(requireContext()) binding.contentRecycler.adapter = adapter @@ -223,6 +223,6 @@ class PageViewFragment : Fragment(), ContentAdapterListener { } companion object { - private const val TAG = "PageViewFragment" + private const val TAG = "PageFragment" } } \ No newline at end of file diff --git a/app/src/main/res/navigation/main.xml b/app/src/main/res/navigation/main.xml index 7152e64..1589968 100644 --- a/app/src/main/res/navigation/main.xml +++ b/app/src/main/res/navigation/main.xml @@ -2,15 +2,15 @@ + app:startDestination="@id/pageFragment">