Merge "Refactor KeyboardAccessibilityDelegate class a bit"
This commit is contained in:
commit
d3642a2a58
2 changed files with 16 additions and 6 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package com.android.inputmethod.accessibility;
|
package com.android.inputmethod.accessibility;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.support.v4.view.AccessibilityDelegateCompat;
|
import android.support.v4.view.AccessibilityDelegateCompat;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
|
@ -69,6 +70,19 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView>
|
||||||
return mKeyboard;
|
return mKeyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a window state change event with the specified string resource id.
|
||||||
|
*
|
||||||
|
* @param resId The string resource id of the text to send with the event.
|
||||||
|
*/
|
||||||
|
protected void sendWindowStateChanged(final int resId) {
|
||||||
|
if (resId == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Context context = mKeyboardView.getContext();
|
||||||
|
sendWindowStateChanged(context.getString(resId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a window state change event with the specified text.
|
* Sends a window state change event with the specified text.
|
||||||
*
|
*
|
||||||
|
|
|
@ -163,17 +163,13 @@ public final class MainKeyboardAccessibilityDelegate
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String text = mKeyboardView.getContext().getString(resId);
|
sendWindowStateChanged(resId);
|
||||||
sendWindowStateChanged(text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Announces that the keyboard has been hidden.
|
* Announces that the keyboard has been hidden.
|
||||||
*/
|
*/
|
||||||
private void announceKeyboardHidden() {
|
private void announceKeyboardHidden() {
|
||||||
final Context context = mKeyboardView.getContext();
|
sendWindowStateChanged(R.string.announce_keyboard_hidden);
|
||||||
final String text = context.getString(R.string.announce_keyboard_hidden);
|
|
||||||
|
|
||||||
sendWindowStateChanged(text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue