diff --git a/app/build.gradle b/app/build.gradle index 7729183cfc5b931549e2b205db5080a29c7e0fe9..6b5f9e45679a3bd938741493bb59ee1d2da89a4e 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 057764ff211721710fd00f93322241890a646951..e2db9e1fd03b2f8596166b623bc65dbfaa4f9849 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 8017cae58b3e30168e8524d155029cc6eb80657b..aedf65232c9887240b50d751296ec4922243dfe2 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 fc7474f5b50cecd5389600196ccc868803ed025e..e56a55552ba037bc47be14ffb0608350c0505ac5 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 945fb929f8ba596b494266b1d2e00b41589f93e0..0abe8d1404c3dac64425bc85e27b9e1bfc2233e3 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 967474dcfebbc26cc4b32c473783dfa106cc5cce..3074edda1d290929a4bcd55d9187863ca0a0a68e 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 73319f060e1f1d8b7c3547c426be48678af62122..0b31902b9d6427531f3d92c1ee6783191f3b245a 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 58b6cd7a20bd602eaf8ab07069fbf2ed8dbedfb4..b1f8178662b2883e7bbfcc005ecc5c541be5ccfc 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 9c65f7817cebaf934fc7d043527bb674e7324656..d5d4450b19109a1bea295f11fa92ef663e254597 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 77363c2a4a7547c9e3e75da8d4ecf4b103d9ac2f..f124a460d20f2e4d2f641e0c88588808c8cf3664 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 3564ceb05cccbcb251005171e5fbb7ab27b4bcae..1786ffe74650b5ee0fb28a31536f09099c081719 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 1ec931b00a8fca2f48aa768f9ce0d9afa14279d0..a5e752a1b2faf787d90719ab86065ec435df3270 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 0000000000000000000000000000000000000000..684a6daceaa383dcfec24f434da8f50fde50f286 --- /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 51c7e5d0daf9e0caef41527c91b8e89c094b7bc3..c4f4c404239a248572f06fead4eb8706d425696e 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 f284d1a89e80a7c0e877ef2bf6cbb3bf672e2d7d..5e55c985dc3eb2739637beef247a0ab3714adac4 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 86af14821c14d2144a4c6eeb6b46426bed4307a3..608e3bb1b634675b0c3800a40190d0e4cc7ec725 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 ed44b85de1030033722bdb249ed0432dbd9120d3..d3c1906efe5d96bb788486cbf6bd5e5485146fb1 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 ed235312183e41833a4c1e841fd1b04c1ab3ee1d..f6ee92b30a60670dbe8752f1f037739cd2f8175a 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 c8f158e7e5bfce5acb33cc235c0e1239832040b9..71a0861c1eac2d48510f0f73b9998180e93c7ad8 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 3be00f0a553b61437c4d75233c33b2b2dcfc661c..295ec8cf1fc172b82946fdc3c18dab0219846aff 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 c9fd74628a8d1d51b2d28c59d691969e5b7b583b..aa807c8f6d2634fd00fe4e9c6d1945d93c4e0981 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 948a5be51c12ffc59d080ab5de7a95593efc13ba..ac7580d689901bc15756753a334b2bfd001cd69f 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 8f26f9e53eeaeafa7c093017134947d4b6de06e8..931eba9bcd2db0ea8fcb5fe8bbe3c3bf184d7e48 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 aee4a2c7c8e43c3b4a2bb58849b6ac34b97c1cba..de17740e870988da74b3bee79b38961642260347 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 ded97e98c5bb6e35f572fa50da85a15d8f379508..ebe8027678b180607f5c0de23c5be588ae15bc9a 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 0000000000000000000000000000000000000000..07f2e7d2b1f2e0a724f1dd7f9db6e895cb893384 --- /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 c066dc99206e349c915a0654cfef6b31fbdf84d3..6c576f130bfcb97dd68919413fe84ea0f3845c40 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 30a106fec9749c057e507837c9bf7a2dcb31e5dc..e8ab253fa49ccfeb002e150d8b659fb5d7dcfe4c 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 77316f76e6b5c438b29976c1e704168e2d63c837..8c09c2dbaed46f1165557e069a3e62837d0f8445 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 2a6a0c4eb1f6deb1eb0c3b5b6a0c85350a6ba169..ff2648394d121f313f65b154acbbed071eb36b7e 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 814d75df1112adaec40b79f7a1c8fcb356c3c5ab..a362bdd82b30ea4cbdd92fb63e23f4598ac8c051 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 0cae7307bcaed231a19a0847a68a39fcee1e6ad0..5a27b18627a5a34421d9d53e486201182178a2b8 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 1ad040383eb018278e7f7cd77d6e0336b7e43310..a971c5fe51944ac2efca1881e8959b4d979f71f4 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 a9edcb2407102b5dbb3355f25ab93967d79a1c82..252ccdc9cf5863ed9c838487aea941cfbd8f9c08 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 c0a4d4df712e698c3ff531e43b20664098aa9e13..26a9d87aa98f637ed30e9fc65bb9fed4ce47c86d 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 0593dbcf4842e29d1270928c877e6bf34c5667bc..d1979654df8a2bb4540a333a333adf41e068e6e4 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 1e98e2d91c712824598eecd80729dcd43dc9cc67..9ef8e4345ddbce158aee9817206ccb4aeaf232c0 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 0f915b8689e8cb415c2e669f705273cb3c0bb0d6..ab91cefc53f42b4b6ba11a1b95870bcee876d1f8 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 219e8cd7e02b7b502657f0d6e9386ae37339a255..8a4a4bf95e270bd65272931c6da180f2ffa9f938 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 bd7da287f49181561663aad53599ae5f84795056..79593ab3866982b2e3103d6777d1e242b1a7e6c4 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 5af579d61a72e42e08b47c7653e7013805cbb4d4..6b9cd3cf273227e7b72447c66c840ff920a03863 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 864d97e185110dd3276669c9aed2ded56b7c6b35..760a2c72fcf67851e5174dc21a0958cb3093e5cd 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 f9612eb78c443029d7ee2b7081e1d4cf4bff0896..a5cc130910b6d7350eedf40505613a8396334547 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 71c6a80ea8ac8bfd2a135a1783eaf426857429c1..f8a12d50e1cac52006cf690ad1ffb15eaf67912e 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 9cdf098a301d0f6739775eddd06543454612100d..0a8715b7b6b94bbe028f83c9fb0a93f975f365d8 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 585c29df451211a46d0a1b3cd16320d373572a9b..5f953ef5c64fb66dfbf77eaf679ee103a8696752 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 02cbe4d55719cd9f8b09c7740d3de1f1fdad7b92..84b4842fae6cb612035ec49ddd8d941fcde7961e 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 29af333ac1b7354439b9592c3a908b3132550064..a993d6429dd300e8b9eb8a2cad1d217a3cf26953 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 70ffada12918d8512a54f233b7280e384dc95078..c1948c267b6b3de3746b5214aee1a056e1a2007b 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 977ecaf9fbaeb082080e5747ff1ad6dc7cda6d57..4011c21f8e4cf315f8dcd2ed7e7322dd8a9bce64 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 0b9b7e3d5be7814c678e9fa60c11c2ec04f4f07c..382ac9f5f8774e9130e8dd5caa653b26dccb1261 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 0000000000000000000000000000000000000000..d28e203b21d1f735106e2781fae4ac0504c52a20 --- /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 0000000000000000000000000000000000000000..575099cce828e8a90667fa88f40b00791af60391 --- /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 784dcd1d5cb7a3c4cf00b1d2116056a4166da05c..3a8daf6d75806ceacc03cca4b875f1f6761423f1 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 dc2cc766a1de90878a0cc814fcc959a04b90fc17..1e416b8a55dc243e68d7263d0fbb5c7658598b13 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" />