2021-07-09 03:14:21 +02:00
package org.thoughtcrime.securesms.preferences
2020-01-06 04:26:52 +01:00
2020-09-07 13:03:15 +02:00
import android.Manifest
2020-01-07 04:51:11 +01:00
import android.app.Activity
2023-05-22 07:23:58 +02:00
import android.content.*
2020-01-07 04:51:11 +01:00
import android.net.Uri
2022-01-14 06:56:15 +01:00
import android.os.AsyncTask
import android.os.Bundle
import android.os.Handler
import android.os.Looper
New app theming (#913)
* feat: start new app theming feature
* feat: add some theming colours
* refactor: start refactoring themes and colours to use dynamic attributes
* feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific
* refactor: take a look at ocean light and logo colour
* feat: global search colours for light and dark ocean
* feat: more styling
* feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc
* feat: add dynamic accent color
* docs: add todo for changing how accent colour is applied
* feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts
* feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items
* refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button
* refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes
* refactor: add context theme wrapper to bottom sheet dialog that references accent color
* fix: input bar bug fix and preference activity themes
* refactor: new settings menu options
* fix: crash for PNModeActivity.kt
refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu
* feat: add new appearance settings activity
* refactor: title and VM changes
* fix: correct override
* feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration
* fix: compile errors and missing themes from emoji features
* refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr
* feat: appearance screen wired up, just need to refresh theme
* feat: add theme state recreation and fix match system settings option
* refactor: add bottom margin
* feat: explore custom preference category
* feat: add the customized session theme for CorrectedPreferenceFragment
* feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment
* refactor: change drawable style and remove explicit dividers
* refactor: remove divider in CorrectedPreferenceFragment
* feat: add theme state check on resume, might be jarring currently
* feat: add preference divider elements for settings menu
* refactor: settings menu redesigns
* refactor: change led preference to integer and refactor TextSecurePreferences.kt
* feat: add scroll parcel to save/restore hierarchy on restart with appearance changes
* feat: add the conversations blocked contacts and refactor preference order and copy
* feat: add blocked contacts activity, basic layout and vm
* feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener
* feat: add blocked contacts and notif recipient listeners
* feat: add recipient db reader
* feat: add blocked contact interactions and fix a theming crash for notifications
* feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison
* feat: add settings menu vectors
* fix: preview compile error
* refactor: migrating settings menu to new designs
* feat: help menu
* refactor: simplify link opening
* refactor: remove space
* feat: refactor preferences and start theming for light mode options
* refactor: fixing dark and light modes with dialogs
* refactor: popup dialogs use proper themes now
* refactor: alert dialogs and media edit fragments use attribute references
* refactor: use input bar button attribute instead color control normal in vector tint
* refactor: transparency, dialog fixes, notification fix
* refactor: attrs and styles for buttons
* fix: use prominent button color on the outline button's border
* fix: fix the trash
* refactor: remove the appearance
* refactor: avatar placeholder generation, chips and element border styles
* refactor: use colors instead of style references
* refactor: theming changes to match designs and feedback
* refactor: the titles are bold and the categories are tertiary coloured now
* fix: appearance settings match preferences, search bottom bar uses themed attributes
* refactor: increase setting button height
* Update clear all data dialog
* Update seed dialog
* refactor: more qa feedback changes
* feat: add new TLs and fa-rIR TLs
* Update notification content dialog
* Fix message requests clear all button text color
* feat: re-add screenshot observer
* refactor: make send tint accent color
* feat: add unread background differences
* fix: change unread count indicator
* build: upgrade build numbers
* Fix message requests popupmenu background color
* fix: crash from attr reference in color attribute
* build: upgrade build number
* fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons
* fix: tertiary text for keyboard page search view
* fix: emoji overflow colour differences
* fix: reaction pill dialog background is now correct colour
* Add style to reactions tab layout
* fix: appearance activity reverting primary color at correct time
* fix: show call privacy warning every time instead of just once
* fix: gradient background(?) and audio autoplay disable
* fix: crash in all media containing documents
* fix: reaction dialog heading fixes
* Add style to reactions tab layout
* fix: remove gradient backgrounds
* fix: adding new reaction normal text attribute to try correct the tab layout
* fix: ocean dark unread/read colours
* build; update build number
* build: update build number
Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
import android.os.Parcelable
import android.util.SparseArray
2020-08-20 09:48:41 +02:00
import android.view.ActionMode
import android.view.Menu
import android.view.MenuItem
2020-01-07 02:00:30 +01:00
import android.view.View
import android.view.inputmethod.InputMethodManager
2020-01-06 04:26:52 +01:00
import android.widget.Toast
2023-05-22 07:23:58 +02:00
import androidx.appcompat.app.AlertDialog
2021-02-24 05:28:48 +01:00
import androidx.core.view.isVisible
2020-02-25 04:04:15 +01:00
import network.loki.messenger.BuildConfig
2020-01-06 04:26:52 +01:00
import network.loki.messenger.R
2022-01-14 06:56:15 +01:00
import network.loki.messenger.databinding.ActivitySettingsBinding
2020-01-07 04:51:11 +01:00
import nl.komponents.kovenant.Promise
import nl.komponents.kovenant.all
import nl.komponents.kovenant.ui.alwaysUi
2021-05-13 07:27:08 +02:00
import nl.komponents.kovenant.ui.successUi
2021-05-18 08:03:47 +02:00
import org.session.libsession.avatars.AvatarHelper
2023-05-25 03:28:52 +02:00
import org.session.libsession.utilities.*
2021-03-03 01:33:35 +01:00
import org.session.libsession.utilities.SSKEnvironment.ProfileManagerProtocol
2020-01-06 04:26:52 +01:00
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
2020-01-07 04:51:11 +01:00
import org.thoughtcrime.securesms.avatar.AvatarSelection
2023-05-22 07:23:58 +02:00
import org.thoughtcrime.securesms.components.ProfilePictureView
2022-02-07 07:06:27 +01:00
import org.thoughtcrime.securesms.home.PathActivity
2022-03-04 07:46:39 +01:00
import org.thoughtcrime.securesms.messagerequests.MessageRequestsActivity
2020-01-06 04:26:52 +01:00
import org.thoughtcrime.securesms.mms.GlideApp
import org.thoughtcrime.securesms.mms.GlideRequests
2020-09-07 13:03:15 +02:00
import org.thoughtcrime.securesms.permissions.Permissions
New app theming (#913)
* feat: start new app theming feature
* feat: add some theming colours
* refactor: start refactoring themes and colours to use dynamic attributes
* feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific
* refactor: take a look at ocean light and logo colour
* feat: global search colours for light and dark ocean
* feat: more styling
* feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc
* feat: add dynamic accent color
* docs: add todo for changing how accent colour is applied
* feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts
* feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items
* refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button
* refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes
* refactor: add context theme wrapper to bottom sheet dialog that references accent color
* fix: input bar bug fix and preference activity themes
* refactor: new settings menu options
* fix: crash for PNModeActivity.kt
refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu
* feat: add new appearance settings activity
* refactor: title and VM changes
* fix: correct override
* feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration
* fix: compile errors and missing themes from emoji features
* refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr
* feat: appearance screen wired up, just need to refresh theme
* feat: add theme state recreation and fix match system settings option
* refactor: add bottom margin
* feat: explore custom preference category
* feat: add the customized session theme for CorrectedPreferenceFragment
* feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment
* refactor: change drawable style and remove explicit dividers
* refactor: remove divider in CorrectedPreferenceFragment
* feat: add theme state check on resume, might be jarring currently
* feat: add preference divider elements for settings menu
* refactor: settings menu redesigns
* refactor: change led preference to integer and refactor TextSecurePreferences.kt
* feat: add scroll parcel to save/restore hierarchy on restart with appearance changes
* feat: add the conversations blocked contacts and refactor preference order and copy
* feat: add blocked contacts activity, basic layout and vm
* feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener
* feat: add blocked contacts and notif recipient listeners
* feat: add recipient db reader
* feat: add blocked contact interactions and fix a theming crash for notifications
* feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison
* feat: add settings menu vectors
* fix: preview compile error
* refactor: migrating settings menu to new designs
* feat: help menu
* refactor: simplify link opening
* refactor: remove space
* feat: refactor preferences and start theming for light mode options
* refactor: fixing dark and light modes with dialogs
* refactor: popup dialogs use proper themes now
* refactor: alert dialogs and media edit fragments use attribute references
* refactor: use input bar button attribute instead color control normal in vector tint
* refactor: transparency, dialog fixes, notification fix
* refactor: attrs and styles for buttons
* fix: use prominent button color on the outline button's border
* fix: fix the trash
* refactor: remove the appearance
* refactor: avatar placeholder generation, chips and element border styles
* refactor: use colors instead of style references
* refactor: theming changes to match designs and feedback
* refactor: the titles are bold and the categories are tertiary coloured now
* fix: appearance settings match preferences, search bottom bar uses themed attributes
* refactor: increase setting button height
* Update clear all data dialog
* Update seed dialog
* refactor: more qa feedback changes
* feat: add new TLs and fa-rIR TLs
* Update notification content dialog
* Fix message requests clear all button text color
* feat: re-add screenshot observer
* refactor: make send tint accent color
* feat: add unread background differences
* fix: change unread count indicator
* build: upgrade build numbers
* Fix message requests popupmenu background color
* fix: crash from attr reference in color attribute
* build: upgrade build number
* fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons
* fix: tertiary text for keyboard page search view
* fix: emoji overflow colour differences
* fix: reaction pill dialog background is now correct colour
* Add style to reactions tab layout
* fix: appearance activity reverting primary color at correct time
* fix: show call privacy warning every time instead of just once
* fix: gradient background(?) and audio autoplay disable
* fix: crash in all media containing documents
* fix: reaction dialog heading fixes
* Add style to reactions tab layout
* fix: remove gradient backgrounds
* fix: adding new reaction normal text attribute to try correct the tab layout
* fix: ocean dark unread/read colours
* build; update build number
* build: update build number
Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
import org.thoughtcrime.securesms.preferences.appearance.AppearanceSettingsActivity
2020-01-07 04:51:11 +01:00
import org.thoughtcrime.securesms.profiles.ProfileMediaConstraints
2022-01-14 06:56:15 +01:00
import org.thoughtcrime.securesms.util.BitmapDecodingException
import org.thoughtcrime.securesms.util.BitmapUtil
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
2022-02-07 07:06:27 +01:00
import org.thoughtcrime.securesms.util.disableClipping
2022-01-14 06:56:15 +01:00
import org.thoughtcrime.securesms.util.push
2022-02-07 07:06:27 +01:00
import org.thoughtcrime.securesms.util.show
2020-01-07 04:51:11 +01:00
import java.io.File
import java.security.SecureRandom
2022-01-14 06:56:15 +01:00
import java.util.Date
2020-01-06 04:26:52 +01:00
class SettingsActivity : PassphraseRequiredActionBarActivity ( ) {
2022-01-14 06:56:15 +01:00
private lateinit var binding : ActivitySettingsBinding
2020-08-20 09:48:41 +02:00
private var displayNameEditActionMode : ActionMode ? = null
set ( value ) { field = value ; handleDisplayNameEditActionModeChanged ( ) }
2020-01-06 04:26:52 +01:00
private lateinit var glide : GlideRequests
2020-01-07 04:51:11 +01:00
private var tempFile : File ? = null
2020-01-06 04:26:52 +01:00
private val hexEncodedPublicKey : String
get ( ) {
2021-02-18 05:12:30 +01:00
return TextSecurePreferences . getLocalNumber ( this ) !!
2020-01-06 04:26:52 +01:00
}
2021-03-01 07:16:15 +01:00
companion object {
const val updatedProfileResultCode = 1234
New app theming (#913)
* feat: start new app theming feature
* feat: add some theming colours
* refactor: start refactoring themes and colours to use dynamic attributes
* feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific
* refactor: take a look at ocean light and logo colour
* feat: global search colours for light and dark ocean
* feat: more styling
* feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc
* feat: add dynamic accent color
* docs: add todo for changing how accent colour is applied
* feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts
* feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items
* refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button
* refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes
* refactor: add context theme wrapper to bottom sheet dialog that references accent color
* fix: input bar bug fix and preference activity themes
* refactor: new settings menu options
* fix: crash for PNModeActivity.kt
refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu
* feat: add new appearance settings activity
* refactor: title and VM changes
* fix: correct override
* feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration
* fix: compile errors and missing themes from emoji features
* refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr
* feat: appearance screen wired up, just need to refresh theme
* feat: add theme state recreation and fix match system settings option
* refactor: add bottom margin
* feat: explore custom preference category
* feat: add the customized session theme for CorrectedPreferenceFragment
* feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment
* refactor: change drawable style and remove explicit dividers
* refactor: remove divider in CorrectedPreferenceFragment
* feat: add theme state check on resume, might be jarring currently
* feat: add preference divider elements for settings menu
* refactor: settings menu redesigns
* refactor: change led preference to integer and refactor TextSecurePreferences.kt
* feat: add scroll parcel to save/restore hierarchy on restart with appearance changes
* feat: add the conversations blocked contacts and refactor preference order and copy
* feat: add blocked contacts activity, basic layout and vm
* feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener
* feat: add blocked contacts and notif recipient listeners
* feat: add recipient db reader
* feat: add blocked contact interactions and fix a theming crash for notifications
* feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison
* feat: add settings menu vectors
* fix: preview compile error
* refactor: migrating settings menu to new designs
* feat: help menu
* refactor: simplify link opening
* refactor: remove space
* feat: refactor preferences and start theming for light mode options
* refactor: fixing dark and light modes with dialogs
* refactor: popup dialogs use proper themes now
* refactor: alert dialogs and media edit fragments use attribute references
* refactor: use input bar button attribute instead color control normal in vector tint
* refactor: transparency, dialog fixes, notification fix
* refactor: attrs and styles for buttons
* fix: use prominent button color on the outline button's border
* fix: fix the trash
* refactor: remove the appearance
* refactor: avatar placeholder generation, chips and element border styles
* refactor: use colors instead of style references
* refactor: theming changes to match designs and feedback
* refactor: the titles are bold and the categories are tertiary coloured now
* fix: appearance settings match preferences, search bottom bar uses themed attributes
* refactor: increase setting button height
* Update clear all data dialog
* Update seed dialog
* refactor: more qa feedback changes
* feat: add new TLs and fa-rIR TLs
* Update notification content dialog
* Fix message requests clear all button text color
* feat: re-add screenshot observer
* refactor: make send tint accent color
* feat: add unread background differences
* fix: change unread count indicator
* build: upgrade build numbers
* Fix message requests popupmenu background color
* fix: crash from attr reference in color attribute
* build: upgrade build number
* fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons
* fix: tertiary text for keyboard page search view
* fix: emoji overflow colour differences
* fix: reaction pill dialog background is now correct colour
* Add style to reactions tab layout
* fix: appearance activity reverting primary color at correct time
* fix: show call privacy warning every time instead of just once
* fix: gradient background(?) and audio autoplay disable
* fix: crash in all media containing documents
* fix: reaction dialog heading fixes
* Add style to reactions tab layout
* fix: remove gradient backgrounds
* fix: adding new reaction normal text attribute to try correct the tab layout
* fix: ocean dark unread/read colours
* build; update build number
* build: update build number
Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
private const val SCROLL _STATE = " SCROLL_STATE "
2021-03-01 07:16:15 +01:00
}
2020-01-06 04:26:52 +01:00
// region Lifecycle
override fun onCreate ( savedInstanceState : Bundle ? , isReady : Boolean ) {
super . onCreate ( savedInstanceState , isReady )
2022-01-14 06:56:15 +01:00
binding = ActivitySettingsBinding . inflate ( layoutInflater )
setContentView ( binding . root )
2023-05-25 03:28:52 +02:00
val displayName = getDisplayName ( )
2020-01-06 04:26:52 +01:00
glide = GlideApp . with ( this )
2022-01-14 06:56:15 +01:00
with ( binding ) {
2023-05-22 07:23:58 +02:00
setupProfilePictureView ( profilePictureView . root )
Performance improvements and bug fixes (#869)
* refactor: fail on testSnode instead of recursively using up snode list. add call timeout on http client
* refactor: refactoring batch message receives and pollers
* refactor: reduce thread utils pool count to a 2 thread fixed pool. Do a check against pubkey instead of room names for oxenHostedOpenGroup
* refactor: caching lib with potential loader fixes and no-cache for giphy
* refactor: remove store and instead use ConcurrentHashMap with a backing update coroutine
* refactor: queue trim thread jobs instead of add every message processed
* fix: wrapping auth token and initial sync for open groups in a threadutils queued runnable, getting initial sync times down
* fix: fixing the user contacts cache in ConversationAdapter.kt
* refactor: improve polling and initial sync, move group joins from config messages into a background job fetching image.
* refactor: improving the job queuing for open groups, replacing placeholder avatar generation with a custom glide loader and archiving initial sync of open groups
* feat: add OpenGroupDeleteJob.kt
* feat: add open group delete job to process deletions after batch adding
* feat: add vacuum and fix job queue re-adding jobs forever, only try to set message hash values in DB if they have changed
* refactor: remove redundant inflation for profile image views throughout app
* refactor(wip): reducing layout inflation and starting to refactor the open group deletion issues taking a long time
* refactor(wip): refactoring group deletion to not iterate through and delete messages individually
* refactor(wip): refactoring group deletion to not iterate through and delete messages individually
* fix: group deletion optimisation
* build: bump build number
* build: bump build number and fix batch message receive retry logic
* fix: clear out open group deletes
* fix: update visible ConversationAdapter.kt binding for initial contact fetching and better traces for debugging background jobs
* fix: add in check for / force sync latest encryption key pair from linked devices if we already have that closed group
* Rename .java to .kt
* refactor: change MmsDatabase to kotlin to make list operations easier
* fix: nullable type
* fix: compilation issues and constants in .kt instead of .java
* fix: bug fix expiration timer on closed group recipient
* feat: use the job queue properly across executors
* feat: start on open group dispatcher-specific logic, probably a queue factory based on openGroupId if that is the same across new message and deletion jobs to ensure consistent entry and removal
* refactor: removing redundant code and fixing jobqueue per opengroup
* fix: allow attachments in note to self
* fix: make the minWidth in quote view bind max of text / title and body, wrapped ?
* fix: fixing up layouts and code view layouts
* fix: remove TODO, remove timestamp binding
* feat: fix view logic, avatars and padding, downloading attachments lazily (on bind), fixing potential crash, add WindowDebouncer.kt
* fix: NPE on viewModel recipient from removed thread while tearing down the Recipient observer in ConversationActivityV2.kt
* refactor: replace conversation notification debouncer handler with handlerthread, same as conversation list debouncer
* refactor: UI for groups and poller improvements
* fix: revert some changes in poller
* feat: add header back in for message requests
* refactor: remove Trace calls, add more conditions to the HomeDiffUtil for updating more efficiently
* feat: try update the home adapter if we get a profile picture modified event
* feat: bump build numbers
* fix: try to start with list in homeViewModel if we don't have already, render quotes to be width of attachment slide view instead of fixed
* fix: set channel to be conflated instead of no buffer
* fix: set unreads based off last local user message vs incrementing unreads to be all amount
* feat: add profile update flag, update build number
* fix: link preview thumbnails download on bind
* fix: centercrop placeholder in glide request
* feat: recycle the contact selection list and profile image in unbind
* fix: try to prevent user KP crash at weird times
* fix: remove additional log, improve attachment download success rate, fix share logs dialog issue
2022-06-08 09:12:34 +02:00
profilePictureView . root . setOnClickListener { showEditProfilePictureUI ( ) }
2022-01-14 06:56:15 +01:00
ctnGroupNameSection . setOnClickListener { startActionMode ( DisplayNameEditActionModeCallback ( ) ) }
btnGroupNameDisplay . text = displayName
publicKeyTextView . text = hexEncodedPublicKey
copyButton . setOnClickListener { copyPublicKey ( ) }
shareButton . setOnClickListener { sharePublicKey ( ) }
2022-02-07 07:06:27 +01:00
pathButton . setOnClickListener { showPath ( ) }
pathContainer . disableClipping ( )
2022-01-14 06:56:15 +01:00
privacyButton . setOnClickListener { showPrivacySettings ( ) }
notificationsButton . setOnClickListener { showNotificationSettings ( ) }
2022-03-04 07:46:39 +01:00
messageRequestsButton . setOnClickListener { showMessageRequests ( ) }
2022-01-14 06:56:15 +01:00
chatsButton . setOnClickListener { showChatSettings ( ) }
New app theming (#913)
* feat: start new app theming feature
* feat: add some theming colours
* refactor: start refactoring themes and colours to use dynamic attributes
* feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific
* refactor: take a look at ocean light and logo colour
* feat: global search colours for light and dark ocean
* feat: more styling
* feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc
* feat: add dynamic accent color
* docs: add todo for changing how accent colour is applied
* feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts
* feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items
* refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button
* refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes
* refactor: add context theme wrapper to bottom sheet dialog that references accent color
* fix: input bar bug fix and preference activity themes
* refactor: new settings menu options
* fix: crash for PNModeActivity.kt
refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu
* feat: add new appearance settings activity
* refactor: title and VM changes
* fix: correct override
* feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration
* fix: compile errors and missing themes from emoji features
* refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr
* feat: appearance screen wired up, just need to refresh theme
* feat: add theme state recreation and fix match system settings option
* refactor: add bottom margin
* feat: explore custom preference category
* feat: add the customized session theme for CorrectedPreferenceFragment
* feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment
* refactor: change drawable style and remove explicit dividers
* refactor: remove divider in CorrectedPreferenceFragment
* feat: add theme state check on resume, might be jarring currently
* feat: add preference divider elements for settings menu
* refactor: settings menu redesigns
* refactor: change led preference to integer and refactor TextSecurePreferences.kt
* feat: add scroll parcel to save/restore hierarchy on restart with appearance changes
* feat: add the conversations blocked contacts and refactor preference order and copy
* feat: add blocked contacts activity, basic layout and vm
* feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener
* feat: add blocked contacts and notif recipient listeners
* feat: add recipient db reader
* feat: add blocked contact interactions and fix a theming crash for notifications
* feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison
* feat: add settings menu vectors
* fix: preview compile error
* refactor: migrating settings menu to new designs
* feat: help menu
* refactor: simplify link opening
* refactor: remove space
* feat: refactor preferences and start theming for light mode options
* refactor: fixing dark and light modes with dialogs
* refactor: popup dialogs use proper themes now
* refactor: alert dialogs and media edit fragments use attribute references
* refactor: use input bar button attribute instead color control normal in vector tint
* refactor: transparency, dialog fixes, notification fix
* refactor: attrs and styles for buttons
* fix: use prominent button color on the outline button's border
* fix: fix the trash
* refactor: remove the appearance
* refactor: avatar placeholder generation, chips and element border styles
* refactor: use colors instead of style references
* refactor: theming changes to match designs and feedback
* refactor: the titles are bold and the categories are tertiary coloured now
* fix: appearance settings match preferences, search bottom bar uses themed attributes
* refactor: increase setting button height
* Update clear all data dialog
* Update seed dialog
* refactor: more qa feedback changes
* feat: add new TLs and fa-rIR TLs
* Update notification content dialog
* Fix message requests clear all button text color
* feat: re-add screenshot observer
* refactor: make send tint accent color
* feat: add unread background differences
* fix: change unread count indicator
* build: upgrade build numbers
* Fix message requests popupmenu background color
* fix: crash from attr reference in color attribute
* build: upgrade build number
* fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons
* fix: tertiary text for keyboard page search view
* fix: emoji overflow colour differences
* fix: reaction pill dialog background is now correct colour
* Add style to reactions tab layout
* fix: appearance activity reverting primary color at correct time
* fix: show call privacy warning every time instead of just once
* fix: gradient background(?) and audio autoplay disable
* fix: crash in all media containing documents
* fix: reaction dialog heading fixes
* Add style to reactions tab layout
* fix: remove gradient backgrounds
* fix: adding new reaction normal text attribute to try correct the tab layout
* fix: ocean dark unread/read colours
* build; update build number
* build: update build number
Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
appearanceButton . setOnClickListener { showAppearanceSettings ( ) }
inviteFriendButton . setOnClickListener { sendInvitation ( ) }
helpButton . setOnClickListener { showHelp ( ) }
2022-01-14 06:56:15 +01:00
seedButton . setOnClickListener { showSeed ( ) }
clearAllDataButton . setOnClickListener { clearAllData ( ) }
versionTextView . text = String . format ( getString ( R . string . version _s ) , " ${BuildConfig.VERSION_NAME} ( ${BuildConfig.VERSION_CODE} ) " )
}
2020-08-19 03:48:16 +02:00
}
2023-05-25 03:28:52 +02:00
private fun getDisplayName ( ) : String =
TextSecurePreferences . getProfileName ( this ) ?: truncateIdForDisplay ( hexEncodedPublicKey )
2023-05-22 07:23:58 +02:00
private fun setupProfilePictureView ( view : ProfilePictureView ) {
view . glide = glide
view . publicKey = hexEncodedPublicKey
2023-05-25 03:28:52 +02:00
view . displayName = getDisplayName ( )
2023-05-22 07:23:58 +02:00
view . isLarge = true
view . update ( )
}
New app theming (#913)
* feat: start new app theming feature
* feat: add some theming colours
* refactor: start refactoring themes and colours to use dynamic attributes
* feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific
* refactor: take a look at ocean light and logo colour
* feat: global search colours for light and dark ocean
* feat: more styling
* feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc
* feat: add dynamic accent color
* docs: add todo for changing how accent colour is applied
* feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts
* feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items
* refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button
* refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes
* refactor: add context theme wrapper to bottom sheet dialog that references accent color
* fix: input bar bug fix and preference activity themes
* refactor: new settings menu options
* fix: crash for PNModeActivity.kt
refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu
* feat: add new appearance settings activity
* refactor: title and VM changes
* fix: correct override
* feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration
* fix: compile errors and missing themes from emoji features
* refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr
* feat: appearance screen wired up, just need to refresh theme
* feat: add theme state recreation and fix match system settings option
* refactor: add bottom margin
* feat: explore custom preference category
* feat: add the customized session theme for CorrectedPreferenceFragment
* feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment
* refactor: change drawable style and remove explicit dividers
* refactor: remove divider in CorrectedPreferenceFragment
* feat: add theme state check on resume, might be jarring currently
* feat: add preference divider elements for settings menu
* refactor: settings menu redesigns
* refactor: change led preference to integer and refactor TextSecurePreferences.kt
* feat: add scroll parcel to save/restore hierarchy on restart with appearance changes
* feat: add the conversations blocked contacts and refactor preference order and copy
* feat: add blocked contacts activity, basic layout and vm
* feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener
* feat: add blocked contacts and notif recipient listeners
* feat: add recipient db reader
* feat: add blocked contact interactions and fix a theming crash for notifications
* feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison
* feat: add settings menu vectors
* fix: preview compile error
* refactor: migrating settings menu to new designs
* feat: help menu
* refactor: simplify link opening
* refactor: remove space
* feat: refactor preferences and start theming for light mode options
* refactor: fixing dark and light modes with dialogs
* refactor: popup dialogs use proper themes now
* refactor: alert dialogs and media edit fragments use attribute references
* refactor: use input bar button attribute instead color control normal in vector tint
* refactor: transparency, dialog fixes, notification fix
* refactor: attrs and styles for buttons
* fix: use prominent button color on the outline button's border
* fix: fix the trash
* refactor: remove the appearance
* refactor: avatar placeholder generation, chips and element border styles
* refactor: use colors instead of style references
* refactor: theming changes to match designs and feedback
* refactor: the titles are bold and the categories are tertiary coloured now
* fix: appearance settings match preferences, search bottom bar uses themed attributes
* refactor: increase setting button height
* Update clear all data dialog
* Update seed dialog
* refactor: more qa feedback changes
* feat: add new TLs and fa-rIR TLs
* Update notification content dialog
* Fix message requests clear all button text color
* feat: re-add screenshot observer
* refactor: make send tint accent color
* feat: add unread background differences
* fix: change unread count indicator
* build: upgrade build numbers
* Fix message requests popupmenu background color
* fix: crash from attr reference in color attribute
* build: upgrade build number
* fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons
* fix: tertiary text for keyboard page search view
* fix: emoji overflow colour differences
* fix: reaction pill dialog background is now correct colour
* Add style to reactions tab layout
* fix: appearance activity reverting primary color at correct time
* fix: show call privacy warning every time instead of just once
* fix: gradient background(?) and audio autoplay disable
* fix: crash in all media containing documents
* fix: reaction dialog heading fixes
* Add style to reactions tab layout
* fix: remove gradient backgrounds
* fix: adding new reaction normal text attribute to try correct the tab layout
* fix: ocean dark unread/read colours
* build; update build number
* build: update build number
Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
override fun onSaveInstanceState ( outState : Bundle ) {
super . onSaveInstanceState ( outState )
val scrollBundle = SparseArray < Parcelable > ( )
binding . scrollView . saveHierarchyState ( scrollBundle )
outState . putSparseParcelableArray ( SCROLL _STATE , scrollBundle )
}
override fun onRestoreInstanceState ( savedInstanceState : Bundle ) {
super . onRestoreInstanceState ( savedInstanceState )
savedInstanceState . getSparseParcelableArray < Parcelable > ( SCROLL _STATE ) ?. let { scrollBundle ->
binding . scrollView . restoreHierarchyState ( scrollBundle )
}
}
2020-08-20 09:48:41 +02:00
override fun onCreateOptionsMenu ( menu : Menu ) : Boolean {
menuInflater . inflate ( R . menu . settings _general , menu )
return true
2020-08-19 03:48:16 +02:00
}
2020-08-20 09:48:41 +02:00
override fun onOptionsItemSelected ( item : MenuItem ) : Boolean {
return when ( item . itemId ) {
R . id . action _qr _code -> {
showQRCode ( )
2020-08-26 15:12:01 +02:00
true
}
2020-08-20 09:48:41 +02:00
else -> super . onOptionsItemSelected ( item )
}
2020-01-06 04:26:52 +01:00
}
2020-01-07 04:51:11 +01:00
2020-08-20 09:48:41 +02:00
override fun onActivityResult ( requestCode : Int , resultCode : Int , data : Intent ? ) {
2020-01-07 04:51:11 +01:00
super . onActivityResult ( requestCode , resultCode , data )
when ( requestCode ) {
AvatarSelection . REQUEST _CODE _AVATAR -> {
2021-05-13 06:24:27 +02:00
if ( resultCode != Activity . RESULT _OK ) {
return
}
2020-01-07 04:51:11 +01:00
val outputFile = Uri . fromFile ( File ( cacheDir , " cropped " ) )
var inputFile : Uri ? = data ?. data
if ( inputFile == null && tempFile != null ) {
inputFile = Uri . fromFile ( tempFile )
}
AvatarSelection . circularCropImage ( this , inputFile , outputFile , R . string . CropImageActivity _profile _avatar )
}
AvatarSelection . REQUEST _CODE _CROP _IMAGE -> {
2021-05-13 06:24:27 +02:00
if ( resultCode != Activity . RESULT _OK ) {
return
}
2020-01-07 04:51:11 +01:00
AsyncTask . execute {
try {
2023-05-22 07:23:58 +02:00
val profilePictureToBeUploaded = BitmapUtil . createScaledBytes ( this @SettingsActivity , AvatarSelection . getResultUri ( data ) , ProfileMediaConstraints ( ) ) . bitmap
2020-01-07 04:51:11 +01:00
Handler ( Looper . getMainLooper ( ) ) . post {
2023-05-22 07:23:58 +02:00
updateProfile ( true , profilePictureToBeUploaded )
2020-01-07 04:51:11 +01:00
}
} catch ( e : BitmapDecodingException ) {
e . printStackTrace ( )
}
}
}
}
}
2020-09-07 13:03:15 +02:00
override fun onRequestPermissionsResult ( requestCode : Int , permissions : Array < out String > , grantResults : IntArray ) {
super . onRequestPermissionsResult ( requestCode , permissions , grantResults )
Permissions . onRequestPermissionsResult ( this , requestCode , permissions , grantResults )
}
2020-01-07 02:00:30 +01:00
// endregion
2020-01-06 04:26:52 +01:00
2020-01-07 02:00:30 +01:00
// region Updating
2020-08-20 09:48:41 +02:00
private fun handleDisplayNameEditActionModeChanged ( ) {
val isEditingDisplayName = this . displayNameEditActionMode !== null
2022-01-14 06:56:15 +01:00
binding . btnGroupNameDisplay . visibility = if ( isEditingDisplayName ) View . INVISIBLE else View . VISIBLE
binding . displayNameEditText . visibility = if ( isEditingDisplayName ) View . VISIBLE else View . INVISIBLE
2020-08-20 09:48:41 +02:00
2020-01-07 02:00:30 +01:00
val inputMethodManager = getSystemService ( Context . INPUT _METHOD _SERVICE ) as InputMethodManager
if ( isEditingDisplayName ) {
2022-01-14 06:56:15 +01:00
binding . displayNameEditText . setText ( binding . btnGroupNameDisplay . text )
binding . displayNameEditText . selectAll ( )
binding . displayNameEditText . requestFocus ( )
inputMethodManager . showSoftInput ( binding . displayNameEditText , 0 )
2020-01-07 02:00:30 +01:00
} else {
2022-01-14 06:56:15 +01:00
inputMethodManager . hideSoftInputFromWindow ( binding . displayNameEditText . windowToken , 0 )
2020-01-07 02:00:30 +01:00
}
}
2023-05-22 07:23:58 +02:00
private fun updateProfile (
isUpdatingProfilePicture : Boolean ,
profilePicture : ByteArray ? = null ,
displayName : String ? = null
) {
2022-01-14 06:56:15 +01:00
binding . loader . isVisible = true
2020-01-07 04:51:11 +01:00
val promises = mutableListOf < Promise < * , Exception > > ( )
if ( displayName != null ) {
TextSecurePreferences . setProfileName ( this , displayName )
}
val encodedProfileKey = ProfileKeyUtil . generateEncodedProfileKey ( this )
2023-05-22 07:23:58 +02:00
if ( isUpdatingProfilePicture ) {
if ( profilePicture != null ) {
promises . add ( ProfilePictureUtilities . upload ( profilePicture , encodedProfileKey , this ) )
} else {
TextSecurePreferences . setLastProfilePictureUpload ( this , System . currentTimeMillis ( ) )
TextSecurePreferences . setProfilePictureURL ( this , null )
}
2020-01-07 04:51:11 +01:00
}
2021-05-13 06:24:27 +02:00
val compoundPromise = all ( promises )
2021-05-13 07:27:08 +02:00
compoundPromise . successUi { // Do this on the UI thread so that it happens before the alwaysUi clause below
2023-05-22 07:23:58 +02:00
if ( isUpdatingProfilePicture ) {
2021-05-13 06:24:27 +02:00
AvatarHelper . setAvatar ( this , Address . fromSerialized ( TextSecurePreferences . getLocalNumber ( this ) !! ) , profilePicture )
2023-05-22 07:23:58 +02:00
TextSecurePreferences . setProfileAvatarId ( this , profilePicture ?. let { SecureRandom ( ) . nextInt ( ) } ?: 0 )
2021-05-13 06:24:27 +02:00
TextSecurePreferences . setLastProfilePictureUpload ( this , Date ( ) . time )
ProfileKeyUtil . setEncodedProfileKey ( this , encodedProfileKey )
}
2021-02-24 05:28:48 +01:00
if ( profilePicture != null || displayName != null ) {
2021-07-09 05:01:16 +02:00
ConfigurationMessageUtilities . forceSyncConfigurationNowIfNeeded ( this @SettingsActivity )
2021-02-24 05:28:48 +01:00
}
2021-05-13 06:24:27 +02:00
}
compoundPromise . alwaysUi {
2020-01-07 04:51:11 +01:00
if ( displayName != null ) {
2022-01-14 06:56:15 +01:00
binding . btnGroupNameDisplay . text = displayName
2020-01-07 04:51:11 +01:00
}
2023-05-22 07:23:58 +02:00
if ( isUpdatingProfilePicture ) {
Performance improvements and bug fixes (#869)
* refactor: fail on testSnode instead of recursively using up snode list. add call timeout on http client
* refactor: refactoring batch message receives and pollers
* refactor: reduce thread utils pool count to a 2 thread fixed pool. Do a check against pubkey instead of room names for oxenHostedOpenGroup
* refactor: caching lib with potential loader fixes and no-cache for giphy
* refactor: remove store and instead use ConcurrentHashMap with a backing update coroutine
* refactor: queue trim thread jobs instead of add every message processed
* fix: wrapping auth token and initial sync for open groups in a threadutils queued runnable, getting initial sync times down
* fix: fixing the user contacts cache in ConversationAdapter.kt
* refactor: improve polling and initial sync, move group joins from config messages into a background job fetching image.
* refactor: improving the job queuing for open groups, replacing placeholder avatar generation with a custom glide loader and archiving initial sync of open groups
* feat: add OpenGroupDeleteJob.kt
* feat: add open group delete job to process deletions after batch adding
* feat: add vacuum and fix job queue re-adding jobs forever, only try to set message hash values in DB if they have changed
* refactor: remove redundant inflation for profile image views throughout app
* refactor(wip): reducing layout inflation and starting to refactor the open group deletion issues taking a long time
* refactor(wip): refactoring group deletion to not iterate through and delete messages individually
* refactor(wip): refactoring group deletion to not iterate through and delete messages individually
* fix: group deletion optimisation
* build: bump build number
* build: bump build number and fix batch message receive retry logic
* fix: clear out open group deletes
* fix: update visible ConversationAdapter.kt binding for initial contact fetching and better traces for debugging background jobs
* fix: add in check for / force sync latest encryption key pair from linked devices if we already have that closed group
* Rename .java to .kt
* refactor: change MmsDatabase to kotlin to make list operations easier
* fix: nullable type
* fix: compilation issues and constants in .kt instead of .java
* fix: bug fix expiration timer on closed group recipient
* feat: use the job queue properly across executors
* feat: start on open group dispatcher-specific logic, probably a queue factory based on openGroupId if that is the same across new message and deletion jobs to ensure consistent entry and removal
* refactor: removing redundant code and fixing jobqueue per opengroup
* fix: allow attachments in note to self
* fix: make the minWidth in quote view bind max of text / title and body, wrapped ?
* fix: fixing up layouts and code view layouts
* fix: remove TODO, remove timestamp binding
* feat: fix view logic, avatars and padding, downloading attachments lazily (on bind), fixing potential crash, add WindowDebouncer.kt
* fix: NPE on viewModel recipient from removed thread while tearing down the Recipient observer in ConversationActivityV2.kt
* refactor: replace conversation notification debouncer handler with handlerthread, same as conversation list debouncer
* refactor: UI for groups and poller improvements
* fix: revert some changes in poller
* feat: add header back in for message requests
* refactor: remove Trace calls, add more conditions to the HomeDiffUtil for updating more efficiently
* feat: try update the home adapter if we get a profile picture modified event
* feat: bump build numbers
* fix: try to start with list in homeViewModel if we don't have already, render quotes to be width of attachment slide view instead of fixed
* fix: set channel to be conflated instead of no buffer
* fix: set unreads based off last local user message vs incrementing unreads to be all amount
* feat: add profile update flag, update build number
* fix: link preview thumbnails download on bind
* fix: centercrop placeholder in glide request
* feat: recycle the contact selection list and profile image in unbind
* fix: try to prevent user KP crash at weird times
* fix: remove additional log, improve attachment download success rate, fix share logs dialog issue
2022-06-08 09:12:34 +02:00
binding . profilePictureView . root . recycle ( ) // Clear the cached image before updating
binding . profilePictureView . root . update ( )
2020-01-07 04:51:11 +01:00
}
2022-01-14 06:56:15 +01:00
binding . loader . isVisible = false
2020-01-07 02:00:30 +01:00
}
2020-01-07 04:51:11 +01:00
}
2020-01-06 04:26:52 +01:00
// endregion
// region Interaction
2020-01-07 02:00:30 +01:00
2020-08-20 09:48:41 +02:00
/ * *
* @return true if the update was successful .
* /
private fun saveDisplayName ( ) : Boolean {
2022-01-14 06:56:15 +01:00
val displayName = binding . displayNameEditText . text . toString ( ) . trim ( )
2020-01-07 04:51:11 +01:00
if ( displayName . isEmpty ( ) ) {
2020-08-20 09:48:41 +02:00
Toast . makeText ( this , R . string . activity _settings _display _name _missing _error , Toast . LENGTH _SHORT ) . show ( )
return false
2020-01-07 04:51:11 +01:00
}
2021-02-22 01:29:22 +01:00
if ( displayName . toByteArray ( ) . size > ProfileManagerProtocol . Companion . NAME _PADDED _LENGTH ) {
2020-08-20 09:48:41 +02:00
Toast . makeText ( this , R . string . activity _settings _display _name _too _long _error , Toast . LENGTH _SHORT ) . show ( )
return false
2020-01-07 04:51:11 +01:00
}
2023-05-22 07:23:58 +02:00
updateProfile ( false , displayName = displayName )
2020-08-20 09:48:41 +02:00
return true
2020-01-06 04:26:52 +01:00
}
private fun showQRCode ( ) {
2020-01-06 06:05:57 +01:00
val intent = Intent ( this , QRCodeActivity :: class . java )
push ( intent )
2020-01-06 04:26:52 +01:00
}
2020-01-07 04:51:11 +01:00
private fun showEditProfilePictureUI ( ) {
2023-05-22 07:23:58 +02:00
AlertDialog . Builder ( this )
. setTitle ( R . string . activity _settings _set _display _picture )
. setView ( R . layout . dialog _change _avatar )
. setPositiveButton ( R . string . activity _settings _upload ) { _ , _ ->
startAvatarSelection ( )
}
. setNegativeButton ( R . string . cancel ) { _ , _ -> }
. apply {
if ( TextSecurePreferences . getProfileAvatarId ( context ) != 0 ) {
setNeutralButton ( R . string . activity _settings _remove ) { _ , _ -> removeAvatar ( ) }
}
}
. show ( ) . apply {
findViewById < ProfilePictureView > ( R . id . profile _picture _view ) ?. let ( :: setupProfilePictureView )
}
}
private fun removeAvatar ( ) {
updateProfile ( true )
}
private fun startAvatarSelection ( ) {
2020-09-07 13:03:15 +02:00
// Ask for an optional camera permission.
Permissions . with ( this )
2021-07-14 06:17:40 +02:00
. request ( Manifest . permission . CAMERA )
. onAnyResult {
tempFile = AvatarSelection . startAvatarSelection ( this , false , true )
}
. execute ( )
2020-01-07 04:51:11 +01:00
}
2020-01-06 04:26:52 +01:00
private fun copyPublicKey ( ) {
val clipboard = getSystemService ( Context . CLIPBOARD _SERVICE ) as ClipboardManager
val clip = ClipData . newPlainText ( " Session ID " , hexEncodedPublicKey )
2020-08-19 02:06:26 +02:00
clipboard . setPrimaryClip ( clip )
2020-05-25 08:38:36 +02:00
Toast . makeText ( this , R . string . copied _to _clipboard , Toast . LENGTH _SHORT ) . show ( )
2020-01-06 04:26:52 +01:00
}
private fun sharePublicKey ( ) {
val intent = Intent ( )
intent . action = Intent . ACTION _SEND
intent . putExtra ( Intent . EXTRA _TEXT , hexEncodedPublicKey )
intent . type = " text/plain "
2021-07-07 06:22:04 +02:00
val chooser = Intent . createChooser ( intent , getString ( R . string . share ) )
startActivity ( chooser )
2020-01-06 04:26:52 +01:00
}
2020-01-07 05:59:18 +01:00
2020-01-09 01:35:43 +01:00
private fun showPrivacySettings ( ) {
2020-01-09 04:15:43 +01:00
val intent = Intent ( this , PrivacySettingsActivity :: class . java )
push ( intent )
}
private fun showNotificationSettings ( ) {
val intent = Intent ( this , NotificationSettingsActivity :: class . java )
push ( intent )
}
2022-03-04 07:46:39 +01:00
private fun showMessageRequests ( ) {
val intent = Intent ( this , MessageRequestsActivity :: class . java )
push ( intent )
}
2020-01-09 04:15:43 +01:00
private fun showChatSettings ( ) {
val intent = Intent ( this , ChatSettingsActivity :: class . java )
2020-01-09 01:35:43 +01:00
push ( intent )
}
New app theming (#913)
* feat: start new app theming feature
* feat: add some theming colours
* refactor: start refactoring themes and colours to use dynamic attributes
* feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific
* refactor: take a look at ocean light and logo colour
* feat: global search colours for light and dark ocean
* feat: more styling
* feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc
* feat: add dynamic accent color
* docs: add todo for changing how accent colour is applied
* feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts
* feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items
* refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button
* refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes
* refactor: add context theme wrapper to bottom sheet dialog that references accent color
* fix: input bar bug fix and preference activity themes
* refactor: new settings menu options
* fix: crash for PNModeActivity.kt
refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu
* feat: add new appearance settings activity
* refactor: title and VM changes
* fix: correct override
* feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration
* fix: compile errors and missing themes from emoji features
* refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr
* feat: appearance screen wired up, just need to refresh theme
* feat: add theme state recreation and fix match system settings option
* refactor: add bottom margin
* feat: explore custom preference category
* feat: add the customized session theme for CorrectedPreferenceFragment
* feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment
* refactor: change drawable style and remove explicit dividers
* refactor: remove divider in CorrectedPreferenceFragment
* feat: add theme state check on resume, might be jarring currently
* feat: add preference divider elements for settings menu
* refactor: settings menu redesigns
* refactor: change led preference to integer and refactor TextSecurePreferences.kt
* feat: add scroll parcel to save/restore hierarchy on restart with appearance changes
* feat: add the conversations blocked contacts and refactor preference order and copy
* feat: add blocked contacts activity, basic layout and vm
* feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener
* feat: add blocked contacts and notif recipient listeners
* feat: add recipient db reader
* feat: add blocked contact interactions and fix a theming crash for notifications
* feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison
* feat: add settings menu vectors
* fix: preview compile error
* refactor: migrating settings menu to new designs
* feat: help menu
* refactor: simplify link opening
* refactor: remove space
* feat: refactor preferences and start theming for light mode options
* refactor: fixing dark and light modes with dialogs
* refactor: popup dialogs use proper themes now
* refactor: alert dialogs and media edit fragments use attribute references
* refactor: use input bar button attribute instead color control normal in vector tint
* refactor: transparency, dialog fixes, notification fix
* refactor: attrs and styles for buttons
* fix: use prominent button color on the outline button's border
* fix: fix the trash
* refactor: remove the appearance
* refactor: avatar placeholder generation, chips and element border styles
* refactor: use colors instead of style references
* refactor: theming changes to match designs and feedback
* refactor: the titles are bold and the categories are tertiary coloured now
* fix: appearance settings match preferences, search bottom bar uses themed attributes
* refactor: increase setting button height
* Update clear all data dialog
* Update seed dialog
* refactor: more qa feedback changes
* feat: add new TLs and fa-rIR TLs
* Update notification content dialog
* Fix message requests clear all button text color
* feat: re-add screenshot observer
* refactor: make send tint accent color
* feat: add unread background differences
* fix: change unread count indicator
* build: upgrade build numbers
* Fix message requests popupmenu background color
* fix: crash from attr reference in color attribute
* build: upgrade build number
* fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons
* fix: tertiary text for keyboard page search view
* fix: emoji overflow colour differences
* fix: reaction pill dialog background is now correct colour
* Add style to reactions tab layout
* fix: appearance activity reverting primary color at correct time
* fix: show call privacy warning every time instead of just once
* fix: gradient background(?) and audio autoplay disable
* fix: crash in all media containing documents
* fix: reaction dialog heading fixes
* Add style to reactions tab layout
* fix: remove gradient backgrounds
* fix: adding new reaction normal text attribute to try correct the tab layout
* fix: ocean dark unread/read colours
* build; update build number
* build: update build number
Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
private fun showAppearanceSettings ( ) {
val intent = Intent ( this , AppearanceSettingsActivity :: class . java )
push ( intent )
}
2020-11-02 04:54:10 +01:00
private fun sendInvitation ( ) {
val intent = Intent ( )
intent . action = Intent . ACTION _SEND
2021-07-14 07:08:59 +02:00
val invitation = " Hey, I've been using Session to chat with complete privacy and security. Come join me! Download it at https://getsession.org/. My Session ID is $hexEncodedPublicKey ! "
2020-11-02 04:54:10 +01:00
intent . putExtra ( Intent . EXTRA _TEXT , invitation )
intent . type = " text/plain "
2021-07-07 07:51:20 +02:00
val chooser = Intent . createChooser ( intent , getString ( R . string . activity _settings _invite _button _title ) )
2021-07-07 06:22:04 +02:00
startActivity ( chooser )
2020-11-02 04:54:10 +01:00
}
New app theming (#913)
* feat: start new app theming feature
* feat: add some theming colours
* refactor: start refactoring themes and colours to use dynamic attributes
* feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific
* refactor: take a look at ocean light and logo colour
* feat: global search colours for light and dark ocean
* feat: more styling
* feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc
* feat: add dynamic accent color
* docs: add todo for changing how accent colour is applied
* feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts
* feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items
* refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button
* refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes
* refactor: add context theme wrapper to bottom sheet dialog that references accent color
* fix: input bar bug fix and preference activity themes
* refactor: new settings menu options
* fix: crash for PNModeActivity.kt
refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu
* feat: add new appearance settings activity
* refactor: title and VM changes
* fix: correct override
* feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration
* fix: compile errors and missing themes from emoji features
* refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr
* feat: appearance screen wired up, just need to refresh theme
* feat: add theme state recreation and fix match system settings option
* refactor: add bottom margin
* feat: explore custom preference category
* feat: add the customized session theme for CorrectedPreferenceFragment
* feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment
* refactor: change drawable style and remove explicit dividers
* refactor: remove divider in CorrectedPreferenceFragment
* feat: add theme state check on resume, might be jarring currently
* feat: add preference divider elements for settings menu
* refactor: settings menu redesigns
* refactor: change led preference to integer and refactor TextSecurePreferences.kt
* feat: add scroll parcel to save/restore hierarchy on restart with appearance changes
* feat: add the conversations blocked contacts and refactor preference order and copy
* feat: add blocked contacts activity, basic layout and vm
* feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener
* feat: add blocked contacts and notif recipient listeners
* feat: add recipient db reader
* feat: add blocked contact interactions and fix a theming crash for notifications
* feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison
* feat: add settings menu vectors
* fix: preview compile error
* refactor: migrating settings menu to new designs
* feat: help menu
* refactor: simplify link opening
* refactor: remove space
* feat: refactor preferences and start theming for light mode options
* refactor: fixing dark and light modes with dialogs
* refactor: popup dialogs use proper themes now
* refactor: alert dialogs and media edit fragments use attribute references
* refactor: use input bar button attribute instead color control normal in vector tint
* refactor: transparency, dialog fixes, notification fix
* refactor: attrs and styles for buttons
* fix: use prominent button color on the outline button's border
* fix: fix the trash
* refactor: remove the appearance
* refactor: avatar placeholder generation, chips and element border styles
* refactor: use colors instead of style references
* refactor: theming changes to match designs and feedback
* refactor: the titles are bold and the categories are tertiary coloured now
* fix: appearance settings match preferences, search bottom bar uses themed attributes
* refactor: increase setting button height
* Update clear all data dialog
* Update seed dialog
* refactor: more qa feedback changes
* feat: add new TLs and fa-rIR TLs
* Update notification content dialog
* Fix message requests clear all button text color
* feat: re-add screenshot observer
* refactor: make send tint accent color
* feat: add unread background differences
* fix: change unread count indicator
* build: upgrade build numbers
* Fix message requests popupmenu background color
* fix: crash from attr reference in color attribute
* build: upgrade build number
* fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons
* fix: tertiary text for keyboard page search view
* fix: emoji overflow colour differences
* fix: reaction pill dialog background is now correct colour
* Add style to reactions tab layout
* fix: appearance activity reverting primary color at correct time
* fix: show call privacy warning every time instead of just once
* fix: gradient background(?) and audio autoplay disable
* fix: crash in all media containing documents
* fix: reaction dialog heading fixes
* Add style to reactions tab layout
* fix: remove gradient backgrounds
* fix: adding new reaction normal text attribute to try correct the tab layout
* fix: ocean dark unread/read colours
* build; update build number
* build: update build number
Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
private fun showHelp ( ) {
val intent = Intent ( this , HelpSettingsActivity :: class . java )
push ( intent )
2021-07-14 06:17:40 +02:00
}
2022-02-07 07:06:27 +01:00
private fun showPath ( ) {
val intent = Intent ( this , PathActivity :: class . java )
show ( intent )
}
2020-01-07 05:59:18 +01:00
private fun showSeed ( ) {
2020-01-08 05:16:34 +01:00
SeedDialog ( ) . show ( supportFragmentManager , " Recovery Phrase Dialog " )
2020-01-07 05:59:18 +01:00
}
2020-01-07 06:11:02 +01:00
private fun clearAllData ( ) {
2021-06-22 09:01:27 +02:00
ClearAllDataDialog ( ) . show ( supportFragmentManager , " Clear All Data Dialog " )
2021-06-18 08:01:34 +02:00
}
2020-01-06 04:26:52 +01:00
// endregion
2020-08-20 09:48:41 +02:00
private inner class DisplayNameEditActionModeCallback : ActionMode . Callback {
override fun onCreateActionMode ( mode : ActionMode , menu : Menu ) : Boolean {
mode . title = getString ( R . string . activity _settings _display _name _edit _text _hint )
mode . menuInflater . inflate ( R . menu . menu _apply , menu )
this @SettingsActivity . displayNameEditActionMode = mode
return true
}
override fun onPrepareActionMode ( mode : ActionMode , menu : Menu ) : Boolean {
return false
}
override fun onDestroyActionMode ( mode : ActionMode ) {
this @SettingsActivity . displayNameEditActionMode = null
}
override fun onActionItemClicked ( mode : ActionMode , item : MenuItem ) : Boolean {
when ( item . itemId ) {
R . id . applyButton -> {
if ( this @SettingsActivity . saveDisplayName ( ) ) {
mode . finish ( )
}
return true
}
}
return false ;
}
}
2020-01-06 04:26:52 +01:00
}