From 326d7449250e1edcf313611c1f3c42c63bf9399d Mon Sep 17 00:00:00 2001 From: Matthieu <24-artectrex@users.noreply.shinice.net> Date: Fri, 8 Jul 2022 23:20:44 +0200 Subject: [PATCH] Start on theme choose --- app/build.gradle | 58 +++--- app/src/main/AndroidManifest.xml | 2 +- .../java/org/pixeldroid/app/MainActivity.kt | 84 +++++--- .../pixeldroid/app/posts/ReportActivity.kt | 6 +- .../app/settings/SettingsActivity.kt | 14 ++ .../app/settings/ThemeColorPreference.kt | 186 ++++++++++++++++++ .../app/utils/PixelDroidApplication.kt | 4 + app/src/main/res/drawable/notifications.xml | 5 + app/src/main/res/drawable/outline_home.xml | 5 + .../res/drawable/outline_notifications.xml | 5 + .../res/drawable/outline_photo_camera.xml | 5 + app/src/main/res/drawable/selector_camera.xml | 5 + .../main/res/drawable/selector_home_feed.xml | 5 + .../res/drawable/selector_notifications.xml | 5 + app/src/main/res/layout/activity_main.xml | 13 +- .../res/layout/activity_post_creation.xml | 14 +- app/src/main/res/layout/activity_report.xml | 37 +++- app/src/main/res/layout/color_dialog.xml | 68 +++++++ .../res/layout/color_preference_thumbnail.xml | 16 ++ .../main/res/menu/bottom_navigation_main.xml | 28 +++ app/src/main/res/values-night/colors.xml | 2 +- app/src/main/res/values-night/styles.xml | 62 ++++++ app/src/main/res/values/colors.xml | 136 ++++++++++++- app/src/main/res/values/strings.xml | 12 +- app/src/main/res/values/styles.xml | 79 ++++++-- app/src/main/res/xml/root_preferences.xml | 6 + build.gradle | 2 +- 27 files changed, 757 insertions(+), 107 deletions(-) create mode 100644 app/src/main/java/org/pixeldroid/app/settings/ThemeColorPreference.kt create mode 100644 app/src/main/res/drawable/notifications.xml create mode 100644 app/src/main/res/drawable/outline_home.xml create mode 100644 app/src/main/res/drawable/outline_notifications.xml create mode 100644 app/src/main/res/drawable/outline_photo_camera.xml create mode 100644 app/src/main/res/drawable/selector_camera.xml create mode 100644 app/src/main/res/drawable/selector_home_feed.xml create mode 100644 app/src/main/res/drawable/selector_notifications.xml create mode 100644 app/src/main/res/layout/color_dialog.xml create mode 100644 app/src/main/res/layout/color_preference_thumbnail.xml create mode 100644 app/src/main/res/menu/bottom_navigation_main.xml create mode 100644 app/src/main/res/values-night/styles.xml diff --git a/app/build.gradle b/app/build.gradle index f163d1e8..58ae7329 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -110,30 +110,30 @@ dependencies { implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.preference:preference-ktx:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2' - implementation 'androidx.navigation:navigation-ui-ktx:2.4.2' + implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0' + implementation 'androidx.navigation:navigation-ui-ktx:2.5.0' implementation "androidx.browser:browser:1.4.0" implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2' - implementation 'androidx.navigation:navigation-ui-ktx:2.4.2' + implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0' + implementation 'androidx.navigation:navigation-ui-ktx:2.5.0' implementation 'androidx.paging:paging-runtime-ktx:3.1.1' - implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.1' - implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.1" - implementation "androidx.lifecycle:lifecycle-common-java8:2.4.1" - implementation "androidx.annotation:annotation:1.3.0" + implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.0' + implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.0" + implementation "androidx.lifecycle:lifecycle-common-java8:2.5.0" + implementation "androidx.annotation:annotation:1.4.0" implementation 'androidx.gridlayout:gridlayout:1.0.0' - implementation "androidx.activity:activity-ktx:1.4.0" - implementation 'androidx.fragment:fragment-ktx:1.4.1' + implementation "androidx.activity:activity-ktx:1.5.0" + implementation 'androidx.fragment:fragment-ktx:1.5.0' implementation 'androidx.work:work-runtime-ktx:2.7.1' implementation 'androidx.media2:media2-widget:1.2.1' implementation 'androidx.media2:media2-player:1.2.1' // 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-camera2:$cameraX_version" // CameraX Lifecycle library @@ -159,17 +159,17 @@ dependencies { implementation 'com.google.android.material:material:1.6.1' //Dagger (dependency injection) - implementation 'com.google.dagger:dagger-android:2.40.5' - implementation 'com.google.dagger:dagger-android-support:2.40.5' + implementation 'com.google.dagger:dagger-android:2.42' + implementation 'com.google.dagger:dagger-android-support:2.42' // if you use the support libraries - kapt 'com.google.dagger:dagger-android-processor:2.40.5' - kapt 'com.google.dagger:dagger-compiler:2.40.5' + kapt 'com.google.dagger:dagger-android-processor:2.42' + 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:converter-gson: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 'com.github.connyduck:sparkbutton:4.1.0' @@ -177,27 +177,27 @@ dependencies { implementation 'info.androidhive:imagefilters:1.0.7' 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" } - implementation 'com.github.bumptech.glide:okhttp-integration:4.12.0' - implementation('com.github.bumptech.glide:recyclerview-integration:4.12.0') { + implementation 'com.github.bumptech.glide:okhttp-integration:4.13.2' + implementation('com.github.bumptech.glide:recyclerview-integration:4.13.2') { // Excludes the support library because it's already included by Glide. 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 'com.mikepenz:materialdrawer:8.4.4' + implementation 'com.mikepenz:materialdrawer:9.0.1' // Add for NavController support - implementation 'com.mikepenz:materialdrawer-nav:8.4.4' + implementation 'com.mikepenz:materialdrawer-nav:9.0.1' //iconics - implementation 'com.mikepenz:iconics-core:5.3.3' - implementation 'com.mikepenz:materialdrawer-iconics:8.4.2' - implementation 'com.mikepenz:iconics-views:5.3.3' + implementation 'com.mikepenz:iconics-core:5.3.4' + implementation 'com.mikepenz:materialdrawer-iconics:9.0.1' + implementation 'com.mikepenz:iconics-views:5.3.4' 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' 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 'junit:junit:4.13.2' testImplementation "androidx.room:room-testing:$room_version" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3ffc4f78..0fdbcf9d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -41,7 +41,7 @@ android:parentActivityName=".MainActivity"> + android:value=".MainActivity" /> diff --git a/app/src/main/java/org/pixeldroid/app/MainActivity.kt b/app/src/main/java/org/pixeldroid/app/MainActivity.kt index 23d9b3d6..71d36132 100644 --- a/app/src/main/java/org/pixeldroid/app/MainActivity.kt +++ b/app/src/main/java/org/pixeldroid/app/MainActivity.kt @@ -6,20 +6,23 @@ import android.graphics.drawable.Drawable import android.net.Uri import android.os.Bundle import android.util.Log +import android.view.MenuItem import android.view.View import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat import androidx.core.view.GravityCompat +import androidx.core.view.forEach +import androidx.core.view.forEachIndexed import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope import androidx.paging.ExperimentalPagingApi import androidx.recyclerview.widget.RecyclerView import androidx.viewpager2.adapter.FragmentStateAdapter import androidx.viewpager2.widget.ViewPager2 +import androidx.viewpager2.widget.ViewPager2.* import com.bumptech.glide.Glide -import com.google.android.material.tabs.TabLayout -import com.google.android.material.tabs.TabLayoutMediator +import com.google.android.material.bottomnavigation.BottomNavigationView import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.mikepenz.materialdrawer.iconics.iconicsIcon 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.utils.BaseActivity 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.PublicFeedStatusDatabaseEntity 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.SHOW_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 retrofit2.HttpException import java.io.IOException @@ -142,11 +145,12 @@ class MainActivity : BaseActivity() { } private fun setupDrawer() { - binding.mainDrawerButton.setOnClickListener{ - binding.drawerLayout.open() + binding.mainDrawerButton.setOnClickListener{ + binding.drawerLayout.openDrawer(binding.drawer) } header = AccountHeaderView(this).apply { + attachToSliderView(binding.drawer) headerBackgroundScaleType = ImageView.ScaleType.CENTER_CROP currentHiddenInList = true onAccountHeaderListener = { _: View?, profile: IProfile, current: Boolean -> @@ -158,7 +162,6 @@ class MainActivity : BaseActivity() { descriptionRes = R.string.add_account_description iconicsIcon = GoogleMaterial.Icon.gmd_add }, 0) - attachToSliderView(binding.drawer) dividerBelowHeader = false closeDrawerOnProfileListClick = true } @@ -294,7 +297,7 @@ class MainActivity : BaseActivity() { isIconTinted = true } .apply(block) -} + } private fun fillDrawerAccountInfo(account: String) { val users = db.userDao().getAll().toMutableList() @@ -353,32 +356,57 @@ class MainActivity : BaseActivity() { return tab_array.size } } - binding.tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { - override fun onTabSelected(tab: TabLayout.Tab?){} - override fun onTabUnselected(tab: TabLayout.Tab?) {} - - override fun onTabReselected(tab: TabLayout.Tab?) { - tab?.position?.let { position -> - val page = - //No clue why this works but it does. F to pay respects - supportFragmentManager.findFragmentByTag("f$position") - (page as? CachedFeedFragment<*>)?.onTabReClicked() + binding.viewPager.registerOnPageChangeCallback(object : OnPageChangeCallback() { + override fun onPageSelected(position: Int) { + val selected = when(position){ + 0 -> R.id.page_1 + 1 -> R.id.page_2 + 2 -> R.id.page_3 + 3 -> R.id.page_4 + 4 -> R.id.page_5 + else -> null } + if (selected != null) { + binding.tabs.selectedItemId = selected + } + super.onPageSelected(position) } }) - TabLayoutMediator(binding.tabs, binding.viewPager) { tab, position -> - tab.icon = ContextCompat.getDrawable(applicationContext, - when(position){ - 0 -> R.drawable.ic_home_white_24dp - 1 -> R.drawable.ic_search_white_24dp - 2 -> R.drawable.photo_camera - 3 -> R.drawable.ic_heart - 4 -> R.drawable.ic_filter_black_24dp - else -> throw IllegalArgumentException() - }) - }.attach() + fun MenuItem.itemPos(): Int? { + return when(itemId){ + R.id.page_1 -> 0 + R.id.page_2 -> 1 + R.id.page_3 -> 2 + R.id.page_4 -> 3 + R.id.page_5 -> 4 + else -> null + } + } + + 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) } /** diff --git a/app/src/main/java/org/pixeldroid/app/posts/ReportActivity.kt b/app/src/main/java/org/pixeldroid/app/posts/ReportActivity.kt index e9ab3aae..428f0c24 100644 --- a/app/src/main/java/org/pixeldroid/app/posts/ReportActivity.kt +++ b/app/src/main/java/org/pixeldroid/app/posts/ReportActivity.kt @@ -56,14 +56,14 @@ class ReportActivity : BaseActivity() { private fun reportStatus(success: Boolean){ if(success){ binding.reportProgressBar.visibility = View.GONE - binding.reportButton.isEnabled = false - binding.reportButton.text = getString(R.string.reported) - binding.reportButton.visibility = View.VISIBLE + binding.reportButton.visibility = View.INVISIBLE + binding.reportSuccess.visibility = View.VISIBLE } else { binding.textInputLayout.error = getString(R.string.report_error) binding.reportButton.visibility = View.VISIBLE binding.textInputLayout.editText?.isEnabled = true binding.reportProgressBar.visibility = View.GONE + binding.reportSuccess.visibility = View.GONE } } } \ No newline at end of file diff --git a/app/src/main/java/org/pixeldroid/app/settings/SettingsActivity.kt b/app/src/main/java/org/pixeldroid/app/settings/SettingsActivity.kt index 3ad822a1..2b64c34c 100644 --- a/app/src/main/java/org/pixeldroid/app/settings/SettingsActivity.kt +++ b/app/src/main/java/org/pixeldroid/app/settings/SettingsActivity.kt @@ -4,6 +4,7 @@ import android.content.Intent import android.content.SharedPreferences import android.os.Build import android.os.Bundle +import androidx.fragment.app.DialogFragment import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceManager @@ -79,6 +80,19 @@ class SettingsActivity : BaseActivity(), SharedPreferences.OnSharedPreferenceCha } 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?) { setPreferencesFromResource(R.xml.root_preferences, rootKey) diff --git a/app/src/main/java/org/pixeldroid/app/settings/ThemeColorPreference.kt b/app/src/main/java/org/pixeldroid/app/settings/ThemeColorPreference.kt new file mode 100644 index 00000000..25ca310b --- /dev/null +++ b/app/src/main/java/org/pixeldroid/app/settings/ThemeColorPreference.kt @@ -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(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 +} diff --git a/app/src/main/java/org/pixeldroid/app/utils/PixelDroidApplication.kt b/app/src/main/java/org/pixeldroid/app/utils/PixelDroidApplication.kt index 0bc5c4cc..8e79beb9 100644 --- a/app/src/main/java/org/pixeldroid/app/utils/PixelDroidApplication.kt +++ b/app/src/main/java/org/pixeldroid/app/utils/PixelDroidApplication.kt @@ -2,6 +2,7 @@ package org.pixeldroid.app.utils import android.app.Application import androidx.preference.PreferenceManager +import com.google.android.material.color.DynamicColors import org.pixeldroid.app.utils.di.* import com.mikepenz.iconics.Iconics import org.ligi.tracedroid.TraceDroid @@ -26,6 +27,9 @@ class PixelDroidApplication: Application() { .aPIModule(APIModule()) .build() mApplicationComponent.inject(this) + + //TODO put condition depending on setting + if(false) DynamicColors.applyToActivitiesIfAvailable(this) } fun getAppComponent(): ApplicationComponent { diff --git a/app/src/main/res/drawable/notifications.xml b/app/src/main/res/drawable/notifications.xml new file mode 100644 index 00000000..538f5818 --- /dev/null +++ b/app/src/main/res/drawable/notifications.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/outline_home.xml b/app/src/main/res/drawable/outline_home.xml new file mode 100644 index 00000000..b6db651d --- /dev/null +++ b/app/src/main/res/drawable/outline_home.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/outline_notifications.xml b/app/src/main/res/drawable/outline_notifications.xml new file mode 100644 index 00000000..45b906f6 --- /dev/null +++ b/app/src/main/res/drawable/outline_notifications.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/outline_photo_camera.xml b/app/src/main/res/drawable/outline_photo_camera.xml new file mode 100644 index 00000000..b4e07a6d --- /dev/null +++ b/app/src/main/res/drawable/outline_photo_camera.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/selector_camera.xml b/app/src/main/res/drawable/selector_camera.xml new file mode 100644 index 00000000..fcb60d0d --- /dev/null +++ b/app/src/main/res/drawable/selector_camera.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_home_feed.xml b/app/src/main/res/drawable/selector_home_feed.xml new file mode 100644 index 00000000..ef4efd33 --- /dev/null +++ b/app/src/main/res/drawable/selector_home_feed.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/selector_notifications.xml b/app/src/main/res/drawable/selector_notifications.xml new file mode 100644 index 00000000..100101fa --- /dev/null +++ b/app/src/main/res/drawable/selector_notifications.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 082aad05..b79c425f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -17,6 +17,7 @@ android:id="@+id/main_activity_main_linear_layout" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?android:attr/selectableItemBackground" android:orientation="horizontal" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -27,27 +28,23 @@ android:id="@+id/main_drawer_button" android:layout_width="wrap_content" android:layout_height="match_parent" - android:background="@color/colorPrimaryTab" + android:background="?attr/colorSurface" android:contentDescription="@string/open_drawer_menu" android:padding="12dp" android:src="@drawable/ic_baseline_menu_24" /> - + app:menu="@menu/bottom_navigation_main" /> + app:drawableTint="?attr/colorOnError" /> diff --git a/app/src/main/res/layout/activity_report.xml b/app/src/main/res/layout/activity_report.xml index e0b029dc..f0deeac4 100644 --- a/app/src/main/res/layout/activity_report.xml +++ b/app/src/main/res/layout/activity_report.xml @@ -40,20 +40,49 @@ - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/color_preference_thumbnail.xml b/app/src/main/res/layout/color_preference_thumbnail.xml new file mode 100644 index 00000000..fff24e97 --- /dev/null +++ b/app/src/main/res/layout/color_preference_thumbnail.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/bottom_navigation_main.xml b/app/src/main/res/menu/bottom_navigation_main.xml new file mode 100644 index 00000000..42822d13 --- /dev/null +++ b/app/src/main/res/menu/bottom_navigation_main.xml @@ -0,0 +1,28 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 712d0ecb..ed91fa9a 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -1,7 +1,7 @@ #FFFFFF - #6200EE + #f4a261 #000000 #FFFFFF diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..abcb6074 --- /dev/null +++ b/app/src/main/res/values-night/styles.xml @@ -0,0 +1,62 @@ + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index cde9c34d..226efc99 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,14 +1,140 @@ - #6200EE + #f4a261 + #924C00 + #FFFFFF + #FFDCC4 + #2F1400 + #745945 + #FFFFFF + #FFDCC4 + #2A1707 + #5D6136 + #FFFFFF + #E3E7AF + #1A1D00 + #BA1A1A + #FFDAD6 + #FFFFFF + #410002 + #FFFBFF + #201A17 + #FFFBFF + #201A17 + #F3DFD2 + #52443B + #84746A + #FBEEE8 + #362F2B + #FFB780 + #000000 + #924C00 + #924C00 + + #FFB780 + #4E2600 + #6F3800 + #FFDCC4 + #E4BFA7 + #422B1A + #5B412F + #FFDCC4 + #C6CA95 + #2F330C + #464A20 + #E3E7AF + #FFB4AB + #93000A + #690005 + #FFDAD6 + #201A17 + #ECE0DA + #201A17 + #ECE0DA + #52443B + #D6C3B7 + #9F8D82 + #201A17 + #ECE0DA + #924C00 + #000000 + #FFB780 + #FFB780 + + + #4285F4 + #005AC1 + #FFFFFF + #D8E2FF + #001A41 + #535E78 + #FFFFFF + #D8E2FF + #0F1B32 + #76517B + #FFFFFF + #FED6FF + #2D0E34 + #BA1A1A + #FFFFFF + #FFDAD6 + #410002 + #FEFBFF + #1B1B1F + #FEFBFF + #1B1B1F + #E1E2EC + #44474F + #74777F + #000000 + #303033 + #F2F0F4 + #ADC6FF + #005AC1 + #005AC1 + #ADC6FF + #002E69 + #004494 + #D8E2FF + #BBC6E4 + #253048 + #3B475F + #D8E2FF + #E5B8E8 + #44244A + #5D3A62 + #FED6FF + #FFB4AB + #690005 + #93000A + #FFB4AB + #1B1B1F + #E3E2E6 + #1B1B1F + #E3E2E6 + #44474F + #C4C6D0 + #8E9099 + #000000 + #E3E2E6 + #303033 + #005AC1 + #ADC6FF + #ADC6FF + + + + + + #2a9d8f #FFFFFF - #6200EE - #3700B3 - #03DAC5 + #e9c46a + #264653 + #e9c46a #FFFFFFFF #DDFFFFFF #AAFFFFFF - #6200EE + #f4a261 #FFFFFF #8A8889 #221F20 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9d838b7e..5f6da297 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -212,9 +212,9 @@ For more info about Pixelfed, you can check here: https://pixelfed.org" HASHTAGS CW / NSFW / Hidden Media\n (click to show) - + Media upload completed - + Media upload failed, try again or check network conditions Image that is being posted Retry @@ -234,8 +234,7 @@ For more info about Pixelfed, you can check here: https://pixelfed.org" Share Link Optional message for mods/admins Report @%1$s\'s post - - Reported {gmd_check_circle} + Post reported Could not send report Edit Profile picture @@ -274,4 +273,9 @@ For more info about Pixelfed, you can check here: https://pixelfed.org" New post %1$s requests to follow you %1$s created a post + Home + Search + Create + Updates + Public \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 20fc5dc0..4028dcff 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,25 +1,11 @@ - - + + + + + + diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml index fe53aa91..5061395e 100644 --- a/app/src/main/res/xml/root_preferences.xml +++ b/app/src/main/res/xml/root_preferences.xml @@ -10,6 +10,12 @@ app:title="@string/theme_title" app:useSimpleSummaryProvider="true" app:icon="@drawable/palette_black_24dp"/> + +