Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85acf7c9 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

Merge branch '1327-ui-update' into 'main'

1327 ui update

See merge request !135
parents 56d3b855 08bf29c1
Loading
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -75,11 +75,6 @@
            android:configChanges="locale"
            android:label="@string/account_setup_basics_title"/>

        <activity
            android:name=".activity.setup.AccountSetupImportSettings"
            android:configChanges="locale"
            android:label="@string/settings_import_title"/>

        <activity
            android:name=".activity.setup.AccountSetupAccountType"
            android:configChanges="locale"
+5 −3
Original line number Diff line number Diff line
/*
 * Copyright ECORP SAS 2022
 * Copyright ECORP SAS 2022-2023
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
@@ -52,7 +52,6 @@ import com.fsck.k9.Preferences
import com.fsck.k9.account.AccountCreator
import com.fsck.k9.account.BackgroundAccountRemover
import com.fsck.k9.activity.compose.MessageActions
import com.fsck.k9.activity.setup.AccountSetupBasics
import com.fsck.k9.activity.setup.accountmanager.EeloAccountCreator
import com.fsck.k9.controller.MessageReference
import com.fsck.k9.controller.MessagingController
@@ -81,6 +80,7 @@ import com.fsck.k9.ui.messageview.MessageViewContainerFragment
import com.fsck.k9.ui.messageview.MessageViewContainerFragment.MessageViewContainerListener
import com.fsck.k9.ui.messageview.MessageViewFragment.MessageViewFragmentListener
import com.fsck.k9.ui.messageview.PlaceholderFragment
import com.fsck.k9.ui.onboarding.OnboardingActivity
import com.fsck.k9.ui.permissions.K9PermissionUiHelper
import com.fsck.k9.ui.permissions.Permission
import com.fsck.k9.ui.permissions.PermissionUiHelper
@@ -181,7 +181,9 @@ open class MessageList :
        if (!hasAccountSetup) {
            generalSettingsManager.setReloadAccountChipsColors(false)

            AccountSetupBasics.actionNewAccount(this)

            val intent = Intent(this, OnboardingActivity::class.java)
            startActivity(intent)
            finish()
            return
        }
+0 −10
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ class AccountSetupBasics : K9Activity() {
    private lateinit var advancedOptionsContainer: View
    private lateinit var nextButton: Button
    private lateinit var manualSetupButton: Button
    private lateinit var importSettingsButton: Button
    private lateinit var allowClientCertificateView: ViewGroup

    private var uiState = UiState.EMAIL_ADDRESS_ONLY
@@ -88,10 +87,7 @@ class AccountSetupBasics : K9Activity() {
        advancedOptionsContainer = findViewById(R.id.foldable_advanced_options)
        nextButton = findViewById(R.id.next)
        manualSetupButton = findViewById(R.id.manual_setup)
        importSettingsButton = findViewById(R.id.import_settings)

        manualSetupButton.setOnClickListener { onManualSetup() }
        importSettingsButton.setOnClickListener { onImportSettings() }
    }

    override fun onPostCreate(savedInstanceState: Bundle?) {
@@ -339,12 +335,6 @@ class AccountSetupBasics : K9Activity() {
        AccountSetupAccountType.actionSelectAccountType(this, account, makeDefault = false, initialAccountSettings)
    }

    private fun onImportSettings() {
        val intent = Intent(this, AccountSetupImportSettings::class.java)
        startActivity(intent)
        finish()
    }

    private fun initAccount(email: String): Account {
        val account = this.account ?: createAccount().also { this.account = it }

+0 −78
Original line number Diff line number Diff line
/*
 * Copyright MURENA SAS 2023
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package com.fsck.k9.activity.setup

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.MenuItem
import com.fsck.k9.activity.MessageList
import com.fsck.k9.ui.R
import com.fsck.k9.ui.base.K9Activity
import com.fsck.k9.ui.settings.import.SettingsImportResultViewModel
import com.fsck.k9.ui.settings.import.SettingsImportSuccess
import org.koin.androidx.viewmodel.ext.android.viewModel

/**
 * Prompts the user to select a exported settings file
 *
 */
class AccountSetupImportSettings : K9Activity() {

    private val resultViewModel: SettingsImportResultViewModel by viewModel()

    public override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setLayout(R.layout.account_setup_import_settings)
        setUpActionBar()

        handleOnSuccessCallback()
    }

    private fun handleOnSuccessCallback() {
        resultViewModel.settingsImportResult.observe(this) {
            if (it == SettingsImportSuccess) {
                startActivityClearTop(MessageList::class.java)
            }
        }
    }

    private fun <T : Activity> startActivityClearTop(clazz: Class<T>) {
        val intent = Intent(this@AccountSetupImportSettings, clazz)
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
        startActivity(intent)
        finish()
    }

    private fun setUpActionBar() {
        setTitle(R.string.settings_import_title)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        if (item.itemId == android.R.id.home) {
            onBackPressed()
            return true
        }

        return super.onOptionsItemSelected(item)
    }

    override fun onBackPressed() {
        startActivityClearTop(AccountSetupBasics::class.java)
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ class OnboardingActivity : K9Activity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setLayout(R.layout.activity_onboarding)
        setTitle(R.string.account_setup_basics_title)

        initializeActionBar()
    }
Loading