Commit 44712336 authored by Tiger Oakes's avatar Tiger Oakes Committed by Emily Kager
Browse files

Remove unused sessions resources

parent badf79da
/* 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
}
}
}
<?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>
<?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>
\ No newline at end of file
<?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>
<?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>
\ No newline at end of file
<?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>
<?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>
......@@ -334,11 +334,6 @@
<string name="collection_rename">Sammlung umbenennen</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">Tabs öffnen</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">Löschen</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">%1$d Websites…</string>
<!-- History -->
......
......@@ -23,9 +23,9 @@
<!-- Explanation for private browsing displayed to users on home view when they first enable private mode
The first parameter is the name of the app defined in app_name (for example: Fenix) -->
<string name="private_browsing_explanation">%1$s borra tus búsquedas e historial de navegación cuando cierras una sesión privada
Aunque no te hace anónimo para los sitios web o proveedor de servicios de Internet,
Aunque no te hace anónimo para los sitios web o proveedor de servicios de Internet,
te ayuda a mantener en privado lo que haces en línea frente a cualquier otra persona que use este dispositivo. \n\nMitos comunes sobre la navegación privada
</string>
<!-- Delete session button to erase your history in a private session -->
<string name="private_browsing_delete_session">Eliminar sesión</string>
......@@ -331,12 +331,6 @@
<string name="collection_rename">Cambiar nombre a colección</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">Abrir pestañas</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">Eliminar</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">Sitios %1$d…</string>
<!-- History -->
......
......@@ -23,7 +23,7 @@
<!-- Explanation for private browsing displayed to users on home view when they first enable private mode
The first parameter is the name of the app defined in app_name (for example: Fenix) -->
<string name="private_browsing_explanation">%1$s borra tus búsquedas e historial de navegación cuando cierras una sesión privada
        Aunque no te hace anónimo para los sitios web o proveedor de servicios de Internet,
        Aunque no te hace anónimo para los sitios web o proveedor de servicios de Internet,
        te ayuda a mantener en privado lo que haces en línea frente a cualquier otra persona que use este dispositivo. \n\nMitos comunes sobre la navegación privada
        
    </string>
......@@ -337,11 +337,6 @@
<string name="collection_rename">Cambiar el nombre a la colección</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">Abrir pestañas</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">Eliminar</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more"> Sitios %1$d…</string>
<!-- History -->
......
......@@ -338,11 +338,6 @@
<string name="collection_rename">Renommer la collection</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">Ouvrir les onglets</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">Supprimer</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">%1$d sites…</string>
<!-- History -->
......
......@@ -340,12 +340,6 @@
<string name="collection_rename">Rinomina raccolta</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">Apri schede</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">Elimina</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">%1$d siti...</string>
<!-- History -->
......
......@@ -327,11 +327,6 @@
<string name="collection_rename">コレクションの名前を変更</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">タブを開く</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">削除</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">%1$d サイト…</string>
<!-- History -->
......
......@@ -330,11 +330,6 @@
<string name="collection_rename">모음집 이름 변경</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">열린 탭</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">삭제</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">사이트 %1$d개…</string>
<!-- History -->
......@@ -682,9 +677,9 @@
<string name="onboarding_privacy_notice_header">개인 정보 보호</string>
<!-- text for the privacy notice onboarding card description
The first parameter is the name of the app (e.g. Firefox Preview) -->
<string name="onboarding_privacy_notice_description">우리는 %s가 무엇을 온라인에서 공유하고 우리와 공유할지
<string name="onboarding_privacy_notice_description">우리는 %s가 무엇을 온라인에서 공유하고 우리와 공유할지
사용자가 제어할 수 있게 만들었습니다.
    </string>
<!-- Text for the button to read the privacy notice -->
<string name="onboarding_privacy_notice_read_button">개인 정보 보호 정책 읽기</string>
......
......@@ -338,11 +338,6 @@
<string name="collection_rename">Переименовать коллекцию</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">Открытые вкладки</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">Удалить</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">%1$d сайт(а)…</string>
<!-- History -->
......
......@@ -341,12 +341,6 @@
<string name="collection_rename">重命名收藏集</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">打开标签页</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">删除</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">还有 %1$d 个网站…</string>
<!-- History -->
......@@ -611,7 +605,7 @@
<!-- Sample text for accessibility font size -->
<string name="accessibility_text_size_sample_text">The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
<string name="accessibility_text_size_sample_text">The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
中文字体测试:天地玄黄,宇宙洪荒。日月盈昃,辰宿列张。</string>
<!-- Summary for Accessibility Text Size Scaling Preference -->
<string name="preference_accessibility_text_size_summary">放大或缩小网站上的文字</string>
......
......@@ -336,11 +336,6 @@
<string name="collection_rename">更名收藏集</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">開啟分頁</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">刪除</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->
<string name="session_items_more">還有 %1$d 個網站…</string>
<!-- History -->
......@@ -602,7 +597,7 @@
<!-- Sample text for accessibility font size -->
<string name="accessibility_text_size_sample_text">The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
<string name="accessibility_text_size_sample_text">The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
中文字型測試:「永東國酬,愛鬱。靈鷹袋!」</string>
<!-- Summary for Accessibility Text Size Scaling Preference -->
<string name="preference_accessibility_text_size_summary">放大或縮小網站上的文字</string>
......
......@@ -331,11 +331,6 @@
<string name="collection_rename">Rename collection</string>
<!-- Text for the button to open tabs of the selected collection -->
<string name="collection_open_tabs">Open tabs</string>
<!-- Text for the button to delete a single session -->
<string name="session_item_delete">Delete</string>
<!-- Text to tell the user how many more tabs this session has.
The first parameter is a digit that shows the cardinal number of how many additional tabs the session has. -->