Skip to content

Commit

Permalink
Remove tap-to-dismiss from view-once.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Jan 8, 2020
1 parent c346f32 commit 5e9c4e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,6 @@ protected void onCreate(Bundle savedInstanceState, boolean ready) {
this.closeButton = findViewById(R.id.view_once_close_button);
this.uri = getIntent().getParcelableExtra(KEY_URI);

ViewOnceGestureListener imageListener = new ViewOnceGestureListener(image);
GestureDetector imageDetector = new GestureDetector(this, imageListener);

ViewOnceGestureListener videoListener = new ViewOnceGestureListener(video);
GestureDetector videoDetector = new GestureDetector(this, videoListener);

image.setOnTouchListener((view, event) -> imageDetector.onTouchEvent(event));
image.setOnClickListener(v -> finish());

video.setOnTouchListener((view, event) -> videoDetector.onTouchEvent(event));
video.setOnClickListener(v -> finish());

closeButton.setOnClickListener(v -> finish());

initViewModel(getIntent().getLongExtra(KEY_MESSAGE_ID, -1), uri);
Expand Down
26 changes: 18 additions & 8 deletions app/src/main/res/layout/view_once_message_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,24 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />

<ImageView
android:id="@+id/view_once_close_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="19dp"
android:layout_marginStart="19dp"
android:tint="@color/core_white"
app:srcCompat="@drawable/ic_x"/>
<!-- Need this wrapper layout to get the ripple to show correctly. https://issuetracker.google.com/issues/111819099 -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent">

<ImageView
android:id="@+id/view_once_close_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:padding="4dp"
android:tint="@color/core_white"
android:background="?selectableItemBackgroundBorderless"
app:srcCompat="@drawable/ic_x"/>

</FrameLayout>

<TextView
android:id="@+id/view_once_duration"
Expand Down

0 comments on commit 5e9c4e8

Please sign in to comment.