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

Commit d2e0e51e authored by Ivan Chiang's avatar Ivan Chiang
Browse files

[PM] Support material progressbar

Flag: android.content.pm.use_pia_v2
Test: manual
Bug: 274120822
Change-Id: Ia9fad51e556a44b8b475483da53ea22c488ba4d2
parent cd3921f6
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ java_defaults {
        "androidx.leanback_leanback",
        "androidx.lifecycle_lifecycle-extensions",
        "androidx.lifecycle_lifecycle-livedata",
        "com.google.android.material_material",
        "kotlin-parcelize-runtime",
    ],

@@ -62,6 +63,10 @@ java_defaults {
        error_checks: ["Recycle"],
    },
    kotlin_plugins: ["kotlin-parcelize-compiler-plugin"],

    optimize: {
        shrink_resources: true,
    },
}

android_app {
+43 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  Copyright (C) 2025 The Android Open Source Project

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:paddingHorizontal="?android:attr/dialogPreferredPadding"
    android:paddingBottom="@dimen/alert_dialog_inner_padding">

    <include layout="@layout/app_snippet_layout" />

    <com.google.android.material.progressindicator.LinearProgressIndicator
        android:id="@+id/progress_bar"
        android:indeterminate="true"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_marginTop="@dimen/dialog_inter_element_margin"
        android:paddingVertical="4dp"
        android:visibility="gone" />

    <TextView
        style="@style/Widget.PackageInstaller.TextView.CustomMessage"
        android:id="@+id/custom_message"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_marginTop="@dimen/dialog_inter_element_margin"
        android:visibility="gone" />

</LinearLayout>
+4 −0
Original line number Diff line number Diff line
@@ -89,6 +89,10 @@ class InstallLaunch : FragmentActivity(), InstallActionListener {
        if (PackageUtil.isMaterialDesignEnabled(this)) {
            Log.d(LOG_TAG, "Apply material design")
            theme.applyStyle(R.style.Theme_AlertDialogActivity_Material, /* force= */ true)
            // Apply the material theme for the material components
            theme.applyStyle(
                com.google.android.material.R.style.Theme_Material3_DynamicColors_DayNight,
                /* force= */ false)
        }

        fragmentManager = supportFragmentManager
+7 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import androidx.fragment.app.DialogFragment;

import com.android.packageinstaller.R;
import com.android.packageinstaller.v2.model.InstallInstalling;
import com.android.packageinstaller.v2.model.PackageUtil;
import com.android.packageinstaller.v2.model.PackageUtil.AppSnippet;

/**
@@ -73,7 +74,12 @@ public class InstallInstallingFragment extends DialogFragment {

        Log.i(LOG_TAG, "Creating " + LOG_TAG + "\n" + mDialogData);

        View dialogView = getLayoutInflater().inflate(R.layout.install_fragment_layout, null);
        int layoutId = R.layout.install_fragment_layout;
        if (PackageUtil.isMaterialDesignEnabled(requireContext())) {
            layoutId = R.layout.install_fragment_material_layout;
        }
        View dialogView = getLayoutInflater().inflate(layoutId, null);

        dialogView.requireViewById(R.id.progress_bar).setVisibility(View.VISIBLE);
        dialogView.requireViewById(R.id.app_snippet).setVisibility(View.VISIBLE);
        ((ImageView) dialogView.requireViewById(R.id.app_icon))
+6 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import androidx.fragment.app.DialogFragment;

import com.android.packageinstaller.R;
import com.android.packageinstaller.v2.model.InstallStage;
import com.android.packageinstaller.v2.model.PackageUtil;
import com.android.packageinstaller.v2.ui.InstallActionListener;

public class InstallStagingFragment extends DialogFragment {
@@ -51,7 +52,11 @@ public class InstallStagingFragment extends DialogFragment {
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
        Log.i(LOG_TAG, "Creating " + LOG_TAG);

        View dialogView = getLayoutInflater().inflate(R.layout.install_fragment_layout, null);
        int layoutId = R.layout.install_fragment_layout;
        if (PackageUtil.isMaterialDesignEnabled(requireContext())) {
            layoutId = R.layout.install_fragment_material_layout;
        }
        View dialogView = getLayoutInflater().inflate(layoutId, null);
        dialogView.requireViewById(R.id.progress_bar).setVisibility(View.VISIBLE);

        mDialog = new AlertDialog.Builder(requireContext())