mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Merge "Introduce Default Ime height." into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e1a4eb4a09
@@ -110,8 +110,6 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
public static final CopyOnWriteArrayList<StatsLogConsumer> LOGS_CONSUMER =
|
||||
new CopyOnWriteArrayList<>();
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
public StatsLogCompatManager(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@@ -438,4 +438,8 @@
|
||||
<!-- Folder spaces -->
|
||||
<dimen name="folder_top_padding_default">24dp</dimen>
|
||||
<dimen name="folder_footer_horiz_padding">20dp</dimen>
|
||||
|
||||
<!-- Default Ime height. Used only for logging purposes.
|
||||
Assume this is default keyboard height in EN locale in case the keyboard height is not known when queried.-->
|
||||
<dimen name="default_ime_height">300dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -24,7 +24,10 @@ import android.os.SystemClock;
|
||||
*/
|
||||
public class KeyboardStateManager {
|
||||
private long mUpdatedTime;
|
||||
private int mImeHeight;
|
||||
private int mImeHeightPx;
|
||||
// Height of the keyboard when it's shown.
|
||||
// mImeShownHeightPx>=mImeHeightPx always.
|
||||
private int mImeShownHeightPx;
|
||||
|
||||
public enum KeyboardState {
|
||||
NO_IME_ACTION,
|
||||
@@ -34,8 +37,9 @@ public class KeyboardStateManager {
|
||||
|
||||
private KeyboardState mKeyboardState;
|
||||
|
||||
public KeyboardStateManager() {
|
||||
public KeyboardStateManager(int defaultImeShownHeightPx) {
|
||||
mKeyboardState = NO_IME_ACTION;
|
||||
mImeShownHeightPx = defaultImeShownHeightPx;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,13 +68,25 @@ public class KeyboardStateManager {
|
||||
* Returns keyboard's current height.
|
||||
*/
|
||||
public int getImeHeight() {
|
||||
return mImeHeight;
|
||||
return mImeHeightPx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter method to set keyboard height.
|
||||
* Returns keyboard's height in pixels when shown.
|
||||
*/
|
||||
public void setImeHeight(int imeHeight) {
|
||||
mImeHeight = imeHeight;
|
||||
public int getImeShownHeight() {
|
||||
return mImeShownHeightPx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter method to set keyboard height in pixels.
|
||||
*/
|
||||
public void setImeHeight(int imeHeightPx) {
|
||||
mImeHeightPx = imeHeightPx;
|
||||
if (mImeHeightPx > 0) {
|
||||
// Update the mImeShownHeightPx with the actual ime height when shown and store it
|
||||
// for future sessions.
|
||||
mImeShownHeightPx = mImeHeightPx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
private InstanceId mInstanceId;
|
||||
|
||||
protected @Nullable ActivityContext mActivityContext = null;
|
||||
protected @Nullable Context mContext = null;
|
||||
private KeyboardStateManager mKeyboardStateManager;
|
||||
|
||||
/**
|
||||
@@ -1035,7 +1036,9 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
*/
|
||||
public KeyboardStateManager keyboardStateManager() {
|
||||
if (mKeyboardStateManager == null) {
|
||||
mKeyboardStateManager = new KeyboardStateManager();
|
||||
mKeyboardStateManager = new KeyboardStateManager(
|
||||
mContext != null ? mContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.default_ime_height) : 0);
|
||||
}
|
||||
return mKeyboardStateManager;
|
||||
}
|
||||
@@ -1071,6 +1074,7 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
StatsLogManager manager = Overrides.getObject(StatsLogManager.class,
|
||||
context.getApplicationContext(), R.string.stats_log_manager_class);
|
||||
manager.mActivityContext = ActivityContext.lookupContextNoThrow(context);
|
||||
manager.mContext = context;
|
||||
return manager;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user