From f0ab91dc37f46441581a4f3381d32caaf40d4acf Mon Sep 17 00:00:00 2001 From: Fahim Date: Sat, 25 Sep 2021 00:24:09 +0600 Subject: [PATCH] 3624-UI_revamp issue: https://gitlab.e.foundation/e/backlog/-/issues/3624 --- app/build.gradle | 9 +- .../ui/ExceptionInfoFragment.kt | 2 +- .../e/accountmanager/ui/HomeSetAdapter.kt | 7 +- .../ui/StartupDialogFragment.kt | 8 +- .../ui/account/AccountActivity.kt | 3 +- .../ui/account/CollectionsFragment.kt | 122 ++++--- .../ui/account/RenameAccountFragment.kt | 2 +- .../ui/account/SettingsActivity.kt | 4 +- .../ui/setup/AccountDetailsFragment.kt | 327 ++++++++++++------ .../ui/setup/DetectConfigurationFragment.kt | 2 +- .../ui/setup/GoogleAuthenticatorFragment.kt | 3 +- app/src/main/res/color/buttontext.xml | 4 +- .../res/color/edittextborderbackground.xml | 15 + .../drawable-anydpi-v24/ic_delete_notify.xml | 5 +- .../drawable-anydpi-v24/ic_sd_card_notify.xml | 5 +- .../drawable-anydpi-v24/ic_share_notify.xml | 5 +- .../ic_sync_problem_notify.xml | 5 +- .../drawable-anydpi-v24/ic_warning_notify.xml | 2 +- .../res/drawable/ic_account_circle_white.xml | 2 +- app/src/main/res/drawable/ic_adb_dark.xml | 4 +- app/src/main/res/drawable/ic_add_white.xml | 2 +- .../main/res/drawable/ic_bug_report_dark.xml | 4 +- .../main/res/drawable/ic_cloud_off_dark.xml | 3 +- .../main/res/drawable/ic_contacts_dark.xml | 4 +- .../main/res/drawable/ic_date_range_dark.xml | 4 +- app/src/main/res/drawable/ic_done.xml | 9 + app/src/main/res/drawable/ic_error_dark.xml | 5 +- app/src/main/res/drawable/ic_expand_less.xml | 2 +- app/src/main/res/drawable/ic_expand_more.xml | 2 +- app/src/main/res/drawable/ic_group_dark.xml | 4 +- app/src/main/res/drawable/ic_info_dark.xml | 4 +- .../res/drawable/ic_launcher_foreground.xml | 12 +- .../res/drawable/ic_network_wifi_dark.xml | 6 +- .../res/drawable/ic_notifications_dark.xml | 5 +- .../drawable/ic_playlist_add_check_dark.xml | 5 +- .../res/drawable/ic_remove_circle_dark.xml | 4 +- .../main/res/drawable/ic_settings_action.xml | 4 +- .../main/res/drawable/ic_settings_dark.xml | 5 +- app/src/main/res/drawable/ic_share_action.xml | 4 +- .../drawable/ic_signal_cellular_off_dark.xml | 2 +- app/src/main/res/drawable/ic_sync_action.xml | 4 +- app/src/main/res/drawable/ic_sync_white.xml | 2 +- app/src/main/res/drawable/ic_today_dark.xml | 4 +- app/src/main/res/layout/about.xml | 1 + .../main/res/layout/account_carddav_item.xml | 3 +- app/src/main/res/layout/account_list_item.xml | 2 +- app/src/main/res/layout/accounts_content.xml | 3 +- app/src/main/res/layout/activity_about.xml | 7 +- app/src/main/res/layout/activity_account.xml | 8 +- app/src/main/res/layout/activity_accounts.xml | 1 + .../layout/activity_create_address_book.xml | 8 +- .../res/layout/custom_simple_list_item_1.xml | 11 + .../res/layout/custom_simple_list_item_2.xml | 25 ++ app/src/main/res/layout/delete_collection.xml | 2 + .../layout/fragment_eelo_authenticator.xml | 252 +++++++------- .../main/res/layout/login_account_details.xml | 5 +- .../res/layout/login_credentials_fragment.xml | 30 +- .../main/res/layout/nav_header_accounts.xml | 4 +- .../res/menu/activity_create_collection.xml | 15 +- app/src/main/res/values-night-v27/styles.xml | 8 + app/src/main/res/values-v27/styles.xml | 8 + app/src/main/res/values/styles.xml | 172 +++++++-- build.gradle | 2 +- e-ui-sdk.jar | Bin 0 -> 115532 bytes 64 files changed, 800 insertions(+), 403 deletions(-) create mode 100644 app/src/main/res/color/edittextborderbackground.xml create mode 100644 app/src/main/res/drawable/ic_done.xml create mode 100644 app/src/main/res/layout/custom_simple_list_item_1.xml create mode 100644 app/src/main/res/layout/custom_simple_list_item_2.xml create mode 100644 app/src/main/res/values-night-v27/styles.xml create mode 100644 app/src/main/res/values-v27/styles.xml create mode 100644 e-ui-sdk.jar diff --git a/app/build.gradle b/app/build.gradle index 7729183cf..6b5f9e456 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,6 +16,10 @@ android { compileSdkVersion 29 buildToolsVersion '29.0.2' + aaptOptions { + additionalParameters '-I', 'e-ui-sdk.jar' + } + defaultConfig { applicationId "foundation.e.accountmanager" @@ -105,6 +109,8 @@ android { } dependencies { + compileOnly files("../e-ui-sdk.jar") + implementation project(':cert4android') implementation project(':ical4android') implementation project(':vcard4android') @@ -114,6 +120,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.fragment:fragment-ktx:1.1.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0' @@ -135,7 +142,7 @@ dependencies { } implementation 'com.jaredrummler:colorpicker:1.1.0' - implementation('com.mikepenz:aboutlibraries:7.0.4') + implementation('com.mikepenz:aboutlibraries:8.9.1') implementation "com.squareup.okhttp3:okhttp:${versions.okhttp}" implementation "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}" implementation 'commons-io:commons-io:2.6' diff --git a/app/src/main/java/foundation/e/accountmanager/ui/ExceptionInfoFragment.kt b/app/src/main/java/foundation/e/accountmanager/ui/ExceptionInfoFragment.kt index 057764ff2..e2db9e1fd 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/ExceptionInfoFragment.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/ExceptionInfoFragment.kt @@ -45,7 +45,7 @@ class ExceptionInfoFragment: DialogFragment() { else -> R.string.exception } - val dialog = MaterialAlertDialogBuilder(requireActivity()) + val dialog = MaterialAlertDialogBuilder(requireActivity(), R.style.CustomAlertDialogStyle) .setIcon(R.drawable.ic_error_dark) .setTitle(title) .setMessage(exception::class.java.name + "\n" + exception.localizedMessage) diff --git a/app/src/main/java/foundation/e/accountmanager/ui/HomeSetAdapter.kt b/app/src/main/java/foundation/e/accountmanager/ui/HomeSetAdapter.kt index 8017cae58..aedf65232 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/HomeSetAdapter.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/HomeSetAdapter.kt @@ -7,18 +7,19 @@ import android.view.View import android.view.ViewGroup import android.widget.ArrayAdapter import android.widget.TextView +import foundation.e.accountmanager.R import foundation.e.accountmanager.model.HomeSet class HomeSetAdapter( context: Context -): ArrayAdapter(context, android.R.layout.simple_list_item_2, android.R.id.text1) { +): ArrayAdapter(context, R.layout.custom_simple_list_item_2, android.R.id.text1) { override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { val data = getItem(position)!! val v: View if (!data.displayName.isNullOrBlank()) { - v = convertView ?: LayoutInflater.from(context).inflate(android.R.layout.simple_list_item_2, null, false) + v = convertView ?: LayoutInflater.from(context).inflate(R.layout.custom_simple_list_item_2, null, false) v.findViewById(android.R.id.text1).text = data.displayName v.findViewById(android.R.id.text2).apply { text = data.url.toString() @@ -26,7 +27,7 @@ class HomeSetAdapter( ellipsize = TextUtils.TruncateAt.START } } else { - v = convertView ?: LayoutInflater.from(context).inflate(android.R.layout.simple_list_item_1, null, false) + v = convertView ?: LayoutInflater.from(context).inflate(R.layout.custom_simple_list_item_1, null, false) v.findViewById(android.R.id.text1).apply { text = data.url.toString() setSingleLine() diff --git a/app/src/main/java/foundation/e/accountmanager/ui/StartupDialogFragment.kt b/app/src/main/java/foundation/e/accountmanager/ui/StartupDialogFragment.kt index fc7474f5b..e56a55552 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/StartupDialogFragment.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/StartupDialogFragment.kt @@ -94,7 +94,7 @@ class StartupDialogFragment: DialogFragment() { val activity = requireActivity() return when (Mode.valueOf(arguments!!.getString(ARGS_MODE)!!)) { Mode.AUTOSTART_PERMISSIONS -> - MaterialAlertDialogBuilder(activity) + MaterialAlertDialogBuilder(activity, R.style.CustomAlertDialogStyle) .setIcon(R.drawable.ic_error_dark) .setTitle(R.string.startup_autostart_permission) .setMessage(getString(R.string.startup_autostart_permission_message, Build.MANUFACTURER)) @@ -109,7 +109,7 @@ class StartupDialogFragment: DialogFragment() { .create() Mode.BATTERY_OPTIMIZATIONS -> - MaterialAlertDialogBuilder(activity) + MaterialAlertDialogBuilder(activity, R.style.CustomAlertDialogStyle) .setIcon(R.drawable.ic_info_dark) .setTitle(R.string.startup_battery_optimization) .setMessage(R.string.startup_battery_optimization_message) @@ -127,7 +127,7 @@ class StartupDialogFragment: DialogFragment() { val builder = StringBuilder(getString(R.string.startup_opentasks_not_installed_message)) if (Build.VERSION.SDK_INT < 23) builder.append("\n\n").append(getString(R.string.startup_opentasks_reinstall_davx5)) - return MaterialAlertDialogBuilder(activity) + return MaterialAlertDialogBuilder(activity, R.style.CustomAlertDialogStyle) .setIcon(R.drawable.ic_playlist_add_check_dark) .setTitle(R.string.startup_opentasks_not_installed) .setMessage(builder.toString()) @@ -143,7 +143,7 @@ class StartupDialogFragment: DialogFragment() { } Mode.OSE_DONATE -> - return MaterialAlertDialogBuilder(activity) + return MaterialAlertDialogBuilder(activity, R.style.CustomAlertDialogStyle) .setIcon(R.mipmap.ic_launcher) .setTitle(R.string.startup_donate) .setMessage(R.string.startup_donate_message) diff --git a/app/src/main/java/foundation/e/accountmanager/ui/account/AccountActivity.kt b/app/src/main/java/foundation/e/accountmanager/ui/account/AccountActivity.kt index 945fb929f..0abe8d140 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/account/AccountActivity.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/account/AccountActivity.kt @@ -91,6 +91,7 @@ class AccountActivity: AppCompatActivity() { } override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (grantResults.contains(PackageManager.PERMISSION_GRANTED)) model.gotPermissions() } @@ -110,7 +111,7 @@ class AccountActivity: AppCompatActivity() { } fun deleteAccount(menuItem: MenuItem) { - MaterialAlertDialogBuilder(this) + MaterialAlertDialogBuilder(this, R.style.CustomAlertDialogStyle) .setIcon(R.drawable.ic_error_dark) .setTitle(R.string.account_delete_confirmation_title) .setMessage(R.string.account_delete_confirmation_text) diff --git a/app/src/main/java/foundation/e/accountmanager/ui/account/CollectionsFragment.kt b/app/src/main/java/foundation/e/accountmanager/ui/account/CollectionsFragment.kt index 967474dcf..3074edda1 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/account/CollectionsFragment.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/account/CollectionsFragment.kt @@ -10,6 +10,7 @@ import android.view.* import android.widget.PopupMenu import androidx.annotation.WorkerThread import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.lifecycle.* import androidx.paging.PagedList @@ -19,7 +20,6 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import foundation.e.accountmanager.Constants import foundation.e.accountmanager.DavService import foundation.e.accountmanager.R import foundation.e.accountmanager.model.AppDatabase @@ -28,10 +28,11 @@ import foundation.e.accountmanager.resource.LocalAddressBook import foundation.e.accountmanager.resource.LocalTaskList import foundation.e.accountmanager.ui.DeleteCollectionFragment import foundation.e.ical4android.TaskProvider +import kotlinx.android.synthetic.main.account_caldav_item.* import kotlinx.android.synthetic.main.account_collections.* import java.util.concurrent.Executors -abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshListener { +abstract class CollectionsFragment : Fragment(), SwipeRefreshLayout.OnRefreshListener { companion object { const val EXTRA_SERVICE_ID = "serviceId" @@ -46,19 +47,26 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - accountModel = ViewModelProviders.of(requireActivity()).get(AccountActivity.Model::class.java) + accountModel = + ViewModelProviders.of(requireActivity()).get(AccountActivity.Model::class.java) model = ViewModelProviders.of(this).get(Model::class.java) model.initialize( - accountModel, - arguments?.getLong(EXTRA_SERVICE_ID) ?: throw IllegalArgumentException("EXTRA_SERVICE_ID required"), - arguments?.getString(EXTRA_COLLECTION_TYPE) ?: throw IllegalArgumentException("EXTRA_COLLECTION_TYPE required") + accountModel, + arguments?.getLong(EXTRA_SERVICE_ID) + ?: throw IllegalArgumentException("EXTRA_SERVICE_ID required"), + arguments?.getString(EXTRA_COLLECTION_TYPE) + ?: throw IllegalArgumentException("EXTRA_COLLECTION_TYPE required") ) setHasOptionsMenu(true) } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View = - inflater.inflate(R.layout.account_collections, container, false) + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View = + inflater.inflate(R.layout.account_collections, container, false) override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -68,10 +76,10 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList }) model.collections.observe(viewLifecycleOwner, Observer { collections -> val colors = collections.orEmpty() - .filterNotNull() - .mapNotNull { it.color } - .distinct() - .ifEmpty { listOf(Constants.DAVDROID_GREEN_RGBA) } + .filterNotNull() + .mapNotNull { it.color } + .distinct() + .ifEmpty { listOf(ContextCompat.getColor(requireContext(), R.color.accentColor)) } swipe_refresh.setColorSchemeColors(*colors.toIntArray()) }) swipe_refresh.setOnRefreshListener(this) @@ -115,42 +123,41 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList protected abstract fun createAdapter(): CollectionAdapter override fun onOptionsItemSelected(item: MenuItem) = - when (item.itemId) { - R.id.refresh -> { - onRefresh() - true - } - else -> - false + when (item.itemId) { + R.id.refresh -> { + onRefresh() + true } + else -> + false + } override fun onRefresh() { model.refresh() } - abstract class CollectionViewHolder( - parent: ViewGroup, - itemLayout: Int, - protected val accountModel: AccountActivity.Model - ): RecyclerView.ViewHolder( - LayoutInflater.from(parent.context).inflate(itemLayout, parent, false) + parent: ViewGroup, + itemLayout: Int, + protected val accountModel: AccountActivity.Model + ) : RecyclerView.ViewHolder( + LayoutInflater.from(parent.context).inflate(itemLayout, parent, false) ) { abstract fun bindTo(item: Collection) } abstract class CollectionAdapter( - protected val accountModel: AccountActivity.Model - ): PagedListAdapter(DIFF_CALLBACK) { + protected val accountModel: AccountActivity.Model + ) : PagedListAdapter(DIFF_CALLBACK) { companion object { - private val DIFF_CALLBACK = object: DiffUtil.ItemCallback() { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { override fun areItemsTheSame(oldItem: Collection, newItem: Collection) = - oldItem.id == newItem.id + oldItem.id == newItem.id override fun areContentsTheSame(oldItem: Collection, newItem: Collection) = - oldItem == newItem + oldItem == newItem } } @@ -163,9 +170,9 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList } class CollectionPopupListener( - private val accountModel: AccountActivity.Model, - private val item: Collection - ): View.OnClickListener { + private val accountModel: AccountActivity.Model, + private val item: Collection + ) : View.OnClickListener { override fun onClick(anchor: View) { val fragmentManager = (anchor.context as AppCompatActivity).supportFragmentManager @@ -174,7 +181,7 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList with(popup.menu.findItem(R.id.force_read_only)) { if (item.type == Collection.TYPE_WEBCAL) - // Webcal collections are always read-only + // Webcal collections are always read-only isVisible = false else { // non-Webcal collection @@ -194,7 +201,8 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList R.id.properties -> CollectionInfoFragment.newInstance(item.id).show(fragmentManager, null) R.id.delete_collection -> - DeleteCollectionFragment.newInstance(accountModel.account, item.id).show(fragmentManager, null) + DeleteCollectionFragment.newInstance(accountModel.account, item.id) + .show(fragmentManager, null) } true } @@ -204,7 +212,8 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList } - class Model(application: Application): AndroidViewModel(application), DavService.RefreshingStatusListener, SyncStatusObserver { + class Model(application: Application) : AndroidViewModel(application), + DavService.RefreshingStatusListener, SyncStatusObserver { private val db = AppDatabase.getInstance(application) private val executor = Executors.newSingleThreadExecutor() @@ -214,20 +223,21 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList private lateinit var collectionType: String val collections: LiveData> = - Transformations.switchMap(serviceId) { service -> - db.collectionDao().pageByServiceAndType(service, collectionType).toLiveData(25) - } + Transformations.switchMap(serviceId) { service -> + db.collectionDao().pageByServiceAndType(service, collectionType).toLiveData(25) + } // observe DavService refresh status @Volatile private var davService: DavService.InfoBinder? = null private var davServiceConn: ServiceConnection? = null - private val svcConn = object: ServiceConnection { + private val svcConn = object : ServiceConnection { override fun onServiceConnected(name: ComponentName?, service: IBinder?) { val svc = service as DavService.InfoBinder davService = svc svc.addRefreshingStatusListener(this@Model, true) } + override fun onServiceDisconnected(name: ComponentName?) { davService = null } @@ -247,11 +257,19 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList serviceId.value = id val context = getApplication() - if (context.bindService(Intent(context, DavService::class.java), svcConn, Context.BIND_AUTO_CREATE)) + if (context.bindService( + Intent(context, DavService::class.java), + svcConn, + Context.BIND_AUTO_CREATE + ) + ) davServiceConn = svcConn executor.submit { - syncStatusHandle = ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_PENDING + ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE, this) + syncStatusHandle = ContentResolver.addStatusChangeListener( + ContentResolver.SYNC_OBSERVER_TYPE_PENDING + ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE, + this + ) checkSyncStatus() } } @@ -290,12 +308,24 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList val context = getApplication() if (collectionType == Collection.TYPE_ADDRESSBOOK) { val mainAuthority = context.getString(R.string.address_books_authority) - val mainSyncActive = ContentResolver.isSyncActive(accountModel.account, mainAuthority) - val mainSyncPending = ContentResolver.isSyncPending(accountModel.account, mainAuthority) + val mainSyncActive = + ContentResolver.isSyncActive(accountModel.account, mainAuthority) + val mainSyncPending = + ContentResolver.isSyncPending(accountModel.account, mainAuthority) val accounts = LocalAddressBook.findAll(context, null, accountModel.account) - val syncActive = accounts.any { ContentResolver.isSyncActive(it.account, ContactsContract.AUTHORITY) } - val syncPending = accounts.any { ContentResolver.isSyncPending(it.account, ContactsContract.AUTHORITY) } + val syncActive = accounts.any { + ContentResolver.isSyncActive( + it.account, + ContactsContract.AUTHORITY + ) + } + val syncPending = accounts.any { + ContentResolver.isSyncPending( + it.account, + ContactsContract.AUTHORITY + ) + } isSyncActive.postValue(mainSyncActive || syncActive) isSyncPending.postValue(mainSyncPending || syncPending) diff --git a/app/src/main/java/foundation/e/accountmanager/ui/account/RenameAccountFragment.kt b/app/src/main/java/foundation/e/accountmanager/ui/account/RenameAccountFragment.kt index 73319f060..0b31902b9 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/account/RenameAccountFragment.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/account/RenameAccountFragment.kt @@ -71,7 +71,7 @@ class RenameAccountFragment: DialogFragment() { this@RenameAccountFragment.requireActivity().finish() }) - return MaterialAlertDialogBuilder(requireActivity()) + return MaterialAlertDialogBuilder(requireActivity(), R.style.CustomAlertDialogStyle) .setTitle(R.string.account_rename) .setMessage(R.string.account_rename_new_name) .setView(layout) diff --git a/app/src/main/java/foundation/e/accountmanager/ui/account/SettingsActivity.kt b/app/src/main/java/foundation/e/accountmanager/ui/account/SettingsActivity.kt index 58b6cd7a2..b1f817866 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/account/SettingsActivity.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/account/SettingsActivity.kt @@ -198,7 +198,7 @@ class SettingsActivity: AppCompatActivity() { if (permissions.any { ContextCompat.checkSelfPermission(requireActivity(), it) != PackageManager.PERMISSION_GRANTED }) { if (permissions.any { shouldShowRequestPermissionRationale(it) }) // show rationale before requesting permissions - MaterialAlertDialogBuilder(requireActivity()) + MaterialAlertDialogBuilder(requireActivity(), R.style.CustomAlertDialogStyle) .setIcon(R.drawable.ic_network_wifi_dark) .setTitle(R.string.settings_sync_wifi_only_ssids) .setMessage(R.string.settings_sync_wifi_only_ssids_location_permission) @@ -374,7 +374,7 @@ class SettingsActivity: AppCompatActivity() { // location permission denied, reset SSID restriction model.updateSyncWifiOnlySSIDs(null) - MaterialAlertDialogBuilder(requireActivity()) + MaterialAlertDialogBuilder(requireActivity(), R.style.CustomAlertDialogStyle) .setIcon(R.drawable.ic_network_wifi_dark) .setTitle(R.string.settings_sync_wifi_only_ssids) .setMessage(R.string.settings_sync_wifi_only_ssids_location_permission) diff --git a/app/src/main/java/foundation/e/accountmanager/ui/setup/AccountDetailsFragment.kt b/app/src/main/java/foundation/e/accountmanager/ui/setup/AccountDetailsFragment.kt index 9c65f7817..d5d4450b1 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/setup/AccountDetailsFragment.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/setup/AccountDetailsFragment.kt @@ -11,6 +11,7 @@ package foundation.e.accountmanager.ui.setup import android.accounts.Account import android.accounts.AccountAuthenticatorResponse import android.accounts.AccountManager +import android.annotation.SuppressLint import android.app.Activity import android.app.Application import android.content.ContentResolver @@ -42,7 +43,7 @@ import com.google.android.material.snackbar.Snackbar import java.util.logging.Level import kotlin.concurrent.thread -class AccountDetailsFragment: Fragment() { +class AccountDetailsFragment : Fragment() { private lateinit var loginModel: LoginModel private lateinit var model: AccountDetailsModel @@ -53,16 +54,20 @@ class AccountDetailsFragment: Fragment() { model = ViewModelProviders.of(this).get(AccountDetailsModel::class.java) } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + @SuppressLint("WrongThread") + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { val v = LoginAccountDetailsBinding.inflate(inflater, container, false) v.lifecycleOwner = viewLifecycleOwner v.details = model val config = loginModel.configuration ?: throw IllegalStateException() - model.name.value = loginModel.credentials?.userName ?: - config.calDAV?.email ?: - loginModel.credentials?.certificateAlias + model.name.value = loginModel.credentials?.userName ?: config.calDAV?.email + ?: loginModel.credentials?.certificateAlias // CardDAV-specific val settings = Settings.getInstance(requireActivity()) @@ -77,28 +82,35 @@ class AccountDetailsFragment: Fragment() { else { // check whether account name already exists val am = AccountManager.get(requireActivity()) - if (am.getAccountsByType(getString(R.string.account_type)).any { it.name == name }) { + if (am.getAccountsByType(getString(R.string.account_type)) + .any { it.name == name } + ) { model.nameError.value = getString(R.string.login_account_name_already_taken) return@setOnClickListener } val idx = v.contactGroupMethod.selectedItemPosition - val groupMethodName = resources.getStringArray(R.array.settings_contact_group_method_values)[idx] + val groupMethodName = + resources.getStringArray(R.array.settings_contact_group_method_values)[idx] v.createAccountProgress.visibility = View.VISIBLE v.createAccount.visibility = View.GONE model.createAccount( - activity!!, - name, - loginModel.credentials!!, - config, - GroupMethod.valueOf(groupMethodName) - ).observe(this, Observer { success -> - if (success) - requireActivity().finish() - else { - Snackbar.make(requireActivity().findViewById(android.R.id.content), R.string.login_account_not_created, Snackbar.LENGTH_LONG).show() + requireActivity(), + name, + loginModel.credentials!!, + config, + GroupMethod.valueOf(groupMethodName) + ).observe(viewLifecycleOwner, Observer { success -> + if (success) + requireActivity().finish() + else { + Snackbar.make( + requireActivity().findViewById(android.R.id.content), + R.string.login_account_not_created, + Snackbar.LENGTH_LONG + ).show() v.createAccountProgress.visibility = View.GONE v.createAccount.visibility = View.VISIBLE @@ -107,10 +119,12 @@ class AccountDetailsFragment: Fragment() { } } - val forcedGroupMethod = settings.getString(AccountSettings.KEY_CONTACT_GROUP_METHOD)?.let { GroupMethod.valueOf(it) } + val forcedGroupMethod = settings.getString(AccountSettings.KEY_CONTACT_GROUP_METHOD) + ?.let { GroupMethod.valueOf(it) } if (forcedGroupMethod != null) { v.contactGroupMethod.isEnabled = false - for ((i, method) in resources.getStringArray(R.array.settings_contact_group_method_values).withIndex()) { + for ((i, method) in resources.getStringArray(R.array.settings_contact_group_method_values) + .withIndex()) { if (method == forcedGroupMethod.name) { v.contactGroupMethod.setSelection(i) break @@ -119,43 +133,56 @@ class AccountDetailsFragment: Fragment() { } else v.contactGroupMethod.isEnabled = true - if (activity!!.intent.getStringExtra(LoginActivity.SETUP_ACCOUNT_PROVIDER_TYPE) == LoginActivity.ACCOUNT_PROVIDER_EELO || - activity!!.intent.getStringExtra(LoginActivity.SETUP_ACCOUNT_PROVIDER_TYPE) == LoginActivity.ACCOUNT_PROVIDER_GOOGLE) { - val name = model.name.value + if (requireActivity().intent.getStringExtra(LoginActivity.SETUP_ACCOUNT_PROVIDER_TYPE) == LoginActivity.ACCOUNT_PROVIDER_EELO || + requireActivity().intent.getStringExtra(LoginActivity.SETUP_ACCOUNT_PROVIDER_TYPE) == LoginActivity.ACCOUNT_PROVIDER_GOOGLE + ) { + val name = model.name.value if (name.isNullOrBlank()) model.nameError.value = getString(R.string.login_account_name_required) else { - val idx = v.contactGroupMethod.selectedItemPosition - val groupMethodName = resources.getStringArray(R.array.settings_contact_group_method_values)[idx] - - model.createAccount( - activity!!, - name, - loginModel.credentials!!, - config, - GroupMethod.valueOf(groupMethodName) - ).observe(this, Observer { success -> + val idx = v.contactGroupMethod.selectedItemPosition + val groupMethodName = + resources.getStringArray(R.array.settings_contact_group_method_values)[idx] + + model.createAccount( + requireActivity(), + name, + loginModel.credentials!!, + config, + GroupMethod.valueOf(groupMethodName) + ).observe(viewLifecycleOwner, Observer { success -> if (success) { - Toast.makeText(context, "Added account successfully", Toast.LENGTH_LONG).show() - requireActivity().setResult(Activity.RESULT_OK) - requireActivity().finish() - if (activity!!.intent.hasExtra(AccountManager - .KEY_ACCOUNT_AUTHENTICATOR_RESPONSE) && activity!!.intent - .getParcelableExtra(AccountManager - .KEY_ACCOUNT_AUTHENTICATOR_RESPONSE) != null) { - activity!!.intent - .getParcelableExtra(AccountManager - .KEY_ACCOUNT_AUTHENTICATOR_RESPONSE).onResult(null) + Toast.makeText(context, "Added account successfully", Toast.LENGTH_LONG) + .show() + requireActivity().setResult(Activity.RESULT_OK) + requireActivity().finish() + if (requireActivity().intent.hasExtra( + AccountManager + .KEY_ACCOUNT_AUTHENTICATOR_RESPONSE + ) && requireActivity().intent + .getParcelableExtra( + AccountManager + .KEY_ACCOUNT_AUTHENTICATOR_RESPONSE + ) != null + ) { + requireActivity().intent + .getParcelableExtra( + AccountManager + .KEY_ACCOUNT_AUTHENTICATOR_RESPONSE + ).onResult(null) } - if (activity!!.intent.getStringExtra(LoginActivity.SETUP_ACCOUNT_PROVIDER_TYPE) == LoginActivity.ACCOUNT_PROVIDER_EELO) { + if (requireActivity().intent.getStringExtra(LoginActivity.SETUP_ACCOUNT_PROVIDER_TYPE) == LoginActivity.ACCOUNT_PROVIDER_EELO) { val intent = Intent("drive.services.InitializerService") intent.setPackage(getString(R.string.e_drive_package_name)) intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, name) - intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, getString(R.string.eelo_account_type)) - activity!!.startService(intent) + intent.putExtra( + AccountManager.KEY_ACCOUNT_TYPE, + getString(R.string.eelo_account_type) + ) + requireActivity().startService(intent) } - } + } }) } } @@ -165,34 +192,42 @@ class AccountDetailsFragment: Fragment() { class AccountDetailsModel( - application: Application - ): AndroidViewModel(application) { + application: Application + ) : AndroidViewModel(application) { val name = MutableLiveData() val nameError = MutableLiveData() - fun createAccount(activity: Activity, name: String, credentials: Credentials, config: DavResourceFinder.Configuration, groupMethod: GroupMethod): LiveData { + fun createAccount( + activity: Activity, + name: String, + credentials: Credentials, + config: DavResourceFinder.Configuration, + groupMethod: GroupMethod + ): LiveData { val result = MutableLiveData() val context = getApplication() thread { - var accountType = context!!.getString(R.string.account_type) - var addressBookAccountType = context!!.getString(R.string.account_type_address_book) - - var baseURL : String? = null - if (config.calDAV != null) { - baseURL = config.calDAV.principal.toString() - } - - when (activity!!.intent.getStringExtra(LoginActivity.SETUP_ACCOUNT_PROVIDER_TYPE)) { - LoginActivity.ACCOUNT_PROVIDER_EELO -> { + var accountType = context!!.getString(R.string.account_type) + var addressBookAccountType = context!!.getString(R.string.account_type_address_book) + + var baseURL: String? = null + if (config.calDAV != null) { + baseURL = config.calDAV.principal.toString() + } + + when (activity!!.intent.getStringExtra(LoginActivity.SETUP_ACCOUNT_PROVIDER_TYPE)) { + LoginActivity.ACCOUNT_PROVIDER_EELO -> { accountType = context!!.getString(R.string.eelo_account_type) - addressBookAccountType = context!!.getString(R.string.account_type_eelo_address_book) - baseURL = credentials.serverUri.toString() + addressBookAccountType = + context!!.getString(R.string.account_type_eelo_address_book) + baseURL = credentials.serverUri.toString() } LoginActivity.ACCOUNT_PROVIDER_GOOGLE -> { accountType = context!!.getString(R.string.google_account_type) - addressBookAccountType = context!!.getString(R.string.account_type_google_address_book) - baseURL = null + addressBookAccountType = + context!!.getString(R.string.account_type_google_address_book) + baseURL = null } } @@ -200,38 +235,67 @@ class AccountDetailsFragment: Fragment() { // create Android account val userData = AccountSettings.initialUserData(credentials, baseURL) - Logger.log.log(Level.INFO, "Creating Android account with initial config", arrayOf(account, userData)) + Logger.log.log( + Level.INFO, + "Creating Android account with initial config", + arrayOf(account, userData) + ) val accountManager = AccountManager.get(context) - - if (!accountManager.addAccountExplicitly(account, credentials.password, userData)) { + + if (!accountManager.addAccountExplicitly(account, credentials.password, userData)) { if (accountType == context.getString(R.string.google_account_type)) { - for (googleAccount in accountManager.getAccountsByType(context.getString( - R.string.google_account_type))) { - if (userData.get(AccountSettings.KEY_EMAIL_ADDRESS) == accountManager - .getUserData(account, AccountSettings.KEY_EMAIL_ADDRESS)) { - accountManager.setUserData(googleAccount, AccountSettings.KEY_AUTH_STATE, - userData.getString(AccountSettings.KEY_AUTH_STATE)) - } - } - } - else { + for (googleAccount in accountManager.getAccountsByType( + context.getString( + R.string.google_account_type + ) + )) { + if (userData.get(AccountSettings.KEY_EMAIL_ADDRESS) == accountManager + .getUserData(account, AccountSettings.KEY_EMAIL_ADDRESS) + ) { + accountManager.setUserData( + googleAccount, AccountSettings.KEY_AUTH_STATE, + userData.getString(AccountSettings.KEY_AUTH_STATE) + ) + } + } + } else { return@thread - } - } - - if (!credentials.authState?.accessToken.isNullOrEmpty()) { - accountManager.setAuthToken(account, Constants.AUTH_TOKEN_TYPE, credentials.authState!!.accessToken) - } - - if (!credentials.password.isNullOrEmpty()) { - accountManager.setPassword(account, credentials.password) - } - - ContentResolver.setSyncAutomatically(account, context.getString(R.string.notes_authority), true) - ContentResolver.setSyncAutomatically(account, context.getString(R.string.email_authority), true) - ContentResolver.setSyncAutomatically(account, context.getString(R.string.media_authority), true) - ContentResolver.setSyncAutomatically(account, context.getString(R.string.app_data_authority), true) + } + } + + if (!credentials.authState?.accessToken.isNullOrEmpty()) { + accountManager.setAuthToken( + account, + Constants.AUTH_TOKEN_TYPE, + credentials.authState!!.accessToken + ) + } + + if (!credentials.password.isNullOrEmpty()) { + accountManager.setPassword(account, credentials.password) + } + + ContentResolver.setSyncAutomatically( + account, + context.getString(R.string.notes_authority), + true + ) + ContentResolver.setSyncAutomatically( + account, + context.getString(R.string.email_authority), + true + ) + ContentResolver.setSyncAutomatically( + account, + context.getString(R.string.media_authority), + true + ) + ContentResolver.setSyncAutomatically( + account, + context.getString(R.string.app_data_authority), + true + ) // add entries for account to service DB Logger.log.log(Level.INFO, "Writing account configuration to database", config) @@ -245,7 +309,15 @@ class AccountDetailsFragment: Fragment() { if (config.cardDAV != null) { // insert CardDAV service - val id = insertService(db, credentials.userName!!, credentials.authState?.jsonSerializeString(), accountType, addressBookAccountType, Service.TYPE_CARDDAV, config.cardDAV) + val id = insertService( + db, + credentials.userName!!, + credentials.authState?.jsonSerializeString(), + accountType, + addressBookAccountType, + Service.TYPE_CARDDAV, + config.cardDAV + ) // initial CardDAV account settings accountSettings.setGroupMethod(groupMethod) @@ -255,33 +327,62 @@ class AccountDetailsFragment: Fragment() { context.startService(refreshIntent) // contact sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_address_books.xml - accountSettings.setSyncInterval(context.getString(R.string.address_books_authority), Constants.DEFAULT_CALENDAR_SYNC_INTERVAL) + accountSettings.setSyncInterval( + context.getString(R.string.address_books_authority), + Constants.DEFAULT_CALENDAR_SYNC_INTERVAL + ) } else - ContentResolver.setIsSyncable(account, context.getString(R.string.address_books_authority), 0) + ContentResolver.setIsSyncable( + account, + context.getString(R.string.address_books_authority), + 0 + ) if (config.calDAV != null) { // insert CalDAV service - val id = insertService(db, credentials.userName!!, credentials.authState?.jsonSerializeString(), accountType, addressBookAccountType, Service.TYPE_CALDAV, config.calDAV) + val id = insertService( + db, + credentials.userName!!, + credentials.authState?.jsonSerializeString(), + accountType, + addressBookAccountType, + Service.TYPE_CALDAV, + config.calDAV + ) // start CalDAV service detection (refresh collections) refreshIntent.putExtra(DavService.EXTRA_DAV_SERVICE_ID, id) context.startService(refreshIntent) // calendar sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_calendars.xml - accountSettings.setSyncInterval(CalendarContract.AUTHORITY, Constants.DEFAULT_CALENDAR_SYNC_INTERVAL) + accountSettings.setSyncInterval( + CalendarContract.AUTHORITY, + Constants.DEFAULT_CALENDAR_SYNC_INTERVAL + ) // enable task sync if OpenTasks is installed // further changes will be handled by PackageChangedReceiver if (LocalTaskList.tasksProviderAvailable(context)) { - ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 1) - accountSettings.setSyncInterval(TaskProvider.ProviderName.OpenTasks.authority, Constants.DEFAULT_CALENDAR_SYNC_INTERVAL) + ContentResolver.setIsSyncable( + account, + TaskProvider.ProviderName.OpenTasks.authority, + 1 + ) + accountSettings.setSyncInterval( + TaskProvider.ProviderName.OpenTasks.authority, + Constants.DEFAULT_CALENDAR_SYNC_INTERVAL + ) } } else { ContentResolver.setIsSyncable(account, CalendarContract.AUTHORITY, 0) - ContentResolver.setIsSyncable(account, TaskProvider.ProviderName.OpenTasks.authority, 0) + ContentResolver.setIsSyncable( + account, + TaskProvider.ProviderName.OpenTasks.authority, + 0 + ) } - } catch(e: InvalidAccountException) { + } catch (e: InvalidAccountException) { Logger.log.log(Level.SEVERE, "Couldn't access account settings", e) result.postValue(false) return@thread @@ -291,10 +392,26 @@ class AccountDetailsFragment: Fragment() { return result } - private fun insertService(db: AppDatabase, accountName: String, authState: String?, accountType: String, addressBookAccountType: String, type: String, info: DavResourceFinder.Configuration.ServiceInfo): Long { - // insert service - val service = Service(0, accountName, authState, accountType, addressBookAccountType, type, info.principal) - val serviceId = db.serviceDao().insertOrReplace(service) + private fun insertService( + db: AppDatabase, + accountName: String, + authState: String?, + accountType: String, + addressBookAccountType: String, + type: String, + info: DavResourceFinder.Configuration.ServiceInfo + ): Long { + // insert service + val service = Service( + 0, + accountName, + authState, + accountType, + addressBookAccountType, + type, + info.principal + ) + val serviceId = db.serviceDao().insertOrReplace(service) // insert home sets val homeSetDao = db.homeSetDao() @@ -309,7 +426,7 @@ class AccountDetailsFragment: Fragment() { collectionDao.insertOrReplace(collection) } - return serviceId + return serviceId } } diff --git a/app/src/main/java/foundation/e/accountmanager/ui/setup/DetectConfigurationFragment.kt b/app/src/main/java/foundation/e/accountmanager/ui/setup/DetectConfigurationFragment.kt index 77363c2a4..f124a460d 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/setup/DetectConfigurationFragment.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/setup/DetectConfigurationFragment.kt @@ -106,7 +106,7 @@ class DetectConfigurationFragment: Fragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val model = ViewModelProviders.of(requireActivity()).get(LoginModel::class.java) - return MaterialAlertDialogBuilder(requireActivity()) + return MaterialAlertDialogBuilder(requireActivity(), R.style.CustomAlertDialogStyle) .setTitle(R.string.login_configuration_detection) .setIcon(R.drawable.ic_error_dark) .setMessage(R.string.login_no_caldav_carddav) diff --git a/app/src/main/java/foundation/e/accountmanager/ui/setup/GoogleAuthenticatorFragment.kt b/app/src/main/java/foundation/e/accountmanager/ui/setup/GoogleAuthenticatorFragment.kt index 3564ceb05..1786ffe74 100644 --- a/app/src/main/java/foundation/e/accountmanager/ui/setup/GoogleAuthenticatorFragment.kt +++ b/app/src/main/java/foundation/e/accountmanager/ui/setup/GoogleAuthenticatorFragment.kt @@ -36,6 +36,7 @@ import android.text.SpannableString import android.text.style.AlignmentSpan import android.widget.Toast import androidx.appcompat.app.AlertDialog +import com.google.android.material.dialog.MaterialAlertDialogBuilder class GoogleAuthenticatorFragment : Fragment(), AuthorizationService.TokenResponseCallback { @@ -72,7 +73,7 @@ class GoogleAuthenticatorFragment : Fragment(), AuthorizationService.TokenRespon activity?.intent?.let { model.initialize(it) - val builder = AlertDialog.Builder(context!!) + val builder = MaterialAlertDialogBuilder(context!!, R.style.CustomAlertDialogStyle) if (!with(it) { getBooleanExtra(LoginActivity.ACCOUNT_PROVIDER_GOOGLE_AUTH_COMPLETE, false) }) { val title = SpannableString(getString(R.string.google_alert_title)) diff --git a/app/src/main/res/color/buttontext.xml b/app/src/main/res/color/buttontext.xml index 1ec931b00..a5e752a1b 100644 --- a/app/src/main/res/color/buttontext.xml +++ b/app/src/main/res/color/buttontext.xml @@ -8,6 +8,6 @@ --> - - + + \ No newline at end of file diff --git a/app/src/main/res/color/edittextborderbackground.xml b/app/src/main/res/color/edittextborderbackground.xml new file mode 100644 index 000000000..684a6dace --- /dev/null +++ b/app/src/main/res/color/edittextborderbackground.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable-anydpi-v24/ic_delete_notify.xml b/app/src/main/res/drawable-anydpi-v24/ic_delete_notify.xml index 51c7e5d0d..c4f4c4042 100644 --- a/app/src/main/res/drawable-anydpi-v24/ic_delete_notify.xml +++ b/app/src/main/res/drawable-anydpi-v24/ic_delete_notify.xml @@ -2,12 +2,11 @@ android:width="24dp" android:height="24dp" android:viewportWidth="26.086956" - android:viewportHeight="26.086956" - android:tint="#FFFFFF"> + android:viewportHeight="26.086956"> diff --git a/app/src/main/res/drawable-anydpi-v24/ic_sd_card_notify.xml b/app/src/main/res/drawable-anydpi-v24/ic_sd_card_notify.xml index f284d1a89..5e55c985d 100644 --- a/app/src/main/res/drawable-anydpi-v24/ic_sd_card_notify.xml +++ b/app/src/main/res/drawable-anydpi-v24/ic_sd_card_notify.xml @@ -2,12 +2,11 @@ android:width="24dp" android:height="24dp" android:viewportWidth="26.086956" - android:viewportHeight="26.086956" - android:tint="#FFFFFF"> + android:viewportHeight="26.086956"> diff --git a/app/src/main/res/drawable-anydpi-v24/ic_share_notify.xml b/app/src/main/res/drawable-anydpi-v24/ic_share_notify.xml index 86af14821..608e3bb1b 100644 --- a/app/src/main/res/drawable-anydpi-v24/ic_share_notify.xml +++ b/app/src/main/res/drawable-anydpi-v24/ic_share_notify.xml @@ -2,12 +2,11 @@ android:width="24dp" android:height="24dp" android:viewportWidth="26.086956" - android:viewportHeight="26.086956" - android:tint="#FFFFFF"> + android:viewportHeight="26.086956"> diff --git a/app/src/main/res/drawable-anydpi-v24/ic_sync_problem_notify.xml b/app/src/main/res/drawable-anydpi-v24/ic_sync_problem_notify.xml index ed44b85de..d3c1906ef 100644 --- a/app/src/main/res/drawable-anydpi-v24/ic_sync_problem_notify.xml +++ b/app/src/main/res/drawable-anydpi-v24/ic_sync_problem_notify.xml @@ -2,12 +2,11 @@ android:width="24dp" android:height="24dp" android:viewportWidth="26.086956" - android:viewportHeight="26.086956" - android:tint="#FFFFFF"> + android:viewportHeight="26.086956"> diff --git a/app/src/main/res/drawable-anydpi-v24/ic_warning_notify.xml b/app/src/main/res/drawable-anydpi-v24/ic_warning_notify.xml index ed2353121..f6ee92b30 100644 --- a/app/src/main/res/drawable-anydpi-v24/ic_warning_notify.xml +++ b/app/src/main/res/drawable-anydpi-v24/ic_warning_notify.xml @@ -6,7 +6,7 @@ diff --git a/app/src/main/res/drawable/ic_account_circle_white.xml b/app/src/main/res/drawable/ic_account_circle_white.xml index c8f158e7e..71a0861c1 100644 --- a/app/src/main/res/drawable/ic_account_circle_white.xml +++ b/app/src/main/res/drawable/ic_account_circle_white.xml @@ -12,6 +12,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_adb_dark.xml b/app/src/main/res/drawable/ic_adb_dark.xml index 3be00f0a5..295ec8cf1 100644 --- a/app/src/main/res/drawable/ic_adb_dark.xml +++ b/app/src/main/res/drawable/ic_adb_dark.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/ic_add_white.xml b/app/src/main/res/drawable/ic_add_white.xml index c9fd74628..aa807c8f6 100644 --- a/app/src/main/res/drawable/ic_add_white.xml +++ b/app/src/main/res/drawable/ic_add_white.xml @@ -12,6 +12,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_bug_report_dark.xml b/app/src/main/res/drawable/ic_bug_report_dark.xml index 948a5be51..ac7580d68 100644 --- a/app/src/main/res/drawable/ic_bug_report_dark.xml +++ b/app/src/main/res/drawable/ic_bug_report_dark.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/ic_cloud_off_dark.xml b/app/src/main/res/drawable/ic_cloud_off_dark.xml index 8f26f9e53..931eba9bc 100644 --- a/app/src/main/res/drawable/ic_cloud_off_dark.xml +++ b/app/src/main/res/drawable/ic_cloud_off_dark.xml @@ -1,10 +1,9 @@ diff --git a/app/src/main/res/drawable/ic_contacts_dark.xml b/app/src/main/res/drawable/ic_contacts_dark.xml index aee4a2c7c..de17740e8 100644 --- a/app/src/main/res/drawable/ic_contacts_dark.xml +++ b/app/src/main/res/drawable/ic_contacts_dark.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/ic_date_range_dark.xml b/app/src/main/res/drawable/ic_date_range_dark.xml index ded97e98c..ebe802767 100644 --- a/app/src/main/res/drawable/ic_date_range_dark.xml +++ b/app/src/main/res/drawable/ic_date_range_dark.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/ic_done.xml b/app/src/main/res/drawable/ic_done.xml new file mode 100644 index 000000000..07f2e7d2b --- /dev/null +++ b/app/src/main/res/drawable/ic_done.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_error_dark.xml b/app/src/main/res/drawable/ic_error_dark.xml index c066dc992..6c576f130 100644 --- a/app/src/main/res/drawable/ic_error_dark.xml +++ b/app/src/main/res/drawable/ic_error_dark.xml @@ -10,9 +10,8 @@ android:width="24dp" android:height="24dp" android:viewportWidth="24.0" - android:viewportHeight="24.0" - android:alpha="0.54" > + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_expand_less.xml b/app/src/main/res/drawable/ic_expand_less.xml index 30a106fec..e8ab253fa 100644 --- a/app/src/main/res/drawable/ic_expand_less.xml +++ b/app/src/main/res/drawable/ic_expand_less.xml @@ -4,7 +4,7 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/drawable/ic_expand_more.xml b/app/src/main/res/drawable/ic_expand_more.xml index 77316f76e..8c09c2dba 100644 --- a/app/src/main/res/drawable/ic_expand_more.xml +++ b/app/src/main/res/drawable/ic_expand_more.xml @@ -4,7 +4,7 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/drawable/ic_group_dark.xml b/app/src/main/res/drawable/ic_group_dark.xml index 2a6a0c4eb..ff2648394 100644 --- a/app/src/main/res/drawable/ic_group_dark.xml +++ b/app/src/main/res/drawable/ic_group_dark.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/ic_info_dark.xml b/app/src/main/res/drawable/ic_info_dark.xml index 814d75df1..a362bdd82 100644 --- a/app/src/main/res/drawable/ic_info_dark.xml +++ b/app/src/main/res/drawable/ic_info_dark.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml index 0cae7307b..5a27b1862 100644 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -15,22 +15,22 @@ android:translateY="729.8276"> + android:fillColor="@color/accentColor" /> + android:fillColor="@color/accentColor" /> + android:fillColor="@color/accentColor" /> + android:fillColor="@color/accentColor" /> + android:fillColor="@color/accentColor" /> + android:fillColor="@color/accentColor" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_network_wifi_dark.xml b/app/src/main/res/drawable/ic_network_wifi_dark.xml index 1ad040383..a971c5fe5 100644 --- a/app/src/main/res/drawable/ic_network_wifi_dark.xml +++ b/app/src/main/res/drawable/ic_network_wifi_dark.xml @@ -1,6 +1,6 @@ - - - + + diff --git a/app/src/main/res/drawable/ic_notifications_dark.xml b/app/src/main/res/drawable/ic_notifications_dark.xml index a9edcb240..252ccdc9c 100644 --- a/app/src/main/res/drawable/ic_notifications_dark.xml +++ b/app/src/main/res/drawable/ic_notifications_dark.xml @@ -2,9 +2,8 @@ android:width="32dp" android:height="32dp" android:viewportWidth="24.0" - android:viewportHeight="24.0" - android:alpha="0.54"> + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_playlist_add_check_dark.xml b/app/src/main/res/drawable/ic_playlist_add_check_dark.xml index c0a4d4df7..26a9d87aa 100644 --- a/app/src/main/res/drawable/ic_playlist_add_check_dark.xml +++ b/app/src/main/res/drawable/ic_playlist_add_check_dark.xml @@ -2,9 +2,8 @@ android:width="24dp" android:height="24dp" android:viewportWidth="24.0" - android:viewportHeight="24.0" - android:alpha="0.54"> + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_remove_circle_dark.xml b/app/src/main/res/drawable/ic_remove_circle_dark.xml index 0593dbcf4..d1979654d 100644 --- a/app/src/main/res/drawable/ic_remove_circle_dark.xml +++ b/app/src/main/res/drawable/ic_remove_circle_dark.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/drawable/ic_settings_action.xml b/app/src/main/res/drawable/ic_settings_action.xml index 1e98e2d91..9ef8e4345 100644 --- a/app/src/main/res/drawable/ic_settings_action.xml +++ b/app/src/main/res/drawable/ic_settings_action.xml @@ -1,6 +1,6 @@ - - + diff --git a/app/src/main/res/drawable/ic_settings_dark.xml b/app/src/main/res/drawable/ic_settings_dark.xml index 0f915b868..ab91cefc5 100644 --- a/app/src/main/res/drawable/ic_settings_dark.xml +++ b/app/src/main/res/drawable/ic_settings_dark.xml @@ -10,9 +10,8 @@ android:width="24dp" android:height="24dp" android:viewportHeight="24.0" - android:viewportWidth="24.0" - android:alpha=".54"> + android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_share_action.xml b/app/src/main/res/drawable/ic_share_action.xml index 219e8cd7e..8a4a4bf95 100644 --- a/app/src/main/res/drawable/ic_share_action.xml +++ b/app/src/main/res/drawable/ic_share_action.xml @@ -1,6 +1,6 @@ - - + diff --git a/app/src/main/res/drawable/ic_signal_cellular_off_dark.xml b/app/src/main/res/drawable/ic_signal_cellular_off_dark.xml index bd7da287f..79593ab38 100644 --- a/app/src/main/res/drawable/ic_signal_cellular_off_dark.xml +++ b/app/src/main/res/drawable/ic_signal_cellular_off_dark.xml @@ -5,6 +5,6 @@ android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_sync_action.xml b/app/src/main/res/drawable/ic_sync_action.xml index 5af579d61..6b9cd3cf2 100644 --- a/app/src/main/res/drawable/ic_sync_action.xml +++ b/app/src/main/res/drawable/ic_sync_action.xml @@ -1,6 +1,6 @@ - - + diff --git a/app/src/main/res/drawable/ic_sync_white.xml b/app/src/main/res/drawable/ic_sync_white.xml index 864d97e18..760a2c72f 100644 --- a/app/src/main/res/drawable/ic_sync_white.xml +++ b/app/src/main/res/drawable/ic_sync_white.xml @@ -4,6 +4,6 @@ android:viewportHeight="24.0" android:viewportWidth="24.0"> diff --git a/app/src/main/res/drawable/ic_today_dark.xml b/app/src/main/res/drawable/ic_today_dark.xml index f9612eb78..a5cc13091 100644 --- a/app/src/main/res/drawable/ic_today_dark.xml +++ b/app/src/main/res/drawable/ic_today_dark.xml @@ -6,8 +6,8 @@ ~ http://www.gnu.org/licenses/gpl.html --> - - + diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml index 71c6a80ea..f8a12d50e 100644 --- a/app/src/main/res/layout/about.xml +++ b/app/src/main/res/layout/about.xml @@ -35,6 +35,7 @@ android:layout_height="wrap_content" android:textAlignment="center" android:textAppearance="?android:attr/textAppearanceLarge" + android:textColor="@color/primaryTextColor" android:text="DAVx⁵" tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/account_carddav_item.xml b/app/src/main/res/layout/account_carddav_item.xml index 9cdf098a3..0a8715b7b 100644 --- a/app/src/main/res/layout/account_carddav_item.xml +++ b/app/src/main/res/layout/account_carddav_item.xml @@ -60,6 +60,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingRight="0dp" - style="@style/Widget.AppCompat.ActionButton.Overflow"/> + android:tint="@color/accentColor" + android:src="@lineageos.platform:drawable/ic_menu" /> \ No newline at end of file diff --git a/app/src/main/res/layout/account_list_item.xml b/app/src/main/res/layout/account_list_item.xml index 585c29df4..5f953ef5c 100644 --- a/app/src/main/res/layout/account_list_item.xml +++ b/app/src/main/res/layout/account_list_item.xml @@ -42,7 +42,7 @@ android:layout_height="wrap_content" android:layout_marginTop="8dp" android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5" - android:textColor="@android:color/white" + android:textColor="@color/viewOnAccentColor" tools:text="Account Name"/> diff --git a/app/src/main/res/layout/accounts_content.xml b/app/src/main/res/layout/accounts_content.xml index 02cbe4d55..84b4842fa 100644 --- a/app/src/main/res/layout/accounts_content.xml +++ b/app/src/main/res/layout/accounts_content.xml @@ -21,7 +21,8 @@ android:layout_height="wrap_content"> diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 29af333ac..a993d6429 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -16,19 +16,20 @@ + style="@style/custom_toolbar_style" + android:background="@color/primaryDarkColor"> + app:popupTheme="@style/custom_popup_theme" /> + style="@style/custom_tab_style" /> diff --git a/app/src/main/res/layout/activity_account.xml b/app/src/main/res/layout/activity_account.xml index 70ffada12..c1948c267 100644 --- a/app/src/main/res/layout/activity_account.xml +++ b/app/src/main/res/layout/activity_account.xml @@ -14,20 +14,20 @@ + style="@style/custom_toolbar_style" + android:background="@color/primaryDarkColor"> + app:popupTheme="@style/custom_popup_theme" /> + style="@style/custom_tab_style" /> diff --git a/app/src/main/res/layout/activity_accounts.xml b/app/src/main/res/layout/activity_accounts.xml index 977ecaf9f..4011c21f8 100644 --- a/app/src/main/res/layout/activity_accounts.xml +++ b/app/src/main/res/layout/activity_accounts.xml @@ -24,6 +24,7 @@ android:layout_height="match_parent" android:layout_gravity="start" android:fitsSystemWindows="true" + android:background="@color/backgroundColor" app:headerLayout="@layout/nav_header_accounts" app:menu="@menu/activity_accounts_drawer"/> diff --git a/app/src/main/res/layout/activity_create_address_book.xml b/app/src/main/res/layout/activity_create_address_book.xml index 0b9b7e3d5..382ac9f5f 100644 --- a/app/src/main/res/layout/activity_create_address_book.xml +++ b/app/src/main/res/layout/activity_create_address_book.xml @@ -32,7 +32,8 @@ android:id="@+id/display_name" android:layout_width="match_parent" android:layout_height="wrap_content" - style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" + style="@style/edittext_holder_style" + android:theme="@style/edittext_holder_theme" android:hint="@string/create_collection_display_name" app:layout_constraintHorizontal_weight="1" app:layout_constraintTop_toTopOf="parent" @@ -40,6 +41,7 @@ @@ -48,7 +50,8 @@ android:id="@+id/description" android:layout_width="match_parent" android:layout_height="wrap_content" - style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" + style="@style/edittext_holder_style" + android:theme="@style/edittext_holder_theme" android:hint="@string/create_collection_description" app:helperText="@string/create_collection_optional" app:layout_constraintStart_toStartOf="parent" @@ -56,6 +59,7 @@ diff --git a/app/src/main/res/layout/custom_simple_list_item_1.xml b/app/src/main/res/layout/custom_simple_list_item_1.xml new file mode 100644 index 000000000..d28e203b2 --- /dev/null +++ b/app/src/main/res/layout/custom_simple_list_item_1.xml @@ -0,0 +1,11 @@ + + diff --git a/app/src/main/res/layout/custom_simple_list_item_2.xml b/app/src/main/res/layout/custom_simple_list_item_2.xml new file mode 100644 index 000000000..575099cce --- /dev/null +++ b/app/src/main/res/layout/custom_simple_list_item_2.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/app/src/main/res/layout/delete_collection.xml b/app/src/main/res/layout/delete_collection.xml index 784dcd1d5..3a8daf6d7 100644 --- a/app/src/main/res/layout/delete_collection.xml +++ b/app/src/main/res/layout/delete_collection.xml @@ -62,6 +62,7 @@ android:id="@+id/cancel" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textColor="@color/accentColor" style="@style/Widget.MaterialComponents.Button.TextButton.Dialog" android:text="@android:string/cancel"/> @@ -69,6 +70,7 @@ android:id="@+id/ok" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textColor="@color/accentColor" style="@style/Widget.MaterialComponents.Button.TextButton.Dialog" android:enabled="@{model.confirmation ?? false}" android:text="@android:string/ok"/> diff --git a/app/src/main/res/layout/fragment_eelo_authenticator.xml b/app/src/main/res/layout/fragment_eelo_authenticator.xml index dc2cc766a..1e416b8a5 100644 --- a/app/src/main/res/layout/fragment_eelo_authenticator.xml +++ b/app/src/main/res/layout/fragment_eelo_authenticator.xml @@ -1,5 +1,4 @@ - - + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> - + + + + type="foundation.e.accountmanager.ui.setup.EeloAuthenticatorModel" /> - - - - - - - + + + + + + + + - - + + - - - - - - + + + + + - - - - - - - - + + + - - - - + + + + + + + + + android:paddingEnd="16dp" + android:theme="@style/edittext_holder_theme"> - + android:id="@+id/urlpwd_server_uri" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:enabled="false" + android:hint="@string/login_server_uri" + android:inputType="textUri" + android:textAlignment="textStart" + android:textColor="@color/primaryTextColor" /> + - + - + android:layout_height="wrap_content"> + style="@style/stepper_nav_button" + android:layout_width="0dp" + android:layout_weight="1" />