Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dfc27436 authored by Samuel Fufa's avatar Samuel Fufa
Browse files

Add work toggle to work apps paused message

This also fixes scrolling issues in landscape

Bug: 186857875
Bug: 161929312
Bug: 189983516
Bug: 190567199
screenshot: https://screenshot.googleplex.com/BCjcyJFqJo6W4Tr
Test: local
Change-Id: I7bcf23cc4be2fca936eba41342731789eb8f3292
parent b8cec440
Loading
Loading
Loading
Loading
+30 −22
Original line number Diff line number Diff line
@@ -16,10 +16,17 @@
<com.android.launcher3.allapps.WorkEduCard xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="@dimen/work_edu_card_margin"
    android:gravity="center">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="@dimen/work_edu_card_margin"
        android:background="@drawable/work_card"
    android:gravity="center">
        android:layout_gravity="center_horizontal"
        android:gravity="center"
        android:id="@+id/wrapper">

        <TextView
            style="@style/PrimaryHeadline"
@@ -42,4 +49,5 @@
            android:textAlignment="center"
            android:background="@drawable/work_card_btn"
            android:textSize="14sp" />
    </LinearLayout>
</com.android.launcher3.allapps.WorkEduCard>
 No newline at end of file
+15 −5
Original line number Diff line number Diff line
@@ -12,11 +12,10 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.launcher3.allapps.WorkPausedCard xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/allAppsScrimColor"
    android:padding="48dp"
    android:layout_height="wrap_content"
    android:padding="@dimen/work_edu_card_margin"
    android:orientation="vertical"
    android:gravity="center">

@@ -39,5 +38,16 @@
        android:textColor="?attr/workProfileOverlayTextColor"
        android:text="@string/work_apps_paused_body"
        android:textAlignment="center"
        android:layout_marginBottom="8dp"
        android:textSize="16sp" />
</LinearLayout>
 No newline at end of file

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/enable_work_apps"
        android:textColor="?attr/workProfileOverlayTextColor"
        android:text="@string/work_apps_enable_btn_text"
        android:textAlignment="center"
        android:background="@drawable/work_card_btn"
        android:textSize="14sp" />
</com.android.launcher3.allapps.WorkPausedCard>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@
    <dimen name="all_apps_background_canvas_height">475dp</dimen>
    <dimen name="all_apps_header_pill_height">48dp</dimen>
    <dimen name="all_apps_header_pill_corner_radius">18dp</dimen>
    <dimen name="all_apps_header_pills_width">320dp</dimen>
    <dimen name="all_apps_header_pills_width">348dp</dimen>
    <dimen name="all_apps_header_tab_height">48dp</dimen>
    <dimen name="all_apps_tabs_indicator_height">2dp</dimen>
    <dimen name="all_apps_header_top_padding">36dp</dimen>
+3 −21
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import static com.android.launcher3.model.BgDataModel.Callbacks.FLAG_QUIET_MODE_

import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -494,15 +493,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
        }
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        View overlay = mAH[AdapterHolder.WORK].getOverlayView();
        int v = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE ? GONE : VISIBLE;
        overlay.findViewById(R.id.work_apps_paused_title).setVisibility(v);
        overlay.findViewById(R.id.work_apps_paused_content).setVisibility(v);
    }

    private void replaceRVContainer(boolean showTabs) {
        for (int i = 0; i < mAH.length; i++) {
            if (mAH[i].recyclerView != null) {
@@ -544,9 +534,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
                    && mAllAppsStore.hasModelFlag(
                    FLAG_HAS_SHORTCUT_PERMISSION | FLAG_QUIET_MODE_CHANGE_PERMISSION));
        }
        if (mSearchUiManager != null && mSearchUiManager.getEditText() != null) {
            mSearchUiManager.getEditText().hideKeyboard();
        }
    }

    // Used by tests only
@@ -704,7 +691,9 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
        mHeaderPaint.setColor(mHeaderColor);
        mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor)));
        if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) {
            canvas.drawRect(0, 0, getWidth(), mSearchContainer.getTop() + getTranslationY(),
            int bottom = mUsingTabs && mHeader.mHeaderCollapsed ? mHeader.getVisibleBottomBound()
                    : mSearchContainer.getBottom();
            canvas.drawRect(0, 0, getWidth(), bottom + getTranslationY(),
                    mHeaderPaint);
        }
    }
@@ -781,13 +770,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
            mAH[AdapterHolder.MAIN].recyclerView.setVerticalFadingEdgeEnabled(!mUsingTabs
                    && verticalFadingEdge);
        }

        private View getOverlayView() {
            if (mOverlay == null) {
                mOverlay = mLauncher.getLayoutInflater().inflate(R.layout.work_apps_paused, null);
            }
            return mOverlay;
        }
    }


+10 −0
Original line number Diff line number Diff line
@@ -447,4 +447,14 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
    public boolean hasOverlappingRendering() {
        return false;
    }

    /**
     * Returns distance between left and right app icons
     */
    public int getTabWidth() {
        DeviceProfile grid = BaseDraggingActivity.fromContext(getContext()).getDeviceProfile();
        int totalWidth = (grid.availableWidthPx - getPaddingLeft() - getPaddingRight());
        int iconPadding = totalWidth / grid.numShownAllAppsColumns - grid.allAppsIconSizePx;
        return totalWidth - iconPadding;
    }
}
Loading