Loading res/layout/item_doc_inflated_message_cross_profile.xml +37 −20 Original line number Diff line number Diff line Loading @@ -25,6 +25,22 @@ android:paddingStart="72dp" android:paddingEnd="72dp"> <ProgressBar android:id="@+id/cross_profile_progress" style="@android:style/Widget.Material.Light.ProgressBar" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminate="true" android:indeterminateTint="?attr/colorAccent"/> <LinearLayout android:id="@+id/cross_profile_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> <ImageView android:id="@+id/artwork" android:layout_width="24dp" Loading @@ -49,3 +65,4 @@ android:layout_height="wrap_content" style="@style/EmptyStateButton"/> </LinearLayout> </LinearLayout> src/com/android/documentsui/AbstractActionHandler.java +5 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,11 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA } } @Override public void requestQuietModeDisabled(RootInfo info, UserId userId) { new RequestQuietModeDisabledTask(mActivity, userId).execute(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { Loading src/com/android/documentsui/ActionHandler.java +2 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,8 @@ public interface ActionHandler { */ void startAuthentication(PendingIntent intent); void requestQuietModeDisabled(RootInfo info, UserId userId); void showAppDetails(ResolveInfo info, UserId userId); void openRoot(RootInfo root); Loading src/com/android/documentsui/RequestQuietModeDisabledTask.java 0 → 100644 +49 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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. */ package com.android.documentsui; import static androidx.core.util.Preconditions.checkNotNull; import android.content.Context; import android.os.AsyncTask; import com.android.documentsui.base.UserId; import java.lang.ref.WeakReference; /** * A task to request disabling quiet mode for a given user. */ class RequestQuietModeDisabledTask extends AsyncTask<Void, Void, Void> { private final WeakReference<Context> mContextWeakReference; private final UserId mUserId; RequestQuietModeDisabledTask(Context context, UserId userId) { mContextWeakReference = new WeakReference<>(checkNotNull(context)); mUserId = checkNotNull(userId); } @Override protected Void doInBackground(Void... voids) { Context context = mContextWeakReference.get(); if (context != null) { mUserId.requestQuietModeDisabled(context); } return null; } } src/com/android/documentsui/dirlist/InflateMessageDocumentHolder.java +12 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.android.documentsui.R; Loading @@ -47,11 +48,15 @@ final class InflateMessageDocumentHolder extends MessageHolder { private View mContentView; private View mCrossProfileView; private View mCrossProfileContent; private ProgressBar mCrossProfileProgress; public InflateMessageDocumentHolder(Context context, ViewGroup parent) { super(context, parent, R.layout.item_doc_inflated_message); mContentView = itemView.findViewById(R.id.content); mCrossProfileView = itemView.findViewById(R.id.cross_profile); mCrossProfileContent = mCrossProfileView.findViewById(R.id.cross_profile_content); mCrossProfileProgress = mCrossProfileView.findViewById(R.id.cross_profile_progress); mContentMessage = mContentView.findViewById(R.id.message); mContentImage = mContentView.findViewById(R.id.artwork); Loading @@ -76,7 +81,9 @@ final class InflateMessageDocumentHolder extends MessageHolder { } } private void onButtonClick(View button) { private void onCrossProfileButtonClick(View button) { mCrossProfileContent.setVisibility(View.GONE); mCrossProfileProgress.setVisibility(View.VISIBLE); mMessage.runCallback(); } Loading @@ -91,6 +98,9 @@ final class InflateMessageDocumentHolder extends MessageHolder { private void bindCrossProfileMessageView() { mContentView.setVisibility(View.GONE); mCrossProfileView.setVisibility(View.VISIBLE); mCrossProfileContent.setVisibility(View.VISIBLE); mCrossProfileProgress.setVisibility(View.GONE); mCrossProfileTitle.setText(mMessage.getTitleString()); if (!TextUtils.isEmpty(mMessage.getMessageString())) { mCrossProfileMessage.setVisibility(View.VISIBLE); Loading @@ -102,7 +112,7 @@ final class InflateMessageDocumentHolder extends MessageHolder { if (!TextUtils.isEmpty(mMessage.getButtonString())) { mCrossProfileButton.setVisibility(View.VISIBLE); mCrossProfileButton.setText(mMessage.getButtonString()); mCrossProfileButton.setOnClickListener(this::onButtonClick); mCrossProfileButton.setOnClickListener(this::onCrossProfileButtonClick); } else { mCrossProfileButton.setVisibility(View.GONE); } Loading Loading
res/layout/item_doc_inflated_message_cross_profile.xml +37 −20 Original line number Diff line number Diff line Loading @@ -25,6 +25,22 @@ android:paddingStart="72dp" android:paddingEnd="72dp"> <ProgressBar android:id="@+id/cross_profile_progress" style="@android:style/Widget.Material.Light.ProgressBar" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminate="true" android:indeterminateTint="?attr/colorAccent"/> <LinearLayout android:id="@+id/cross_profile_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal"> <ImageView android:id="@+id/artwork" android:layout_width="24dp" Loading @@ -49,3 +65,4 @@ android:layout_height="wrap_content" style="@style/EmptyStateButton"/> </LinearLayout> </LinearLayout>
src/com/android/documentsui/AbstractActionHandler.java +5 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,11 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA } } @Override public void requestQuietModeDisabled(RootInfo info, UserId userId) { new RequestQuietModeDisabledTask(mActivity, userId).execute(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { Loading
src/com/android/documentsui/ActionHandler.java +2 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,8 @@ public interface ActionHandler { */ void startAuthentication(PendingIntent intent); void requestQuietModeDisabled(RootInfo info, UserId userId); void showAppDetails(ResolveInfo info, UserId userId); void openRoot(RootInfo root); Loading
src/com/android/documentsui/RequestQuietModeDisabledTask.java 0 → 100644 +49 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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. */ package com.android.documentsui; import static androidx.core.util.Preconditions.checkNotNull; import android.content.Context; import android.os.AsyncTask; import com.android.documentsui.base.UserId; import java.lang.ref.WeakReference; /** * A task to request disabling quiet mode for a given user. */ class RequestQuietModeDisabledTask extends AsyncTask<Void, Void, Void> { private final WeakReference<Context> mContextWeakReference; private final UserId mUserId; RequestQuietModeDisabledTask(Context context, UserId userId) { mContextWeakReference = new WeakReference<>(checkNotNull(context)); mUserId = checkNotNull(userId); } @Override protected Void doInBackground(Void... voids) { Context context = mContextWeakReference.get(); if (context != null) { mUserId.requestQuietModeDisabled(context); } return null; } }
src/com/android/documentsui/dirlist/InflateMessageDocumentHolder.java +12 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.android.documentsui.R; Loading @@ -47,11 +48,15 @@ final class InflateMessageDocumentHolder extends MessageHolder { private View mContentView; private View mCrossProfileView; private View mCrossProfileContent; private ProgressBar mCrossProfileProgress; public InflateMessageDocumentHolder(Context context, ViewGroup parent) { super(context, parent, R.layout.item_doc_inflated_message); mContentView = itemView.findViewById(R.id.content); mCrossProfileView = itemView.findViewById(R.id.cross_profile); mCrossProfileContent = mCrossProfileView.findViewById(R.id.cross_profile_content); mCrossProfileProgress = mCrossProfileView.findViewById(R.id.cross_profile_progress); mContentMessage = mContentView.findViewById(R.id.message); mContentImage = mContentView.findViewById(R.id.artwork); Loading @@ -76,7 +81,9 @@ final class InflateMessageDocumentHolder extends MessageHolder { } } private void onButtonClick(View button) { private void onCrossProfileButtonClick(View button) { mCrossProfileContent.setVisibility(View.GONE); mCrossProfileProgress.setVisibility(View.VISIBLE); mMessage.runCallback(); } Loading @@ -91,6 +98,9 @@ final class InflateMessageDocumentHolder extends MessageHolder { private void bindCrossProfileMessageView() { mContentView.setVisibility(View.GONE); mCrossProfileView.setVisibility(View.VISIBLE); mCrossProfileContent.setVisibility(View.VISIBLE); mCrossProfileProgress.setVisibility(View.GONE); mCrossProfileTitle.setText(mMessage.getTitleString()); if (!TextUtils.isEmpty(mMessage.getMessageString())) { mCrossProfileMessage.setVisibility(View.VISIBLE); Loading @@ -102,7 +112,7 @@ final class InflateMessageDocumentHolder extends MessageHolder { if (!TextUtils.isEmpty(mMessage.getButtonString())) { mCrossProfileButton.setVisibility(View.VISIBLE); mCrossProfileButton.setText(mMessage.getButtonString()); mCrossProfileButton.setOnClickListener(this::onButtonClick); mCrossProfileButton.setOnClickListener(this::onCrossProfileButtonClick); } else { mCrossProfileButton.setVisibility(View.GONE); } Loading