[SQUASH]Revert "Launcher3: Add AppInfo Bottom Sheet from Shade Launcher"
This reverts commit78e1005614
. Revert "SystemShortcuts: fix fc with InfoBottomSheet" This reverts commit2d2c5768a6
. Revert "Launcher3: Do not attempt to show promise icon when info is null" This reverts commita15d13d800
. Revert "Launcher3: Fix NPE with AppInfoBottomSheet" This reverts commit41e92c2a48
. Revert "InfoBottomSheet: Fix NPE with AppTransitionManager" This reverts commitf9a5fb8402
.
This commit is contained in:
parent
5c933b040d
commit
6006d9205c
|
@ -1,15 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0"
|
|
||||||
android:tint="?android:attr/textColorPrimary">
|
|
||||||
<group
|
|
||||||
android:name="rotationGroup"
|
|
||||||
android:pivotX="12"
|
|
||||||
android:scaleX="-1">
|
|
||||||
<path
|
|
||||||
android:fillColor="@android:color/white"
|
|
||||||
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM5.92,19H5v-0.92l9.06,-9.06 0.92,0.92L5.92,19zM20.71,5.63l-2.34,-2.34c-0.2,-0.2 -0.45,-0.29 -0.71,-0.29s-0.51,0.1 -0.7,0.29l-1.83,1.83 3.75,3.75 1.83,-1.83c0.39,-0.39 0.39,-1.02 0,-1.41z"/>
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0"
|
|
||||||
android:tint="?android:attr/textColorPrimary">
|
|
||||||
<path
|
|
||||||
android:fillColor="@android:color/white"
|
|
||||||
android:pathData="M21,10.12h-6.78l2.74,-2.82c-2.73,-2.7 -7.15,-2.8 -9.88,-0.1 -2.73,2.71 -2.73,7.08 0,9.79 2.73,2.71 7.15,2.71 9.88,0C18.32,15.65 19,14.08 19,12.1h2c0,1.98 -0.88,4.55 -2.64,6.29 -3.51,3.48 -9.21,3.48 -12.72,0 -3.5,-3.47 -3.53,-9.11 -0.02,-12.58 3.51,-3.47 9.14,-3.47 12.65,0L21,3v7.12zM12.5,8v4.25l3.5,2.08 -0.72,1.21L11,13V8h1.5z" />
|
|
||||||
</vector>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0"
|
|
||||||
android:tint="?android:attr/textColorPrimary">
|
|
||||||
<path
|
|
||||||
android:fillColor="@android:color/white"
|
|
||||||
android:pathData="M20.54,5.23l-1.39,-1.68C18.88,3.21 18.47,3 18,3L6,3c-0.47,0 -0.88,0.21 -1.16,0.55L3.46,5.23C3.17,5.57 3,6.02 3,6.5L3,19c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6.5c0,-0.48 -0.17,-0.93 -0.46,-1.27zM6.24,5h11.52l0.81,0.97L5.44,5.97l0.8,-0.97zM5,19L5,8h14v11L5,19zM13.45,10h-2.9v3L8,13l4,4 4,-4h-2.55z"/>
|
|
||||||
</vector>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0"
|
|
||||||
android:tint="?android:attr/textColorPrimary">
|
|
||||||
<path
|
|
||||||
android:fillColor="@android:color/white"
|
|
||||||
android:pathData="M15,9L9,9v6h6L15,9zM13,13h-2v-2h2v2zM21,11L21,9h-2L19,7c0,-1.1 -0.9,-2 -2,-2h-2L15,3h-2v2h-2L11,3L9,3v2L7,5c-1.1,0 -2,0.9 -2,2v2L3,9v2h2v2L3,13v2h2v2c0,1.1 0.9,2 2,2h2v2h2v-2h2v2h2v-2h2c1.1,0 2,-0.9 2,-2v-2h2v-2h-2v-2h2zM17,17L7,17L7,7h10v10z"/>
|
|
||||||
</vector>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<com.android.launcher3.customization.InfoBottomSheet
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:theme="?attr/widgetsTheme">
|
|
||||||
|
|
||||||
<include layout="@layout/app_info_bottom_sheet_content" />
|
|
||||||
|
|
||||||
</com.android.launcher3.customization.InfoBottomSheet>
|
|
|
@ -1,61 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2021 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.
|
|
||||||
-->
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/widgets_bottom_sheet"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/bg_rounded_corner_bottom_sheet"
|
|
||||||
android:paddingTop="16dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<View
|
|
||||||
android:id="@+id/collapse_handle"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="2dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:background="?android:attr/textColorSecondary"/>
|
|
||||||
<TextView
|
|
||||||
style="@style/TextHeadline"
|
|
||||||
android:id="@+id/title"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
|
||||||
android:textSize="24sp"/>
|
|
||||||
<ScrollView
|
|
||||||
android:id="@+id/widgets_table_scroll_view"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:fadeScrollbars="false"
|
|
||||||
android:layout_marginVertical="16dp">
|
|
||||||
<include layout="@layout/widgets_table_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin"
|
|
||||||
android:layout_gravity="center_horizontal" />
|
|
||||||
</ScrollView>
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/sheet_prefs"
|
|
||||||
android:name="com.android.launcher3.customization.InfoBottomSheet$PrefsFragment"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_marginBottom="40dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</merge>
|
|
|
@ -1,50 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2015 Google Inc.
|
|
||||||
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<androidx.preference.PreferenceScreen
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="pref_app_info_version"
|
|
||||||
android:title="@string/app_info_version"
|
|
||||||
android:icon="@drawable/ic_app_info_version"
|
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="pref_app_info_last_update"
|
|
||||||
android:title="@string/app_info_last_update"
|
|
||||||
android:icon="@drawable/ic_app_info_last_update"
|
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="pref_app_info_source"
|
|
||||||
android:title="@string/app_info_source"
|
|
||||||
android:icon="@drawable/ic_app_info_source"
|
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
<com.android.launcher3.settings.preference.ReloadingListPreference
|
|
||||||
android:key="pref_app_info_icon_pack"
|
|
||||||
android:title="@string/app_info_icon_pack"
|
|
||||||
android:icon="@drawable/ic_app_info_icon_pack"
|
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="pref_app_info_more"
|
|
||||||
android:title="@string/app_info_more"
|
|
||||||
android:icon="@drawable/ic_info_no_shadow"
|
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
|
|
@ -1,218 +0,0 @@
|
||||||
package com.android.launcher3.customization;
|
|
||||||
|
|
||||||
import android.app.ActivityOptions;
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.app.FragmentManager;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import androidx.preference.Preference;
|
|
||||||
import androidx.preference.PreferenceFragment;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import android.graphics.Rect;
|
|
||||||
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.android.launcher3.BaseDraggingActivity;
|
|
||||||
import com.android.launcher3.model.data.ItemInfo;
|
|
||||||
import com.android.launcher3.Launcher;
|
|
||||||
import com.android.launcher3.QuickstepTransitionManager;
|
|
||||||
import com.android.launcher3.R;
|
|
||||||
import com.android.launcher3.util.ActivityOptionsWrapper;
|
|
||||||
import com.android.launcher3.util.ComponentKey;
|
|
||||||
import com.android.launcher3.widget.WidgetsBottomSheet;
|
|
||||||
import com.android.launcher3.util.PackageManagerHelper;
|
|
||||||
|
|
||||||
import com.android.launcher3.settings.preference.IconPackPrefSetter;
|
|
||||||
import com.android.launcher3.settings.preference.ReloadingListPreference;
|
|
||||||
import com.android.launcher3.util.AppReloader;
|
|
||||||
|
|
||||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
|
||||||
import static com.android.launcher3.util.Executors.THREAD_POOL_EXECUTOR;
|
|
||||||
|
|
||||||
public class InfoBottomSheet extends WidgetsBottomSheet {
|
|
||||||
private final FragmentManager mFragmentManager;
|
|
||||||
protected static Rect mSourceBounds;
|
|
||||||
protected static Context mTarget;
|
|
||||||
|
|
||||||
public InfoBottomSheet(Context context) {
|
|
||||||
this(context, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InfoBottomSheet(Context context, AttributeSet attrs) {
|
|
||||||
this(context, attrs, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InfoBottomSheet(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
mFragmentManager = Launcher.getLauncher(context).getFragmentManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void configureBottomSheet(Rect sourceBounds, Context target) {
|
|
||||||
mSourceBounds = sourceBounds;
|
|
||||||
mTarget = target;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void populateAndShow(ItemInfo itemInfo) {
|
|
||||||
super.populateAndShow(itemInfo);
|
|
||||||
TextView title = findViewById(R.id.title);
|
|
||||||
title.setText(itemInfo.title);
|
|
||||||
|
|
||||||
PrefsFragment fragment =
|
|
||||||
(PrefsFragment) mFragmentManager.findFragmentById(R.id.sheet_prefs);
|
|
||||||
fragment.loadForApp(itemInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDetachedFromWindow() {
|
|
||||||
Fragment pf = mFragmentManager.findFragmentById(R.id.sheet_prefs);
|
|
||||||
if (pf != null) {
|
|
||||||
mFragmentManager.beginTransaction()
|
|
||||||
.remove(pf)
|
|
||||||
.commitAllowingStateLoss();
|
|
||||||
}
|
|
||||||
super.onDetachedFromWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWidgetsBound() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PrefsFragment extends PreferenceFragment
|
|
||||||
implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener {
|
|
||||||
private static final String KEY_ICON_PACK = "pref_app_info_icon_pack";
|
|
||||||
private static final String KEY_SOURCE = "pref_app_info_source";
|
|
||||||
private static final String KEY_LAST_UPDATE = "pref_app_info_last_update";
|
|
||||||
private static final String KEY_VERSION = "pref_app_info_version";
|
|
||||||
private static final String KEY_MORE = "pref_app_info_more";
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
private ItemInfo mItemInfo;
|
|
||||||
|
|
||||||
private ComponentName mComponent;
|
|
||||||
private ComponentKey mKey;
|
|
||||||
private QuickstepTransitionManager mAppTransitionManager;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
mContext = getActivity();
|
|
||||||
mAppTransitionManager = new QuickstepTransitionManager(mContext);
|
|
||||||
mAppTransitionManager.registerRemoteAnimations();
|
|
||||||
mAppTransitionManager.registerRemoteTransitions();
|
|
||||||
}
|
|
||||||
|
|
||||||
private QuickstepTransitionManager getAppTransitionManager() {
|
|
||||||
return mAppTransitionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActivityOptionsWrapper getActivityLaunchOptions(View v) {
|
|
||||||
return mAppTransitionManager.getActivityLaunchOptions(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
mAppTransitionManager.onActivityDestroyed();
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
|
||||||
addPreferencesFromResource(R.xml.app_info_preferences);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
RecyclerView view = super.onCreateRecyclerView(inflater, parent, savedInstanceState);
|
|
||||||
view.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadForApp(ItemInfo itemInfo) {
|
|
||||||
mComponent = itemInfo.getTargetComponent();
|
|
||||||
mItemInfo = itemInfo;
|
|
||||||
mKey = new ComponentKey(mComponent, itemInfo.user);
|
|
||||||
|
|
||||||
ReloadingListPreference icons = (ReloadingListPreference) findPreference(KEY_ICON_PACK);
|
|
||||||
icons.setValue(IconDatabase.getByComponent(mContext, mKey));
|
|
||||||
icons.setOnReloadListener(ctx -> new IconPackPrefSetter(ctx, mComponent));
|
|
||||||
icons.setOnPreferenceChangeListener(this);
|
|
||||||
|
|
||||||
THREAD_POOL_EXECUTOR.execute(() -> {
|
|
||||||
MetadataExtractor extractor = new MetadataExtractor(mContext, mComponent);
|
|
||||||
|
|
||||||
CharSequence source = extractor.getSource();
|
|
||||||
CharSequence lastUpdate = extractor.getLastUpdate();
|
|
||||||
CharSequence version = mContext.getString(
|
|
||||||
R.string.app_info_version_value,
|
|
||||||
extractor.getVersionName(),
|
|
||||||
extractor.getVersionCode());
|
|
||||||
Intent marketIntent = extractor.getMarketIntent();
|
|
||||||
|
|
||||||
MAIN_EXECUTOR.execute(() -> {
|
|
||||||
Preference sourcePref = findPreference(KEY_SOURCE);
|
|
||||||
Preference lastUpdatePref = findPreference(KEY_LAST_UPDATE);
|
|
||||||
Preference versionPref = findPreference(KEY_VERSION);
|
|
||||||
Preference morePref = findPreference(KEY_MORE);
|
|
||||||
|
|
||||||
sourcePref.setSummary(source);
|
|
||||||
lastUpdatePref.setSummary(lastUpdate);
|
|
||||||
versionPref.setSummary(version);
|
|
||||||
morePref.setOnPreferenceClickListener(this);
|
|
||||||
|
|
||||||
if (marketIntent != null) {
|
|
||||||
sourcePref.setOnPreferenceClickListener(
|
|
||||||
pref -> tryStartActivity(marketIntent));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean tryStartActivity(Intent intent) {
|
|
||||||
Launcher launcher = Launcher.getLauncher(mContext);
|
|
||||||
Bundle opts = getAppTransitionManager()
|
|
||||||
.getActivityLaunchOptions(getView())
|
|
||||||
.toBundle();
|
|
||||||
try {
|
|
||||||
launcher.startActivity(intent, opts);
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
||||||
if (newValue.equals(IconDatabase.getGlobal(mContext))) {
|
|
||||||
IconDatabase.resetForComponent(mContext, mKey);
|
|
||||||
} else {
|
|
||||||
IconDatabase.setForComponent(mContext, mKey, (String) newValue);
|
|
||||||
}
|
|
||||||
AppReloader.get(mContext).reload(mKey);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onMoreClick() {
|
|
||||||
new PackageManagerHelper(InfoBottomSheet.mTarget).startDetailsActivityForInfo(
|
|
||||||
mItemInfo, InfoBottomSheet.mSourceBounds, ActivityOptions.makeBasic().toBundle());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
onMoreClick();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasSeenEducationTip() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
package com.android.launcher3.customization;
|
|
||||||
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.ApplicationInfo;
|
|
||||||
import android.content.pm.PackageInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.text.format.DateUtils;
|
|
||||||
|
|
||||||
import com.android.launcher3.R;
|
|
||||||
import com.android.launcher3.Utilities;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import static android.content.pm.PackageManager.GET_META_DATA;
|
|
||||||
|
|
||||||
class MetadataExtractor {
|
|
||||||
private final Context mContext;
|
|
||||||
private final PackageManager mPm;
|
|
||||||
|
|
||||||
private String mSourcePkg = "";
|
|
||||||
private Intent mMarketIntent;
|
|
||||||
|
|
||||||
private long mLastUpdate = 0;
|
|
||||||
private String mVersionName = "Unknown";
|
|
||||||
private long mVersionCode = 0;
|
|
||||||
|
|
||||||
MetadataExtractor(Context context, ComponentName cn) {
|
|
||||||
mContext = context;
|
|
||||||
mPm = context.getPackageManager();
|
|
||||||
String pkg = cn.getPackageName();
|
|
||||||
|
|
||||||
try {
|
|
||||||
mSourcePkg = mPm.getInstallerPackageName(pkg);
|
|
||||||
if (!TextUtils.isEmpty(mSourcePkg)) {
|
|
||||||
mMarketIntent = new Intent(Intent.ACTION_VIEW)
|
|
||||||
.setData(Uri.parse("market://details?id=" + pkg))
|
|
||||||
.setPackage(mSourcePkg);
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
PackageInfo pi = mPm.getPackageInfo(pkg, GET_META_DATA);
|
|
||||||
mLastUpdate = new File(pi.applicationInfo.sourceDir).lastModified();
|
|
||||||
mVersionName = pi.versionName;
|
|
||||||
mVersionCode = Utilities.ATLEAST_P ? pi.getLongVersionCode() : pi.versionCode;
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CharSequence getSource() {
|
|
||||||
if (TextUtils.isEmpty(mSourcePkg)) {
|
|
||||||
return mContext.getString(R.string.app_info_source_system);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
ApplicationInfo pi = mPm.getApplicationInfo(mSourcePkg, 0);
|
|
||||||
return pi.loadLabel(mPm);
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return mSourcePkg;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getLastUpdate() {
|
|
||||||
return DateUtils.formatDateTime(mContext, mLastUpdate,
|
|
||||||
DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_DATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
String getVersionName() {
|
|
||||||
return mVersionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
long getVersionCode() {
|
|
||||||
return mVersionCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
Intent getMarketIntent() {
|
|
||||||
return mMarketIntent;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -107,7 +107,6 @@ public class ItemInstallQueue {
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
private void addToQueue(PendingInstallShortcutInfo info) {
|
private void addToQueue(PendingInstallShortcutInfo info) {
|
||||||
if (info == null) return;
|
|
||||||
ensureQueueLoaded();
|
ensureQueueLoaded();
|
||||||
if (!mItems.contains(info)) {
|
if (!mItems.contains(info)) {
|
||||||
mItems.add(info);
|
mItems.add(info);
|
||||||
|
|
|
@ -15,7 +15,6 @@ import android.graphics.Rect;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.InflateException;
|
|
||||||
import android.view.accessibility.AccessibilityNodeInfo;
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -37,7 +36,6 @@ import com.android.launcher3.util.PackageManagerHelper;
|
||||||
import com.android.launcher3.util.PackageUserKey;
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
import com.android.launcher3.views.ActivityContext;
|
import com.android.launcher3.views.ActivityContext;
|
||||||
import com.android.launcher3.widget.WidgetsBottomSheet;
|
import com.android.launcher3.widget.WidgetsBottomSheet;
|
||||||
import com.android.launcher3.customization.InfoBottomSheet;
|
|
||||||
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -199,24 +197,12 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
InfoBottomSheet cbs;
|
|
||||||
dismissTaskMenuView(mTarget);
|
dismissTaskMenuView(mTarget);
|
||||||
Rect sourceBounds = Utilities.getViewBounds(view);
|
Rect sourceBounds = Utilities.getViewBounds(view);
|
||||||
try {
|
new PackageManagerHelper(mTarget).startDetailsActivityForInfo(
|
||||||
cbs = (InfoBottomSheet) mTarget.getLayoutInflater().inflate(
|
mItemInfo, sourceBounds, ActivityOptions.makeBasic().toBundle());
|
||||||
R.layout.app_info_bottom_sheet,
|
|
||||||
mTarget.getDragLayer(),
|
|
||||||
false);
|
|
||||||
cbs.configureBottomSheet(sourceBounds, mTarget);
|
|
||||||
cbs.populateAndShow(mItemInfo);
|
|
||||||
} catch (InflateException e) {
|
|
||||||
new PackageManagerHelper(mTarget).startDetailsActivityForInfo(
|
|
||||||
mItemInfo, sourceBounds, ActivityOptions.makeBasic().toBundle());
|
|
||||||
}
|
|
||||||
|
|
||||||
mTarget.getStatsLogManager().logger().withItemInfo(mItemInfo)
|
mTarget.getStatsLogManager().logger().withItemInfo(mItemInfo)
|
||||||
.log(LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP);
|
.log(LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue