Add mailbox view UI to v4 flavor

Added a new v4 design for the mailbox view and made it work with the existing logic.

MAILAND-1495
This commit is contained in:
stefanija 2021-03-15 02:13:04 +01:00
parent 5549e51c2a
commit b07b7e5552
46 changed files with 2036 additions and 182 deletions

View File

@ -18,6 +18,7 @@
*/
package ch.protonmail.android.activities;
import static ch.protonmail.android.core.Constants.FLAVOR_V4;
import static ch.protonmail.android.settings.pin.ValidatePinActivityKt.EXTRA_FRAGMENT_TITLE;
import static ch.protonmail.android.settings.pin.ValidatePinActivityKt.EXTRA_LOGOUT;
import static ch.protonmail.android.settings.pin.ValidatePinActivityKt.EXTRA_PIN_VALID;
@ -53,6 +54,7 @@ import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
import ch.protonmail.android.BuildConfig;
import ch.protonmail.android.R;
import ch.protonmail.android.activities.messageDetails.MessageDetailsActivity;
import ch.protonmail.android.adapters.swipe.SwipeProcessor;
@ -129,7 +131,7 @@ public abstract class BaseActivity extends AppCompatActivity implements INetwork
@BindView(R.id.layout_no_connectivity_info)
protected View mConnectivitySnackLayout;
@Nullable
@BindView(R.id.screenProtector)
@BindView(R.id.screenProtectorView)
protected View mScreenProtectorLayout;
private BroadcastReceiver mLangReceiver = null;
@ -177,7 +179,9 @@ public abstract class BaseActivity extends AppCompatActivity implements INetwork
setSupportActionBar(mToolbar);
}
UiUtil.setStatusBarColor(this, ContextCompat.getColor(this, R.color.dark_purple_statusbar));
if (!BuildConfig.FLAVOR.equals(FLAVOR_V4)) {
UiUtil.setStatusBarColor(this, ContextCompat.getColor(this, R.color.dark_purple_statusbar));
}
ForceSwitchedAccountNotifier.notifier.observe(this, event -> {
if (event != null) {

View File

@ -30,6 +30,7 @@ import androidx.drawerlayout.widget.DrawerLayout
import androidx.lifecycle.Observer
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.RecyclerView
import ch.protonmail.android.BuildConfig
import ch.protonmail.android.R
import ch.protonmail.android.activities.dialogs.QuickSnoozeDialogFragment
import ch.protonmail.android.activities.multiuser.AccountManagerActivity
@ -50,6 +51,7 @@ import ch.protonmail.android.api.segments.event.AlarmReceiver
import ch.protonmail.android.api.segments.event.FetchUpdatesJob
import ch.protonmail.android.contacts.ContactsActivity
import ch.protonmail.android.core.Constants
import ch.protonmail.android.core.Constants.FLAVOR_V4
import ch.protonmail.android.core.UserManager
import ch.protonmail.android.data.local.MessageDatabase
import ch.protonmail.android.domain.entity.Id
@ -74,6 +76,7 @@ import ch.protonmail.android.utils.ui.dialogs.DialogUtils
import ch.protonmail.android.utils.ui.dialogs.DialogUtils.Companion.showTwoButtonInfoDialog
import ch.protonmail.android.views.DrawerHeaderView
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.activity_mailbox.*
import kotlinx.android.synthetic.main.drawer_header.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@ -319,7 +322,9 @@ abstract class NavigationActivity :
onUserClicked(false)
drawerHeaderView.switchState()
}
drawerToggle.syncState()
if (BuildConfig.FLAVOR != FLAVOR_V4) {
drawerToggle.syncState()
}
navigationDrawerRecyclerView!!.smoothScrollToPosition(0)
onDrawerClose()
onDrawerClose = {}
@ -489,7 +494,9 @@ abstract class NavigationActivity :
fun onSignOutSelected() {
fun onLogoutConfirmed(currentUserId: Id, hasNextLoggedInUser: Boolean) {
findViewById<View>(R.id.spinner_layout)?.visibility = View.VISIBLE
if (BuildConfig.FLAVOR != FLAVOR_V4) {
findViewById<View>(R.id.spinner_layout)?.visibility = View.VISIBLE
}
lifecycleScope.launch {
if (hasNextLoggedInUser) {

View File

@ -41,6 +41,7 @@ import android.view.MenuItem
import android.view.View
import android.view.WindowManager
import android.widget.AbsListView.MultiChoiceModeListener
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.activity.viewModels
@ -53,12 +54,14 @@ import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.switchMap
import androidx.loader.app.LoaderManager
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener
import androidx.work.WorkInfo
import ch.protonmail.android.BuildConfig
import ch.protonmail.android.R
import ch.protonmail.android.activities.EXTRA_FIRST_LOGIN
import ch.protonmail.android.activities.EXTRA_HAS_SWITCHED_USER
@ -111,6 +114,7 @@ import ch.protonmail.android.api.services.MessagesService.Companion.startFetchMe
import ch.protonmail.android.api.services.MessagesService.Companion.startFetchMessagesByLabel
import ch.protonmail.android.core.Constants
import ch.protonmail.android.core.Constants.DrawerOptionType
import ch.protonmail.android.core.Constants.FLAVOR_V4
import ch.protonmail.android.core.Constants.MessageLocationType
import ch.protonmail.android.core.Constants.MessageLocationType.Companion.fromInt
import ch.protonmail.android.core.Constants.Prefs.PREF_DONT_SHOW_PLAY_SERVICES
@ -179,6 +183,10 @@ import com.google.firebase.iid.FirebaseInstanceId
import com.squareup.otto.Subscribe
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.activity_mailbox.*
import kotlinx.android.synthetic.main.activity_mailbox.mailboxRecyclerView
import kotlinx.android.synthetic.main.activity_mailbox.screenShotPreventerView
import kotlinx.android.synthetic.main.activity_mailbox.storageLimitAlert
import kotlinx.android.synthetic.v4.activity_mailbox.*
import kotlinx.android.synthetic.main.fragment_billing.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.launchIn
@ -207,7 +215,6 @@ const val LOADER_ID_LABELS_OFFLINE = 32
private const val REQUEST_CODE_TRASH_MESSAGE_DETAILS = 1
private const val REQUEST_CODE_COMPOSE_MESSAGE = 19
@AndroidEntryPoint
class MailboxActivity :
NavigationActivity(),
@ -354,12 +361,21 @@ class MailboxActivity :
setUpDrawer()
setTitle()
messages_list_view.adapter = messagesAdapter
messages_list_view.layoutManager = LinearLayoutManager(this)
mailboxRecyclerView.adapter = messagesAdapter
mailboxRecyclerView.layoutManager = LinearLayoutManager(this)
if (BuildConfig.FLAVOR == FLAVOR_V4) {
val itemDecoration = DividerItemDecoration(mailboxRecyclerView.context, DividerItemDecoration.VERTICAL)
itemDecoration.setDrawable(getDrawable(R.drawable.list_divider)!!)
mailboxRecyclerView.addItemDecoration(itemDecoration)
}
buildSwipeProcessor()
initializeSwipeRefreshLayout(swipe_refresh_layout)
initializeSwipeRefreshLayout(spinner_layout)
initializeSwipeRefreshLayout(no_messages_layout)
if (BuildConfig.FLAVOR == FLAVOR_V4) {
initializeSwipeRefreshLayout(mailboxSwipeRefreshLayout)
} else {
initializeSwipeRefreshLayout(swipe_refresh_layout)
initializeSwipeRefreshLayout(spinner_layout)
initializeSwipeRefreshLayout(no_messages_layout)
}
if (userManager.isFirstMailboxLoad) {
swipeCustomizeSnack = Snackbar.make(
@ -401,7 +417,7 @@ class MailboxActivity :
checkRegistration()
closeDrawer()
messages_list_view.addOnScrollListener(listScrollListener)
mailboxRecyclerView.addOnScrollListener(listScrollListener)
fetchOrganizationData()
@ -411,7 +427,7 @@ class MailboxActivity :
mailboxLocationMain.observe(this, messagesAdapter::setNewLocation)
messagesLiveData.observe(this, MessagesListObserver(messagesAdapter))
ItemTouchHelper(SwipeController()).attachToRecyclerView(messages_list_view)
ItemTouchHelper(SwipeController()).attachToRecyclerView(mailboxRecyclerView)
if (extras != null && extras.getBoolean(EXTRA_HAS_SWITCHED_USER, false)) {
if (EXTRA_SWITCHED_TO_USER_ID in extras) {
@ -428,11 +444,11 @@ class MailboxActivity :
override fun secureContent(): Boolean = true
override fun enableScreenshotProtector() {
screenShotPreventer.visibility = View.VISIBLE
screenShotPreventerView.visibility = View.VISIBLE
}
override fun disableScreenshotProtector() {
screenShotPreventer.visibility = View.GONE
screenShotPreventerView.visibility = View.GONE
}
private fun startObserving() {
@ -627,6 +643,10 @@ class MailboxActivity :
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
if (BuildConfig.FLAVOR == FLAVOR_V4) {
setElevationOnToolbarAndStatusView(false)
}
}
private inner class MessagesListObserver(
@ -638,6 +658,16 @@ class MailboxActivity :
}
}
private fun setElevationOnToolbarAndStatusView(shouldIncreaseElevation: Boolean) {
if (shouldIncreaseElevation) {
supportActionBar?.elevation = 32F
mailboxStatusLayout.elevation = 32F
} else {
supportActionBar?.elevation = 0F
mailboxStatusLayout.elevation = 0F
}
}
private val listScrollListener: RecyclerView.OnScrollListener = object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(view: RecyclerView, scrollState: Int) {
scrollStateChanged =
@ -655,6 +685,15 @@ class MailboxActivity :
if (lastVisibleItem == lastPosition && dy > 0 && !setLoadingMore(true)) {
loadMoreMessages()
}
if (BuildConfig.FLAVOR == FLAVOR_V4) {
val firstVisibleItem = layoutManager.findFirstCompletelyVisibleItemPosition()
if (firstVisibleItem == 0) {
setElevationOnToolbarAndStatusView(false)
} else {
setElevationOnToolbarAndStatusView(true)
}
}
}
private fun loadMoreMessages() {
@ -724,7 +763,9 @@ class MailboxActivity :
syncUUID = UUID.randomUUID().toString()
if (userManager.isBackgroundSyncEnabled) {
setRefreshing(true)
layout_sync.visibility = View.VISIBLE
if (BuildConfig.FLAVOR != FLAVOR_V4) {
layout_sync.visibility = View.VISIBLE
}
}
if (firstLogin == null) {
firstLogin = intent.getBooleanExtra(EXTRA_FIRST_LOGIN, false)
@ -820,7 +861,9 @@ class MailboxActivity :
reloadMessageCounts()
registerFcmReceiver()
checkDelinquency()
no_messages_layout.visibility = View.GONE
if (BuildConfig.FLAVOR != FLAVOR_V4) {
no_messages_layout.visibility = View.GONE
}
mailboxViewModel.checkConnectivity()
val mailboxLocation = mailboxLocationMain.value
if (mailboxLocation == MessageLocationType.INBOX) {
@ -859,11 +902,36 @@ class MailboxActivity :
super.onSaveInstanceState(outState)
}
private fun setUpMenuItems(composeMenuItem: MenuItem, searchMenuItem: MenuItem) {
composeMenuItem.actionView.findViewById<ImageView>(R.id.composeImageView)
.setOnClickListener {
mailboxViewModel.usedSpaceActionEvent(FLOW_TRY_COMPOSE)
}
searchMenuItem.actionView.findViewById<ImageView>(R.id.searchImageView)
.setOnClickListener {
val intent = AppUtil.decorInAppIntent(
Intent(
this@MailboxActivity,
SearchActivity::class.java
)
)
startActivity(intent)
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.mailbox_options_menu, menu)
val mailboxLocation = mailboxLocationMain.value
menu.findItem(R.id.empty).isVisible =
mailboxLocation in listOf(MessageLocationType.DRAFT, MessageLocationType.SPAM, MessageLocationType.TRASH)
if (BuildConfig.FLAVOR == FLAVOR_V4) {
setUpMenuItems(menu.findItem(R.id.compose), menu.findItem(R.id.search))
} else {
menu.findItem(R.id.empty).isVisible =
mailboxLocation in listOf(
MessageLocationType.DRAFT,
MessageLocationType.SPAM,
MessageLocationType.TRASH
)
}
return true
}
@ -871,14 +939,18 @@ class MailboxActivity :
menu.clear()
menuInflater.inflate(R.menu.mailbox_options_menu, menu)
val mailboxLocation = mailboxLocationMain.value
menu.findItem(R.id.empty).isVisible =
mailboxLocation in listOf(
MessageLocationType.DRAFT,
MessageLocationType.SPAM,
MessageLocationType.TRASH,
MessageLocationType.LABEL,
MessageLocationType.LABEL_FOLDER
)
if (BuildConfig.FLAVOR == FLAVOR_V4) {
setUpMenuItems(menu.findItem(R.id.compose), menu.findItem(R.id.search))
} else {
menu.findItem(R.id.empty).isVisible =
mailboxLocation in listOf(
MessageLocationType.DRAFT,
MessageLocationType.SPAM,
MessageLocationType.TRASH,
MessageLocationType.LABEL,
MessageLocationType.LABEL_FOLDER
)
}
return super.onPrepareOptionsMenu(menu)
}
@ -918,12 +990,16 @@ class MailboxActivity :
override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
drawerToggle.syncState()
if (BuildConfig.FLAVOR != FLAVOR_V4) {
drawerToggle.syncState()
}
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
drawerToggle.syncState()
if (BuildConfig.FLAVOR != FLAVOR_V4) {
drawerToggle.syncState()
}
}
override fun onBackPressed() {
@ -937,21 +1013,29 @@ class MailboxActivity :
}
private fun initializeSwipeRefreshLayout(swipeRefreshLayoutAux: SwipeRefreshLayout) {
swipeRefreshLayoutAux.setColorSchemeResources(R.color.ultramarine_blue, R.color.lake_blue)
if (BuildConfig.FLAVOR == FLAVOR_V4) {
swipeRefreshLayoutAux.setColorSchemeResources(R.color.cornflower_blue)
} else {
swipeRefreshLayoutAux.setColorSchemeResources(R.color.ultramarine_blue, R.color.lake_blue)
}
swipeRefreshLayoutAux.setOnRefreshListener(this)
}
fun setRefreshing(shouldRefresh: Boolean) {
Timber.v("setRefreshing shouldRefresh:$shouldRefresh")
swipe_refresh_layout.isRefreshing = shouldRefresh
spinner_layout.isRefreshing = shouldRefresh
no_messages_layout.isRefreshing = shouldRefresh
spinner_layout.visibility = if (shouldRefresh) View.VISIBLE else View.GONE
if (BuildConfig.FLAVOR == FLAVOR_V4) {
mailboxSwipeRefreshLayout.isRefreshing = shouldRefresh
} else {
swipe_refresh_layout.isRefreshing = shouldRefresh
spinner_layout.isRefreshing = shouldRefresh
no_messages_layout.isRefreshing = shouldRefresh
spinner_layout.visibility = if (shouldRefresh) View.VISIBLE else View.GONE
}
}
private fun setLoadingMore(loadingMore: Boolean): Boolean {
val previousValue = isLoadingMore.getAndSet(loadingMore)
messages_list_view.post { messagesAdapter.includeFooter = isLoadingMore.get() }
mailboxRecyclerView.post { messagesAdapter.includeFooter = isLoadingMore.get() }
return previousValue
}
@ -959,7 +1043,7 @@ class MailboxActivity :
fun onSwitchedAccountEvent(event: SwitchUserEvent) {
val (fromUsername, toUsername) = event.from.second.s to event.to.second.s
showSignedInSnack(
messages_list_view,
mailboxRecyclerView,
getString(R.string.signed_in_with_logged_out_from, fromUsername, toUsername)
)
onSwitchedAccounts()
@ -1204,15 +1288,23 @@ class MailboxActivity :
fun refreshEmptyView(count: Int) {
if (count == 0) {
spinner_layout.visibility = View.GONE
no_messages_layout.visibility = View.VISIBLE
swipe_refresh_layout.visibility = View.GONE
swipe_refresh_wrapper.visibility = View.GONE
if (BuildConfig.FLAVOR == FLAVOR_V4) {
mailboxSwipeRefreshLayout.visibility = View.GONE
} else {
spinner_layout.visibility = View.GONE
no_messages_layout.visibility = View.VISIBLE
swipe_refresh_layout.visibility = View.GONE
swipe_refresh_wrapper.visibility = View.GONE
}
} else {
spinner_layout.visibility = View.VISIBLE
no_messages_layout.visibility = View.GONE
swipe_refresh_layout.visibility = View.VISIBLE
swipe_refresh_wrapper.visibility = View.VISIBLE
if (BuildConfig.FLAVOR == FLAVOR_V4) {
mailboxSwipeRefreshLayout.visibility = View.VISIBLE
} else {
spinner_layout.visibility = View.VISIBLE
no_messages_layout.visibility = View.GONE
swipe_refresh_layout.visibility = View.VISIBLE
swipe_refresh_wrapper.visibility = View.VISIBLE
}
}
}
@ -1258,7 +1350,11 @@ class MailboxActivity :
menu.removeItem(moveToInbox.itemId)
}
menu.findItem(R.id.move_to_spam).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
swipe_refresh_layout.isEnabled = false
if (BuildConfig.FLAVOR == FLAVOR_V4) {
mailboxSwipeRefreshLayout.isEnabled = false
} else {
swipe_refresh_layout.isEnabled = false
}
return true
}
@ -1425,7 +1521,11 @@ class MailboxActivity :
override fun onDestroyActionMode(mode: ActionMode) {
actionMode = null
swipe_refresh_layout.isEnabled = true
if (BuildConfig.FLAVOR == FLAVOR_V4) {
mailboxSwipeRefreshLayout.isEnabled = true
} else {
swipe_refresh_layout.isEnabled = true
}
messagesAdapter.endSelectionMode()
UiUtil.setStatusBarColor(this, ContextCompat.getColor(this, R.color.dark_purple_statusbar))
}
@ -1498,7 +1598,11 @@ class MailboxActivity :
/* SwipeRefreshLayout.OnRefreshListener */
override fun onRefresh() {
if (!spinner_layout.isRefreshing) {
if (BuildConfig.FLAVOR != FLAVOR_V4) {
if (!spinner_layout.isRefreshing) {
fetchUpdates(true)
}
} else {
fetchUpdates(true)
}
}
@ -1524,7 +1628,9 @@ class MailboxActivity :
}
private fun syncingDone() {
layout_sync.visibility = View.GONE
if (BuildConfig.FLAVOR != FLAVOR_V4) {
layout_sync.visibility = View.GONE
}
}
private class SyncDoneRunnable internal constructor(activity: MailboxActivity) : Runnable {
@ -1537,12 +1643,19 @@ class MailboxActivity :
private fun setupNewMessageLocation(newLocation: Int) {
val newMessageLocationType = fromInt(newLocation)
swipe_refresh_layout.visibility = View.VISIBLE
swipe_refresh_layout.isRefreshing = true
swipe_refresh_wrapper.visibility = View.VISIBLE
if (BuildConfig.FLAVOR == FLAVOR_V4) {
mailboxSwipeRefreshLayout.visibility = View.VISIBLE
mailboxSwipeRefreshLayout.isRefreshing = true
setElevationOnToolbarAndStatusView(false)
} else {
swipe_refresh_layout.visibility = View.VISIBLE
swipe_refresh_layout.isRefreshing = true
swipe_refresh_wrapper.visibility = View.VISIBLE
no_messages_layout.visibility = View.GONE
spinner_layout.visibility = View.VISIBLE
}
LoaderManager.getInstance(this).destroyLoader(LOADER_ID_LABELS_OFFLINE)
no_messages_layout.visibility = View.GONE
spinner_layout.visibility = View.VISIBLE
if (actionMode != null) {
actionMode!!.finish()
}
@ -1551,8 +1664,8 @@ class MailboxActivity :
mailboxLocationMain.value = newMessageLocationType
setTitle()
closeDrawer()
messages_list_view.clearFocus()
messages_list_view.scrollToPosition(0)
mailboxRecyclerView.clearFocus()
mailboxRecyclerView.scrollToPosition(0)
if (newMessageLocationType == MessageLocationType.STARRED) {
startFetchFirstPage(applicationContext, userManager.requireCurrentUserId(), newMessageLocationType)
} else {
@ -1615,8 +1728,10 @@ class MailboxActivity :
when (requestCode) {
REQUEST_CODE_TRASH_MESSAGE_DETAILS -> {
move_to_trash.visibility = View.VISIBLE
handler.postDelayed({ move_to_trash.visibility = View.GONE }, 1000)
if (BuildConfig.FLAVOR != FLAVOR_V4) {
move_to_trash.visibility = View.VISIBLE
handler.postDelayed({ move_to_trash.visibility = View.GONE }, 1000)
}
}
REQUEST_CODE_VALIDATE_PIN -> {
requireNotNull(data) { "No data for request $requestCode" }
@ -1789,11 +1904,18 @@ class MailboxActivity :
override fun onPostExecute(label: Label?) {
val mailboxActivity = mailboxActivity.get() ?: return
mailboxActivity.swipe_refresh_layout.visibility = View.VISIBLE
mailboxActivity.swipe_refresh_wrapper.visibility = View.VISIBLE
mailboxActivity.swipe_refresh_layout.isRefreshing = true
mailboxActivity.no_messages_layout.visibility = View.GONE
mailboxActivity.spinner_layout.visibility = View.VISIBLE
if (BuildConfig.FLAVOR == FLAVOR_V4) {
mailboxActivity.mailboxSwipeRefreshLayout.visibility = View.VISIBLE
mailboxActivity.mailboxSwipeRefreshLayout.isRefreshing = true
mailboxActivity.setElevationOnToolbarAndStatusView(false)
} else {
mailboxActivity.swipe_refresh_layout.visibility = View.VISIBLE
mailboxActivity.swipe_refresh_wrapper.visibility = View.VISIBLE
mailboxActivity.swipe_refresh_layout.isRefreshing = true
mailboxActivity.no_messages_layout.visibility = View.GONE
mailboxActivity.spinner_layout.visibility = View.VISIBLE
}
if (mailboxActivity.actionMode != null) {
mailboxActivity.actionMode!!.finish()
}
@ -1813,7 +1935,7 @@ class MailboxActivity :
}
}
mailboxActivity.closeDrawer()
mailboxActivity.messages_list_view.scrollToPosition(0)
mailboxActivity.mailboxRecyclerView.scrollToPosition(0)
startFetchFirstPageByLabel(
mailboxActivity,
userId,
@ -1837,7 +1959,7 @@ class MailboxActivity :
) {
syncUUID = UUID.randomUUID().toString()
checkUserAndFetchNews()
if ((messages_list_view.layoutManager as LinearLayoutManager?)!!.findFirstVisibleItemPosition() > 1) {
if ((mailboxRecyclerView.layoutManager as LinearLayoutManager?)!!.findFirstVisibleItemPosition() > 1) {
handler.postDelayed(750) {
val newMessageSnack =
Snackbar.make(

View File

@ -22,8 +22,10 @@ import androidx.recyclerview.widget.RecyclerView
import android.view.View
import ch.protonmail.android.views.messagesList.MessagesListFooterView
import ch.protonmail.android.views.messagesList.MessagesListItemView
import ch.protonmail.android.views.messagesList.MessagesListItemViewV4
sealed class MessagesListViewHolder(view: View) : RecyclerView.ViewHolder(view) {
class MessageViewHolder(val view: MessagesListItemView) : MessagesListViewHolder(view)
class MessageViewHolderV4(val view: MessagesListItemViewV4) : MessagesListViewHolder(view)
class FooterViewHolder(val view: MessagesListFooterView) : MessagesListViewHolder(view)
}
}

View File

@ -20,13 +20,18 @@ package ch.protonmail.android.adapters.messages
import android.content.Context
import android.graphics.Typeface
import android.os.Build
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import ch.protonmail.android.BuildConfig
import ch.protonmail.android.core.Constants
import ch.protonmail.android.core.Constants.FLAVOR_V4
import ch.protonmail.android.data.local.model.*
import ch.protonmail.android.utils.ui.selection.SelectionModeEnum
import ch.protonmail.android.views.messagesList.MessagesListFooterView
import ch.protonmail.android.views.messagesList.MessagesListItemView
import ch.protonmail.android.views.messagesList.MessagesListItemViewV4
class MessagesRecyclerViewAdapter(
private val context: Context,
@ -61,14 +66,16 @@ class MessagesRecyclerViewAdapter(
}
fun getItem(position: Int) = messages[position]
val checkedMessages get() = selectedMessageIds.mapNotNull { messages.find { message -> message.messageId == it } }
fun getItem(position: Int) = messages[position]
fun addAll(messages: List<Message>) {
this.messages.addAll(messages.filter {
!it.deleted
})
this.messages.addAll(
messages.filter {
!it.deleted
}
)
notifyDataSetChanged()
}
@ -92,18 +99,30 @@ class MessagesRecyclerViewAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MessagesListViewHolder {
return when (ElementType.values()[viewType]) {
ElementType.MESSAGE -> MessagesListViewHolder.MessageViewHolder(MessagesListItemView(context))
ElementType.MESSAGE -> {
if (BuildConfig.FLAVOR == FLAVOR_V4 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
MessagesListViewHolder.MessageViewHolderV4(MessagesListItemViewV4(context))
} else {
MessagesListViewHolder.MessageViewHolder(MessagesListItemView(context))
}
}
ElementType.FOOTER -> MessagesListViewHolder.FooterViewHolder(MessagesListFooterView(context))
}
}
override fun getItemCount(): Int {
return messages.size + if (includeFooter) 1 else 0
}
override fun getItemCount(): Int = messages.size + if (includeFooter) 1 else 0
override fun onBindViewHolder(holder: MessagesListViewHolder, position: Int) {
when (ElementType.values()[getItemViewType(position)]) {
ElementType.MESSAGE -> (holder as MessagesListViewHolder.MessageViewHolder).bindMessage(position)
ElementType.MESSAGE -> {
if (BuildConfig.FLAVOR == FLAVOR_V4) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
(holder as MessagesListViewHolder.MessageViewHolderV4).bindMessage(position)
}
} else {
(holder as MessagesListViewHolder.MessageViewHolder).bindMessage(position)
}
}
ElementType.FOOTER -> {
// NOOP
}
@ -115,10 +134,10 @@ class MessagesRecyclerViewAdapter(
val messageLabels = message.allLabelIDs.mapNotNull { labels[it] }
val pendingSend = pendingSendList?.find { it.messageId == message.messageId }
message.isBeingSent = pendingSend != null && pendingSend.sent == null // under these conditions the message is in sending process
// under these conditions the message is in sending process
message.isBeingSent = pendingSend != null && pendingSend.sent == null
message.isAttachmentsBeingUploaded = pendingUploadList?.find { it.messageId == message.messageId } != null
message.senderDisplayName = contactsList?.find { message.senderEmail == it.email }?.name
?: message.senderName
message.senderDisplayName = contactsList?.find { message.senderEmail == it.email }?.name ?: message.senderName
this.view.bind(message, messageLabels, selectedMessageIds.isNotEmpty(), mMailboxLocation, typeface)
@ -161,6 +180,21 @@ class MessagesRecyclerViewAdapter(
}
}
// TODO: Remove annotation when we drop Android 5
@RequiresApi(Build.VERSION_CODES.M)
private fun MessagesListViewHolder.MessageViewHolderV4.bindMessage(position: Int) {
val message = messages[position]
val messageLabels = message.allLabelIDs.mapNotNull { labels[it] }
message.senderDisplayName = contactsList?.find { message.senderEmail == it.email }?.name ?: message.senderName
this.view.bind(message, messageLabels, mMailboxLocation)
this.view.setOnClickListener {
onItemClick?.invoke(message)
}
}
fun endSelectionMode() {
selectedMessageIds.clear()
notifyDataSetChanged()

View File

@ -25,6 +25,9 @@ import ch.protonmail.android.R
object Constants {
// flavors
const val FLAVOR_V4 = "v4"
// region Urls
const val REDIRECT_URI = "https://protonmail.ch"
const val ENDPOINT_URI = "https://api.protonmail.ch/"

View File

@ -44,10 +44,6 @@ private const val CHECKBOX_WIDTH_IN_DP = 34
private const val MAX_LABELS_WITH_TEXT = 1
// endregion
/**
* Created by Kamil Rajtar on 16.07.18.
*/
class MessagesListItemView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
@ -56,18 +52,18 @@ class MessagesListItemView @JvmOverloads constructor(
init {
inflate(context, R.layout.messages_list_item_new, this)
layoutParams = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT)
ViewGroup.LayoutParams.WRAP_CONTENT)
}
private val mCheckBoxWidthInPixels: Int by lazy {
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
CHECKBOX_WIDTH_IN_DP.toFloat(),
context.resources.displayMetrics).toInt()
CHECKBOX_WIDTH_IN_DP.toFloat(),
context.resources.displayMetrics).toInt()
}
private val mStrokeWidth by lazy {
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f, context
.resources.displayMetrics).toInt()
.resources.displayMetrics).toInt()
}
private var allFolders = HashMap<String, Label>()
@ -138,7 +134,7 @@ class MessagesListItemView @JvmOverloads constructor(
val messageSenderText = when {
Constants.MessageLocationType.fromInt(message.location) in arrayOf(Constants.MessageLocationType.DRAFT,
Constants.MessageLocationType.SENT) -> message.toListStringGroupsAware
Constants.MessageLocationType.SENT) -> message.toListStringGroupsAware
!message.senderDisplayName.isNullOrEmpty() -> message.senderDisplayName
else -> message.senderEmail
}
@ -149,11 +145,11 @@ class MessagesListItemView @JvmOverloads constructor(
labelsLinearLayout.visibility = View.GONE
val messageLabelsIDs = message.allLabelIDs
val isMessageSentAndTrashed =
message.searchForLocation(Constants.MessageLocationType.SENT.messageLocationTypeValue) &&
messageLabelsIDs.any { it == Constants.MessageLocationType.TRASH.messageLocationTypeValue.toString() }
message.searchForLocation(Constants.MessageLocationType.SENT.messageLocationTypeValue) &&
messageLabelsIDs.any { it == Constants.MessageLocationType.TRASH.messageLocationTypeValue.toString() }
val isMessageSentAndArchived =
message.searchForLocation(Constants.MessageLocationType.SENT.messageLocationTypeValue) &&
messageLabelsIDs.any { it == Constants.MessageLocationType.ARCHIVE.messageLocationTypeValue.toString() }
message.searchForLocation(Constants.MessageLocationType.SENT.messageLocationTypeValue) &&
messageLabelsIDs.any { it == Constants.MessageLocationType.ARCHIVE.messageLocationTypeValue.toString() }
//region labels
labels.forEach { allFolders[it.id] = it }
val nonExclusiveLabels = labels.filter { !it.exclusive }
@ -178,7 +174,7 @@ class MessagesListItemView @JvmOverloads constructor(
} else {
val imageView = ImageView(context)
val lp = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT)
LinearLayout.LayoutParams.WRAP_CONTENT)
lp.setMargins(0, 0, 0, 0)
imageView.layoutParams = lp
imageView.setImageResource(R.drawable.mail_label_collapsed)
@ -192,10 +188,10 @@ class MessagesListItemView @JvmOverloads constructor(
//endregion
messageLabelTrashTextView.visibility =
if (mailboxLocation != Constants.MessageLocationType.TRASH &&
if (mailboxLocation != Constants.MessageLocationType.TRASH &&
isMessageSentAndTrashed) View.VISIBLE else View.GONE
messageLabelArchiveTextView.visibility =
if (mailboxLocation != Constants.MessageLocationType.ARCHIVE &&
if (mailboxLocation != Constants.MessageLocationType.ARCHIVE &&
isMessageSentAndArchived) View.VISIBLE else View.GONE
messageStarredTextView.typeface = typeface
messageExpirationTextView.typeface = typeface
@ -217,10 +213,10 @@ class MessagesListItemView @JvmOverloads constructor(
messageStarredTextView.visibility = if (message.isStarred == true) View.VISIBLE else View.GONE
if (mailboxLocation in arrayOf(Constants.MessageLocationType.STARRED,
Constants.MessageLocationType.LABEL,
Constants.MessageLocationType.SEARCH,
Constants.MessageLocationType.ALL_MAIL,
Constants.MessageLocationType.SENT)) {
Constants.MessageLocationType.LABEL,
Constants.MessageLocationType.SEARCH,
Constants.MessageLocationType.ALL_MAIL,
Constants.MessageLocationType.SENT)) {
val title = if (mailboxLocation == Constants.MessageLocationType.SENT)
message.getFolderTitle()
else
@ -281,11 +277,11 @@ class MessagesListItemView @JvmOverloads constructor(
if (labelId.length <= 2) {
messageLocation = Constants.MessageLocationType.fromInt(Integer.valueOf(labelId))
if (messageLocation !in arrayOf(Constants.MessageLocationType.STARRED,
Constants.MessageLocationType.ALL_MAIL,
Constants.MessageLocationType.INVALID,
Constants.MessageLocationType.ALL_DRAFT,
Constants.MessageLocationType.ALL_SENT
)) {
Constants.MessageLocationType.ALL_MAIL,
Constants.MessageLocationType.INVALID,
Constants.MessageLocationType.ALL_DRAFT,
Constants.MessageLocationType.ALL_SENT
)) {
break
}
}
@ -312,7 +308,7 @@ class MessagesListItemView @JvmOverloads constructor(
private fun Message.getFolderTitle(): String {
return allLabelIDs.asReversed().asSequence().map(allFolders::get).filterNotNull().filter(Label::exclusive).map { it.name }.lastOrNull()
?: ""
?: ""
}
}

View File

@ -0,0 +1,217 @@
/*
* Copyright (c) 2020 Proton Technologies AG
*
* This file is part of ProtonMail.
*
* ProtonMail 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.
*
* ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
*/
package ch.protonmail.android.views.messagesList
import android.content.Context
import android.graphics.Color
import android.os.Build.VERSION_CODES.M
import android.util.TypedValue
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import androidx.annotation.RequiresApi
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import ch.protonmail.android.R
import ch.protonmail.android.api.models.room.messages.Label
import ch.protonmail.android.api.models.room.messages.Message
import ch.protonmail.android.core.Constants
import ch.protonmail.android.utils.DateUtil
import ch.protonmail.android.utils.UiUtil
import kotlinx.android.synthetic.v4.list_item_mailbox.view.*
private const val MAX_LABELS_WITH_TEXT = 1
/**
* A view that represents one item in the mailbox list when conversation mode is turned off.
*/
// TODO: Remove annotation when we drop Android 5
@RequiresApi(M)
class MessagesListItemViewV4 constructor(
context: Context
) : ConstraintLayout(context) {
init {
inflate(context, R.layout.list_item_mailbox, this)
layoutParams = RecyclerView.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
}
private var allFolders = HashMap<String, Label>()
private val mStrokeWidth by lazy {
TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
1f,
context
.resources.displayMetrics
).toInt()
}
private fun setIconsTint(isRead: Boolean) {
val iconTint = if (isRead) context.getColor(R.color.icon_weak) else context.getColor(R.color.icon_norm)
replyImageView.setColorFilter(iconTint)
replyAllImageView.setColorFilter(iconTint)
forwardImageView.setColorFilter(iconTint)
firstLocationImageView.setColorFilter(iconTint)
secondLocationImageView.setColorFilter(iconTint)
thirdLocationImageView.setColorFilter(iconTint)
}
private fun setTextViewStyles(isRead: Boolean) {
if (isRead) {
senderTextView.setTextAppearance(R.style.Text_Default)
subjectTextView.setTextAppearance(R.style.Text_DefaultSmall_Weak)
timeDateTextView.setTextAppearance(R.style.Text_Caption_Weak)
} else {
senderTextView.setTextAppearance(R.style.Text_Default_Strong)
subjectTextView.setTextAppearance(R.style.Text_DefaultSmall_Strong)
timeDateTextView.setTextAppearance(R.style.Text_Caption_Strong)
}
}
private fun getSenderText(messageLocation: Constants.MessageLocationType, message: Message) = when {
messageLocation in arrayOf(
Constants.MessageLocationType.DRAFT,
Constants.MessageLocationType.SENT
) -> message.toListStringGroupsAware
!message.senderDisplayName.isNullOrEmpty() -> message.senderDisplayName
else -> message.senderEmail
}
private fun getIconForMessageLocation(messageLocation: Constants.MessageLocationType) = when (messageLocation) {
Constants.MessageLocationType.INBOX -> R.drawable.ic_inbox
Constants.MessageLocationType.SENT -> R.drawable.ic_send
Constants.MessageLocationType.DRAFT -> R.drawable.ic_draft
Constants.MessageLocationType.ALL_DRAFT -> R.drawable.ic_draft
Constants.MessageLocationType.ALL_SENT -> R.drawable.ic_send
Constants.MessageLocationType.ARCHIVE -> R.drawable.ic_archive
Constants.MessageLocationType.TRASH -> R.drawable.ic_trash
else -> null
}
fun bind(
message: Message,
labels: List<Label>,
mailboxLocation: Constants.MessageLocationType
) {
val readStatus = message.isRead
val messageLocation = Constants.MessageLocationType.fromInt(message.location)
setTextViewStyles(readStatus)
setIconsTint(readStatus)
val senderText = getSenderText(messageLocation, message)
senderTextView.text = senderText
senderInitialTextView.text =
if (senderText.isNullOrEmpty()) "D" else senderText.capitalize().subSequence(0, 1)
subjectTextView.text = message.subject
timeDateTextView.text = DateUtil.formatDateTime(context, message.timeMs)
replyImageView.visibility =
if (message.isReplied == true && message.isRepliedAll != true) View.VISIBLE else View.GONE
replyAllImageView.visibility = if (message.isRepliedAll == true) View.VISIBLE else View.GONE
forwardImageView.visibility = if (message.isForwarded == true) View.VISIBLE else View.GONE
draftImageView.visibility = if (mailboxLocation in arrayOf(
Constants.MessageLocationType.DRAFT,
Constants.MessageLocationType.ALL_DRAFT
)
) View.VISIBLE else View.GONE
// TODO: Currently there's a bug with showing the location on certain messages.
// Revisit the logic with MAILAND-1422
if (mailboxLocation in arrayOf(
Constants.MessageLocationType.ALL_MAIL,
Constants.MessageLocationType.STARRED,
Constants.MessageLocationType.LABEL,
Constants.MessageLocationType.SEARCH
)
) {
val icon = getIconForMessageLocation(messageLocation)
if (icon != null) {
firstLocationImageView.visibility = View.VISIBLE
firstLocationImageView.setImageDrawable(context.getDrawable(icon))
}
}
val hasAttachments = message.Attachments.isNotEmpty() || message.numAttachments >= 1
attachmentImageView.visibility = if (hasAttachments) View.VISIBLE else View.GONE
starImageView.visibility = if (message.isStarred == true) View.VISIBLE else View.GONE
emptySpaceView.visibility = if (
attachmentImageView.visibility == View.VISIBLE ||
starImageView.visibility == View.VISIBLE
) View.VISIBLE else View.GONE
expirationImageView.visibility = if (message.expirationTime > 0) View.VISIBLE else View.GONE
showLabels(labels)
}
private fun showLabels(labels: List<Label>) {
// TODO: This is the old labels logic and it should be changed with MAILAND-1502
labelsLayout.removeAllViews()
labelsLayout.visibility = View.GONE
labels.forEach { allFolders[it.id] = it }
val nonExclusiveLabels = labels.filter { !it.exclusive }
var commonHeight = 20
nonExclusiveLabels.forEachIndexed { i, (_, name, colorString) ->
val labelItemView = ItemLabelMarginlessSmallView(context)
val color = if (colorString.isNotEmpty()) {
val normalizedColor = UiUtil.normalizeColor(colorString)
Color.parseColor(normalizedColor)
} else 0
if (i < MAX_LABELS_WITH_TEXT) {
labelItemView.bind(name, color, mStrokeWidth)
labelsLayout.visibility = View.VISIBLE
labelsLayout.addView(labelItemView)
labelItemView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED)
commonHeight = labelItemView.measuredHeight
} else {
val imageView = ImageView(context)
val lp = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT
)
lp.setMargins(0, 0, 0, 0)
imageView.layoutParams = lp
imageView.setImageResource(R.drawable.mail_label_collapsed)
imageView.setColorFilter(color)
imageView.layoutParams.height = commonHeight
labelsLayout.visibility = View.VISIBLE
labelsLayout.addView(imageView)
}
labelItemView.requestLayout()
}
}
}

View File

@ -456,7 +456,7 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
<View
android:orientation="vertical"
android:id="@+id/screenProtector"
android:id="@+id/screenProtectorView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"

View File

@ -17,7 +17,8 @@ You should have received a copy of the GNU General Public License
along with ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
@ -46,10 +47,10 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
android:layout_height="wrap_content"
android:visibility="gone" />
<FrameLayout
android:id="@+id/swipe_refresh_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/swipe_refresh_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
@ -57,7 +58,7 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/messages_list_view"
android:id="@+id/mailboxRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
@ -66,7 +67,7 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<View
android:id="@+id/screenProtector"
android:id="@+id/screenProtectorView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
@ -75,13 +76,13 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
</FrameLayout>
<FrameLayout
android:id="@+id/layout_sync"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/rain_gray_50"
android:padding="5dp"
android:visibility="gone">
<FrameLayout
android:id="@+id/layout_sync"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/rain_gray_50"
android:padding="5dp"
android:visibility="gone">
<ch.protonmail.android.views.CustomFontTextView
android:layout_width="wrap_content"
@ -139,13 +140,13 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
android:layout_height="@dimen/shadow_height"
android:background="@drawable/actionbar_shadow" />
<TextView
android:id="@+id/move_to_trash"
android:layout_width="75dp"
android:layout_height="75dp"
android:background="@android:color/transparent"
android:text="@string/trash_icon"
android:visibility="gone" />
<TextView
android:id="@+id/move_to_trash"
android:layout_width="75dp"
android:layout_height="75dp"
android:background="@android:color/transparent"
android:text="@string/trash_icon"
android:visibility="gone" />
<FrameLayout
android:id="@+id/layout_no_connectivity_info"
@ -154,62 +155,16 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
</LinearLayout>
<View
android:id="@+id/screenShotPreventer"
android:id="@+id/screenShotPreventerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:clickable="true"
android:visibility="gone"
android:focusable="true" />
android:focusable="true"
android:visibility="gone" />
</FrameLayout>
<ch.protonmail.android.views.ScrimInsetsFrameLayout
android:layout_width="@dimen/navdrawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/dark_purple"
app:pmInsetForeground="#4000">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true">
<include
layout="@layout/drawer_header"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/header">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/left_drawer_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/left_drawer_users"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:background="@color/white"
android:visibility="gone"/>
</FrameLayout>
</RelativeLayout>
</ch.protonmail.android.views.ScrimInsetsFrameLayout>
<include layout="@layout/navigation_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>

View File

@ -63,7 +63,7 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
<View
android:orientation="vertical"
android:id="@+id/screenProtector"
android:id="@+id/screenProtectorView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"

View File

@ -56,7 +56,7 @@ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
android:background="@drawable/actionbar_shadow" />
<View
android:id="@+id/screenProtector"
android:id="@+id/screenProtectorView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<ch.protonmail.android.views.ScrimInsetsFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:pmInsetForeground="#4000"
android:layout_width="@dimen/navdrawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/dark_purple">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true">
<include
layout="@layout/drawer_header"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/header">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/left_drawer_navigation"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/left_drawer_users"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:visibility="gone" />
</FrameLayout>
</RelativeLayout>
</ch.protonmail.android.views.ScrimInsetsFrameLayout>

View File

@ -18,12 +18,12 @@
~ along with ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="ch.protonmail.android">
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:theme="@style/ProtonTheme"
tools:replace="android:theme"/>
android:theme="@style/ProtonTheme.Mail"
tools:replace="android:theme" />
</manifest>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dp" android:color="@color/text_weak" />
<corners android:radius="3dp" />
</shape>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/interaction_weak" />
<corners android:radius="6dp" />
</shape>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M2,7V3H14V7H13V15H3V7H2ZM4,14H12V7H4V14ZM13,6H3V4H13V6ZM9,9H10V11H6V9H7V10H9V9Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M13.26,1.9C11.6144,0.8403 9.4492,1.0916 8.09,2.5L1.84,8.75C1.2518,9.3212 0.9446,10.1221 1,10.94C1.0641,11.7593 1.4799,12.5106 2.14,13C2.6096,13.3451 3.1773,13.5308 3.76,13.53C4.5791,13.5204 5.3617,13.1901 5.94,12.61L11.34,7.21C11.9381,6.5557 11.9166,5.5469 11.2911,4.9187C10.6656,4.2906 9.6568,4.2647 9,4.86L5.4,8.46L6.11,9.17L9.7,5.57C9.9621,5.3492 10.3496,5.3657 10.592,5.608C10.8344,5.8504 10.8509,6.2379 10.63,6.5L5.24,11.9C4.5821,12.5779 3.5396,12.703 2.74,12.2C2.3211,11.8823 2.0591,11.3997 2.0208,10.8752C1.9825,10.3508 2.1716,9.8353 2.54,9.46L8.79,3.21C9.8115,2.145 11.4408,1.9445 12.69,2.73C13.4309,3.2287 13.9111,4.0314 14,4.92C14.0753,5.798 13.7608,6.6647 13.14,7.29L7.86,12.55L8.56,13.26L13.83,8C14.6605,7.1591 15.0766,5.994 14.9666,4.8172C14.8566,3.6404 14.2319,2.5726 13.26,1.9Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,32 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:viewportWidth="40"
android:viewportHeight="40">
<path
android:pathData="M20,20m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0"
android:fillColor="@color/interaction_strong"/>
<path
android:pathData="M30.964,14.5153L27.2722,10.8198L18.7209,19.3915L18.18,23.628L22.413,23.0866L30.964,14.5153ZM20.1859,20.1105L27.273,13.0066L28.7809,14.516L21.6934,21.6203L19.9649,21.8414L20.1859,20.1105ZM21.8837,11.6405H11V29.1856H28.5451V21.0797H27.0001V27.6406H12.545V13.1855H21.8837V11.6405Z"
android:fillColor="@color/icon_inverted"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M12.85,3.8499L12.15,3.1499L8,7.2899L3.85,3.1499L3.15,3.8499L7.29,7.9999L3.15,12.1499L3.85,12.8499L8,8.7099L12.15,12.8499L12.85,12.1499L8.71,7.9999L12.85,3.8499Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M11.261,2.0001L14.5936,5.336L6.0734,13.8514L2,14.5931L2.741,10.5153L11.261,2.0001ZM11.2605,3.4569L9.8325,4.884L11.7092,6.7626L13.1372,5.3354L11.2605,3.4569ZM4.0282,10.6851L9.104,5.6121L10.9807,7.4907L5.9048,12.5636L4.0282,10.6851ZM3.5743,11.6881L3.2791,13.3128L4.9021,13.0173L3.5743,11.6881Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,32 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="18dp"
android:viewportWidth="20"
android:viewportHeight="18">
<path
android:pathData="M9,0L11,0A9,9 0,0 1,20 9L20,9A9,9 0,0 1,11 18L9,18A9,9 0,0 1,0 9L0,9A9,9 0,0 1,9 0z"
android:fillColor="@color/interaction_weak"/>
<path
android:pathData="M12.0475,7.92C12.2263,7.7295 12.3846,7.5209 12.52,7.2975C12.7789,6.9083 12.9433,6.464 13,6V5.25H13.75V4.5H6.25V5.25H7V6C7.058,6.4567 7.2224,6.8934 7.48,7.275C7.6173,7.5014 7.7782,7.7125 7.96,7.905C8.1742,8.1327 8.4104,8.3387 8.665,8.52C8.9151,8.7115 9.187,8.8726 9.475,9C9.1897,9.1206 8.9181,9.2714 8.665,9.45C8.3982,9.6392 8.1474,9.8499 7.915,10.08C7.7382,10.2721 7.5799,10.4805 7.4425,10.7025C7.1938,11.0936 7.0421,11.5384 7,12V12.75H6.25V13.5H13.75V12.75H13V12C12.9399,11.5438 12.7757,11.1076 12.52,10.725C12.3806,10.5001 12.2199,10.2891 12.04,10.095C11.8238,9.8694 11.5878,9.6636 11.335,9.48C11.0849,9.2885 10.813,9.1274 10.525,9C10.8103,8.8794 11.0819,8.7286 11.335,8.55C11.5907,8.3615 11.8291,8.1507 12.0475,7.92ZM10.9,10.065C11.1133,10.2185 11.3117,10.3918 11.4925,10.5825C11.6414,10.7444 11.7745,10.9202 11.89,11.1075C12.0781,11.3867 12.2011,11.7045 12.25,12.0375V12.75H7.75V12.0525C7.7979,11.711 7.9236,11.3851 8.1175,11.1C8.2298,10.9191 8.3578,10.7484 8.5,10.59C8.6839,10.3946 8.8875,10.2186 9.1075,10.065C9.3807,9.8635 9.6812,9.7018 10,9.585C10.3205,9.7033 10.6233,9.8648 10.9,10.065ZM10,8.415C9.6795,8.2967 9.3767,8.1352 9.1,7.935C8.8838,7.7822 8.6829,7.6089 8.5,7.4175C8.3511,7.2556 8.218,7.0798 8.1025,6.8925C7.9252,6.6223 7.8052,6.3185 7.75,6V5.25H12.25V5.9475C12.2021,6.289 12.0764,6.6149 11.8825,6.9C11.7721,7.0822 11.644,7.253 11.5,7.41C11.3164,7.6057 11.1128,7.7817 10.8925,7.935C10.6193,8.1365 10.3188,8.2982 10,8.415Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M2.0004,7.94V9V10C3.0004,10 5.93,10 5.92,9.99L8.63,10V12.8L14.54,7.94L8.63,3.23V6L2.0005,6L2.0009,7C2.0004,7.94 2.0004,7.94 2.0004,7.94ZM3.0004,9C3.0004,9 3.0004,7.5 3.0004,7H5.93H9.63V5.3L13,8L9.63,10.68V9H5.93H3.9404H3.0004Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,34 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="14dp"
android:viewportWidth="16"
android:viewportHeight="14">
<path
android:pathData="M0.5,0H15.5V1.5H0.5V0Z"
android:fillColor="@color/icon_norm"/>
<path
android:pathData="M0.5,6H15.5V7.5H0.5V6Z"
android:fillColor="@color/icon_norm"/>
<path
android:pathData="M15.5,12H0.5V13.5H15.5V12Z"
android:fillColor="@color/icon_norm"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M10.73,6.56C10.9683,6.306 11.1795,6.0279 11.36,5.73C11.7052,5.2111 11.9244,4.6186 12,4V3H13V2H3V3H4V4C4.0773,4.609 4.2965,5.1913 4.64,5.7C4.8231,6.0018 5.0376,6.2834 5.28,6.54C5.5656,6.8436 5.8805,7.1182 6.22,7.36C6.5534,7.6153 6.916,7.8301 7.3,8C6.9196,8.1608 6.5575,8.3619 6.22,8.6C5.8643,8.8523 5.5299,9.1332 5.22,9.44C4.9842,9.6961 4.7733,9.974 4.59,10.27C4.2584,10.7915 4.0561,11.3846 4,12V13H3V14H13V13H12V12C11.9199,11.3918 11.7009,10.8101 11.36,10.3C11.1742,10.0001 10.9598,9.7188 10.72,9.46C10.4317,9.1592 10.1171,8.8848 9.78,8.64C9.4466,8.3847 9.084,8.1699 8.7,8C9.0804,7.8392 9.4425,7.6381 9.78,7.4C10.1209,7.1487 10.4388,6.8675 10.73,6.56ZM9.2,9.42C9.4844,9.6247 9.7489,9.8557 9.99,10.11C10.1886,10.3259 10.3661,10.5603 10.52,10.81C10.7707,11.1822 10.9348,11.606 11,12.05V13H5V12.07C5.0639,11.6147 5.2315,11.1802 5.49,10.8C5.6397,10.5588 5.8103,10.3312 6,10.12C6.2452,9.8594 6.5166,9.6249 6.81,9.42C7.1743,9.1513 7.575,8.9358 8,8.78C8.4273,8.9377 8.831,9.153 9.2,9.42ZM8,7.22C7.5727,7.0623 7.169,6.847 6.8,6.58C6.5118,6.3762 6.2439,6.1452 6,5.89C5.8014,5.6741 5.6239,5.4397 5.47,5.19C5.2336,4.8297 5.0736,4.4246 5,4V3H11V3.93C10.9361,4.3853 10.7685,4.8198 10.51,5.2C10.3628,5.4429 10.192,5.6707 10,5.88C9.7551,6.1409 9.4837,6.3756 9.19,6.58C8.8257,6.8487 8.425,7.0642 8,7.22Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M15,6L12.44,2H3.56L1,6.07V13H15V6ZM4.11,3H11.89L13.77,6H11V8H5V6H2.23L4.11,3ZM14,12H2V7H4V9H12V7H14V12Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M13.33,7.17C12.5387,6.4325 11.5015,6.0155 10.42,6H8V3.23L2.09,7.94L8,12.8V10H10.71C11.3824,9.8994 12.0687,10.0374 12.65,10.39C13.0243,10.7098 13.3599,11.0723 13.65,11.47L14.53,12.71V10.04C14.5336,8.9606 14.1008,7.9255 13.33,7.17ZM13.26,9.6C12.5063,9.0992 11.5977,8.8863 10.7,9H7V10.68L3.68,8L7,5.3V7H10.39C11.2223,7.0089 12.0225,7.3219 12.64,7.88C13.1768,8.4125 13.4974,9.125 13.54,9.88L13.26,9.6Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,32 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M13.63,7.12C12.7696,6.3915 11.6773,5.9943 10.55,6H10V3.23L4.09,7.94L10,12.8V10H10.59C11.3561,9.8876 12.1378,10.0355 12.81,10.42C13.1704,10.6644 13.4795,10.9769 13.72,11.34L14.61,12.81L14.67,10C14.727,8.9389 14.3518,7.8999 13.63,7.12ZM13.35,9.58C12.5132,9.1031 11.548,8.9002 10.59,9H9V10.68L5.68,8L9,5.3V7H10.52C11.3956,6.9868 12.2482,7.2804 12.93,7.83C13.4235,8.3774 13.6883,9.0932 13.67,9.83C13.5701,9.7383 13.4631,9.6547 13.35,9.58Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
<path
android:pathData="M6.34,3.61L6.97,4.39L2.51,7.95L6.97,11.61L6.34,12.39L0.92,7.94L6.34,3.61Z"
android:fillColor="@color/icon_norm"/>
</vector>

View File

@ -0,0 +1,32 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:viewportWidth="40"
android:viewportHeight="40">
<path
android:pathData="M20,20m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0"
android:fillColor="@color/interaction_weak"/>
<path
android:pathData="M12.545,18.3061C12.545,15.1243 15.1243,12.545 18.3061,12.545C21.4879,12.545 24.0673,15.1243 24.0673,18.3061C24.0673,21.4879 21.4879,24.0673 18.3061,24.0673C15.1243,24.0673 12.545,21.4879 12.545,18.3061ZM18.3061,11C14.2711,11 11,14.2711 11,18.3061C11,22.3412 14.2711,25.6123 18.3061,25.6123C20.0454,25.6123 21.6427,25.0045 22.8973,23.9898L27.977,29.0696L29.0695,27.9771L23.9897,22.8974C25.0045,21.6428 25.6123,20.0454 25.6123,18.3061C25.6123,14.2711 22.3412,11 18.3061,11Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M0.25,6.2799L6.35,9.3299L9.4,15.4299L14.74,0.9399L0.25,6.2799ZM2.77,6.4199L11.93,2.9999L6.62,8.3499L2.77,6.4199ZM9.26,12.9199L7.33,9.0599L12.64,3.7499L9.26,12.9199Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M15.07,6.2999L10.19,5.5899L8,1.1599L5.81,5.5899L0.93,6.2999L4.46,9.7499L3.63,14.6199L8,12.3199L12.37,14.6199L11.54,9.7499L15.07,6.2999Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,35 @@
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M6,7H7V12H6V7Z"
android:fillColor="@color/icon_norm"/>
<path
android:pathData="M9,7H10V12H9V7Z"
android:fillColor="@color/icon_norm"/>
<path
android:pathData="M11,4H15V5H13V15H3V5H1V4H5V2H11V4ZM10,3H6V4H10V3ZM12,14H4V5H12V14Z"
android:fillColor="@color/icon_norm"
android:fillType="evenOdd"/>
</vector>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/separator_norm" />
<size android:height="1dp" />
</shape>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="@color/interaction_weak"
android:state_checked="false" />
<item
android:color="@color/cornflower_blue"
android:state_checked="true" />
</selector>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="@color/cornflower_blue"
android:state_checked="false" />
<item
android:color="@color/text_inverted"
android:state_checked="true" />
</selector>

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.mailbox.MailboxActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/toolbar_mailbox"
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
layout="@layout/layout_mailbox_status_view"
android:id="@+id/mailboxStatusLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar" />
<!-- TODO: Should be removed and replaced with MAILAND-1503 -->
<ch.protonmail.android.views.alerts.StorageLimitAlert
android:id="@+id/storageLimitAlert"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/mailboxStatusLayout"
android:visibility="gone" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/mailboxSwipeRefreshLayout"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/storageLimitAlert">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mailboxRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/list_item_mailbox" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<!-- TODO: Should be removed and replaced with MAILAND-1497 -->
<FrameLayout
android:id="@+id/layout_no_connectivity_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<View
android:id="@+id/screenProtectorView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="@id/mailboxSwipeRefreshLayout"
app:layout_constraintRight_toRightOf="@id/mailboxSwipeRefreshLayout"
app:layout_constraintTop_toTopOf="@id/mailboxSwipeRefreshLayout"
app:layout_constraintBottom_toBottomOf="@id/mailboxSwipeRefreshLayout"
android:background="@android:color/transparent"
android:clickable="true"
android:focusable="true" />
<View
android:id="@+id/screenShotPreventerView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/background_norm"
android:clickable="true"
android:focusable="true"
android:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="@layout/navigation_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/toolbar_action_layout_size"
android:layout_height="@dimen/toolbar_action_layout_size">
<ImageView
android:id="@+id/composeImageView"
android:layout_width="@dimen/button_nav_size"
android:layout_height="@dimen/button_nav_size"
android:layout_gravity="center"
android:src="@drawable/ic_compose"
android:contentDescription="@null" />
</FrameLayout>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background_norm">
<TextView
android:id="@+id/updatedStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/updated_status_text_view_margin"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:text="Updated Just now"
style="@style/Text.Caption.Hint" />
<com.google.android.material.chip.Chip
android:id="@+id/unreadMessagesStatusChip"
android:layout_width="wrap_content"
android:layout_height="@dimen/unread_messages_chip_size"
android:layout_marginHorizontal="@dimen/unread_messages_chip_margin_horizontal"
android:layout_marginVertical="@dimen/unread_messages_chip_margin_vertical"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:chipMinTouchTargetSize="0dp"
app:chipStartPadding="0dp"
app:chipEndPadding="2dp"
android:text="4 unread"
android:checkable="true"
style="@style/UnreadMessagesStatusChip" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/toolbar_action_layout_size"
android:layout_height="@dimen/toolbar_action_layout_size">
<ImageView
android:id="@+id/searchImageView"
android:layout_width="@dimen/button_nav_size"
android:layout_height="@dimen/button_nav_size"
android:layout_gravity="center"
android:src="@drawable/ic_search"
android:contentDescription="@null" />
</FrameLayout>

View File

@ -0,0 +1,277 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/mailbox_list_item_padding_horizontal"
android:paddingVertical="@dimen/mailbox_list_item_padding_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/senderInitialTextView"
android:layout_width="@dimen/sender_initial_view_size"
android:layout_height="@dimen/sender_initial_view_size"
android:layout_marginStart="@dimen/sender_initial_view_margin_start"
android:layout_marginEnd="@dimen/sender_initial_view_margin_end"
android:layout_marginTop="@dimen/sender_initial_view_margin_top"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/senderInitialBarrier"
app:layout_constraintTop_toTopOf="parent"
android:textAlignment="center"
android:gravity="center"
android:background="@drawable/background_sender_initial"
tools:text="S" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/senderInitialBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="@id/senderInitialTextView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<ImageView
android:id="@+id/replyImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/mailbox_list_item_icon_margin_horizontal"
app:layout_constraintLeft_toRightOf="@id/senderInitialBarrier"
app:layout_constraintRight_toLeftOf="@id/replyAllImageView"
app:layout_constraintTop_toTopOf="@id/replyAllImageView"
app:layout_constraintBottom_toBottomOf="@id/replyAllImageView"
android:src="@drawable/ic_reply"
android:contentDescription="@null"
app:tint="@color/icon_weak" />
<ImageView
android:id="@+id/replyAllImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/mailbox_list_item_icon_margin_horizontal"
app:layout_constraintLeft_toRightOf="@id/replyImageView"
app:layout_constraintRight_toLeftOf="@id/forwardImageView"
app:layout_constraintTop_toTopOf="@id/forwardImageView"
app:layout_constraintBottom_toBottomOf="@id/forwardImageView"
android:src="@drawable/ic_reply_all"
android:contentDescription="@null"
app:tint="@color/icon_weak" />
<ImageView
android:id="@+id/forwardImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/mailbox_list_item_icon_margin_horizontal"
app:layout_constraintLeft_toRightOf="@id/replyAllImageView"
app:layout_constraintRight_toLeftOf="@id/draftImageView"
app:layout_constraintTop_toTopOf="@id/draftImageView"
app:layout_constraintBottom_toBottomOf="@id/draftImageView"
android:src="@drawable/ic_forward"
android:contentDescription="@null"
app:tint="@color/icon_weak" />
<ImageView
android:id="@+id/draftImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/mailbox_list_item_icon_margin_horizontal"
app:layout_constraintLeft_toRightOf="@id/forwardImageView"
app:layout_constraintRight_toLeftOf="@id/senderTextView"
app:layout_constraintTop_toTopOf="@id/senderTextView"
app:layout_constraintBottom_toBottomOf="@id/senderTextView"
android:src="@drawable/ic_draft"
android:contentDescription="@null" />
<TextView
android:id="@+id/senderTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/mailbox_list_item_text_margin_horizontal"
app:layout_constraintLeft_toRightOf="@id/draftImageView"
app:layout_constraintRight_toLeftOf="@id/timeDateTextView"
app:layout_constraintTop_toTopOf="parent"
android:singleLine="true"
android:textAppearance="@style/Text.Default"
tools:text="@tools:sample/full_names" />
<TextView
android:id="@+id/timeDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/senderTextView"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/senderTextView"
app:layout_constraintBottom_toBottomOf="@id/senderTextView"
android:textAppearance="@style/Text.Caption.Weak"
tools:text="@tools:sample/date/ddmmyy" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/firstRowBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintLeft_toRightOf="@id/senderInitialBarrier"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/senderTextView" />
<ImageView
android:id="@+id/firstLocationImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/mailbox_list_item_icon_margin_horizontal"
app:layout_constraintLeft_toRightOf="@id/senderInitialBarrier"
app:layout_constraintRight_toLeftOf="@id/secondLocationImageView"
app:layout_constraintTop_toTopOf="@id/secondLocationImageView"
app:layout_constraintBottom_toBottomOf="@id/secondLocationImageView"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintHorizontal_bias="0.0"
android:contentDescription="@null"
app:tint="@color/icon_weak"
android:visibility="gone"
tools:src="@drawable/ic_trash"
tools:visibility="visible"/>
<ImageView
android:id="@+id/secondLocationImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/mailbox_list_item_icon_margin_horizontal"
app:layout_constraintLeft_toRightOf="@id/firstLocationImageView"
app:layout_constraintRight_toLeftOf="@id/thirdLocationImageView"
app:layout_constraintTop_toTopOf="@id/thirdLocationImageView"
app:layout_constraintBottom_toBottomOf="@id/thirdLocationImageView"
android:contentDescription="@null"
app:tint="@color/icon_weak"
android:visibility="gone"
tools:src="@drawable/ic_trash"
tools:visibility="visible" />
<ImageView
android:id="@+id/thirdLocationImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/mailbox_list_item_icon_margin_horizontal"
app:layout_constraintLeft_toRightOf="@id/secondLocationImageView"
app:layout_constraintRight_toLeftOf="@id/subjectTextView"
app:layout_constraintTop_toTopOf="@id/subjectTextView"
app:layout_constraintBottom_toBottomOf="@id/subjectTextView"
android:contentDescription="@null"
app:tint="@color/icon_weak"
android:visibility="gone"
tools:src="@drawable/ic_trash"
tools:visibility="visible" />
<TextView
android:id="@+id/subjectTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/thirdLocationImageView"
app:layout_constraintRight_toLeftOf="@id/messagesNumberTextView"
app:layout_constraintTop_toBottomOf="@id/firstRowBarrier"
app:layout_constrainedWidth="true"
android:singleLine="true"
android:textAppearance="@style/Text.DefaultSmall.Weak"
tools:text="@tools:sample/lorem" />
<TextView
android:id="@+id/messagesNumberTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/mailbox_list_item_icon_margin_horizontal"
android:paddingHorizontal="@dimen/message_number_view_padding_horizontal"
android:paddingVertical="@dimen/message_number_view_padding_vertical"
app:layout_constraintLeft_toRightOf="@id/subjectTextView"
app:layout_constraintRight_toLeftOf="@id/emptySpaceView"
app:layout_constraintTop_toTopOf="@id/subjectTextView"
app:layout_constraintBottom_toBottomOf="@id/subjectTextView"
android:background="@drawable/background_messages_number"
android:textSize="11sp"
android:textColor="@color/text_weak"
android:visibility="gone"
tools:text="3"
tools:visibility="visible" />
<View
android:id="@+id/emptySpaceView"
android:layout_width="@dimen/mailbox_list_item_text_margin_horizontal"
android:layout_height="1dp"
app:layout_constraintLeft_toRightOf="@id/messagesNumberTextView"
app:layout_constraintRight_toLeftOf="@id/attachmentImageView"
app:layout_constraintTop_toTopOf="@id/messagesNumberTextView"
app:layout_constraintBottom_toBottomOf="@id/messagesNumberTextView" />
<ImageView
android:id="@+id/attachmentImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toLeftOf="@id/starImageView"
app:layout_constraintTop_toTopOf="@id/starImageView"
app:layout_constraintBottom_toBottomOf="@id/starImageView"
android:src="@drawable/ic_attachment"
android:contentDescription="@null"
app:tint="@color/icon_weak" />
<ImageView
android:id="@+id/starImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/subjectTextView"
app:layout_constraintBottom_toBottomOf="@id/subjectTextView"
android:src="@drawable/ic_star_filled"
android:contentDescription="@null"
app:tint="@color/notification_warning" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/secondRowBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintLeft_toRightOf="@id/senderInitialBarrier"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/subjectTextView" />
<ImageView
android:id="@+id/expirationImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/mailbox_list_item_label_margin_top"
app:layout_constraintLeft_toRightOf="@id/senderInitialBarrier"
app:layout_constraintTop_toBottomOf="@id/secondRowBarrier"
android:src="@drawable/ic_expiration_pill"
android:contentDescription="@null" />
<!-- TODO: Should be replaced in MAILAND-1502 -->
<LinearLayout
android:id="@+id/labelsLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/mailbox_list_item_label_margin_top"
android:layout_marginStart="@dimen/mailbox_list_item_label_margin_horizontal"
app:layout_goneMarginStart="0dp"
app:layout_constraintLeft_toRightOf="@id/expirationImageView"
app:layout_constraintTop_toBottomOf="@id/secondRowBarrier"
android:orientation="horizontal" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<androidx.appcompat.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:paddingStart="@dimen/action_bar_padding_start"
android:paddingEnd="@dimen/action_bar_padding_end"
app:contentInsetStartWithNavigation="0dp"
app:navigationIcon="@drawable/ic_hamburger"
app:titleTextAppearance="@style/Text.Headline.Small"
android:background="@color/background_norm" />

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/search"
android:title="@string/search"
app:actionLayout="@layout/layout_search_action"
app:showAsAction="ifRoom" />
<item
android:id="@+id/compose"
android:title="@string/compose_message"
app:actionLayout="@layout/layout_compose_action"
app:showAsAction="ifRoom" />
</menu>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<resources>
<!-- TODO: Move to values/styles.xml when min sdk is changed to 23 -->
<style name="ProtonTheme.Mail" parent="ProtonTheme">
<item name="brand_norm">@color/cornflower_blue</item>
<item name="brand_darken_20">@color/san_marino</item>
<item name="brand_darken_40">@color/chambray</item>
<item name="brand_lighten_20">@color/portage</item>
<item name="brand_lighten_40">@color/perano</item>
<item name="android:statusBarColor">@color/background_norm</item>
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<resources>
<dimen name="toolbar_action_layout_size">48dp</dimen>
<dimen name="action_bar_padding_start">0dp</dimen>
<dimen name="action_bar_padding_end">8dp</dimen>
<dimen name="updated_status_text_view_margin">16dp</dimen>
<dimen name="unread_messages_chip_size">20dp</dimen>
<dimen name="unread_messages_chip_margin_horizontal">16dp</dimen>
<dimen name="unread_messages_chip_margin_vertical">14dp</dimen>
<dimen name="mailbox_list_item_padding_horizontal">16dp</dimen>
<dimen name="mailbox_list_item_padding_vertical">12dp</dimen>
<dimen name="mailbox_list_item_text_margin_horizontal">8dp</dimen>
<dimen name="mailbox_list_item_icon_margin_horizontal">4dp</dimen>
<dimen name="mailbox_list_item_label_margin_top">8dp</dimen>
<dimen name="mailbox_list_item_label_margin_horizontal">4dp</dimen>
<dimen name="sender_initial_view_size">28dp</dimen>
<dimen name="sender_initial_view_margin_start">2dp</dimen>
<dimen name="sender_initial_view_margin_end">16dp</dimen>
<dimen name="sender_initial_view_margin_top">2dp</dimen>
<dimen name="message_number_view_padding_horizontal">6dp</dimen>
<dimen name="message_number_view_padding_vertical">3dp</dimen>
</resources>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<resources>
<string name="inbox_option">Inbox</string>
<string name="starred_option">Starred</string>
<string name="drafts_option">Drafts</string>
<string name="sent_option">Sent</string>
<string name="archive_option">Archive</string>
<string name="trash_option">Trash</string>
<string name="spam_option">Spam</string>
<string name="allmail_option">All Mail</string>
</resources>

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2020 Proton Technologies AG
~
~ This file is part of ProtonMail.
~
~ ProtonMail 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.
~
~ ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<resources>
<style name="ProtonTheme.Mail" parent="ProtonTheme">
<item name="brand_norm">@color/cornflower_blue</item>
<item name="brand_darken_20">@color/san_marino</item>
<item name="brand_darken_40">@color/chambray</item>
<item name="brand_lighten_20">@color/portage</item>
<item name="brand_lighten_40">@color/perano</item>
</style>
<style name="UnreadMessagesStatusChip" parent="Widget.MaterialComponents.Chip.Choice">
<item name="android:textAppearance">@style/Text.Caption.Strong</item>
<item name="android:textColor">@drawable/selector_unread_messages_status_text_color</item>
<item name="chipBackgroundColor">@drawable/selector_unread_messages_status_background</item>
<item name="chipCornerRadius">25dp</item>
</style>
<!-- Can be extracted to core -->
<style name="Text" parent="TextAppearance.AppCompat" />
<style name="Text.Headline">
<item name="android:textSize">20sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/text_norm</item>
<item name="android:letterSpacing">0.01</item>
<item name="android:lineSpacingExtra">1sp</item>
</style>
<style name="Text.Headline.Hint">
<item name="android:textColor">@color/text_hint</item>
</style>
<style name="Text.Headline.Small">
<item name="android:textSize">16sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textStyle">normal</item>
<item name="android:letterSpacing">0.03</item>
<item name="android:lineSpacingExtra">5sp</item>
</style>
<style name="Text.Default">
<item name="android:textSize">16sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/text_norm</item>
<item name="android:letterSpacing">0.03</item>
<item name="android:lineSpacingExtra">5sp</item>
</style>
<style name="Text.Default.Strong">
<item name="android:textStyle">bold</item>
</style>
<style name="Text.Default.Weak">
<item name="android:textColor">@color/text_weak</item>
</style>
<style name="Text.DefaultSmall">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/text_norm</item>
<item name="android:letterSpacing">0.02</item>
<item name="android:lineSpacingExtra">4sp</item>
</style>
<style name="Text.DefaultSmall.Weak">
<item name="android:textColor">@color/text_weak</item>
</style>
<style name="Text.DefaultSmall.Strong">
<item name="android:fontFamily">sans-serif-medium</item>
</style>
<style name="Text.DefaultSmall.Weak.Italic">
<item name="android:textStyle">italic</item>
</style>
<style name="Text.DefaultSmall.Strong.Inverted">
<item name="android:textColor">@color/text_inverted</item>
</style>
<style name="Text.Caption">
<item name="android:textSize">12sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/text_norm</item>
<item name="android:letterSpacing">0.03</item>
<item name="android:lineSpacingExtra">2sp</item>
</style>
<style name="Text.Caption.Strong">
<item name="android:fontFamily">sans-serif-medium</item>
</style>
<style name="Text.Caption.Weak">
<item name="android:textColor">@color/text_weak</item>
</style>
<style name="Text.Caption.Hint">
<item name="android:textColor">@color/text_hint</item>
</style>
</resources>