Update the hotseat edu layout for foldable devices. am: 9188b6b993

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16125840

Change-Id: Icd8930f73d7438257ebaf18e08be5d938386d23f
This commit is contained in:
Schneider Victor-tulias
2021-10-27 21:44:34 +00:00
committed by Automerger Merge Worker
2 changed files with 15 additions and 1 deletions
@@ -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(