Android: use lambda or improve it's code in few places
Some calls are still not using lambda expressions, or use braces where it's not needed. Change-Id: Ic5f5507dbdd655792b01e8e8187ca04449949806 Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
This commit is contained in:
parent
0b955e7009
commit
8deec05a61
@ -198,12 +198,7 @@ class QtApkFileEngine {
|
||||
}
|
||||
|
||||
// sort alphabetically based on the file path
|
||||
fileInfos.sort(new Comparator<JFileInfo>() {
|
||||
@Override
|
||||
public int compare(JFileInfo info1, JFileInfo info2) {
|
||||
return info1.relativePath.compareTo(info2.relativePath);
|
||||
}
|
||||
});
|
||||
fileInfos.sort(Comparator.comparing(info -> info.relativePath));
|
||||
} catch (Exception e) {
|
||||
Log.e(QtTAG, "Failed to list App's APK files with " + e.toString());
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase
|
||||
public void addView(QtView view)
|
||||
{
|
||||
if (m_views.add(view)) {
|
||||
QtNative.runAction(() -> { createRootWindow(view); });
|
||||
QtNative.runAction(() -> createRootWindow(view));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,19 +55,16 @@ abstract class QtView extends ViewGroup {
|
||||
super(context);
|
||||
|
||||
m_viewInterface = QtEmbeddedViewInterfaceFactory.create(context);
|
||||
addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
||||
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
if (m_windowReference != 0L) {
|
||||
final int oldWidth = oldRight - oldLeft;
|
||||
final int oldHeight = oldBottom - oldTop;
|
||||
final int newWidth = right - left;
|
||||
final int newHeight = bottom - top;
|
||||
if (oldWidth != newWidth || oldHeight != newHeight || left != oldLeft ||
|
||||
top != oldTop) {
|
||||
resizeWindow(m_windowReference, left, top, newWidth, newHeight);
|
||||
}
|
||||
addOnLayoutChangeListener(
|
||||
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
|
||||
if (m_windowReference != 0L) {
|
||||
final int oldWidth = oldRight - oldLeft;
|
||||
final int oldHeight = oldBottom - oldTop;
|
||||
final int newWidth = right - left;
|
||||
final int newHeight = bottom - top;
|
||||
if (oldWidth != newWidth || oldHeight != newHeight || left != oldLeft ||
|
||||
top != oldTop) {
|
||||
resizeWindow(m_windowReference, left, top, newWidth, newHeight);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -189,19 +186,16 @@ abstract class QtView extends ViewGroup {
|
||||
setWindowReference(viewReference);
|
||||
m_parentWindowReference = parentWindowRef;
|
||||
final Handler handler = new Handler(Looper.getMainLooper());
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
m_window = window;
|
||||
m_window.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
addView(m_window, 0);
|
||||
// Call show window + parent
|
||||
setWindowVisible(true);
|
||||
if (m_windowListener != null)
|
||||
m_windowListener.onQtWindowLoaded();
|
||||
}
|
||||
handler.post(() -> {
|
||||
m_window = window;
|
||||
m_window.setLayoutParams(new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT));
|
||||
addView(m_window, 0);
|
||||
// Call show window + parent
|
||||
setWindowVisible(true);
|
||||
if (m_windowListener != null)
|
||||
m_windowListener.onQtWindowLoaded();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -47,11 +47,9 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
||||
// TODO QTBUG-122552 - Service keyboard input not implemented
|
||||
m_editText = new QtEditText(context, listener);
|
||||
m_editText.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
QtNative.runAction(() -> {
|
||||
addView(m_editText,
|
||||
new QtLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
});
|
||||
LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
QtNative.runAction(() -> addView(m_editText, layoutParams));
|
||||
} else {
|
||||
m_editText = null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user