Compare commits
5 commits
f7b1b9072c
...
e730cdc0b2
Author | SHA1 | Date | |
---|---|---|---|
dece | e730cdc0b2 | ||
dece | 503075f4d0 | ||
dece | 0059b7ff4f | ||
dece | 5fe56880cb | ||
dece | 45813c576a |
|
@ -2,15 +2,16 @@ plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
id 'kotlin-android'
|
id 'kotlin-android'
|
||||||
id 'kotlin-kapt'
|
id 'kotlin-kapt'
|
||||||
|
id 'androidx.navigation.safeargs.kotlin'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 31
|
compileSdk 33
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "dev.lowrespalmtree.comet"
|
applicationId "dev.lowrespalmtree.comet"
|
||||||
minSdk 24
|
minSdk 24
|
||||||
targetSdk 31
|
targetSdk 33
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "0.1.0"
|
versionName "0.1.0"
|
||||||
|
|
||||||
|
@ -45,24 +46,24 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
def nav_version = "2.4.0"
|
def nav_version = "2.5.3"
|
||||||
def room_version = "2.4.1"
|
def room_version = "2.5.1"
|
||||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
implementation "androidx.cardview:cardview:1.0.0"
|
implementation "androidx.cardview:cardview:1.0.0"
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
implementation 'androidx.core:core-ktx:1.7.0'
|
implementation 'androidx.core:core-ktx:1.10.0'
|
||||||
implementation 'androidx.fragment:fragment-ktx:1.4.1'
|
implementation 'androidx.fragment:fragment-ktx:1.5.6'
|
||||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
|
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
|
||||||
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
|
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.0'
|
implementation 'androidx.preference:preference-ktx:1.2.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
implementation 'androidx.recyclerview:recyclerview:1.3.0'
|
||||||
implementation "androidx.room:room-runtime:$room_version"
|
implementation "androidx.room:room-runtime:$room_version"
|
||||||
implementation "androidx.room:room-ktx:$room_version"
|
implementation "androidx.room:room-ktx:$room_version"
|
||||||
implementation 'com.google.android.material:material:1.5.0'
|
implementation 'com.google.android.material:material:1.8.0'
|
||||||
kapt "androidx.room:room-compiler:$room_version"
|
kapt "androidx.room:room-compiler:$room_version"
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
}
|
}
|
|
@ -4,7 +4,6 @@ import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.os.bundleOf
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
@ -46,8 +45,7 @@ class HistoryFragment : Fragment(), HistoryAdapter.Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClick(url: String) {
|
override fun onItemClick(url: String) {
|
||||||
val bundle = bundleOf("url" to url)
|
findNavController().navigate(PageFragmentDirections.actionGlobalPageFragment(url))
|
||||||
findNavController().navigate(R.id.action_global_pageFragment, bundle)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class HistoryViewModel(
|
class HistoryViewModel(
|
||||||
|
|
|
@ -9,10 +9,10 @@ import java.security.KeyStore
|
||||||
import javax.security.auth.x500.X500Principal
|
import javax.security.auth.x500.X500Principal
|
||||||
|
|
||||||
object Identities {
|
object Identities {
|
||||||
const val PROVIDER = "AndroidKeyStore"
|
private const val PROVIDER = "AndroidKeyStore"
|
||||||
private const val TAG = "Identities"
|
private const val TAG = "Identities"
|
||||||
|
|
||||||
val keyStore by lazy { KeyStore.getInstance(PROVIDER).apply { load(null) } }
|
val keyStore: KeyStore by lazy { KeyStore.getInstance(PROVIDER).apply { load(null) } }
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
data class Identity(
|
data class Identity(
|
||||||
|
|
|
@ -3,39 +3,51 @@ package dev.lowrespalmtree.comet
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
|
import androidx.appcompat.app.ActionBarDrawerToggle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.navigation.fragment.NavHostFragment
|
import androidx.navigation.fragment.NavHostFragment
|
||||||
|
import androidx.navigation.ui.setupActionBarWithNavController
|
||||||
import androidx.navigation.ui.setupWithNavController
|
import androidx.navigation.ui.setupWithNavController
|
||||||
import dev.lowrespalmtree.comet.databinding.ActivityMainBinding
|
import dev.lowrespalmtree.comet.databinding.ActivityMainBinding
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
|
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
private lateinit var binding: ActivityMainBinding
|
private val binding by lazy { ActivityMainBinding.inflate(layoutInflater) }
|
||||||
private var nhf: NavHostFragment? = null
|
private val nhf by lazy { supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment }
|
||||||
|
private val navController by lazy { nhf.navController }
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
Log.i(TAG, "onCreate")
|
Log.d(TAG, "onCreate")
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
setSupportActionBar(binding.toolbar)
|
||||||
|
|
||||||
Database.init(applicationContext) // TODO move to App Startup?
|
Database.init(applicationContext) // TODO move to App Startup?
|
||||||
|
|
||||||
nhf = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment?
|
val toggle = ActionBarDrawerToggle(
|
||||||
nhf?.also { binding.drawerNavigation.setupWithNavController(it.navController) }
|
this,
|
||||||
|
binding.drawerLayout,
|
||||||
|
binding.toolbar,
|
||||||
|
R.string.navigation_drawer_open,
|
||||||
|
R.string.navigation_drawer_close
|
||||||
|
)
|
||||||
|
binding.drawerLayout.addDrawerListener(toggle)
|
||||||
|
toggle.syncState()
|
||||||
|
setupActionBarWithNavController(navController, binding.drawerLayout)
|
||||||
|
binding.drawerNavigation.setupWithNavController(nhf.navController)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Navigate to the PageViewFragment; this will automatically use the home URL if any. */
|
// /** Navigate to the PageViewFragment; this will automatically use the home URL if any. */
|
||||||
fun goHome(@Suppress("unused_parameter") item: MenuItem) {
|
// fun goHome(@Suppress("unused_parameter") item: MenuItem) {
|
||||||
val bundle = bundleOf()
|
// val bundle = bundleOf()
|
||||||
Preferences.getHomeUrl(this)?.let { bundle.putString("url", it) }
|
// Preferences.getHomeUrl(this)?.let { bundle.putString("url", it) }
|
||||||
nhf?.navController?.navigate(R.id.action_global_pageFragment, bundle)
|
// }
|
||||||
binding.drawerLayout.closeDrawers()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "MainActivity"
|
private const val TAG = "MainActivity"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ import androidx.activity.addCallback
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.navigation.fragment.navArgs
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import dev.lowrespalmtree.comet.databinding.FragmentPageViewBinding
|
import dev.lowrespalmtree.comet.databinding.FragmentPageViewBinding
|
||||||
|
@ -26,6 +27,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class PageFragment : Fragment(), PageAdapter.Listener {
|
class PageFragment : Fragment(), PageAdapter.Listener {
|
||||||
private val vm: PageViewModel by viewModels()
|
private val vm: PageViewModel by viewModels()
|
||||||
|
private val args: PageFragmentArgs by navArgs()
|
||||||
private lateinit var binding: FragmentPageViewBinding
|
private lateinit var binding: FragmentPageViewBinding
|
||||||
private lateinit var adapter: PageAdapter
|
private lateinit var adapter: PageAdapter
|
||||||
|
|
||||||
|
@ -35,12 +37,12 @@ class PageFragment : Fragment(), PageAdapter.Listener {
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
Log.d(TAG, "onCreateView")
|
Log.d(TAG, "onCreateView")
|
||||||
binding = FragmentPageViewBinding.inflate(layoutInflater)
|
binding = FragmentPageViewBinding.inflate(layoutInflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
Log.d(TAG, "onViewCreated")
|
Log.d(TAG, "onViewCreated (args: ${args})")
|
||||||
binding.contentRecycler.layoutManager = LinearLayoutManager(requireContext())
|
binding.contentRecycler.layoutManager = LinearLayoutManager(requireContext())
|
||||||
adapter = PageAdapter(this)
|
adapter = PageAdapter(this)
|
||||||
binding.contentRecycler.adapter = adapter
|
binding.contentRecycler.adapter = adapter
|
||||||
|
@ -53,14 +55,15 @@ class PageFragment : Fragment(), PageAdapter.Listener {
|
||||||
vm.lines.observe(viewLifecycleOwner) { updateLines(it.second, it.first) }
|
vm.lines.observe(viewLifecycleOwner) { updateLines(it.second, it.first) }
|
||||||
vm.event.observe(viewLifecycleOwner) { handleEvent(it) }
|
vm.event.observe(viewLifecycleOwner) { handleEvent(it) }
|
||||||
|
|
||||||
activity?.onBackPressedDispatcher?.addCallback(viewLifecycleOwner) { onBackPressed() }
|
(activity as MainActivity?)?.let {
|
||||||
|
it.onBackPressedDispatcher.addCallback(viewLifecycleOwner) { onBackPressed() }
|
||||||
|
it.supportActionBar?.title = vm.currentTitle
|
||||||
|
}
|
||||||
|
|
||||||
val url = arguments?.getString("url")
|
val url = args.url
|
||||||
if (!url.isNullOrEmpty()) {
|
if (vm.currentUrl.isEmpty() && url.isNotEmpty()) {
|
||||||
Log.d(TAG, "onViewCreated: open \"$url\"")
|
Log.d(TAG, "onViewCreated: open \"$url\"")
|
||||||
openUrl(url)
|
openUrl(url)
|
||||||
} else if (vm.currentUrl.isNotEmpty()) {
|
|
||||||
Log.d(TAG, "onViewCreated: reuse current URL, probably fragment recreation")
|
|
||||||
} else if (vm.visitedUrls.isEmpty()) {
|
} else if (vm.visitedUrls.isEmpty()) {
|
||||||
Log.d(TAG, "onViewCreated: no current URL, open home if configured")
|
Log.d(TAG, "onViewCreated: no current URL, open home if configured")
|
||||||
Preferences.getHomeUrl(requireContext())?.let { if (it.isNotBlank()) openUrl(it) }
|
Preferences.getHomeUrl(requireContext())?.let { if (it.isNotBlank()) openUrl(it) }
|
||||||
|
@ -72,6 +75,7 @@ class PageFragment : Fragment(), PageAdapter.Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onBackPressed() {
|
private fun onBackPressed() {
|
||||||
|
Log.d(TAG, "onBackPressed")
|
||||||
if (vm.visitedUrls.size >= 2) {
|
if (vm.visitedUrls.size >= 2) {
|
||||||
vm.visitedUrls.removeLastOrNull() // Always remove current page first.
|
vm.visitedUrls.removeLastOrNull() // Always remove current page first.
|
||||||
vm.visitedUrls.removeLastOrNull()?.also { openUrl(it) }
|
vm.visitedUrls.removeLastOrNull()?.also { openUrl(it) }
|
||||||
|
@ -130,6 +134,7 @@ class PageFragment : Fragment(), PageAdapter.Listener {
|
||||||
binding.addressBar.setTextColor(resources.getColor(R.color.url_bar_loading, null))
|
binding.addressBar.setTextColor(resources.getColor(R.color.url_bar_loading, null))
|
||||||
}
|
}
|
||||||
PageViewModel.State.RECEIVING -> {
|
PageViewModel.State.RECEIVING -> {
|
||||||
|
binding.contentRecycler.smoothScrollToPosition(0)
|
||||||
binding.contentSwipeLayout.isRefreshing = false
|
binding.contentSwipeLayout.isRefreshing = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,9 +162,11 @@ class PageFragment : Fragment(), PageAdapter.Listener {
|
||||||
}
|
}
|
||||||
is PageViewModel.SuccessEvent -> {
|
is PageViewModel.SuccessEvent -> {
|
||||||
vm.currentUrl = event.uri
|
vm.currentUrl = event.uri
|
||||||
|
vm.currentTitle = event.mainTitle ?: ""
|
||||||
if (vm.visitedUrls.isEmpty() || vm.visitedUrls.last() != event.uri)
|
if (vm.visitedUrls.isEmpty() || vm.visitedUrls.last() != event.uri)
|
||||||
vm.visitedUrls.add(event.uri)
|
vm.visitedUrls.add(event.uri)
|
||||||
binding.addressBar.setText(event.uri)
|
binding.addressBar.setText(event.uri)
|
||||||
|
(activity as MainActivity?)?.supportActionBar?.title = vm.currentTitle
|
||||||
}
|
}
|
||||||
is PageViewModel.BinaryEvent -> {
|
is PageViewModel.BinaryEvent -> {
|
||||||
// TODO this should present the user with options on what to do according to the
|
// TODO this should present the user with options on what to do according to the
|
||||||
|
|
|
@ -25,6 +25,9 @@ class PageViewModel(
|
||||||
/** Currently viewed page URL. */
|
/** Currently viewed page URL. */
|
||||||
var currentUrl: String = ""
|
var currentUrl: String = ""
|
||||||
|
|
||||||
|
/** The first level 1 header of the current page (default is an empty string). */
|
||||||
|
var currentTitle: String = ""
|
||||||
|
|
||||||
/** Latest Uri requested using `sendGeminiRequest`. */
|
/** Latest Uri requested using `sendGeminiRequest`. */
|
||||||
var loadingUrl: Uri? = null
|
var loadingUrl: Uri? = null
|
||||||
|
|
||||||
|
@ -58,7 +61,7 @@ class PageViewModel(
|
||||||
data class InputEvent(val uri: Uri, val prompt: String) : Event()
|
data class InputEvent(val uri: Uri, val prompt: String) : Event()
|
||||||
|
|
||||||
/** The server responded with a success code and *has finished* its response. */
|
/** The server responded with a success code and *has finished* its response. */
|
||||||
data class SuccessEvent(val uri: String) : Event()
|
data class SuccessEvent(val uri: String, val mainTitle: String?) : Event()
|
||||||
|
|
||||||
/** The server responded with a success code and a binary MIME type (not delivered yet). */
|
/** The server responded with a success code and a binary MIME type (not delivered yet). */
|
||||||
data class BinaryEvent(
|
data class BinaryEvent(
|
||||||
|
@ -243,7 +246,7 @@ class PageViewModel(
|
||||||
// We record the history entry here: it's nice because we have the main title available
|
// We record the history entry here: it's nice because we have the main title available
|
||||||
// and we're already in a coroutine for database access.
|
// and we're already in a coroutine for database access.
|
||||||
History.record(uriString, mainTitle)
|
History.record(uriString, mainTitle)
|
||||||
event.postValue(SuccessEvent(uriString))
|
event.postValue(SuccessEvent(uriString, mainTitle))
|
||||||
state.postValue(State.IDLE)
|
state.postValue(State.IDLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
app/src/main/res/drawable/baseline_history_24.xml
Normal file
5
app/src/main/res/drawable/baseline_history_24.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#000000"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
|
||||||
|
</vector>
|
5
app/src/main/res/drawable/baseline_home_24.xml
Normal file
5
app/src/main/res/drawable/baseline_home_24.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#000000"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
|
||||||
|
</vector>
|
5
app/src/main/res/drawable/baseline_settings_24.xml
Normal file
5
app/src/main/res/drawable/baseline_settings_24.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#000000"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
|
||||||
|
</vector>
|
5
app/src/main/res/drawable/baseline_switch_account_24.xml
Normal file
5
app/src/main/res/drawable/baseline_switch_account_24.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<vector android:height="24dp" android:tint="#000000"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM14,4c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM20,16L8,16v-1.5c0,-1.99 4,-3 6,-3s6,1.01 6,3L20,16z"/>
|
||||||
|
</vector>
|
|
@ -1,19 +1,33 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.drawerlayout.widget.DrawerLayout
|
<androidx.drawerlayout.widget.DrawerLayout
|
||||||
android:id="@+id/drawer_layout"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true"
|
||||||
|
tools:openDrawer="start"
|
||||||
|
tools:context="dev.lowrespalmtree.comet.MainActivity">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/background_emph" />
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/nav_host_fragment"
|
android:id="@+id/nav_host_fragment"
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
app:navGraph="@navigation/main"
|
app:navGraph="@navigation/main"
|
||||||
app:defaultNavHost="true" />
|
app:defaultNavHost="true" />
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<com.google.android.material.navigation.NavigationView
|
<com.google.android.material.navigation.NavigationView
|
||||||
android:id="@+id/drawer_navigation"
|
android:id="@+id/drawer_navigation"
|
||||||
|
@ -21,6 +35,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
app:headerLayout="@layout/activity_main_nav_header"
|
||||||
app:menu="@menu/drawer" />
|
app:menu="@menu/drawer" />
|
||||||
|
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
</androidx.drawerlayout.widget.DrawerLayout>
|
18
app/src/main/res/layout/activity_main_nav_header.xml
Normal file
18
app/src/main/res/layout/activity_main_nav_header.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="176dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/logo"
|
||||||
|
android:src="@mipmap/ic_logo"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.5" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -9,6 +9,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:inputType="text" />
|
android:inputType="text"
|
||||||
|
android:autofillHints="" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -4,13 +4,12 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/root"
|
android:id="@+id/root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
>
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/app_bar_layout"
|
android:id="@+id/app_bar_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="56dp">
|
android:layout_height="48dp">
|
||||||
|
|
||||||
<Toolbar
|
<Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item
|
|
||||||
android:id="@+id/homeItem"
|
|
||||||
android:icon="@android:drawable/ic_menu_myplaces"
|
|
||||||
android:onClick="goHome"
|
|
||||||
android:title="@string/home" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/historyFragment"
|
android:id="@+id/historyFragment"
|
||||||
android:icon="@android:drawable/ic_menu_recent_history"
|
android:icon="@drawable/baseline_history_24"
|
||||||
android:title="@string/history" />
|
android:title="@string/history" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/identitiesFragment"
|
android:id="@+id/identitiesFragment"
|
||||||
|
android:icon="@drawable/baseline_switch_account_24"
|
||||||
android:title="@string/identities" />
|
android:title="@string/identities" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/settingsFragment"
|
android:id="@+id/settingsFragment"
|
||||||
android:icon="@android:drawable/ic_menu_preferences"
|
android:icon="@drawable/baseline_settings_24"
|
||||||
android:title="@string/settings" />
|
android:title="@string/settings" />
|
||||||
</menu>
|
</menu>
|
|
@ -7,7 +7,12 @@
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/pageFragment"
|
android:id="@+id/pageFragment"
|
||||||
android:name="dev.lowrespalmtree.comet.PageFragment"
|
android:name="dev.lowrespalmtree.comet.PageFragment"
|
||||||
android:label="PageViewFragment" />
|
android:label="">
|
||||||
|
<argument
|
||||||
|
android:name="url"
|
||||||
|
app:argType="string"
|
||||||
|
android:defaultValue="" />
|
||||||
|
</fragment>
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_global_pageFragment"
|
android:id="@+id/action_global_pageFragment"
|
||||||
app:destination="@id/pageFragment"
|
app:destination="@id/pageFragment"
|
||||||
|
@ -19,7 +24,15 @@
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/historyFragment"
|
android:id="@+id/historyFragment"
|
||||||
android:name="dev.lowrespalmtree.comet.HistoryFragment"
|
android:name="dev.lowrespalmtree.comet.HistoryFragment"
|
||||||
android:label="HistoryFragment" />
|
android:label="@string/history" >
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_historyFragment_to_pageFragment"
|
||||||
|
app:destination="@id/pageFragment"
|
||||||
|
app:enterAnim="@anim/nav_default_enter_anim"
|
||||||
|
app:exitAnim="@anim/nav_default_exit_anim"
|
||||||
|
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||||
|
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||||
|
</fragment>
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_global_historyFragment"
|
android:id="@+id/action_global_historyFragment"
|
||||||
app:destination="@id/historyFragment"
|
app:destination="@id/historyFragment"
|
||||||
|
@ -31,12 +44,19 @@
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/identitiesFragment"
|
android:id="@+id/identitiesFragment"
|
||||||
android:name="dev.lowrespalmtree.comet.IdentitiesFragment"
|
android:name="dev.lowrespalmtree.comet.IdentitiesFragment"
|
||||||
android:label="IdentitiesFragment" />
|
android:label="@string/identities" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_global_identitiesFragment"
|
||||||
|
app:destination="@id/identitiesFragment"
|
||||||
|
app:enterAnim="@anim/nav_default_enter_anim"
|
||||||
|
app:exitAnim="@anim/nav_default_exit_anim"
|
||||||
|
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||||
|
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/settingsFragment"
|
android:id="@+id/settingsFragment"
|
||||||
android:name="dev.lowrespalmtree.comet.SettingsFragment"
|
android:name="dev.lowrespalmtree.comet.SettingsFragment"
|
||||||
android:label="SettingsFragment" />
|
android:label="@string/settings" />
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_global_settingsFragment"
|
android:id="@+id/action_global_settingsFragment"
|
||||||
app:destination="@id/settingsFragment"
|
app:destination="@id/settingsFragment"
|
||||||
|
|
|
@ -50,5 +50,8 @@
|
||||||
<string name="open">Open</string>
|
<string name="open">Open</string>
|
||||||
<string name="download_completed">File downloaded.</string>
|
<string name="download_completed">File downloaded.</string>
|
||||||
<string name="image_download_completed">Image downloaded.</string>
|
<string name="image_download_completed">Image downloaded.</string>
|
||||||
|
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||||
|
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||||
|
<string name="logo">Logo</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -10,7 +10,7 @@
|
||||||
<item name="colorSecondaryVariant">@color/second_accent_dark</item>
|
<item name="colorSecondaryVariant">@color/second_accent_dark</item>
|
||||||
<item name="colorOnSecondary">@color/text</item>
|
<item name="colorOnSecondary">@color/text</item>
|
||||||
<!-- Status bar color. -->
|
<!-- Status bar color. -->
|
||||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
<item name="android:windowBackground">@color/background</item>
|
<item name="android:windowBackground">@color/background</item>
|
||||||
<item name="android:progressBackgroundTint">?attr/colorSecondaryVariant</item>
|
<item name="android:progressBackgroundTint">?attr/colorSecondaryVariant</item>
|
||||||
|
|
|
@ -6,9 +6,9 @@ buildscript {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.1.0'
|
classpath 'com.android.tools.build:gradle:7.3.1'
|
||||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
|
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0'
|
||||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
|
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
||||||
#Mon Nov 29 12:01:36 CET 2021
|
#Mon Nov 29 12:01:36 CET 2021
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
Reference in a new issue