-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Camera content descriptions and allow camera capture in talk back.
- Loading branch information
1 parent
af8042c
commit 5a614fa
Showing
10 changed files
with
101 additions
and
55 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
64 changes: 64 additions & 0 deletions
64
src/org/thoughtcrime/securesms/mediasend/CameraButtonView.java
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,64 @@ | ||
package org.thoughtcrime.securesms.mediasend; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
import android.view.animation.Animation; | ||
import android.view.animation.AnimationUtils; | ||
|
||
import androidx.appcompat.widget.AppCompatButton; | ||
|
||
import org.thoughtcrime.securesms.R; | ||
|
||
public final class CameraButtonView extends AppCompatButton { | ||
|
||
private Animation shrinkAnimation; | ||
private Animation growAnimation; | ||
|
||
public CameraButtonView(Context context) { | ||
super(context); | ||
init(context); | ||
} | ||
|
||
public CameraButtonView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
init(context); | ||
} | ||
|
||
public CameraButtonView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
init(context); | ||
} | ||
|
||
public void init(Context context) { | ||
shrinkAnimation = AnimationUtils.loadAnimation(context, R.anim.camera_capture_button_shrink); | ||
growAnimation = AnimationUtils.loadAnimation(context, R.anim.camera_capture_button_grow); | ||
|
||
shrinkAnimation.setFillAfter(true); | ||
shrinkAnimation.setFillEnabled(true); | ||
|
||
growAnimation.setFillAfter(true); | ||
growAnimation.setFillEnabled(true); | ||
} | ||
|
||
@Override | ||
public boolean onTouchEvent(MotionEvent event) { | ||
switch (event.getAction()) { | ||
case MotionEvent.ACTION_DOWN: | ||
if (isEnabled()) { | ||
startAnimation(shrinkAnimation); | ||
performClick(); | ||
} | ||
return true; | ||
case MotionEvent.ACTION_UP: | ||
startAnimation(growAnimation); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean performClick() { | ||
return super.performClick(); | ||
} | ||
} |
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