Merge "Avoid recreating views in SmartSpaceComplicationViewHolder." into tm-qpr-dev
This commit is contained in:
@@ -89,6 +89,7 @@ public class SmartSpaceComplication implements Complication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class SmartSpaceComplicationViewHolder implements ViewHolder {
|
private static class SmartSpaceComplicationViewHolder implements ViewHolder {
|
||||||
|
private View mView = null;
|
||||||
private static final int SMARTSPACE_COMPLICATION_WEIGHT = 10;
|
private static final int SMARTSPACE_COMPLICATION_WEIGHT = 10;
|
||||||
private final DreamSmartspaceController mSmartSpaceController;
|
private final DreamSmartspaceController mSmartSpaceController;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@@ -102,12 +103,16 @@ public class SmartSpaceComplication implements Complication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView() {
|
public View getView() {
|
||||||
|
if (mView != null) {
|
||||||
|
return mView;
|
||||||
|
}
|
||||||
final FrameLayout smartSpaceContainer = new FrameLayout(mContext);
|
final FrameLayout smartSpaceContainer = new FrameLayout(mContext);
|
||||||
smartSpaceContainer.addView(
|
smartSpaceContainer.addView(
|
||||||
mSmartSpaceController.buildAndConnectView(smartSpaceContainer),
|
mSmartSpaceController.buildAndConnectView(smartSpaceContainer),
|
||||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT));
|
ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
|
|
||||||
|
mView = smartSpaceContainer;
|
||||||
return smartSpaceContainer;
|
return smartSpaceContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import javax.inject.Named;
|
|||||||
* a {@link ComplicationLayoutEngine}.
|
* a {@link ComplicationLayoutEngine}.
|
||||||
*/
|
*/
|
||||||
public class ComplicationHostViewController extends ViewController<ConstraintLayout> {
|
public class ComplicationHostViewController extends ViewController<ConstraintLayout> {
|
||||||
public static final String TAG = "ComplicationHostViewController";
|
public static final String TAG = "ComplicationHostVwCtrl";
|
||||||
|
|
||||||
private final ComplicationLayoutEngine mLayoutEngine;
|
private final ComplicationLayoutEngine mLayoutEngine;
|
||||||
private final LifecycleOwner mLifecycleOwner;
|
private final LifecycleOwner mLifecycleOwner;
|
||||||
|
|||||||
Reference in New Issue
Block a user