Start on theme choose

This commit is contained in:
Matthieu 2022-07-08 23:20:44 +02:00
parent 29abb422bf
commit 326d744925
27 changed files with 757 additions and 107 deletions

View File

@ -110,30 +110,30 @@ dependencies {
implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.preference:preference-ktx:1.2.0' implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2' implementation 'androidx.navigation:navigation-ui-ktx:2.5.0'
implementation "androidx.browser:browser:1.4.0" implementation "androidx.browser:browser:1.4.0"
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2' implementation 'androidx.navigation:navigation-ui-ktx:2.5.0'
implementation 'androidx.paging:paging-runtime-ktx:3.1.1' implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.0'
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1" implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.4.1" implementation "androidx.lifecycle:lifecycle-common-java8:2.5.0"
implementation "androidx.annotation:annotation:1.3.0" implementation "androidx.annotation:annotation:1.4.0"
implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation "androidx.activity:activity-ktx:1.4.0" implementation "androidx.activity:activity-ktx:1.5.0"
implementation 'androidx.fragment:fragment-ktx:1.4.1' implementation 'androidx.fragment:fragment-ktx:1.5.0'
implementation 'androidx.work:work-runtime-ktx:2.7.1' implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation 'androidx.media2:media2-widget:1.2.1' implementation 'androidx.media2:media2-widget:1.2.1'
implementation 'androidx.media2:media2-player:1.2.1' implementation 'androidx.media2:media2-player:1.2.1'
// Use the most recent version of CameraX // Use the most recent version of CameraX
def cameraX_version = '1.1.0-rc02' def cameraX_version = '1.1.0'
implementation "androidx.camera:camera-core:$cameraX_version" implementation "androidx.camera:camera-core:$cameraX_version"
implementation "androidx.camera:camera-camera2:$cameraX_version" implementation "androidx.camera:camera-camera2:$cameraX_version"
// CameraX Lifecycle library // CameraX Lifecycle library
@ -159,17 +159,17 @@ dependencies {
implementation 'com.google.android.material:material:1.6.1' implementation 'com.google.android.material:material:1.6.1'
//Dagger (dependency injection) //Dagger (dependency injection)
implementation 'com.google.dagger:dagger-android:2.40.5' implementation 'com.google.dagger:dagger-android:2.42'
implementation 'com.google.dagger:dagger-android-support:2.40.5' implementation 'com.google.dagger:dagger-android-support:2.42'
// if you use the support libraries // if you use the support libraries
kapt 'com.google.dagger:dagger-android-processor:2.40.5' kapt 'com.google.dagger:dagger-android-processor:2.42'
kapt 'com.google.dagger:dagger-compiler:2.40.5' kapt 'com.google.dagger:dagger-compiler:2.42'
implementation 'com.squareup.okhttp3:okhttp:4.9.2' implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0' implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
implementation 'io.reactivex.rxjava3:rxjava:3.1.3' implementation 'io.reactivex.rxjava3:rxjava:3.1.5'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0' implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'com.github.connyduck:sparkbutton:4.1.0' implementation 'com.github.connyduck:sparkbutton:4.1.0'
@ -177,27 +177,27 @@ dependencies {
implementation 'info.androidhive:imagefilters:1.0.7' implementation 'info.androidhive:imagefilters:1.0.7'
implementation 'com.github.yalantis:ucrop:2.2.6-native' implementation 'com.github.yalantis:ucrop:2.2.6-native'
implementation('com.github.bumptech.glide:glide:4.12.0') { implementation('com.github.bumptech.glide:glide:4.13.2') {
exclude group: "com.android.support" exclude group: "com.android.support"
} }
implementation 'com.github.bumptech.glide:okhttp-integration:4.12.0' implementation 'com.github.bumptech.glide:okhttp-integration:4.13.2'
implementation('com.github.bumptech.glide:recyclerview-integration:4.12.0') { implementation('com.github.bumptech.glide:recyclerview-integration:4.13.2') {
// Excludes the support library because it's already included by Glide. // Excludes the support library because it's already included by Glide.
transitive = false transitive = false
} }
kapt 'com.github.bumptech.glide:compiler:4.12.0' kapt 'com.github.bumptech.glide:compiler:4.13.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.mikepenz:materialdrawer:8.4.4' implementation 'com.mikepenz:materialdrawer:9.0.1'
// Add for NavController support // Add for NavController support
implementation 'com.mikepenz:materialdrawer-nav:8.4.4' implementation 'com.mikepenz:materialdrawer-nav:9.0.1'
//iconics //iconics
implementation 'com.mikepenz:iconics-core:5.3.3' implementation 'com.mikepenz:iconics-core:5.3.4'
implementation 'com.mikepenz:materialdrawer-iconics:8.4.2' implementation 'com.mikepenz:materialdrawer-iconics:9.0.1'
implementation 'com.mikepenz:iconics-views:5.3.3' implementation 'com.mikepenz:iconics-views:5.3.4'
implementation 'com.mikepenz:google-material-typeface:4.0.0.2-kotlin@aar' implementation 'com.mikepenz:google-material-typeface:4.0.0.2-kotlin@aar'
@ -214,7 +214,7 @@ dependencies {
//stagingImplementation 'com.squareup.leakcanary:leakcanary-android:2.7' //stagingImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
androidTestImplementation 'androidx.work:work-testing:2.7.1' androidTestImplementation 'androidx.work:work-testing:2.7.1'
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.32.0' testImplementation 'com.github.tomakehurst:wiremock-jre8:2.33.2'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
testImplementation "androidx.room:room-testing:$room_version" testImplementation "androidx.room:room-testing:$room_version"

View File

@ -41,7 +41,7 @@
android:parentActivityName=".MainActivity"> android:parentActivityName=".MainActivity">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity " /> android:value=".MainActivity" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
</intent-filter> </intent-filter>

View File

@ -6,20 +6,23 @@ import android.graphics.drawable.Drawable
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.MenuItem
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import androidx.core.view.forEach
import androidx.core.view.forEachIndexed
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.paging.ExperimentalPagingApi import androidx.paging.ExperimentalPagingApi
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.adapter.FragmentStateAdapter import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2 import androidx.viewpager2.widget.ViewPager2
import androidx.viewpager2.widget.ViewPager2.*
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.google.android.material.tabs.TabLayout import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.tabs.TabLayoutMediator
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.mikepenz.materialdrawer.iconics.iconicsIcon import com.mikepenz.materialdrawer.iconics.iconicsIcon
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem import com.mikepenz.materialdrawer.model.PrimaryDrawerItem
@ -41,7 +44,6 @@ import org.pixeldroid.app.searchDiscover.SearchDiscoverFragment
import org.pixeldroid.app.settings.SettingsActivity import org.pixeldroid.app.settings.SettingsActivity
import org.pixeldroid.app.utils.BaseActivity import org.pixeldroid.app.utils.BaseActivity
import org.pixeldroid.app.utils.db.addUser import org.pixeldroid.app.utils.db.addUser
import org.pixeldroid.app.utils.notificationsWorker.enablePullNotifications
import org.pixeldroid.app.utils.db.entities.HomeStatusDatabaseEntity import org.pixeldroid.app.utils.db.entities.HomeStatusDatabaseEntity
import org.pixeldroid.app.utils.db.entities.PublicFeedStatusDatabaseEntity import org.pixeldroid.app.utils.db.entities.PublicFeedStatusDatabaseEntity
import org.pixeldroid.app.utils.db.entities.UserDatabaseEntity import org.pixeldroid.app.utils.db.entities.UserDatabaseEntity
@ -49,6 +51,7 @@ import org.pixeldroid.app.utils.hasInternet
import org.pixeldroid.app.utils.notificationsWorker.NotificationsWorker.Companion.INSTANCE_NOTIFICATION_TAG import org.pixeldroid.app.utils.notificationsWorker.NotificationsWorker.Companion.INSTANCE_NOTIFICATION_TAG
import org.pixeldroid.app.utils.notificationsWorker.NotificationsWorker.Companion.SHOW_NOTIFICATION_TAG import org.pixeldroid.app.utils.notificationsWorker.NotificationsWorker.Companion.SHOW_NOTIFICATION_TAG
import org.pixeldroid.app.utils.notificationsWorker.NotificationsWorker.Companion.USER_NOTIFICATION_TAG import org.pixeldroid.app.utils.notificationsWorker.NotificationsWorker.Companion.USER_NOTIFICATION_TAG
import org.pixeldroid.app.utils.notificationsWorker.enablePullNotifications
import org.pixeldroid.app.utils.notificationsWorker.removeNotificationChannelsFromAccount import org.pixeldroid.app.utils.notificationsWorker.removeNotificationChannelsFromAccount
import retrofit2.HttpException import retrofit2.HttpException
import java.io.IOException import java.io.IOException
@ -142,11 +145,12 @@ class MainActivity : BaseActivity() {
} }
private fun setupDrawer() { private fun setupDrawer() {
binding.mainDrawerButton.setOnClickListener{ binding.mainDrawerButton.setOnClickListener{
binding.drawerLayout.open() binding.drawerLayout.openDrawer(binding.drawer)
} }
header = AccountHeaderView(this).apply { header = AccountHeaderView(this).apply {
attachToSliderView(binding.drawer)
headerBackgroundScaleType = ImageView.ScaleType.CENTER_CROP headerBackgroundScaleType = ImageView.ScaleType.CENTER_CROP
currentHiddenInList = true currentHiddenInList = true
onAccountHeaderListener = { _: View?, profile: IProfile, current: Boolean -> onAccountHeaderListener = { _: View?, profile: IProfile, current: Boolean ->
@ -158,7 +162,6 @@ class MainActivity : BaseActivity() {
descriptionRes = R.string.add_account_description descriptionRes = R.string.add_account_description
iconicsIcon = GoogleMaterial.Icon.gmd_add iconicsIcon = GoogleMaterial.Icon.gmd_add
}, 0) }, 0)
attachToSliderView(binding.drawer)
dividerBelowHeader = false dividerBelowHeader = false
closeDrawerOnProfileListClick = true closeDrawerOnProfileListClick = true
} }
@ -294,7 +297,7 @@ class MainActivity : BaseActivity() {
isIconTinted = true isIconTinted = true
} }
.apply(block) .apply(block)
} }
private fun fillDrawerAccountInfo(account: String) { private fun fillDrawerAccountInfo(account: String) {
val users = db.userDao().getAll().toMutableList() val users = db.userDao().getAll().toMutableList()
@ -353,32 +356,57 @@ class MainActivity : BaseActivity() {
return tab_array.size return tab_array.size
} }
} }
binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?){}
override fun onTabUnselected(tab: TabLayout.Tab?) {} binding.viewPager.registerOnPageChangeCallback(object : OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
override fun onTabReselected(tab: TabLayout.Tab?) { val selected = when(position){
tab?.position?.let { position -> 0 -> R.id.page_1
val page = 1 -> R.id.page_2
//No clue why this works but it does. F to pay respects 2 -> R.id.page_3
supportFragmentManager.findFragmentByTag("f$position") 3 -> R.id.page_4
(page as? CachedFeedFragment<*>)?.onTabReClicked() 4 -> R.id.page_5
else -> null
} }
if (selected != null) {
binding.tabs.selectedItemId = selected
}
super.onPageSelected(position)
} }
}) })
TabLayoutMediator(binding.tabs, binding.viewPager) { tab, position -> fun MenuItem.itemPos(): Int? {
tab.icon = ContextCompat.getDrawable(applicationContext, return when(itemId){
when(position){ R.id.page_1 -> 0
0 -> R.drawable.ic_home_white_24dp R.id.page_2 -> 1
1 -> R.drawable.ic_search_white_24dp R.id.page_3 -> 2
2 -> R.drawable.photo_camera R.id.page_4 -> 3
3 -> R.drawable.ic_heart R.id.page_5 -> 4
4 -> R.drawable.ic_filter_black_24dp else -> null
else -> throw IllegalArgumentException() }
}) }
}.attach()
binding.tabs.setOnItemSelectedListener {item ->
item.itemPos()?.let {
binding.viewPager.currentItem = it
true
} ?: false
}
binding.tabs.setOnItemReselectedListener { item ->
item.itemPos()?.let { position ->
val page =
//No clue why this works but it does. F to pay respects
supportFragmentManager.findFragmentByTag("f$position")
(page as? CachedFeedFragment<*>)?.onTabReClicked()
}
}
}
fun BottomNavigationView.uncheckAllItems() {
menu.setGroupCheckable(0, true, false)
for (i in 0 until menu.size()) {
menu.getItem(i).isChecked = false
}
menu.setGroupCheckable(0, true, true)
} }
/** /**

View File

@ -56,14 +56,14 @@ class ReportActivity : BaseActivity() {
private fun reportStatus(success: Boolean){ private fun reportStatus(success: Boolean){
if(success){ if(success){
binding.reportProgressBar.visibility = View.GONE binding.reportProgressBar.visibility = View.GONE
binding.reportButton.isEnabled = false binding.reportButton.visibility = View.INVISIBLE
binding.reportButton.text = getString(R.string.reported) binding.reportSuccess.visibility = View.VISIBLE
binding.reportButton.visibility = View.VISIBLE
} else { } else {
binding.textInputLayout.error = getString(R.string.report_error) binding.textInputLayout.error = getString(R.string.report_error)
binding.reportButton.visibility = View.VISIBLE binding.reportButton.visibility = View.VISIBLE
binding.textInputLayout.editText?.isEnabled = true binding.textInputLayout.editText?.isEnabled = true
binding.reportProgressBar.visibility = View.GONE binding.reportProgressBar.visibility = View.GONE
binding.reportSuccess.visibility = View.GONE
} }
} }
} }

View File

@ -4,6 +4,7 @@ import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import androidx.fragment.app.DialogFragment
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
@ -79,6 +80,19 @@ class SettingsActivity : BaseActivity(), SharedPreferences.OnSharedPreferenceCha
} }
class SettingsFragment : PreferenceFragmentCompat() { class SettingsFragment : PreferenceFragmentCompat() {
override fun onDisplayPreferenceDialog(preference: Preference) {
var dialogFragment: DialogFragment? = null
if (preference is ColorPreference) {
dialogFragment = ColorPreferenceDialog((preference as ColorPreference?)!!)
}
if (dialogFragment != null) {
dialogFragment.setTargetFragment(this, 0)
dialogFragment.show(parentFragmentManager, "settings_fragment")
} else {
super.onDisplayPreferenceDialog(preference)
}
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.root_preferences, rootKey) setPreferencesFromResource(R.xml.root_preferences, rootKey)

View File

@ -0,0 +1,186 @@
package org.pixeldroid.app.settings
import android.content.Context
import android.content.DialogInterface
import android.content.res.TypedArray
import android.graphics.Color
import android.os.Bundle
import android.util.AttributeSet
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.preference.DialogPreference
import androidx.preference.PreferenceDialogFragmentCompat
import androidx.preference.PreferenceViewHolder
import org.pixeldroid.app.R
import org.pixeldroid.app.databinding.ColorDialogBinding
import org.pixeldroid.app.databinding.ImageCarouselBinding
/** AndroidX version created by yvolk@yurivolkov.com
* based on this answer: https://stackoverflow.com/a/53290775/297710
* and on the code of https://github.com/koji-1009/ChronoDialogPreference
*/
class ColorPreferenceDialog(preference: ColorPreference) :
PreferenceDialogFragmentCompat() {
private val preference: ColorPreference
private var mPicker: ColorPickerView? = null
init {
this.preference = preference
val b = Bundle()
b.putString(ARG_KEY, preference.key)
arguments = b
}
override fun onCreateDialogView(context: Context): View? {
val picker = ColorPickerView(context)
mPicker = picker
return mPicker
}
override fun onStart() {
super.onStart()
val dialog: AlertDialog? = dialog as AlertDialog?
if (preference.selectNoneButtonText != null && preference.defaultColor != null && mPicker != null && dialog != null) {
// In order to prevent dialog from closing we setup its onLickListener this late
dialog.getButton(DialogInterface.BUTTON_POSITIVE)?.setOnClickListener{
mPicker?.setCurrentColor(preference.defaultColor!!)
}
}
}
override fun onPrepareDialogBuilder(builder: AlertDialog.Builder) {
if (preference.selectNoneButtonText != null) {
builder.setNeutralButton(preference.selectNoneButtonText, null)
}
}
override fun onDialogClosed(positiveResult: Boolean) {
if (positiveResult) {
val color: Int = mPicker!!.color
if (preference.callChangeListener(color)) {
preference.color = color
}
}
}
}
class ColorPreference constructor(context: Context, attrs: AttributeSet? = null) :
DialogPreference(context, attrs) {
var selectNoneButtonText: String? = null
var defaultColor: Int? = null
private var noneSelectedSummaryText: String? = null
private val summaryText: CharSequence = super.getSummary()!!
private var thumbnail: View? = null
private val mPicker: ColorPickerView? = null
init {
}
override fun onBindViewHolder(viewHolder: PreferenceViewHolder) {
thumbnail = addThumbnail(viewHolder.itemView)
showColor(persistedIntDefaultOrNull)
// Only call after showColor sets any summary text:
super.onBindViewHolder(viewHolder)
}
override fun onGetDefaultValue(a: TypedArray, index: Int): Any? {
defaultColor = readDefaultValue(a, index)
return defaultColor
}
override fun setDefaultValue(defaultValue: Any?) {
super.setDefaultValue(defaultValue)
defaultColor = parseDefaultValue(defaultValue)
}
override fun onSetInitialValue(defaultValue: Any?) {
color = defaultValue?.let {
parseDefaultValue(defaultValue)
} ?: color
}
private fun addThumbnail(view: View): View {
val widgetFrameView: LinearLayout = view.findViewById(android.R.id.widget_frame)
widgetFrameView.visibility = View.VISIBLE
widgetFrameView.removeAllViews()
LayoutInflater.from(context).inflate(R.layout.color_preference_thumbnail, widgetFrameView)
return widgetFrameView.findViewById(R.id.thumbnail)
}
private val persistedIntDefaultOrNull: Int
get() = if (shouldPersist() && sharedPreferences?.contains(key) == true)
Integer.valueOf(getPersistedInt(Color.GRAY)) else defaultColor!!
private fun showColor(color: Int?) {
val thumbColor = color ?: defaultColor
thumbnail?.visibility = if (thumbColor == null) View.GONE else View.VISIBLE
thumbnail?.findViewById<ImageView>(R.id.colorPreview)?.setBackgroundColor(thumbColor ?: 0)
if (noneSelectedSummaryText != null) {
summary = if (thumbColor == null) noneSelectedSummaryText else summaryText
}
}
private fun removeSetting() {
if (shouldPersist()) {
sharedPreferences
?.edit()
?.remove(key)
?.apply()
}
}
var color: Int?
get() = persistedIntDefaultOrNull
set(color) {
if (color == null) {
removeSetting()
} else {
persistInt(color)
}
showColor(color)
}
companion object {
private fun readDefaultValue(a: TypedArray, index: Int): Int? {
if (a.peekValue(index) != null) {
val type = a.peekValue(index).type
if (type == TypedValue.TYPE_STRING) {
return when(a.getString(index)){
"default" -> 0
"second" -> 1
"third" -> 2
else -> null
}
}
}
return null
}
private fun parseDefaultValue(defaultValue: Any?): Int {
return if (defaultValue == null) 0 else if (defaultValue is Int) defaultValue else 0
}
}
}
class ColorPickerView @JvmOverloads constructor(context: Context?, attrs: AttributeSet? = null) : FrameLayout(context!!, attrs) {
var binding: ColorDialogBinding
fun setCurrentColor(defaultColor: Int) {
Toast.makeText(context, "test $defaultColor", Toast.LENGTH_LONG).show()
}
init {
binding = ColorDialogBinding.inflate(LayoutInflater.from(context),this, true)
}
/** Returns the color selected by the user */
/** Sets the original color swatch and the current color to the specified value. */
var color: Int = 1
}

