Merge "New design for instant apps in app details header"
This commit is contained in:
committed by
Android (Google) Code Review
commit
fa9da424a8
@@ -37,7 +37,6 @@ import android.widget.TextView;
|
||||
import com.android.settings.AppHeader;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.instantapps.InstantAppDetails;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
@@ -81,7 +80,7 @@ public class AppHeaderController {
|
||||
@ActionType
|
||||
private int mRightAction;
|
||||
|
||||
private InstantAppDetails mInstantAppDetails;
|
||||
private boolean mIsInstantApp;
|
||||
|
||||
public AppHeaderController(Context context, Fragment fragment, View appHeader) {
|
||||
mContext = context;
|
||||
@@ -154,8 +153,8 @@ public class AppHeaderController {
|
||||
return this;
|
||||
}
|
||||
|
||||
public AppHeaderController setInstantAppDetails(InstantAppDetails instantAppDetails) {
|
||||
mInstantAppDetails = instantAppDetails;
|
||||
public AppHeaderController setIsInstantApp(boolean isInstantApp) {
|
||||
this.mIsInstantApp = isInstantApp;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -220,26 +219,9 @@ public class AppHeaderController {
|
||||
bindAppHeaderButtons();
|
||||
}
|
||||
|
||||
if (mInstantAppDetails != null) {
|
||||
setText(R.id.instant_app_developer_title, mInstantAppDetails.developerTitle);
|
||||
View maturity = mAppHeader.findViewById(R.id.instant_app_maturity);
|
||||
|
||||
if (maturity != null) {
|
||||
String maturityText = mInstantAppDetails.maturityRatingString;
|
||||
Drawable maturityIcon = mInstantAppDetails.maturityRatingIcon;
|
||||
if (!TextUtils.isEmpty(maturityText) || maturityIcon != null) {
|
||||
maturity.setVisibility(View.VISIBLE);
|
||||
}
|
||||
setText(R.id.instant_app_maturity_text, maturityText);
|
||||
if (maturityIcon != null) {
|
||||
ImageView maturityIconView = (ImageView) mAppHeader.findViewById(
|
||||
R.id.instant_app_maturity_icon);
|
||||
if (maturityIconView != null) {
|
||||
maturityIconView.setImageDrawable(maturityIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
setText(R.id.instant_app_monetization, mInstantAppDetails.monetizationNotice);
|
||||
if (mIsInstantApp) {
|
||||
setText(R.id.install_type,
|
||||
mAppHeader.getResources().getString(R.string.install_type_instant));
|
||||
}
|
||||
|
||||
return mAppHeader;
|
||||
|
@@ -23,6 +23,7 @@ import android.util.Log;
|
||||
|
||||
import com.android.settings.AppHeader;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.applications.AppUtils;
|
||||
|
||||
import static com.android.settings.applications.AppHeaderController.ActionType;
|
||||
|
||||
@@ -52,6 +53,7 @@ public abstract class AppInfoWithHeader extends AppInfoBase {
|
||||
.setIcon(mPackageInfo.applicationInfo.loadIcon(mPm))
|
||||
.setLabel(mPackageInfo.applicationInfo.loadLabel(mPm))
|
||||
.setSummary(mPackageInfo)
|
||||
.setIsInstantApp(AppUtils.isInstant(mPackageInfo.applicationInfo))
|
||||
.setPackageName(mPackageName)
|
||||
.setUid(mPackageInfo.applicationInfo.uid)
|
||||
.setButtonActions(ActionType.ACTION_APP_INFO, ActionType.ACTION_NONE)
|
||||
|
@@ -563,6 +563,7 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
.setLabel(mAppEntry)
|
||||
.setIcon(mAppEntry)
|
||||
.setSummary(getString(getInstallationStatus(mAppEntry.info)))
|
||||
.setIsInstantApp(AppUtils.isInstant(mPackageInfo.applicationInfo))
|
||||
.done(false /* rebindActions */);
|
||||
mVersionPreference.setSummary(getString(R.string.version_text, pkgInfo.versionName));
|
||||
} else {
|
||||
|
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 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.settings.applications.instantapps;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Encapsulates state about instant apps that is provided by an app store implementation.
|
||||
*/
|
||||
public class InstantAppDetails {
|
||||
|
||||
// Most of these members are self-explanatory; the one that may not be is
|
||||
// monetizationNotice, which is a string alerting users that the app contains ads and/or uses
|
||||
// in-app purchases (this may eventually become two separate members).
|
||||
public final Drawable maturityRatingIcon;
|
||||
public final String maturityRatingString;
|
||||
public final String monetizationNotice;
|
||||
public final String developerTitle;
|
||||
public final URL privacyPolicy;
|
||||
public final URL developerWebsite;
|
||||
public final String developerEmail;
|
||||
public final String developerMailingAddress;
|
||||
|
||||
public static class Builder {
|
||||
private Drawable mMaturityRatingIcon;
|
||||
private String mMaturityRatingString;
|
||||
private String mMonetizationNotice;
|
||||
private String mDeveloperTitle;
|
||||
private URL mPrivacyPolicy;
|
||||
private URL mDeveloperWebsite;
|
||||
private String mDeveloperEmail;
|
||||
private String mDeveloperMailingAddress;
|
||||
|
||||
public Builder maturityRatingIcon(Drawable maturityRatingIcon) {
|
||||
this.mMaturityRatingIcon = maturityRatingIcon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder maturityRatingString(String maturityRatingString) {
|
||||
mMaturityRatingString = maturityRatingString;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder monetizationNotice(String monetizationNotice) {
|
||||
mMonetizationNotice = monetizationNotice;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder developerTitle(String developerTitle) {
|
||||
mDeveloperTitle = developerTitle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder privacyPolicy(URL privacyPolicy) {
|
||||
mPrivacyPolicy = privacyPolicy;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder developerWebsite(URL developerWebsite) {
|
||||
mDeveloperWebsite = developerWebsite;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder developerEmail(String developerEmail) {
|
||||
mDeveloperEmail = developerEmail;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder developerMailingAddress(String developerMailingAddress) {
|
||||
mDeveloperMailingAddress = developerMailingAddress;
|
||||
return this;
|
||||
}
|
||||
|
||||
public InstantAppDetails build() {
|
||||
return new InstantAppDetails(mMaturityRatingIcon, mMaturityRatingString,
|
||||
mMonetizationNotice, mDeveloperTitle, mPrivacyPolicy, mDeveloperWebsite,
|
||||
mDeveloperEmail, mDeveloperMailingAddress);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() { return new Builder(); }
|
||||
|
||||
private InstantAppDetails(Drawable maturityRatingIcon, String maturityRatingString,
|
||||
String monetizationNotice, String developerTitle, URL privacyPolicy,
|
||||
URL developerWebsite, String developerEmail, String developerMailingAddress) {
|
||||
this.maturityRatingIcon = maturityRatingIcon;
|
||||
this.maturityRatingString = maturityRatingString;
|
||||
this.monetizationNotice = monetizationNotice;
|
||||
this.developerTitle = developerTitle;
|
||||
this.privacyPolicy = privacyPolicy;
|
||||
this.developerWebsite = developerWebsite;
|
||||
this.developerEmail = developerEmail;
|
||||
this.developerMailingAddress = developerMailingAddress;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user