[fenix] Remove unused sessions resources
parent
755e717e82
commit
c7ad818506
@ -1,117 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.home
|
||||
|
||||
import android.graphics.PorterDuff.Mode.SRC_IN
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlinx.android.extensions.LayoutContainer
|
||||
import kotlinx.android.synthetic.main.session_bottom_sheet.view.*
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ThemeManager
|
||||
import org.mozilla.fenix.ext.getColorFromAttr
|
||||
import org.mozilla.fenix.utils.ItsNotBrokenSnack
|
||||
|
||||
class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer {
|
||||
sealed class SessionType {
|
||||
data class Current(override val titles: List<String>) : SessionType()
|
||||
data class Private(override val titles: List<String>) : SessionType()
|
||||
|
||||
abstract val titles: List<String>
|
||||
}
|
||||
|
||||
private var sessionType: SessionType? = null
|
||||
var onDelete: ((SessionType) -> Unit)? = null
|
||||
|
||||
override val containerView: View?
|
||||
get() = view
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setStyle(BottomSheetDialogFragment.STYLE_NORMAL, R.style.CurrentSessionBottomSheetDialogTheme)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val view = inflater.inflate(R.layout.session_bottom_sheet, container, false)
|
||||
|
||||
view.current_session_card_title.text = getCardTitle()
|
||||
view.current_session_card_tab_list.text = getTabTitles()
|
||||
view.archive_session_button.apply {
|
||||
val drawable = ContextCompat.getDrawable(context!!, R.drawable.ic_tab_collection)
|
||||
drawable?.setColorFilter(
|
||||
ContextCompat.getColor(
|
||||
context!!,
|
||||
ThemeManager.resolveAttribute(R.attr.accent, context!!)
|
||||
), SRC_IN
|
||||
)
|
||||
setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
view.delete_session_button.apply {
|
||||
val drawable = ContextCompat.getDrawable(context!!, R.drawable.ic_delete)
|
||||
drawable?.setColorFilter(
|
||||
R.attr.destructive.getColorFromAttr(context), SRC_IN
|
||||
)
|
||||
setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
}
|
||||
|
||||
view.send_and_share_session_button.apply {
|
||||
val drawable = ContextCompat.getDrawable(context!!, R.drawable.mozac_ic_share)
|
||||
drawable?.setColorFilter(
|
||||
ContextCompat.getColor(
|
||||
context!!,
|
||||
ThemeManager.resolveAttribute(R.attr.primaryText, context!!)
|
||||
), SRC_IN
|
||||
)
|
||||
setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null)
|
||||
}
|
||||
|
||||
view.send_and_share_session_button.setOnClickListener {
|
||||
ItsNotBrokenSnack(context!!).showSnackbar(issueNumber = "244")
|
||||
}
|
||||
|
||||
view.delete_session_button.setOnClickListener {
|
||||
sessionType?.apply { onDelete?.invoke(this) }
|
||||
dismiss()
|
||||
}
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
private fun getCardTitle(): String? {
|
||||
return sessionType?.let {
|
||||
when (it) {
|
||||
is SessionType.Current -> getString(R.string.tab_header_label)
|
||||
is SessionType.Private -> getString(R.string.tabs_header_private_title)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTabTitles(): String? {
|
||||
return sessionType?.titles?.joinToString(", ") {
|
||||
if (it.length > maxTitleLength) it.substring(0,
|
||||
maxTitleLength
|
||||
) + "..." else it
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val maxTitleLength = 20
|
||||
const val overflowFragmentTag = "sessionOverflow"
|
||||
|
||||
fun create(sessionType: SessionType): SessionBottomSheetFragment {
|
||||
val fragment = SessionBottomSheetFragment()
|
||||
fragment.sessionType = sessionType
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="64"
|
||||
android:viewportHeight="64">
|
||||
<path
|
||||
android:fillColor="@color/photonGrey60"
|
||||
android:pathData="M12,8L60,8A4,4 0,0 1,64 12L64,60A4,4 0,0 1,60 64L12,64A4,4 0,0 1,8 60L8,12A4,4 0,0 1,12 8z" />
|
||||
<path
|
||||
android:fillColor="@color/photonGrey40"
|
||||
android:pathData="M8,4L56,4A4,4 0,0 1,60 8L60,56A4,4 0,0 1,56 60L8,60A4,4 0,0 1,4 56L4,8A4,4 0,0 1,8 4z" />
|
||||
<path
|
||||
android:fillColor="@color/photonWhite"
|
||||
android:pathData="M4,0L52,0A4,4 0,0 1,56 4L56,52A4,4 0,0 1,52 56L4,56A4,4 0,0 1,0 52L0,4A4,4 0,0 1,4 0z" />
|
||||
<path
|
||||
android:fillColor="@color/photonGrey30"
|
||||
android:pathData="M28.37,22.793L33.5,14 44,32L32.988,32c-0.26,5.567 -4.857,10 -10.488,10C16.701,42 12,37.299 12,31.5S16.701,21 22.5,21c2.175,0 4.195,0.661 5.87,1.793zM28.37,22.793L23,32h9.988c0.008,-0.166 0.012,-0.332 0.012,-0.5 0,-3.624 -1.836,-6.82 -4.63,-8.707z" />
|
||||
</vector>
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="?foundation"/>
|
||||
|
||||
<padding android:left="2dp"
|
||||
android:top="2dp"
|
||||
android:right="2dp"
|
||||
android:bottom="2dp"/>
|
||||
|
||||
<corners android:bottomRightRadius="8dp"
|
||||
android:bottomLeftRadius="8dp"
|
||||
android:topLeftRadius="8dp"
|
||||
android:topRightRadius="8dp"/>
|
||||
</shape>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#393473"
|
||||
android:endColor="#20123A"
|
||||
android:type="linear" />
|
||||
</shape>
|
@ -1,131 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<LinearLayout 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="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/bottom_sheet_behavior">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/current_session_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
app:cardBackgroundColor="?above"
|
||||
android:background="?foundation"
|
||||
android:elevation="5dp"
|
||||
android:padding="10dp"
|
||||
app:cardCornerRadius="10dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/current_session_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:contentDescription="@string/current_session_image"
|
||||
android:paddingBottom="20dp"
|
||||
android:src="@drawable/ic_session_thumbnail_placeholder_greyscale"
|
||||
android:tint="@color/collection_icon_color_blue"
|
||||
android:tintMode="multiply"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_session_card_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/tab_header_label"
|
||||
android:textAppearance="@style/HeaderTextStyle"
|
||||
android:textColor="?primaryText"
|
||||
app:layout_constraintStart_toEndOf="@id/current_session_image"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/current_session_card_tab_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fadingEdgeLength="48dp"
|
||||
android:requiresFadingEdge="vertical"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="?secondaryText"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toEndOf="@id/current_session_image"
|
||||
app:layout_constraintTop_toBottomOf="@id/current_session_card_title"
|
||||
app:layout_constraintVertical_bias="0"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/delete_session_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?foundation"
|
||||
android:drawableStart="@drawable/ic_delete"
|
||||
android:drawablePadding="14dp"
|
||||
android:drawableTint="?destructive"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:text="@string/current_session_delete"
|
||||
android:textColor="?destructive"
|
||||
android:textSize="16sp"
|
||||
tools:targetApi="m" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?neutralFaded"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/archive_session_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?foundation"
|
||||
android:drawableStart="@drawable/ic_tab_collection"
|
||||
android:drawablePadding="14dp"
|
||||
android:drawableTint="?accent"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:text="@string/current_session_save"
|
||||
android:textColor="?primaryText"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone"
|
||||
tools:targetApi="m" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/send_and_share_session_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?foundation"
|
||||
android:drawableStart="@drawable/mozac_ic_share"
|
||||
android:drawablePadding="14dp"
|
||||
android:drawableTint="?primaryText"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:text="@string/current_session_share"
|
||||
android:textColor="?primaryText"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone"
|
||||
tools:targetApi="m" />
|
||||
</LinearLayout>
|
@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/session_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="96dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardBackgroundColor="?above"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/session_card_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/session_card_thumbnail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/session_card_padding"
|
||||
android:src="@drawable/ic_session_thumbnail_placeholder_greyscale"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/session_card_timestamp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textAppearance="@style/Header14TextStyle"
|
||||
android:textColor="?primaryText"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/session_card_overflow_button"
|
||||
app:layout_constraintStart_toEndOf="@+id/session_card_thumbnail"
|
||||
app:layout_constraintTop_toTopOf="@id/session_card_thumbnail" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/session_card_titles"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="?secondaryText"
|
||||
app:layout_constraintEnd_toEndOf="@id/session_card_timestamp"
|
||||
app:layout_constraintStart_toStartOf="@id/session_card_timestamp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/session_card_timestamp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/session_card_extras"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
android:textColor="?secondaryText"
|
||||
app:layout_constraintStart_toStartOf="@id/session_card_titles"
|
||||
app:layout_constraintTop_toBottomOf="@+id/session_card_titles" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/bottomBarrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="session_card_thumbnail,session_card_extras" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/session_card_overflow_button"
|
||||
android:layout_width="@dimen/glyph_button_width"
|
||||
android:layout_height="@dimen/glyph_button_height"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/content_description_session_menu"
|
||||
android:src="@drawable/ic_menu"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/session_card_share_button"
|
||||
android:layout_width="@dimen/glyph_button_width"
|
||||
android:layout_height="@dimen/glyph_button_height"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/content_description_session_share"
|
||||
android:src="@drawable/ic_send"/>
|
||||
</androidx.cardview.widget.CardView>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/header_text"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textAppearance="@style/HeaderTextStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
Loading…
Reference in New Issue