View File

@ -2,6 +2,7 @@ package org.pixeldroid.app.utils
import android.app.Application import android.app.Application
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import com.google.android.material.color.DynamicColors
import org.pixeldroid.app.utils.di.* import org.pixeldroid.app.utils.di.*
import com.mikepenz.iconics.Iconics import com.mikepenz.iconics.Iconics
import org.ligi.tracedroid.TraceDroid import org.ligi.tracedroid.TraceDroid
@ -26,6 +27,9 @@ class PixelDroidApplication: Application() {
.aPIModule(APIModule()) .aPIModule(APIModule())
.build() .build()
mApplicationComponent.inject(this) mApplicationComponent.inject(this)
//TODO put condition depending on setting
if(false) DynamicColors.applyToActivitiesIfAvailable(this)
} }
fun getAppComponent(): ApplicationComponent { fun getAppComponent(): ApplicationComponent {

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
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="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
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="M12,5.69l5,4.5V18h-2v-6H9v6H7v-7.81l5,-4.5M12,3L2,12h3v8h6v-6h2v6h6v-8h3L12,3z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
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="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zM18,16v-5c0,-3.07 -1.63,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.64,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2zM16,17L8,17v-6c0,-2.48 1.51,-4.5 4,-4.5s4,2.02 4,4.5v6z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
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="M14.12,4l1.83,2L20,6v12L4,18L4,6h4.05l1.83,-2h4.24M15,2L9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2zM12,9c1.65,0 3,1.35 3,3s-1.35,3 -3,3 -3,-1.35 -3,-3 1.35,-3 3,-3m0,-2c-2.76,0 -5,2.24 -5,5s2.24,5 5,5 5,-2.24 5,-5 -2.24,-5 -5,-5z"/>
</vector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/photo_camera" android:state_checked="true"/>
<item android:drawable="@drawable/outline_photo_camera" android:state_checked="false"/>
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_home_white_24dp" android:state_checked="true"/>
<item android:drawable="@drawable/outline_home" android:state_checked="false"/>
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/notifications" android:state_checked="true"/>
<item android:drawable="@drawable/outline_notifications" android:state_checked="false"/>
</selector>

View File

@ -17,6 +17,7 @@
android:id="@+id/main_activity_main_linear_layout" android:id="@+id/main_activity_main_linear_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -27,27 +28,23 @@
android:id="@+id/main_drawer_button" android:id="@+id/main_drawer_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/colorPrimaryTab" android:background="?attr/colorSurface"
android:contentDescription="@string/open_drawer_menu" android:contentDescription="@string/open_drawer_menu"
android:padding="12dp" android:padding="12dp"
android:src="@drawable/ic_baseline_menu_24" /> android:src="@drawable/ic_baseline_menu_24" />
<com.google.android.material.tabs.TabLayout <com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/tabs" android:id="@+id/tabs"
app:elevation="0dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:tabBackground="@color/colorPrimaryTab" app:menu="@menu/bottom_navigation_main" />
app:tabGravity="fill"
app:tabMaxWidth="0dp"
app:tabMode="fixed"
app:tabUnboundedRipple="false" />
</LinearLayout> </LinearLayout>
<androidx.viewpager2.widget.ViewPager2 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager" android:id="@+id/view_pager"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
app:layout_constraintBottom_toTopOf="@+id/main_activity_main_linear_layout" app:layout_constraintBottom_toTopOf="@+id/main_activity_main_linear_layout"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -22,24 +22,24 @@
android:id="@+id/upload_error_text_view" android:id="@+id/upload_error_text_view"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#90000000" android:background="?attr/colorError"
android:text="@string/media_upload_failed" android:text="@string/media_upload_failed"
android:textColor="@color/colorPrimaryError" android:textColor="?attr/colorOnError"
android:textSize="20sp" android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:drawableStartCompat="@drawable/cloud_off_24" app:drawableStartCompat="@drawable/cloud_off_24"
app:drawableTint="@color/colorPrimaryError" /> app:drawableTint="?attr/colorOnError" />
<TextView <TextView
android:id="@+id/upload_error_text_explanation" android:id="@+id/upload_error_text_explanation"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#90000000" android:background="?attr/colorError"
tools:text="Error code returned by server: 413" tools:text="Error code returned by server: 413"
android:textColor="@color/colorPrimaryError" android:textColor="?attr/colorOnError"
android:textSize="20sp" android:textSize="20sp"
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -96,10 +96,8 @@
android:id="@+id/post_creation_send_button" android:id="@+id/post_creation_send_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:backgroundTint="@color/colorButtonBg"
android:enabled="true" android:enabled="true"
android:text="@string/post" android:text="@string/post"
android:textColor="@color/colorButtonText"
android:visibility="visible" android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -138,7 +136,7 @@
android:paddingEnd="15dp" android:paddingEnd="15dp"
android:textColorHint="@color/colorPrimaryTab" android:textColorHint="@color/colorPrimaryTab"
app:errorEnabled="true" app:errorEnabled="true"
app:errorTextColor="@color/colorPrimaryError" app:errorTextColor="?attr/colorOnError"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/buttonConstraints" app:layout_constraintEnd_toStartOf="@+id/buttonConstraints"
app:layout_constraintStart_toStartOf="parent"> app:layout_constraintStart_toStartOf="parent">

View File

@ -40,20 +40,49 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.mikepenz.iconics.view.IconicsButton <Button
android:id="@+id/reportButton" android:id="@+id/reportButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/report" android:text="@string/report"
android:textColor="@color/colorText"
android:backgroundTint="@color/colorPrimary"
app:iconGravity="end"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.75" /> app:layout_constraintVertical_bias="0.75" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:id="@+id/reportSuccess"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.75"
tools:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/reportSuccessText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/check_circle_24"
android:contentDescription="@string/reported" />
<TextView
android:id="@+id/reportSuccessText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="@string/reported"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<ProgressBar <ProgressBar
android:id="@+id/reportProgressBar" android:id="@+id/reportProgressBar"
style="?android:attr/progressBarStyle" style="?android:attr/progressBarStyle"

View File

@ -0,0 +1,68 @@
<?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="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/theme1"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleX="2"
android:scaleY="2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/theme2"
app:srcCompat="@drawable/circle_black_24dp"
app:tint="@color/seed" />
<ImageButton
android:id="@+id/theme2"
android:scaleX="2"
android:scaleY="2"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
app:layout_constraintStart_toEndOf="@+id/theme1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/theme3"
app:srcCompat="@drawable/circle_black_24dp"
app:tint="@color/seed2" />
<ImageButton
android:id="@+id/theme3"
android:scaleX="2"
android:scaleY="2"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
app:layout_constraintStart_toEndOf="@+id/theme2"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/theme4"
app:srcCompat="@drawable/circle_black_24dp"
app:tint="@color/seed" />
<ImageButton
android:id="@+id/theme4"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleX="2"
android:scaleY="2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/theme3"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:srcCompat="@drawable/circle_black_24dp"
app:tint="@color/seed" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@+id/thumbnail"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="42dp"
android:layout_height="42dp">
<ImageView
android:id="@+id/colorPreview"
android:layout_margin="1dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/circle_black_24dp"
app:tint="@color/seed" />
</FrameLayout>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/page_1"
android:enabled="true"
android:icon="@drawable/selector_home_feed"
android:title="@string/home_feed"/>
<item
android:id="@+id/page_2"
android:enabled="true"
android:icon="@drawable/ic_search_white_24dp"
android:title="@string/search_discover_feed"/>
<item
android:id="@+id/page_3"
android:enabled="true"
android:icon="@drawable/selector_camera"
android:title="@string/create_feed"/>
<item
android:id="@+id/page_4"
android:enabled="true"
android:icon="@drawable/selector_notifications"
android:title="@string/notifications_feed"/>
<item
android:id="@+id/page_5"
android:enabled="true"
android:icon="@drawable/ic_filter_black_24dp"
android:title="@string/public_feed"/>
</menu>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#FFFFFF</color> <color name="colorPrimary">#FFFFFF</color>
<color name="colorPrimaryTab">#6200EE</color> <color name="colorPrimaryTab">#f4a261</color>
<color name="colorText">#000000</color> <color name="colorText">#000000</color>
<color name="colorDrawing">#FFFFFF</color> <color name="colorDrawing">#FFFFFF</color>

View File

@ -0,0 +1,62 @@
<resources>
<style name="AppTheme" parent="Theme.Material3.Dark">
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/md_theme_dark_onPrimaryContainer</item>
<item name="colorSecondary">@color/md_theme_dark_secondary</item>
<item name="colorOnSecondary">@color/md_theme_dark_onSecondary</item>
<item name="colorSecondaryContainer">@color/md_theme_dark_secondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/md_theme_dark_onSecondaryContainer</item>
<item name="colorTertiary">@color/md_theme_dark_tertiary</item>
<item name="colorOnTertiary">@color/md_theme_dark_onTertiary</item>
<item name="colorTertiaryContainer">@color/md_theme_dark_tertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/md_theme_dark_onTertiaryContainer</item>
<item name="colorError">@color/md_theme_dark_error</item>
<item name="colorErrorContainer">@color/md_theme_dark_errorContainer</item>
<item name="colorOnError">@color/md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/md_theme_dark_background</item>
<item name="colorOnBackground">@color/md_theme_dark_onBackground</item>
<item name="colorSurface">@color/md_theme_dark_surface</item>
<item name="colorOnSurface">@color/md_theme_dark_onSurface</item>
<item name="colorSurfaceVariant">@color/md_theme_dark_surfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/md_theme_dark_onSurfaceVariant</item>
<item name="colorOutline">@color/md_theme_dark_outline</item>
<item name="colorOnSurfaceInverse">@color/md_theme_dark_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_dark_inverseSurface</item>
<item name="elevationOverlayColor">@color/md_theme_dark_surfaceTint</item>
<item name="colorPrimaryInverse">@color/md_theme_dark_inversePrimary</item>
</style>
<style name="AppTheme2" parent="Theme.Material3.Dark.NoActionBar">
<item name="colorPrimary">@color/md_theme_dark_primary2</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary2</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer2</item>
<item name="colorOnPrimaryContainer">@color/md_theme_dark_onPrimaryContainer2</item>
<item name="colorSecondary">@color/md_theme_dark_secondary2</item>
<item name="colorOnSecondary">@color/md_theme_dark_onSecondary2</item>
<item name="colorSecondaryContainer">@color/md_theme_dark_secondaryContainer2</item>
<item name="colorOnSecondaryContainer">@color/md_theme_dark_onSecondaryContainer2</item>
<item name="colorTertiary">@color/md_theme_dark_tertiary2</item>
<item name="colorOnTertiary">@color/md_theme_dark_onTertiary2</item>
<item name="colorTertiaryContainer">@color/md_theme_dark_tertiaryContainer2</item>
<item name="colorOnTertiaryContainer">@color/md_theme_dark_onTertiaryContainer2</item>
<item name="colorError">@color/md_theme_dark_error2</item>
<item name="colorOnError">@color/md_theme_dark_onError2</item>
<item name="colorErrorContainer">@color/md_theme_dark_errorContainer2</item>
<item name="colorOnErrorContainer">@color/md_theme_dark_onErrorContainer2</item>
<item name="android:colorBackground">@color/md_theme_dark_background2</item>
<item name="colorOnBackground">@color/md_theme_dark_onBackground2</item>
<item name="colorSurface">@color/md_theme_dark_surface2</item>
<item name="colorOnSurface">@color/md_theme_dark_onSurface2</item>
<item name="colorSurfaceVariant">@color/md_theme_dark_surfaceVariant2</item>
<item name="colorOnSurfaceVariant">@color/md_theme_dark_onSurfaceVariant2</item>
<item name="colorOutline">@color/md_theme_dark_outline2</item>
<item name="colorSurfaceInverse">@color/md_theme_dark_inverseSurface2</item>
<item name="colorOnSurfaceInverse">@color/md_theme_dark_inverseOnSurface2</item>
<item name="elevationOverlayColor">@color/md_theme_dark_surfaceTint2</item>
<item name="colorPrimaryInverse">@color/md_theme_dark_inversePrimary2</item>
</style>
</resources>

View File

@ -1,14 +1,140 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#6200EE</color> <color name="seed">#f4a261</color>
<color name="md_theme_light_primary">#924C00</color>
<color name="md_theme_light_onPrimary">#FFFFFF</color>
<color name="md_theme_light_primaryContainer">#FFDCC4</color>
<color name="md_theme_light_onPrimaryContainer">#2F1400</color>
<color name="md_theme_light_secondary">#745945</color>
<color name="md_theme_light_onSecondary">#FFFFFF</color>
<color name="md_theme_light_secondaryContainer">#FFDCC4</color>
<color name="md_theme_light_onSecondaryContainer">#2A1707</color>
<color name="md_theme_light_tertiary">#5D6136</color>
<color name="md_theme_light_onTertiary">#FFFFFF</color>
<color name="md_theme_light_tertiaryContainer">#E3E7AF</color>
<color name="md_theme_light_onTertiaryContainer">#1A1D00</color>
<color name="md_theme_light_error">#BA1A1A</color>
<color name="md_theme_light_errorContainer">#FFDAD6</color>
<color name="md_theme_light_onError">#FFFFFF</color>
<color name="md_theme_light_onErrorContainer">#410002</color>
<color name="md_theme_light_background">#FFFBFF</color>
<color name="md_theme_light_onBackground">#201A17</color>
<color name="md_theme_light_surface">#FFFBFF</color>
<color name="md_theme_light_onSurface">#201A17</color>
<color name="md_theme_light_surfaceVariant">#F3DFD2</color>
<color name="md_theme_light_onSurfaceVariant">#52443B</color>
<color name="md_theme_light_outline">#84746A</color>
<color name="md_theme_light_inverseOnSurface">#FBEEE8</color>
<color name="md_theme_light_inverseSurface">#362F2B</color>
<color name="md_theme_light_inversePrimary">#FFB780</color>
<color name="md_theme_light_shadow">#000000</color>
<color name="md_theme_light_surfaceTint">#924C00</color>
<color name="md_theme_light_surfaceTintColor">#924C00</color>
<color name="md_theme_dark_primary">#FFB780</color>
<color name="md_theme_dark_onPrimary">#4E2600</color>
<color name="md_theme_dark_primaryContainer">#6F3800</color>
<color name="md_theme_dark_onPrimaryContainer">#FFDCC4</color>
<color name="md_theme_dark_secondary">#E4BFA7</color>
<color name="md_theme_dark_onSecondary">#422B1A</color>
<color name="md_theme_dark_secondaryContainer">#5B412F</color>
<color name="md_theme_dark_onSecondaryContainer">#FFDCC4</color>
<color name="md_theme_dark_tertiary">#C6CA95</color>
<color name="md_theme_dark_onTertiary">#2F330C</color>
<color name="md_theme_dark_tertiaryContainer">#464A20</color>
<color name="md_theme_dark_onTertiaryContainer">#E3E7AF</color>
<color name="md_theme_dark_error">#FFB4AB</color>
<color name="md_theme_dark_errorContainer">#93000A</color>
<color name="md_theme_dark_onError">#690005</color>
<color name="md_theme_dark_onErrorContainer">#FFDAD6</color>
<color name="md_theme_dark_background">#201A17</color>
<color name="md_theme_dark_onBackground">#ECE0DA</color>
<color name="md_theme_dark_surface">#201A17</color>
<color name="md_theme_dark_onSurface">#ECE0DA</color>
<color name="md_theme_dark_surfaceVariant">#52443B</color>
<color name="md_theme_dark_onSurfaceVariant">#D6C3B7</color>
<color name="md_theme_dark_outline">#9F8D82</color>
<color name="md_theme_dark_inverseOnSurface">#201A17</color>
<color name="md_theme_dark_inverseSurface">#ECE0DA</color>
<color name="md_theme_dark_inversePrimary">#924C00</color>
<color name="md_theme_dark_shadow">#000000</color>
<color name="md_theme_dark_surfaceTint">#FFB780</color>
<color name="md_theme_dark_surfaceTintColor">#FFB780</color>
<color name="seed2">#4285F4</color>
<color name="md_theme_light_primary2">#005AC1</color>
<color name="md_theme_light_onPrimary2">#FFFFFF</color>
<color name="md_theme_light_primaryContainer2">#D8E2FF</color>
<color name="md_theme_light_onPrimaryContainer2">#001A41</color>
<color name="md_theme_light_secondary2">#535E78</color>
<color name="md_theme_light_onSecondary2">#FFFFFF</color>
<color name="md_theme_light_secondaryContainer2">#D8E2FF</color>
<color name="md_theme_light_onSecondaryContainer2">#0F1B32</color>
<color name="md_theme_light_tertiary2">#76517B</color>
<color name="md_theme_light_onTertiary2">#FFFFFF</color>
<color name="md_theme_light_tertiaryContainer2">#FED6FF</color>
<color name="md_theme_light_onTertiaryContainer2">#2D0E34</color>
<color name="md_theme_light_error2">#BA1A1A</color>
<color name="md_theme_light_onError2">#FFFFFF</color>
<color name="md_theme_light_errorContainer2">#FFDAD6</color>
<color name="md_theme_light_onErrorContainer2">#410002</color>
<color name="md_theme_light_background2">#FEFBFF</color>
<color name="md_theme_light_onBackground2">#1B1B1F</color>
<color name="md_theme_light_surface2">#FEFBFF</color>
<color name="md_theme_light_onSurface2">#1B1B1F</color>
<color name="md_theme_light_surfaceVariant2">#E1E2EC</color>
<color name="md_theme_light_onSurfaceVariant2">#44474F</color>
<color name="md_theme_light_outline2">#74777F</color>
<color name="md_theme_light_shadow2">#000000</color>
<color name="md_theme_light_inverseSurface2">#303033</color>
<color name="md_theme_light_inverseOnSurface2">#F2F0F4</color>
<color name="md_theme_light_inversePrimary2">#ADC6FF</color>
<color name="md_theme_light_surfaceTint2">#005AC1</color>
<color name="md_theme_light_surfaceTintColor2">#005AC1</color>
<color name="md_theme_dark_primary2">#ADC6FF</color>
<color name="md_theme_dark_onPrimary2">#002E69</color>
<color name="md_theme_dark_primaryContainer2">#004494</color>
<color name="md_theme_dark_onPrimaryContainer2">#D8E2FF</color>
<color name="md_theme_dark_secondary2">#BBC6E4</color>
<color name="md_theme_dark_onSecondary2">#253048</color>
<color name="md_theme_dark_secondaryContainer2">#3B475F</color>
<color name="md_theme_dark_onSecondaryContainer2">#D8E2FF</color>
<color name="md_theme_dark_tertiary2">#E5B8E8</color>
<color name="md_theme_dark_onTertiary2">#44244A</color>
<color name="md_theme_dark_tertiaryContainer2">#5D3A62</color>
<color name="md_theme_dark_onTertiaryContainer2">#FED6FF</color>
<color name="md_theme_dark_error2">#FFB4AB</color>
<color name="md_theme_dark_onError2">#690005</color>
<color name="md_theme_dark_errorContainer2">#93000A</color>
<color name="md_theme_dark_onErrorContainer2">#FFB4AB</color>
<color name="md_theme_dark_background2">#1B1B1F</color>
<color name="md_theme_dark_onBackground2">#E3E2E6</color>
<color name="md_theme_dark_surface2">#1B1B1F</color>
<color name="md_theme_dark_onSurface2">#E3E2E6</color>
<color name="md_theme_dark_surfaceVariant2">#44474F</color>
<color name="md_theme_dark_onSurfaceVariant2">#C4C6D0</color>
<color name="md_theme_dark_outline2">#8E9099</color>
<color name="md_theme_dark_shadow2">#000000</color>
<color name="md_theme_dark_inverseSurface2">#E3E2E6</color>
<color name="md_theme_dark_inverseOnSurface2">#303033</color>
<color name="md_theme_dark_inversePrimary2">#005AC1</color>
<color name="md_theme_dark_surfaceTint2">#ADC6FF</color>
<color name="md_theme_dark_surfaceTintColor2">#ADC6FF</color>
<color name="colorPrimary">#2a9d8f</color>
<color name="colorPrimaryTab">#FFFFFF</color> <color name="colorPrimaryTab">#FFFFFF</color>
<color name="colorPrimaryActionBar">#6200EE</color> <color name="colorPrimaryActionBar">#e9c46a</color>
<color name="colorPrimaryDark">#3700B3</color> <color name="colorPrimaryDark">#264653</color>
<color name="colorAccent">#03DAC5</color> <color name="colorAccent">#e9c46a</color>
<color name="icActive">#FFFFFFFF</color> <color name="icActive">#FFFFFFFF</color>
<color name="icFocused">#DDFFFFFF</color> <color name="icFocused">#DDFFFFFF</color>
<color name="icPressed">#AAFFFFFF</color> <color name="icPressed">#AAFFFFFF</color>
<color name="colorButtonBg">#6200EE</color> <color name="colorButtonBg">#f4a261</color>
<color name="colorButtonText">#FFFFFF</color> <color name="colorButtonText">#FFFFFF</color>
<color name="filterLabelNormal">#8A8889</color> <color name="filterLabelNormal">#8A8889</color>
<color name="filterLabelSelected">#221F20</color> <color name="filterLabelSelected">#221F20</color>

View File

@ -212,9 +212,9 @@ For more info about Pixelfed, you can check here: https://pixelfed.org"</string>
<string name="hashtags">HASHTAGS</string> <string name="hashtags">HASHTAGS</string>
<!-- Sensitive media --> <!-- Sensitive media -->
<string name="cw_nsfw_hidden_media_n_click_to_show">CW / NSFW / Hidden Media\n (click to show)</string> <string name="cw_nsfw_hidden_media_n_click_to_show">CW / NSFW / Hidden Media\n (click to show)</string>
<!-- Shown when image has finished uploading. {gmd_cloud_done} is an icon, position it as is appropriate in target language --> <!-- Shown when image has finished uploading.-->
<string name="media_upload_completed">Media upload completed</string> <string name="media_upload_completed">Media upload completed</string>
<!-- Shown when image uploading has failed. {gmd_cloud_off} is an icon, position it as is appropriate in target language --> <!-- Shown when image uploading has failed.-->
<string name="media_upload_failed">Media upload failed, try again or check network conditions</string> <string name="media_upload_failed">Media upload failed, try again or check network conditions</string>
<string name="posting_image_accessibility_hint">Image that is being posted</string> <string name="posting_image_accessibility_hint">Image that is being posted</string>
<string name="retry">Retry</string> <string name="retry">Retry</string>
@ -234,8 +234,7 @@ For more info about Pixelfed, you can check here: https://pixelfed.org"</string>
<string name="share_link">Share Link</string> <string name="share_link">Share Link</string>
<string name="optional_report_comment">Optional message for mods/admins</string> <string name="optional_report_comment">Optional message for mods/admins</string>
<string name="report_target">Report @%1$s\'s post</string> <string name="report_target">Report @%1$s\'s post</string>
<!-- Text on button, shown when report was successful. {gmd_check_circle} is an icon, position it as is appropriate in target language --> <string name="reported">Post reported</string>
<string name="reported">Reported {gmd_check_circle}</string>
<string name="report_error">Could not send report</string> <string name="report_error">Could not send report</string>
<string name="toolbar_title_edit">Edit</string> <string name="toolbar_title_edit">Edit</string>
<string name="profile_picture">Profile picture</string> <string name="profile_picture">Profile picture</string>
@ -274,4 +273,9 @@ For more info about Pixelfed, you can check here: https://pixelfed.org"</string>
<string name="new_post_shortcut_short">New post</string> <string name="new_post_shortcut_short">New post</string>
<string name="follow_request">%1$s requests to follow you</string> <string name="follow_request">%1$s requests to follow you</string>
<string name="status_notification">%1$s created a post</string> <string name="status_notification">%1$s created a post</string>
<string name="home_feed">Home</string>
<string name="search_discover_feed">Search</string>
<string name="create_feed">Create</string>
<string name="notifications_feed">Updates</string>
<string name="public_feed">Public</string>
</resources> </resources>

View File

@ -1,25 +1,11 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>
<style name="AppTheme.Launcher"> <style name="AppTheme.Launcher">
<item name="android:windowBackground">@drawable/theme</item> <item name="android:windowBackground">@drawable/theme</item>
</style> </style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> <style name="AppTheme.PopupOverlay" parent="Theme.Material3.Light" />
<style name="posts_title">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_marginBottom">8dp</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:background">@android:color/holo_orange_light</item>
<item name="android:textAppearance">@android:style/TextAppearance.Large</item>
</style>
<style name="AppTheme.ActionBar.Transparent" parent="AppTheme"> <style name="AppTheme.ActionBar.Transparent" parent="AppTheme">
<item name="colorPrimary">@android:color/transparent</item> <item name="colorPrimary">@android:color/transparent</item>
@ -38,4 +24,67 @@
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="AppTheme" parent="Theme.Material3.Light">
<item name="materialDrawerStyle">@style/Widget.MaterialDrawerStyle</item>
<item name="materialDrawerHeaderStyle">@style/Widget.MaterialDrawerHeaderStyle</item>
<item name="colorPrimary">@color/md_theme_light_primary</item>
<item name="colorOnPrimary">@color/md_theme_light_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer</item>
<item name="colorOnPrimaryContainer">@color/md_theme_light_onPrimaryContainer</item>
<item name="colorSecondary">@color/md_theme_light_secondary</item>
<item name="colorOnSecondary">@color/md_theme_light_onSecondary</item>
<item name="colorSecondaryContainer">@color/md_theme_light_secondaryContainer</item>
<item name="colorOnSecondaryContainer">@color/md_theme_light_onSecondaryContainer</item>
<item name="colorTertiary">@color/md_theme_light_tertiary</item>
<item name="colorOnTertiary">@color/md_theme_light_onTertiary</item>
<item name="colorTertiaryContainer">@color/md_theme_light_tertiaryContainer</item>
<item name="colorOnTertiaryContainer">@color/md_theme_light_onTertiaryContainer</item>
<item name="colorError">@color/md_theme_light_error</item>
<item name="colorErrorContainer">@color/md_theme_light_errorContainer</item>
<item name="colorOnError">@color/md_theme_light_onError</item>
<item name="colorOnErrorContainer">@color/md_theme_light_onErrorContainer</item>
<item name="android:colorBackground">@color/md_theme_light_background</item>
<item name="colorOnBackground">@color/md_theme_light_onBackground</item>
<item name="colorSurface">@color/md_theme_light_surface</item>
<item name="colorOnSurface">@color/md_theme_light_onSurface</item>
<item name="colorSurfaceVariant">@color/md_theme_light_surfaceVariant</item>
<item name="colorOnSurfaceVariant">@color/md_theme_light_onSurfaceVariant</item>
<item name="colorOutline">@color/md_theme_light_outline</item>
<item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface</item>
<item name="colorSurfaceInverse">@color/md_theme_light_inverseSurface</item>
<item name="elevationOverlayColor">@color/md_theme_light_surfaceTint</item>
<item name="colorPrimaryInverse">@color/md_theme_light_inversePrimary</item>
</style>
<style name="AppTheme2" parent="Theme.Material3.Light.NoActionBar">
<item name="colorPrimary">@color/md_theme_light_primary2</item>
<item name="colorOnPrimary">@color/md_theme_light_onPrimary2</item>
<item name="colorPrimaryContainer">@color/md_theme_light_primaryContainer2</item>
<item name="colorOnPrimaryContainer">@color/md_theme_light_onPrimaryContainer2</item>
<item name="colorSecondary">@color/md_theme_light_secondary2</item>
<item name="colorOnSecondary">@color/md_theme_light_onSecondary2</item>
<item name="colorSecondaryContainer">@color/md_theme_light_secondaryContainer2</item>
<item name="colorOnSecondaryContainer">@color/md_theme_light_onSecondaryContainer2</item>
<item name="colorTertiary">@color/md_theme_light_tertiary2</item>
<item name="colorOnTertiary">@color/md_theme_light_onTertiary2</item>
<item name="colorTertiaryContainer">@color/md_theme_light_tertiaryContainer2</item>
<item name="colorOnTertiaryContainer">@color/md_theme_light_onTertiaryContainer2</item>
<item name="colorError">@color/md_theme_light_error2</item>
<item name="colorOnError">@color/md_theme_light_onError2</item>
<item name="colorErrorContainer">@color/md_theme_light_errorContainer2</item>
<item name="colorOnErrorContainer">@color/md_theme_light_onErrorContainer2</item>
<item name="android:colorBackground">@color/md_theme_light_background2</item>
<item name="colorOnBackground">@color/md_theme_light_onBackground2</item>
<item name="colorSurface">@color/md_theme_light_surface2</item>
<item name="colorOnSurface">@color/md_theme_light_onSurface2</item>
<item name="colorSurfaceVariant">@color/md_theme_light_surfaceVariant2</item>
<item name="colorOnSurfaceVariant">@color/md_theme_light_onSurfaceVariant2</item>
<item name="colorOutline">@color/md_theme_light_outline2</item>
<item name="colorSurfaceInverse">@color/md_theme_light_inverseSurface2</item>
<item name="colorOnSurfaceInverse">@color/md_theme_light_inverseOnSurface2</item>
<item name="elevationOverlayColor">@color/md_theme_light_surfaceTint2</item>
<item name="colorPrimaryInverse">@color/md_theme_light_inversePrimary2</item>
</style>
</resources> </resources>

View File

@ -10,6 +10,12 @@
app:title="@string/theme_title" app:title="@string/theme_title"
app:useSimpleSummaryProvider="true" app:useSimpleSummaryProvider="true"
app:icon="@drawable/palette_black_24dp"/> app:icon="@drawable/palette_black_24dp"/>
<org.pixeldroid.app.settings.ColorPreference
android:title="Color theme"
android:key="themeColor"
android:defaultValue="default"
android:summary="Choose a color theme" />
</PreferenceCategory> </PreferenceCategory>
<ListPreference <ListPreference

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.6.21' ext.kotlin_version = '1.7.0'
repositories { repositories {
google() google()
mavenCentral() mavenCentral()