-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84e654e
commit ffc1463
Showing
13 changed files
with
220 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
app/src/main/java/org/thoughtcrime/securesms/conversation/v2/DoubleTapEditEducationSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.thoughtcrime.securesms.conversation.v2 | ||
|
||
import android.content.DialogInterface | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.google.android.material.button.MaterialButton | ||
import org.thoughtcrime.securesms.R | ||
import org.thoughtcrime.securesms.components.FixedRoundedCornerBottomSheetDialogFragment | ||
import org.thoughtcrime.securesms.conversation.ConversationMessage | ||
import org.thoughtcrime.securesms.conversation.mutiselect.MultiselectPart | ||
import org.thoughtcrime.securesms.keyvalue.SignalStore | ||
import org.thoughtcrime.securesms.util.fragments.requireListener | ||
|
||
/** | ||
* Shows an education sheet to users explaining how double tapping a sent message within 24hrs will allow them to edit it | ||
*/ | ||
class DoubleTapEditEducationSheet(private val item: MultiselectPart) : FixedRoundedCornerBottomSheetDialogFragment() { | ||
|
||
companion object { | ||
const val KEY = "DOUBLE_TAP_EDIT_EDU" | ||
} | ||
|
||
override val peekHeightPercentage: Float = 1f | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
return inflater.inflate(R.layout.conversation_item_double_tap_edit_education_sheet, container, false) | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
SignalStore.uiHints().hasSeenDoubleTapEditEducationSheet = true | ||
|
||
view.findViewById<MaterialButton>(R.id.got_it).setOnClickListener { | ||
requireListener<Callback>().onDoubleTapEditEducationSheetNext(item.conversationMessage) | ||
dismissAllowingStateLoss() | ||
} | ||
} | ||
|
||
override fun onCancel(dialog: DialogInterface) { | ||
super.onCancel(dialog) | ||
requireListener<Callback>().onDoubleTapEditEducationSheetNext(item.conversationMessage) | ||
} | ||
|
||
interface Callback { | ||
fun onDoubleTapEditEducationSheetNext(conversationMessage: ConversationMessage) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
app/src/main/res/layout/conversation_item_double_tap_edit_education_sheet.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<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" | ||
tools:viewBindingIgnore="true"> | ||
|
||
<ImageView | ||
android:id="@+id/handle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_horizontal" | ||
android:layout_marginTop="10dp" | ||
android:importantForAccessibility="no" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:srcCompat="@drawable/bottom_sheet_handle" /> | ||
|
||
<ImageView | ||
android:id="@+id/image" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="24dp" | ||
android:importantForAccessibility="no" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/handle" | ||
app:tint="@color/signal_icon_tint_primary" | ||
app:srcCompat="@drawable/ic_tap_outline_24" /> | ||
|
||
<TextView | ||
android:id="@+id/title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginBottom="24dp" | ||
android:text="@string/DoubleTapEditEducationSheet__double_tap_edit_title" | ||
android:textAppearance="@style/Signal.Text.TitleLarge" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/image" /> | ||
|
||
<TextView | ||
android:id="@+id/double_tap_details" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="24dp" | ||
android:layout_marginHorizontal="30dp" | ||
android:gravity="center" | ||
android:text="@string/DoubleTapEditEducationSheet__quickly_tap_twice" | ||
android:textAppearance="@style/Signal.Text.BodyLarge" | ||
android:textColor="@color/signal_colorSecondary" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/title" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/got_it" | ||
style="@style/Signal.Widget.Button.Medium.Primary" | ||
android:backgroundTint="@color/signal_colorPrimaryContainer" | ||
android:textColor="@color/signal_colorOnPrimaryContainer" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="36dp" | ||
android:layout_marginEnd="24dp" | ||
android:layout_marginBottom="16dp" | ||
android:text="@string/DoubleTapEditEducationSheet__got_it" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/double_tap_details" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters