Update the hotseat edu layout for foldable devices.
Test: ran the hotseat edu on folded and unfolded foldable device in portrait and landscape mode and in three-button and gesture nav mode. ran hotseat edu on regular phone Fixes: 203734732 Change-Id: Iea2140c8241cdea60cb5db37fbfb7f7701d63bd6
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
launcher:containerType="hotseat" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/button_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/bottom_sheet_edu_padding"
|
||||
|
||||
@@ -28,17 +28,20 @@ import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.uioverrides.ApiWrapper;
|
||||
import com.android.launcher3.uioverrides.PredictedAppIcon;
|
||||
import com.android.launcher3.views.AbstractSlideInView;
|
||||
|
||||
@@ -89,8 +92,9 @@ public class HotseatEduDialog extends AbstractSlideInView<Launcher> implements I
|
||||
mHotseatWrapper = findViewById(R.id.hotseat_wrapper);
|
||||
mSampleHotseat = findViewById(R.id.sample_prediction);
|
||||
|
||||
Context context = getContext();
|
||||
DeviceProfile grid = mActivityContext.getDeviceProfile();
|
||||
Rect padding = grid.getHotseatLayoutPadding(getContext());
|
||||
Rect padding = grid.getHotseatLayoutPadding(context);
|
||||
|
||||
mSampleHotseat.getLayoutParams().height = grid.cellHeightPx;
|
||||
mSampleHotseat.setGridSize(grid.numShownHotseatIcons, 1);
|
||||
@@ -102,6 +106,15 @@ public class HotseatEduDialog extends AbstractSlideInView<Launcher> implements I
|
||||
mDismissBtn = findViewById(R.id.no_thanks);
|
||||
mDismissBtn.setOnClickListener(this::onDismiss);
|
||||
|
||||
LinearLayout buttonContainer = findViewById(R.id.button_container);
|
||||
int adjustedMarginEnd = ApiWrapper.getHotseatEndOffset(context)
|
||||
- buttonContainer.getPaddingEnd();
|
||||
if (InvariantDeviceProfile.INSTANCE.get(context)
|
||||
.getDeviceProfile(context).isTaskbarPresent && adjustedMarginEnd > 0) {
|
||||
((LinearLayout.LayoutParams) buttonContainer.getLayoutParams()).setMarginEnd(
|
||||
adjustedMarginEnd);
|
||||
}
|
||||
|
||||
// update ui to reflect which migration method is going to be used
|
||||
if (FeatureFlags.HOTSEAT_MIGRATE_TO_FOLDER.get()) {
|
||||
((TextView) findViewById(R.id.hotseat_edu_content)).setText(
|
||||
|
||||
Reference in New Issue
Block a user