mirror of
https://github.com/yuliskov/LeanKeyboard.git
synced 2026-04-29 03:13:57 -04:00
refactoring + license
This commit is contained in:
339
License
Normal file
339
License
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -14,6 +14,7 @@ import android.inputmethodservice.Keyboard;
|
||||
import android.inputmethodservice.Keyboard.Key;
|
||||
import android.os.Bundle;
|
||||
import android.speech.RecognitionListener;
|
||||
import android.speech.RecognizerIntent;
|
||||
import android.speech.SpeechRecognizer;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -101,7 +102,7 @@ public class LeanbackKeyboardContainer {
|
||||
private LeanbackKeyboardContainer.KeyFocus mTempKeyInfo = new LeanbackKeyboardContainer.KeyFocus();
|
||||
private PointF mTempPoint = new PointF();
|
||||
private boolean mTouchDown = false;
|
||||
private int mTouchState = 0;
|
||||
private int mTouchState = TOUCH_STATE_NO_TOUCH;
|
||||
private final int mVoiceAnimDur;
|
||||
private final LeanbackKeyboardContainer.VoiceIntroAnimator mVoiceAnimator;
|
||||
private RecognizerView mVoiceButtonView;
|
||||
@@ -225,8 +226,8 @@ public class LeanbackKeyboardContainer {
|
||||
final float width = (float) (this.mRootView.getWidth() - this.mRootView.getPaddingRight() - this.mRootView.getPaddingLeft());
|
||||
final float height = (float) (this.mRootView.getHeight() - this.mRootView.getPaddingTop() - this.mRootView.getPaddingBottom());
|
||||
final float size = this.mContext.getResources().getDimension(R.dimen.selector_size);
|
||||
result.x = posXCm / 12.0F * (width - size) + (float) this.mRootView.getPaddingLeft();
|
||||
result.y = posYCm / 5.0F * (height - size) + (float) this.mRootView.getPaddingTop();
|
||||
result.x = posXCm / PHYSICAL_WIDTH_CM * (width - size) + (float) this.mRootView.getPaddingLeft();
|
||||
result.y = posYCm / PHYSICAL_HEIGHT_CM * (height - size) + (float) this.mRootView.getPaddingTop();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -236,8 +237,8 @@ public class LeanbackKeyboardContainer {
|
||||
float posXCm = (float) (this.mRootView.getWidth() - this.mRootView.getPaddingRight() - this.mRootView.getPaddingLeft());
|
||||
float posYCm = (float) (this.mRootView.getHeight() - this.mRootView.getPaddingTop() - this.mRootView.getPaddingBottom());
|
||||
float size = this.mContext.getResources().getDimension(R.dimen.selector_size);
|
||||
result.x = (x - width - (float) this.mRootView.getPaddingLeft()) * 12.0F / (posXCm - size);
|
||||
result.y = (y - height - (float) this.mRootView.getPaddingTop()) * 5.0F / (posYCm - size);
|
||||
result.x = (x - width - (float) this.mRootView.getPaddingLeft()) * PHYSICAL_WIDTH_CM / (posXCm - size);
|
||||
result.y = (y - height - (float) this.mRootView.getPaddingTop()) * PHYSICAL_HEIGHT_CM / (posYCm - size);
|
||||
}
|
||||
|
||||
private PointF getTouchSnapPosition() {
|
||||
@@ -359,11 +360,11 @@ public class LeanbackKeyboardContainer {
|
||||
|
||||
this.mCapCharacters = false;
|
||||
if (var2.privateImeOptions != null) {
|
||||
if (var2.privateImeOptions.contains("EscapeNorth=1")) {
|
||||
if (var2.privateImeOptions.contains(IME_PRIVATE_OPTIONS_ESCAPE_NORTH)) {
|
||||
this.mEscapeNorthEnabled = false;
|
||||
}
|
||||
|
||||
if (var2.privateImeOptions.contains("VoiceDismiss=1")) {
|
||||
if (var2.privateImeOptions.contains(IME_PRIVATE_OPTIONS_VOICE_DISMISS)) {
|
||||
this.mVoiceKeyDismissesEnabled = false;
|
||||
}
|
||||
}
|
||||
@@ -442,37 +443,41 @@ public class LeanbackKeyboardContainer {
|
||||
}
|
||||
}
|
||||
|
||||
private void setShiftState(int var1) {
|
||||
this.mMainKeyboardView.setShiftState(var1);
|
||||
private void setShiftState(int state) {
|
||||
this.mMainKeyboardView.setShiftState(state);
|
||||
}
|
||||
|
||||
private void setTouchStateInternal(int var1) {
|
||||
this.mTouchState = var1;
|
||||
private void setTouchStateInternal(int state) {
|
||||
this.mTouchState = state;
|
||||
}
|
||||
|
||||
private void startRecognition(Context var1) {
|
||||
this.mRecognizerIntent = new Intent("android.speech.action.RECOGNIZE_SPEECH");
|
||||
this.mRecognizerIntent.putExtra("android.speech.extra.LANGUAGE_MODEL", "free_form");
|
||||
this.mRecognizerIntent.putExtra("android.speech.extra.PARTIAL_RESULTS", true);
|
||||
private void startRecognition(Context context) {
|
||||
this.mRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
||||
this.mRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "free_form");
|
||||
this.mRecognizerIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
|
||||
this.mSpeechRecognizer.setRecognitionListener(new RecognitionListener() {
|
||||
float peakRmsLevel = 0.0F;
|
||||
int rmsCounter = 0;
|
||||
|
||||
@Override
|
||||
public void onBeginningOfSpeech() {
|
||||
LeanbackKeyboardContainer.this.mVoiceButtonView.showRecording();
|
||||
}
|
||||
|
||||
public void onBufferReceived(byte[] var1) {
|
||||
@Override
|
||||
public void onBufferReceived(byte[] bytes) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEndOfSpeech() {
|
||||
LeanbackKeyboardContainer.this.mVoiceButtonView.showRecognizing();
|
||||
LeanbackKeyboardContainer.this.mVoiceOn = false;
|
||||
}
|
||||
|
||||
public void onError(int var1) {
|
||||
@Override
|
||||
public void onError(int i) {
|
||||
LeanbackKeyboardContainer.this.cancelVoiceRecording();
|
||||
switch (var1) {
|
||||
switch (i) {
|
||||
case 4:
|
||||
Log.d("LbKbContainer", "recognizer error server error");
|
||||
return;
|
||||
@@ -486,24 +491,28 @@ public class LeanbackKeyboardContainer {
|
||||
Log.d("LbKbContainer", "recognizer error no match");
|
||||
return;
|
||||
default:
|
||||
Log.d("LbKbContainer", "recognizer other error " + var1);
|
||||
Log.d("LbKbContainer", "recognizer other error " + i);
|
||||
}
|
||||
}
|
||||
|
||||
public void onEvent(int var1, Bundle var2) {
|
||||
@Override
|
||||
public void onEvent(int i, Bundle bundle) {
|
||||
}
|
||||
|
||||
public void onPartialResults(Bundle var1) {
|
||||
@Override
|
||||
public void onPartialResults(Bundle bundle) {
|
||||
synchronized (this) {
|
||||
}
|
||||
}
|
||||
|
||||
public void onReadyForSpeech(Bundle var1) {
|
||||
@Override
|
||||
public void onReadyForSpeech(Bundle bundle) {
|
||||
LeanbackKeyboardContainer.this.mVoiceButtonView.showListening();
|
||||
}
|
||||
|
||||
public void onResults(Bundle var1) {
|
||||
ArrayList var2 = var1.getStringArrayList("results_recognition");
|
||||
@Override
|
||||
public void onResults(Bundle bundle) {
|
||||
ArrayList var2 = bundle.getStringArrayList("results_recognition");
|
||||
if (var2 != null && LeanbackKeyboardContainer.this.mVoiceListener != null) {
|
||||
LeanbackKeyboardContainer.this.mVoiceListener.onVoiceResult((String) var2.get(0));
|
||||
}
|
||||
@@ -511,7 +520,8 @@ public class LeanbackKeyboardContainer {
|
||||
LeanbackKeyboardContainer.this.cancelVoiceRecording();
|
||||
}
|
||||
|
||||
public void onRmsChanged(float param1) {
|
||||
@Override
|
||||
public void onRmsChanged(float v) {
|
||||
// $FF: Couldn't be decompiled
|
||||
throw new IllegalStateException("method not implemented");
|
||||
}
|
||||
@@ -519,14 +529,14 @@ public class LeanbackKeyboardContainer {
|
||||
this.mSpeechRecognizer.startListening(this.mRecognizerIntent);
|
||||
}
|
||||
|
||||
public void alignSelector(float var1, float var2, boolean var3) {
|
||||
var1 -= (float) (this.mSelector.getWidth() / 2);
|
||||
var2 -= (float) (this.mSelector.getHeight() / 2);
|
||||
if (!var3) {
|
||||
this.mSelector.setX(var1);
|
||||
this.mSelector.setY(var2);
|
||||
public void alignSelector(final float x, final float y, final boolean playAnimation) {
|
||||
final float translatedX = x - (float) (this.mSelector.getWidth() / 2);
|
||||
final float translatedY = y - (float) (this.mSelector.getHeight() / 2);
|
||||
if (!playAnimation) {
|
||||
this.mSelector.setX(translatedX);
|
||||
this.mSelector.setY(translatedY);
|
||||
} else {
|
||||
this.mSelector.animate().x(var1).y(var2).setInterpolator(sMovementInterpolator).setDuration(150L).start();
|
||||
this.mSelector.animate().x(translatedX).y(translatedY).setInterpolator(sMovementInterpolator).setDuration(MOVEMENT_ANIMATION_DURATION).start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,8 +631,8 @@ public class LeanbackKeyboardContainer {
|
||||
return this.mActionButtonView;
|
||||
}
|
||||
|
||||
public Key getKey(int var1, int var2) {
|
||||
return var1 == 0 ? this.mMainKeyboardView.getKey(var2) : null;
|
||||
public Key getKey(int type, int index) {
|
||||
return type == KeyFocus.TYPE_MAIN ? this.mMainKeyboardView.getKey(index) : null;
|
||||
}
|
||||
|
||||
public boolean getNextFocusInDirection(int direction, LeanbackKeyboardContainer.KeyFocus startFocus, LeanbackKeyboardContainer.KeyFocus nextFocus) {
|
||||
@@ -846,15 +856,16 @@ public class LeanbackKeyboardContainer {
|
||||
this.setShiftState(var1);
|
||||
}
|
||||
|
||||
public void onShiftDoubleClick(boolean var1) {
|
||||
byte var2;
|
||||
if (var1) {
|
||||
var2 = 0;
|
||||
// TODO: state constants
|
||||
public void onShiftDoubleClick(boolean wasCapsLockOn) {
|
||||
byte state;
|
||||
if (wasCapsLockOn) {
|
||||
state = 0;
|
||||
} else {
|
||||
var2 = 2;
|
||||
state = 2;
|
||||
}
|
||||
|
||||
this.setShiftState(var2);
|
||||
this.setShiftState(state);
|
||||
}
|
||||
|
||||
public void onSpaceEntry() {
|
||||
@@ -869,8 +880,8 @@ public class LeanbackKeyboardContainer {
|
||||
|
||||
}
|
||||
|
||||
public void onStartInput(EditorInfo var1) {
|
||||
this.setImeOptions(this.mContext.getResources(), var1);
|
||||
public void onStartInput(EditorInfo info) {
|
||||
this.setImeOptions(this.mContext.getResources(), info);
|
||||
this.mVoiceOn = false;
|
||||
}
|
||||
|
||||
@@ -994,33 +1005,33 @@ public class LeanbackKeyboardContainer {
|
||||
}
|
||||
}
|
||||
|
||||
public void setTouchState(int var1) {
|
||||
switch (var1) {
|
||||
case 0:
|
||||
if (this.mTouchState == 2 || this.mTouchState == 3) {
|
||||
this.mSelectorAnimator.reverse();
|
||||
public void setTouchState(final int state) {
|
||||
switch (state) {
|
||||
case TOUCH_STATE_NO_TOUCH:
|
||||
if (mTouchState == TOUCH_STATE_TOUCH_MOVE || mTouchState == TOUCH_STATE_CLICK) {
|
||||
mSelectorAnimator.reverse();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this.mTouchState == 3) {
|
||||
this.mSelectorAnimator.reverse();
|
||||
} else if (this.mTouchState == 2) {
|
||||
this.mSelectorAnimator.reverse();
|
||||
case TOUCH_STATE_TOUCH_SNAP:
|
||||
if (mTouchState == TOUCH_STATE_CLICK) {
|
||||
mSelectorAnimator.reverse();
|
||||
} else if (mTouchState == TOUCH_STATE_TOUCH_MOVE) {
|
||||
mSelectorAnimator.reverse();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this.mTouchState == 0 || this.mTouchState == 1) {
|
||||
this.mSelectorAnimator.start();
|
||||
case TOUCH_STATE_TOUCH_MOVE:
|
||||
if (mTouchState == TOUCH_STATE_NO_TOUCH || mTouchState == TOUCH_STATE_TOUCH_SNAP) {
|
||||
mSelectorAnimator.start();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (this.mTouchState == 0 || this.mTouchState == 1) {
|
||||
this.mSelectorAnimator.start();
|
||||
case TOUCH_STATE_CLICK:
|
||||
if (mTouchState == TOUCH_STATE_NO_TOUCH || mTouchState == TOUCH_STATE_TOUCH_SNAP) {
|
||||
mSelectorAnimator.start();
|
||||
}
|
||||
}
|
||||
|
||||
this.setTouchStateInternal(var1);
|
||||
this.setKbFocus(this.mCurrKeyInfo, true, true);
|
||||
setTouchStateInternal(state);
|
||||
setKbFocus(mCurrKeyInfo, true, true);
|
||||
}
|
||||
|
||||
public void setVoiceListener(LeanbackKeyboardContainer.VoiceListener var1) {
|
||||
@@ -1093,39 +1104,41 @@ public class LeanbackKeyboardContainer {
|
||||
final Rect rect = new Rect();
|
||||
int type = -1;
|
||||
|
||||
public boolean equals(Object var1) {
|
||||
if (this != var1) {
|
||||
if (var1 == null || this.getClass() != var1.getClass()) {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this != obj) {
|
||||
if (obj == null || this.getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LeanbackKeyboardContainer.KeyFocus var2 = (LeanbackKeyboardContainer.KeyFocus) var1;
|
||||
if (this.code != var2.code) {
|
||||
LeanbackKeyboardContainer.KeyFocus focus = (LeanbackKeyboardContainer.KeyFocus) obj;
|
||||
if (this.code != focus.code) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.index != var2.index) {
|
||||
if (this.index != focus.index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.type != var2.type) {
|
||||
if (this.type != focus.type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: label
|
||||
label31:
|
||||
{
|
||||
if (this.label != null) {
|
||||
if (this.label.equals(var2.label)) {
|
||||
if (this.label.equals(focus.label)) {
|
||||
break label31;
|
||||
}
|
||||
} else if (var2.label == null) {
|
||||
} else if (focus.label == null) {
|
||||
break label31;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.rect.equals(var2.rect)) {
|
||||
if (!this.rect.equals(focus.rect)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1134,33 +1147,33 @@ public class LeanbackKeyboardContainer {
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int var2 = this.rect.hashCode();
|
||||
int var3 = this.index;
|
||||
int var4 = this.type;
|
||||
int var5 = this.code;
|
||||
int var1;
|
||||
int hash = this.rect.hashCode();
|
||||
int index = this.index;
|
||||
int type = this.type;
|
||||
int code = this.code;
|
||||
int salt;
|
||||
if (this.label != null) {
|
||||
var1 = this.label.hashCode();
|
||||
salt = this.label.hashCode();
|
||||
} else {
|
||||
var1 = 0;
|
||||
salt = 0;
|
||||
}
|
||||
|
||||
return (((var2 * 31 + var3) * 31 + var4) * 31 + var5) * 31 + var1;
|
||||
return (((hash * 31 + index) * 31 + type) * 31 + code) * 31 + salt;
|
||||
}
|
||||
|
||||
public void set(LeanbackKeyboardContainer.KeyFocus var1) {
|
||||
this.index = var1.index;
|
||||
this.type = var1.type;
|
||||
this.code = var1.code;
|
||||
this.label = var1.label;
|
||||
this.rect.set(var1.rect);
|
||||
public void set(LeanbackKeyboardContainer.KeyFocus focus) {
|
||||
this.index = focus.index;
|
||||
this.type = focus.type;
|
||||
this.code = focus.code;
|
||||
this.label = focus.label;
|
||||
this.rect.set(focus.rect);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder var1 = new StringBuilder();
|
||||
var1.append("[type: ").append(this.type).append(", index: ").append(this.index).append(", code: ").append(this.code).append(", label: " +
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("[type: ").append(this.type).append(", index: ").append(this.index).append(", code: ").append(this.code).append(", label: " +
|
||||
"").append(this.label).append(", rect: ").append(this.rect).append("]");
|
||||
return var1.toString();
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1179,7 +1192,7 @@ public class LeanbackKeyboardContainer {
|
||||
public ScaleAnimation(FrameLayout var2) {
|
||||
this.mView = var2;
|
||||
this.mParams = var2.getLayoutParams();
|
||||
this.setDuration(150L);
|
||||
this.setDuration(MOVEMENT_ANIMATION_DURATION);
|
||||
this.setInterpolator(LeanbackKeyboardContainer.sMovementInterpolator);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -258,8 +258,8 @@ public class LeanbackKeyboardView extends FrameLayout {
|
||||
return this.mKeyboard;
|
||||
}
|
||||
|
||||
public int getNearestIndex(float x, float y) {
|
||||
int var7;
|
||||
public int getNearestIndex(final float x, final float y) {
|
||||
int result;
|
||||
if (this.mKeys != null && this.mKeys.length != 0) {
|
||||
float var3 = (float) this.getPaddingLeft();
|
||||
float var4 = (float) this.getPaddingTop();
|
||||
@@ -269,11 +269,11 @@ public class LeanbackKeyboardView extends FrameLayout {
|
||||
int var10 = this.getColCount();
|
||||
int var8 = (int) ((y - var4) / var5 * (float) var9);
|
||||
if (var8 < 0) {
|
||||
var7 = 0;
|
||||
result = 0;
|
||||
} else {
|
||||
var7 = var8;
|
||||
result = var8;
|
||||
if (var8 >= var9) {
|
||||
var7 = var9 - 1;
|
||||
result = var9 - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,33 +287,33 @@ public class LeanbackKeyboardView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
var8 += this.mColCount * var7;
|
||||
var7 = var8;
|
||||
if (var8 > 46) {
|
||||
var7 = var8;
|
||||
var8 += this.mColCount * result;
|
||||
result = var8;
|
||||
if (var8 > ASCII_PERIOD) {
|
||||
result = var8;
|
||||
if (var8 < 53) {
|
||||
var7 = 46;
|
||||
result = ASCII_PERIOD;
|
||||
}
|
||||
}
|
||||
|
||||
var8 = var7;
|
||||
if (var7 >= 53) {
|
||||
var8 = var7 - 6;
|
||||
var8 = result;
|
||||
if (result >= 53) {
|
||||
var8 = result - 6;
|
||||
}
|
||||
|
||||
if (var8 < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var7 = var8;
|
||||
result = var8;
|
||||
if (var8 >= this.mKeys.length) {
|
||||
return this.mKeys.length - 1;
|
||||
}
|
||||
} else {
|
||||
var7 = 0;
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return var7;
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
|
||||
@@ -20,9 +20,9 @@ public class LeanbackSuggestionsFactory {
|
||||
private int mNumSuggestions;
|
||||
private final ArrayList<String> mSuggestions = new ArrayList();
|
||||
|
||||
public LeanbackSuggestionsFactory(InputMethodService var1, int var2) {
|
||||
this.mContext = var1;
|
||||
this.mNumSuggestions = var2;
|
||||
public LeanbackSuggestionsFactory(InputMethodService context, int numSuggestions) {
|
||||
this.mContext = context;
|
||||
this.mNumSuggestions = numSuggestions;
|
||||
}
|
||||
|
||||
public void clearSuggestions() {
|
||||
|
||||
@@ -127,13 +127,13 @@ public class TouchNavSpaceTracker {
|
||||
return var3;
|
||||
}
|
||||
|
||||
private void checkForLongClick(int var1, KeyEvent var2) {
|
||||
private void checkForLongClick(int var1, KeyEvent event) {
|
||||
if (var1 == 23) {
|
||||
Message var3 = this.mHandler.obtainMessage(0);
|
||||
var3.arg1 = var1;
|
||||
var3.obj = var2;
|
||||
Message msg = this.mHandler.obtainMessage(0);
|
||||
msg.arg1 = var1;
|
||||
msg.obj = event;
|
||||
if (!this.mHandler.hasMessages(0)) {
|
||||
this.mHandler.sendMessageDelayed(var3, (long)ViewConfiguration.getLongPressTimeout());
|
||||
this.mHandler.sendMessageDelayed(msg, (long)ViewConfiguration.getLongPressTimeout());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -253,16 +253,16 @@ public class TouchNavSpaceTracker {
|
||||
return new PointF(this.getPixelX(this.mPhysicalPosition.x), this.getPixelY(this.mPhysicalPosition.y));
|
||||
}
|
||||
|
||||
public boolean onGenericMotionEvent(MotionEvent var1) {
|
||||
if (var1 != null && (var1.getSource() & 2097152) == 2097152) {
|
||||
InputDevice var13 = var1.getDevice();
|
||||
public boolean onGenericMotionEvent(MotionEvent event) {
|
||||
if (event != null && (event.getSource() & InputDevice.SOURCE_TOUCH_NAVIGATION) == InputDevice.SOURCE_TOUCH_NAVIGATION) {
|
||||
InputDevice var13 = event.getDevice();
|
||||
if (var13 == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TouchNavMotionTracker var19 = this.getTrackerForDevice(var13);
|
||||
int var10 = var1.getActionMasked();
|
||||
var19.addMovement(var1);
|
||||
int var10 = event.getActionMasked();
|
||||
var19.addMovement(event);
|
||||
boolean var6;
|
||||
if ((var10 & 255) == 6) {
|
||||
var6 = true;
|
||||
@@ -272,19 +272,19 @@ public class TouchNavSpaceTracker {
|
||||
|
||||
int var7;
|
||||
if (var6) {
|
||||
var7 = var1.getActionIndex();
|
||||
var7 = event.getActionIndex();
|
||||
} else {
|
||||
var7 = -1;
|
||||
}
|
||||
|
||||
float var3 = 0.0F;
|
||||
float var2 = 0.0F;
|
||||
int var9 = var1.getPointerCount();
|
||||
int var9 = event.getPointerCount();
|
||||
|
||||
for(int var8 = 0; var8 < var9; ++var8) {
|
||||
if (var7 != var8) {
|
||||
var3 += var1.getX(var8);
|
||||
var2 += var1.getY(var8);
|
||||
var3 += event.getX(var8);
|
||||
var2 += event.getY(var8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ public class TouchNavSpaceTracker {
|
||||
|
||||
float var4 = var3 / (float)var17;
|
||||
float var5 = var2 / (float)var17;
|
||||
TouchNavSpaceTracker.PhysicalMotionEvent var14 = new TouchNavSpaceTracker.PhysicalMotionEvent(var1.getDeviceId(), var19.getPhysicalX(var4), var19.getPhysicalX(var5), var1.getEventTime());
|
||||
TouchNavSpaceTracker.PhysicalMotionEvent var14 = new TouchNavSpaceTracker.PhysicalMotionEvent(event.getDeviceId(), var19.getPhysicalX(var4), var19.getPhysicalX(var5), event.getEventTime());
|
||||
boolean var18 = false;
|
||||
boolean var12 = false;
|
||||
boolean var11;
|
||||
@@ -312,7 +312,7 @@ public class TouchNavSpaceTracker {
|
||||
|
||||
var19.setNewValues(var4, var5);
|
||||
var19.updatePrevValues();
|
||||
var19.setDownEvent(MotionEvent.obtain(var1));
|
||||
var19.setDownEvent(MotionEvent.obtain(event));
|
||||
if (this.mPixelListener != null) {
|
||||
return false | this.mPixelListener.onDown(var14);
|
||||
}
|
||||
@@ -324,7 +324,7 @@ public class TouchNavSpaceTracker {
|
||||
return false | this.mPixelListener.onUp(var14, this.getPixelX(this.mPhysicalPosition.x), this.getPixelY(this.mPhysicalPosition.y));
|
||||
}
|
||||
|
||||
var16 = new TouchNavSpaceTracker.PhysicalMotionEvent(var1.getDeviceId(), var19.getPhysicalX(var15.getX()), var19.getPhysicalY(var15.getY()), var15.getEventTime());
|
||||
var16 = new TouchNavSpaceTracker.PhysicalMotionEvent(event.getDeviceId(), var19.getPhysicalX(var15.getX()), var19.getPhysicalY(var15.getY()), var15.getEventTime());
|
||||
var6 = var18;
|
||||
if (var19.computeVelocity()) {
|
||||
var6 = var18;
|
||||
@@ -356,7 +356,7 @@ public class TouchNavSpaceTracker {
|
||||
return var6 | var11;
|
||||
case 2:
|
||||
if (var19.getDownEvent() == null) {
|
||||
var19.setDownEvent(MotionEvent.obtain(var1));
|
||||
var19.setDownEvent(MotionEvent.obtain(event));
|
||||
if (this.mLPFEnabled) {
|
||||
this.mLPFCurrX = var4;
|
||||
this.mLPFCurrY = var5;
|
||||
@@ -375,7 +375,7 @@ public class TouchNavSpaceTracker {
|
||||
if (var19.setNewValues(var3, var2)) {
|
||||
var2 = var19.getPhysicalX(var19.getScrollX());
|
||||
var3 = var19.getPhysicalY(var19.getScrollY());
|
||||
var4 = this.calculateSensitivity(var1, var19.getDownEvent());
|
||||
var4 = this.calculateSensitivity(event, var19.getDownEvent());
|
||||
this.mPhysicalPosition.x = this.mPrevPhysPosition.x + this.getScaledValue(var2, var4);
|
||||
this.mPhysicalPosition.y = this.mPrevPhysPosition.y + this.getScaledValue(var3, var4);
|
||||
this.clampPosition();
|
||||
@@ -387,7 +387,7 @@ public class TouchNavSpaceTracker {
|
||||
var11 = var12;
|
||||
if (this.mPixelWidth > 0.0F) {
|
||||
var15 = var19.getDownEvent();
|
||||
var16 = new TouchNavSpaceTracker.PhysicalMotionEvent(var1.getDeviceId(), var19.getPhysicalX(var15.getX()), var19.getPhysicalY(var15.getY()), var15.getEventTime());
|
||||
var16 = new TouchNavSpaceTracker.PhysicalMotionEvent(event.getDeviceId(), var19.getPhysicalX(var15.getX()), var19.getPhysicalY(var15.getY()), var15.getEventTime());
|
||||
var2 = this.getPixelX(this.mPhysicalPosition.x);
|
||||
var3 = this.getPixelY(this.mPhysicalPosition.y);
|
||||
var11 = false | this.mPixelListener.onMove(var16, var14, var2, var3);
|
||||
@@ -416,28 +416,28 @@ public class TouchNavSpaceTracker {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int var1, KeyEvent var2) {
|
||||
if (var2 != null && var2.getDevice() != null && (var2.getDevice().getSources() & 2097152) == 2097152) {
|
||||
if (var2.getRepeatCount() == 0) {
|
||||
this.checkForLongClick(var1, var2);
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (event != null && event.getDevice() != null && (event.getDevice().getSources() & InputDevice.SOURCE_TOUCH_NAVIGATION) == InputDevice.SOURCE_TOUCH_NAVIGATION) {
|
||||
if (event.getRepeatCount() == 0) {
|
||||
checkForLongClick(keyCode, event);
|
||||
}
|
||||
|
||||
if (this.mKeyEventListener != null) {
|
||||
return this.mKeyEventListener.onKeyDown(var1, var2);
|
||||
if (mKeyEventListener != null) {
|
||||
return mKeyEventListener.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int var1, KeyEvent var2) {
|
||||
if (var2 != null && var2.getDevice() != null && (var2.getDevice().getSources() & 2097152) == 2097152) {
|
||||
if (var1 == 23) {
|
||||
this.mHandler.removeMessages(0);
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (event != null && event.getDevice() != null && (event.getDevice().getSources() & InputDevice.SOURCE_TOUCH_NAVIGATION) == InputDevice.SOURCE_TOUCH_NAVIGATION) {
|
||||
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
|
||||
mHandler.removeMessages(0);
|
||||
}
|
||||
|
||||
if (this.mKeyEventListener != null) {
|
||||
return this.mKeyEventListener.onKeyUp(var1, var2);
|
||||
if (mKeyEventListener != null) {
|
||||
return mKeyEventListener.onKeyUp(keyCode, event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,56 +445,56 @@ public class TouchNavSpaceTracker {
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
this.mHandler.removeMessages(0);
|
||||
mHandler.removeMessages(0);
|
||||
}
|
||||
|
||||
public void setKeyEventListener(TouchNavSpaceTracker.KeyEventListener var1) {
|
||||
this.mKeyEventListener = var1;
|
||||
public void setKeyEventListener(TouchNavSpaceTracker.KeyEventListener listener) {
|
||||
mKeyEventListener = listener;
|
||||
}
|
||||
|
||||
public void setLPFEnabled(boolean var1) {
|
||||
this.mLPFEnabled = var1;
|
||||
public void setLPFEnabled(boolean enabled) {
|
||||
mLPFEnabled = enabled;
|
||||
}
|
||||
|
||||
public void setPhysicalDensity(float var1) {
|
||||
this.mPixelsPerMm = var1;
|
||||
if (var1 > 0.0F) {
|
||||
this.updatePhysicalSize();
|
||||
public void setPhysicalDensity(float density) {
|
||||
mPixelsPerMm = density;
|
||||
if (density > 0.0F) {
|
||||
updatePhysicalSize();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setPhysicalPosition(float var1, float var2) {
|
||||
this.mPhysicalPosition.x = var1;
|
||||
this.mPhysicalPosition.y = var2;
|
||||
this.mPrevPhysPosition.x = var1;
|
||||
this.mPrevPhysPosition.y = var2;
|
||||
this.clampPosition();
|
||||
public void setPhysicalPosition(float x, float y) {
|
||||
mPhysicalPosition.x = x;
|
||||
mPhysicalPosition.y = y;
|
||||
mPrevPhysPosition.x = x;
|
||||
mPrevPhysPosition.y = y;
|
||||
clampPosition();
|
||||
}
|
||||
|
||||
public void setPhysicalSize(float var1, float var2) {
|
||||
if (this.mPixelsPerMm <= 0.0F) {
|
||||
this.setPhysicalSizeInternal(var1, var2);
|
||||
public void setPhysicalSize(float widthMm, float heightMm) {
|
||||
if (mPixelsPerMm <= 0.0F) {
|
||||
setPhysicalSizeInternal(widthMm, heightMm);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPixelPosition(float var1, float var2) {
|
||||
this.setPhysicalPosition(this.getPhysicalX(var1), this.getPhysicalY(var2));
|
||||
public void setPixelPosition(float x, float y) {
|
||||
setPhysicalPosition(getPhysicalX(x), getPhysicalY(y));
|
||||
}
|
||||
|
||||
public void setPixelSize(float var1, float var2) {
|
||||
this.mPixelHeight = var2;
|
||||
this.mPixelWidth = var1;
|
||||
this.updatePhysicalSize();
|
||||
public void setPixelSize(float width, float height) {
|
||||
mPixelHeight = height;
|
||||
mPixelWidth = width;
|
||||
updatePhysicalSize();
|
||||
}
|
||||
|
||||
public void setSensitivity(float var1) {
|
||||
this.mSensitivity = var1;
|
||||
this.configureFlicks(this.mUnscaledFlickMinDistance, this.mUnscaledFlickMaxDistance, this.mFlickMaxDuration);
|
||||
public void setSensitivity(float sensitivity) {
|
||||
mSensitivity = sensitivity;
|
||||
configureFlicks(mUnscaledFlickMinDistance, mUnscaledFlickMaxDistance, mFlickMaxDuration);
|
||||
}
|
||||
|
||||
public void setTouchEventListener(TouchNavSpaceTracker.TouchEventListener var1) {
|
||||
this.mPixelListener = var1;
|
||||
public void setTouchEventListener(TouchNavSpaceTracker.TouchEventListener listener) {
|
||||
mPixelListener = listener;
|
||||
}
|
||||
|
||||
public void unblockMovement() {
|
||||
@@ -502,11 +502,11 @@ public class TouchNavSpaceTracker {
|
||||
}
|
||||
|
||||
public interface KeyEventListener {
|
||||
boolean onKeyDown(int var1, KeyEvent var2);
|
||||
boolean onKeyDown(int keyCode, KeyEvent event);
|
||||
|
||||
boolean onKeyLongPress(int var1, KeyEvent var2);
|
||||
boolean onKeyLongPress(int keyCode, KeyEvent event);
|
||||
|
||||
boolean onKeyUp(int var1, KeyEvent var2);
|
||||
boolean onKeyUp(int keyCode, KeyEvent event);
|
||||
}
|
||||
|
||||
public static class PhysicalMotionEvent {
|
||||
@@ -558,15 +558,15 @@ public class TouchNavSpaceTracker {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int var1, KeyEvent var2) {
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onKeyLongPress(int var1, KeyEvent var2) {
|
||||
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int var1, KeyEvent var2) {
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.inputmethodservice.InputMethodService;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -13,6 +14,8 @@ import android.view.inputmethod.CompletionInfo;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import com.google.android.leanback.ime.LeanbackKeyboardController;
|
||||
import com.google.android.leanback.ime.LeanbackKeyboardController.InputListener;
|
||||
import com.google.android.leanback.ime.LeanbackKeyboardView;
|
||||
import com.google.android.leanback.ime.LeanbackSuggestionsFactory;
|
||||
import com.google.android.leanback.ime.LeanbackUtils;
|
||||
|
||||
@@ -38,8 +41,9 @@ public class LeanbackImeService extends InputMethodService {
|
||||
}
|
||||
};
|
||||
private LeanbackKeyboardController.InputListener mInputListener = new LeanbackKeyboardController.InputListener() {
|
||||
public void onEntry(int var1, int var2, CharSequence var3) {
|
||||
LeanbackImeService.this.handleTextEntry(var1, var2, var3);
|
||||
@Override
|
||||
public void onEntry(int type, int keyCode, CharSequence text) {
|
||||
LeanbackImeService.this.handleTextEntry(type, keyCode, text);
|
||||
}
|
||||
};
|
||||
private View mInputView;
|
||||
@@ -56,160 +60,156 @@ public class LeanbackImeService extends InputMethodService {
|
||||
}
|
||||
|
||||
private void clearSuggestionsDelayed() {
|
||||
if (!this.mSuggestionsFactory.shouldSuggestionsAmend()) {
|
||||
this.mHandler.removeMessages(123);
|
||||
this.mShouldClearSuggestions = true;
|
||||
this.mHandler.sendEmptyMessageDelayed(123, 1000L);
|
||||
if (!mSuggestionsFactory.shouldSuggestionsAmend()) {
|
||||
mHandler.removeMessages(MSG_SUGGESTIONS_CLEAR);
|
||||
mShouldClearSuggestions = true;
|
||||
mHandler.sendEmptyMessageDelayed(MSG_SUGGESTIONS_CLEAR, SUGGESTIONS_CLEAR_DELAY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int getAmpersandLocation(InputConnection var1) {
|
||||
String var4 = this.getEditorText(var1);
|
||||
int var3 = var4.indexOf(64);
|
||||
int var2 = var3;
|
||||
if (var3 < 0) {
|
||||
var2 = var4.length();
|
||||
private int getAmpersandLocation(InputConnection connection) {
|
||||
String text = getEditorText(connection);
|
||||
int pos = text.indexOf(64);
|
||||
if (pos < 0) { // not found
|
||||
pos = text.length();
|
||||
}
|
||||
|
||||
return var2;
|
||||
return pos;
|
||||
}
|
||||
|
||||
private int getCharLengthAfterCursor(InputConnection var1) {
|
||||
int var2 = 0;
|
||||
CharSequence var3 = var1.getTextAfterCursor(1000, 0);
|
||||
if (var3 != null) {
|
||||
var2 = var3.length();
|
||||
private int getCharLengthAfterCursor(InputConnection connection) {
|
||||
int len = 0;
|
||||
CharSequence after = connection.getTextAfterCursor(1000, 0);
|
||||
if (after != null) {
|
||||
len = after.length();
|
||||
}
|
||||
|
||||
return var2;
|
||||
return len;
|
||||
}
|
||||
|
||||
private int getCharLengthBeforeCursor(InputConnection var1) {
|
||||
int var2 = 0;
|
||||
CharSequence var3 = var1.getTextBeforeCursor(1000, 0);
|
||||
if (var3 != null) {
|
||||
var2 = var3.length();
|
||||
private int getCharLengthBeforeCursor(InputConnection connection) {
|
||||
int len = 0;
|
||||
CharSequence before = connection.getTextBeforeCursor(1000, 0);
|
||||
if (before != null) {
|
||||
len = before.length();
|
||||
}
|
||||
|
||||
return var2;
|
||||
return len;
|
||||
}
|
||||
|
||||
private String getEditorText(InputConnection var1) {
|
||||
StringBuilder var2 = new StringBuilder();
|
||||
CharSequence var3 = var1.getTextBeforeCursor(1000, 0);
|
||||
CharSequence var4 = var1.getTextAfterCursor(1000, 0);
|
||||
if (var3 != null) {
|
||||
var2.append(var3);
|
||||
private String getEditorText(InputConnection connection) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
CharSequence before = connection.getTextBeforeCursor(1000, 0);
|
||||
CharSequence after = connection.getTextAfterCursor(1000, 0);
|
||||
if (before != null) {
|
||||
result.append(before);
|
||||
}
|
||||
|
||||
if (var4 != null) {
|
||||
var2.append(var4);
|
||||
if (after != null) {
|
||||
result.append(after);
|
||||
}
|
||||
|
||||
return var2.toString();
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private void handleTextEntry(int var1, int var2, CharSequence var3) {
|
||||
InputConnection var5 = this.getCurrentInputConnection();
|
||||
boolean var4 = true;
|
||||
if (var5 != null) {
|
||||
boolean var6;
|
||||
switch (var1) {
|
||||
case 0:
|
||||
this.clearSuggestionsDelayed();
|
||||
if (this.mEnterSpaceBeforeCommitting && this.mKeyboardController.enableAutoEnterSpace()) {
|
||||
if (LeanbackUtils.isAlphabet(var2)) {
|
||||
var5.commitText(" ", 1);
|
||||
private void handleTextEntry(final int type, final int keyCode, final CharSequence text) {
|
||||
final InputConnection connection = getCurrentInputConnection();
|
||||
if (connection != null) {
|
||||
boolean updateSuggestions;
|
||||
switch (type) {
|
||||
case InputListener.ENTRY_TYPE_STRING:
|
||||
clearSuggestionsDelayed();
|
||||
if (mEnterSpaceBeforeCommitting && mKeyboardController.enableAutoEnterSpace()) {
|
||||
if (LeanbackUtils.isAlphabet(keyCode)) {
|
||||
connection.commitText(" ", 1);
|
||||
}
|
||||
|
||||
this.mEnterSpaceBeforeCommitting = false;
|
||||
mEnterSpaceBeforeCommitting = false;
|
||||
}
|
||||
|
||||
var5.commitText(var3, 1);
|
||||
var6 = var4;
|
||||
if (var2 == 46) {
|
||||
this.mEnterSpaceBeforeCommitting = true;
|
||||
var6 = var4;
|
||||
connection.commitText(text, 1);
|
||||
updateSuggestions = true;
|
||||
if (keyCode == LeanbackKeyboardView.ASCII_PERIOD) {
|
||||
mEnterSpaceBeforeCommitting = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
this.clearSuggestionsDelayed();
|
||||
var5.deleteSurroundingText(1, 0);
|
||||
this.mEnterSpaceBeforeCommitting = false;
|
||||
var6 = var4;
|
||||
case InputListener.ENTRY_TYPE_BACKSPACE:
|
||||
clearSuggestionsDelayed();
|
||||
connection.deleteSurroundingText(1, 0);
|
||||
mEnterSpaceBeforeCommitting = false;
|
||||
updateSuggestions = true;
|
||||
break;
|
||||
case 2:
|
||||
case 6:
|
||||
this.clearSuggestionsDelayed();
|
||||
if (!this.mSuggestionsFactory.shouldSuggestionsAmend()) {
|
||||
var5.deleteSurroundingText(this.getCharLengthBeforeCursor(var5), this.getCharLengthAfterCursor(var5));
|
||||
case InputListener.ENTRY_TYPE_SUGGESTION:
|
||||
case InputListener.ENTRY_TYPE_VOICE:
|
||||
clearSuggestionsDelayed();
|
||||
if (!mSuggestionsFactory.shouldSuggestionsAmend()) {
|
||||
connection.deleteSurroundingText(this.getCharLengthBeforeCursor(connection), this.getCharLengthAfterCursor(connection));
|
||||
} else {
|
||||
var1 = this.getAmpersandLocation(var5);
|
||||
var5.setSelection(var1, var1);
|
||||
var5.deleteSurroundingText(0, this.getCharLengthAfterCursor(var5));
|
||||
int location = this.getAmpersandLocation(connection);
|
||||
connection.setSelection(location, location);
|
||||
connection.deleteSurroundingText(0, this.getCharLengthAfterCursor(connection));
|
||||
}
|
||||
|
||||
var5.commitText(var3, 1);
|
||||
this.mEnterSpaceBeforeCommitting = true;
|
||||
case 5:
|
||||
this.sendDefaultEditorAction(false);
|
||||
var6 = false;
|
||||
connection.commitText(text, 1);
|
||||
mEnterSpaceBeforeCommitting = true;
|
||||
case InputListener.ENTRY_TYPE_ACTION:
|
||||
sendDefaultEditorAction(false);
|
||||
updateSuggestions = false;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
var3 = var5.getTextBeforeCursor(1000, 0);
|
||||
if (var3 == null) {
|
||||
var2 = 0;
|
||||
case InputListener.ENTRY_TYPE_LEFT:
|
||||
case InputListener.ENTRY_TYPE_RIGHT:
|
||||
CharSequence textBeforeCursor = connection.getTextBeforeCursor(1000, 0);
|
||||
int len;
|
||||
if (textBeforeCursor == null) {
|
||||
len = 0;
|
||||
} else {
|
||||
var2 = var3.length();
|
||||
len = textBeforeCursor.length();
|
||||
}
|
||||
|
||||
if (var1 == 3) {
|
||||
var1 = var2;
|
||||
if (var2 > 0) {
|
||||
var1 = var2 - 1;
|
||||
int index;
|
||||
if (type == InputListener.ENTRY_TYPE_LEFT) {
|
||||
index = len;
|
||||
if (len > 0) {
|
||||
index = len - 1;
|
||||
}
|
||||
} else {
|
||||
var3 = var5.getTextAfterCursor(1000, 0);
|
||||
var1 = var2;
|
||||
if (var3 != null) {
|
||||
var1 = var2;
|
||||
if (var3.length() > 0) {
|
||||
var1 = var2 + 1;
|
||||
}
|
||||
textBeforeCursor = connection.getTextAfterCursor(1000, 0);
|
||||
index = len;
|
||||
if (textBeforeCursor != null && textBeforeCursor.length() > 0) {
|
||||
index = len + 1;
|
||||
}
|
||||
}
|
||||
|
||||
var5.setSelection(var1, var1);
|
||||
var6 = var4;
|
||||
connection.setSelection(index, index);
|
||||
updateSuggestions = true;
|
||||
break;
|
||||
case 7:
|
||||
var5.performEditorAction(1);
|
||||
var6 = false;
|
||||
case InputListener.ENTRY_TYPE_DISMISS:
|
||||
connection.performEditorAction(EditorInfo.IME_ACTION_NONE);
|
||||
updateSuggestions = false;
|
||||
break;
|
||||
case 8:
|
||||
var5.performEditorAction(2);
|
||||
var6 = false;
|
||||
case InputListener.ENTRY_TYPE_VOICE_DISMISS:
|
||||
connection.performEditorAction(EditorInfo.IME_ACTION_GO);
|
||||
updateSuggestions = false;
|
||||
break;
|
||||
default:
|
||||
var6 = var4;
|
||||
updateSuggestions = true;
|
||||
}
|
||||
|
||||
if (this.mKeyboardController.areSuggestionsEnabled() && var6) {
|
||||
this.mKeyboardController.updateSuggestions(this.mSuggestionsFactory.getSuggestions());
|
||||
return;
|
||||
if (mKeyboardController.areSuggestionsEnabled() && updateSuggestions) {
|
||||
mKeyboardController.updateSuggestions(mSuggestionsFactory.getSuggestions());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateInputView() {
|
||||
this.mInputView = this.mKeyboardController.getView();
|
||||
this.mInputView.requestFocus();
|
||||
return this.mInputView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayCompletions(CompletionInfo[] var1) {
|
||||
if (this.mKeyboardController.areSuggestionsEnabled()) {
|
||||
this.mShouldClearSuggestions = false;
|
||||
@@ -231,47 +231,56 @@ public class LeanbackImeService extends InputMethodService {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinishInputView(boolean var1) {
|
||||
super.onFinishInputView(var1);
|
||||
this.sendBroadcast(new Intent("com.google.android.athome.action.IME_CLOSE"));
|
||||
this.sendBroadcast(new Intent(IME_CLOSE));
|
||||
this.mSuggestionsFactory.clearSuggestions();
|
||||
}
|
||||
|
||||
public boolean onGenericMotionEvent(MotionEvent var1) {
|
||||
return this.isInputViewShown() && (var1.getSource() & 2097152) == 2097152 && this.mKeyboardController.onGenericMotionEvent(var1) ? true :
|
||||
super.onGenericMotionEvent(var1);
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public boolean onGenericMotionEvent(MotionEvent event) {
|
||||
return isInputViewShown() &&
|
||||
(event.getSource() & InputDevice.SOURCE_TOUCH_NAVIGATION) == InputDevice.SOURCE_TOUCH_NAVIGATION &&
|
||||
mKeyboardController.onGenericMotionEvent(event) || super.onGenericMotionEvent(event);
|
||||
}
|
||||
|
||||
public void onHideIme() {
|
||||
this.requestHideSelf(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitializeInterface() {
|
||||
this.mKeyboardController = new LeanbackKeyboardController(this, this.mInputListener);
|
||||
this.mEnterSpaceBeforeCommitting = false;
|
||||
this.mSuggestionsFactory = new LeanbackSuggestionsFactory(this, 10);
|
||||
mKeyboardController = new LeanbackKeyboardController(this, mInputListener);
|
||||
mEnterSpaceBeforeCommitting = false;
|
||||
mSuggestionsFactory = new LeanbackSuggestionsFactory(this, MAX_SUGGESTIONS);
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int var1, KeyEvent var2) {
|
||||
return this.isInputViewShown() && this.mKeyboardController.onKeyDown(var1, var2) ? true : super.onKeyDown(var1, var2);
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return isInputViewShown() && mKeyboardController.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int var1, KeyEvent var2) {
|
||||
return this.isInputViewShown() && this.mKeyboardController.onKeyUp(var1, var2) ? true : super.onKeyUp(var1, var2);
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
return isInputViewShown() && mKeyboardController.onKeyUp(keyCode, event) || super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
public boolean onShowInputRequested(int var1, boolean var2) {
|
||||
@Override
|
||||
public boolean onShowInputRequested(int flags, boolean configChange) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int onStartCommand(Intent var1, int var2, int var3) {
|
||||
if (var1 != null) {
|
||||
super.onStartCommand(var1, var2, var3);
|
||||
if (var1.getBooleanExtra("restart", false)) {
|
||||
@Override
|
||||
public int onStartCommand(final Intent intent, final int flags, final int startId) {
|
||||
if (intent != null) {
|
||||
super.onStartCommand(intent, flags, startId);
|
||||
if (intent.getBooleanExtra("restart", false)) {
|
||||
Log.e("LeanbackImeService", "Service->onStartCommand: trying to restart service");
|
||||
LeanbackKeyboardController var4 = this.mKeyboardController;
|
||||
if (var4 != null) {
|
||||
var4.updateAddonKeyboard();
|
||||
LeanbackKeyboardController controller = mKeyboardController;
|
||||
if (controller != null) {
|
||||
controller.updateAddonKeyboard();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,25 +288,27 @@ public class LeanbackImeService extends InputMethodService {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void onStartInput(EditorInfo var1, boolean var2) {
|
||||
super.onStartInput(var1, var2);
|
||||
this.mEnterSpaceBeforeCommitting = false;
|
||||
this.mSuggestionsFactory.onStartInput(var1);
|
||||
this.mKeyboardController.onStartInput(var1);
|
||||
@Override
|
||||
public void onStartInput(EditorInfo info, boolean restarting) {
|
||||
super.onStartInput(info, restarting);
|
||||
mEnterSpaceBeforeCommitting = false;
|
||||
mSuggestionsFactory.onStartInput(info);
|
||||
mKeyboardController.onStartInput(info);
|
||||
}
|
||||
|
||||
public void onStartInputView(EditorInfo var1, boolean var2) {
|
||||
super.onStartInputView(var1, var2);
|
||||
this.mKeyboardController.onStartInputView();
|
||||
this.sendBroadcast(new Intent("com.google.android.athome.action.IME_OPEN"));
|
||||
if (this.mKeyboardController.areSuggestionsEnabled()) {
|
||||
this.mSuggestionsFactory.createSuggestions();
|
||||
this.mKeyboardController.updateSuggestions(this.mSuggestionsFactory.getSuggestions());
|
||||
InputConnection var4 = this.getCurrentInputConnection();
|
||||
if (var4 != null) {
|
||||
String var3 = this.getEditorText(var4);
|
||||
var4.deleteSurroundingText(this.getCharLengthBeforeCursor(var4), this.getCharLengthAfterCursor(var4));
|
||||
var4.commitText(var3, 1);
|
||||
@Override
|
||||
public void onStartInputView(EditorInfo info, boolean restarting) {
|
||||
super.onStartInputView(info, restarting);
|
||||
mKeyboardController.onStartInputView();
|
||||
sendBroadcast(new Intent(IME_OPEN));
|
||||
if (mKeyboardController.areSuggestionsEnabled()) {
|
||||
mSuggestionsFactory.createSuggestions();
|
||||
mKeyboardController.updateSuggestions(mSuggestionsFactory.getSuggestions());
|
||||
InputConnection connection = getCurrentInputConnection();
|
||||
if (connection != null) {
|
||||
String text = getEditorText(connection);
|
||||
connection.deleteSurroundingText(getCharLengthBeforeCursor(connection), getCharLengthAfterCursor(connection));
|
||||
connection.commitText(text, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user