Add support for dismissing in Talkback Mode

This should let the user be able to access dismiss in talkback
mode. However, because talkback relies on focus changes to work,
the focus change animator is disabled. This means some visuals
will not work the same as when talkback is turned off.

BUG: 28594452
Change-Id: Idb443fe559bd7a636ff381e6727f81d41d0bd325
This commit is contained in:
Sid Soundararajan
2016-05-19 14:08:46 -07:00
parent c991879f29
commit 1103bfca8d
3 changed files with 22 additions and 1 deletions

View File

@@ -16,5 +16,5 @@ limitations under the License.
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<item format="float" type="integer" name="unselected_scale">1.0</item>
<item format="float" type="integer" name="selected_scale">1.259</item>
<item format="float" type="integer" name="dismiss_unselected_alpha">0.1</item>
<item format="float" type="integer" name="dismiss_unselected_alpha">0.3</item>
</resources>

View File

@@ -104,6 +104,7 @@ public class ViewFocusAnimator implements View.OnFocusChangeListener {
mTargetView.getDismissIconView().setAlpha(mDismissIconAlpha * level);
mTargetView.getThumbnailView().setZ(z);
mTargetView.getDismissIconView().setZ(z);
}
public float getFocusProgress() {

View File

@@ -38,6 +38,8 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.tv.animations.DismissAnimationsHolder;
import com.android.systemui.recents.tv.animations.RecentsRowFocusAnimationHolder;
import com.android.systemui.recents.tv.animations.ViewFocusAnimator;
@@ -85,6 +87,24 @@ public class TaskCardView extends LinearLayout {
mCornerRadius = getResources().getDimensionPixelSize(
R.dimen.recents_task_view_rounded_corners_radius);
mRecentsRowFocusAnimationHolder = new RecentsRowFocusAnimationHolder(this, title);
SystemServicesProxy ssp = Recents.getSystemServices();
if (ssp.isTouchExplorationEnabled()) {
mDismissIconView.setFocusable(true);
mDismissIconView.setFocusableInTouchMode(true);
mDismissIconView.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
setDismissState(true);
} else {
setDismissState(false);
}
}
});
} else {
mDismissIconView.setFocusable(false);
mDismissIconView.setFocusableInTouchMode(false);
}
mViewFocusAnimator = new ViewFocusAnimator(this);
}