summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml1
-rw-r--r--RemoteFolder/src/com/android/launcher3/RemoteFolderManager.java15
-rw-r--r--proguard.flags11
-rw-r--r--res/drawable/download_badge.pngbin0 -> 2711 bytes
-rw-r--r--res/layout/remote_folder.xml112
-rw-r--r--res/layout/user_folder.xml15
-rw-r--r--res/values/cm_strings.xml6
-rw-r--r--res/values/dimens.xml2
-rw-r--r--src/com/android/launcher3/Folder.java87
-rw-r--r--src/com/android/launcher3/FolderIcon.java18
-rw-r--r--src/com/android/launcher3/FolderInfo.java13
-rw-r--r--src/com/android/launcher3/Utilities.java15
12 files changed, 108 insertions, 187 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2b35a5b89..a34f30f78 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -77,7 +77,6 @@
<uses-permission android:name="com.android.launcher3.permission.RECEIVE_FIRST_LOAD_BROADCAST" />
<uses-permission android:name="cyanogenmod.permission.PROTECTED_APP" />
<uses-permission android:name="com.cyngn.stats.SEND_ANALYTICS" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name="com.android.launcher3.LauncherApplication"
diff --git a/RemoteFolder/src/com/android/launcher3/RemoteFolderManager.java b/RemoteFolder/src/com/android/launcher3/RemoteFolderManager.java
index 61a003399..e09010d16 100644
--- a/RemoteFolder/src/com/android/launcher3/RemoteFolderManager.java
+++ b/RemoteFolder/src/com/android/launcher3/RemoteFolderManager.java
@@ -1,5 +1,9 @@
package com.android.launcher3;
+import android.graphics.drawable.Drawable;
+import android.view.View;
+import android.view.ViewGroup;
+
import java.util.ArrayList;
/**
@@ -14,7 +18,7 @@ public class RemoteFolderManager {
* @param icon folder icon view on the workspace.
* @return a view for the remote folder.
*/
- public Folder createRemoteFolder(final FolderIcon icon) { return null; }
+ public Folder createRemoteFolder(final FolderIcon icon, ViewGroup root) { return null; }
/**
* Called when Launcher finishes binding items from the model.
@@ -49,6 +53,15 @@ public class RemoteFolderManager {
public void onInfoIconClicked() { }
/**
+ * Change the appearance of FolderIcon for our RemoteFolder by adding a badge
+ * @param icon the FolderIcon to update
+ * @return a FolderIcon with an added ImageView
+ */
+ public static FolderIcon addBadgeToFolderIcon(FolderIcon icon) {
+ return icon;
+ }
+
+ /**
* Called when the view holder is created for the remote header.
* @param holder remote view holder.
*/
diff --git a/proguard.flags b/proguard.flags
index 5eef9074c..440477b26 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -85,3 +85,14 @@
-keep class android.view.inputmethod.** { *; }
-dontwarn android.view.inputmethod.*
+
+-keep class com.google.android.gms.common.api.GoogleApiClient { public *; }
+-keep class com.google.android.gms.common.api.GoogleApiClient$* {public *;}
+-keep class com.google.android.gms.location.LocationServices {public *;}
+-keep class com.google.android.gms.location.FusedLocationProviderApi {public *;}
+-keep class com.google.android.gms.location.ActivityRecognition {public *;}
+-keep class com.google.android.gms.location.ActivityRecognitionApi {public *;}
+-keep class com.google.android.gms.location.ActivityRecognitionResult {public *;}
+-keep class com.google.android.gms.location.DetectedActivity {public *;}
+-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient{public *;}
+-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info{public *;} \ No newline at end of file
diff --git a/res/drawable/download_badge.png b/res/drawable/download_badge.png
new file mode 100644
index 000000000..fad49b65f
--- /dev/null
+++ b/res/drawable/download_badge.png
Binary files differ
diff --git a/res/layout/remote_folder.xml b/res/layout/remote_folder.xml
index ffbcb645c..49d47292d 100644
--- a/res/layout/remote_folder.xml
+++ b/res/layout/remote_folder.xml
@@ -1,112 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
- <!-- Copyright (C) 2008 The Android Open Source Project
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
- 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.
- -->
-<com.android.launcher3.RemoteFolder
-xmlns:android="http://schemas.android.com/apk/res/android"
-xmlns:launcher="http://schemas.android.com/apk/res-auto"
-android:layout_width="wrap_content"
-android:layout_height="wrap_content"
-android:orientation="vertical"
-android:paddingTop="16dp"
-android:paddingStart="@dimen/folder_preview_padding"
-android:paddingEnd="@dimen/folder_preview_padding"
-android:paddingBottom="@dimen/folder_preview_padding"
-android:layout_gravity="center"
-android:background="@drawable/folder_bg">
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/folder_info_container"
- android:background="@android:color/holo_green_dark">
-
- <!-- TODO replace background with android:background="@android:color/transparent" -->
- <com.android.launcher3.FolderEditText
- android:id="@+id/folder_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@android:color/holo_orange_dark"
- android:fontFamily="sans-serif-condensed"
- android:hint="@string/folder_hint_text"
- android:imeOptions="flagNoExtractUi"
- android:paddingBottom="@dimen/folder_name_padding"
- android:paddingTop="@dimen/folder_name_padding"
- android:layout_marginStart="@dimen/folder_name_padding"
- android:layout_marginEnd="@dimen/folder_name_padding"
- android:gravity="center_vertical"
- android:singleLine="true"
- android:textColor="@color/workspace_icon_text_color"
- android:textColorHighlight="#ffCCCCCC"
- android:textColorHint="#78ffffff"
- android:textCursorDrawable="@null"
- android:textSize="18sp"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"/>
-
-
- <ImageView
- android:id="@+id/folder_info"
- android:layout_width="@dimen/folder_lock_icon"
- android:layout_height="@dimen/folder_lock_icon"
- android:padding="@dimen/folder_name_padding"
- android:src="@drawable/ic_launcher_info_normal_holo"
- android:layout_alignTop="@id/folder_name"
- android:layout_alignParentRight="true"/>
-
- <TextView
- android:id="@+id/help_text_view"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/folder_name_padding"
- android:layout_marginEnd="@dimen/folder_name_padding"
- android:text="@string/recommendations_help_text"
- android:fontFamily="sans-serif-condensed"
- android:textSize="18sp"
- android:textColor="@color/workspace_icon_text_color"
- android:textColorHighlight="#ffCCCCCC"
- android:textColorHint="#78ffffff"
- android:layout_below="@id/folder_info"
- android:background="@android:color/holo_purple"
- />
-
- <Button
- android:id="@+id/close_info_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:minHeight="@dimen/folder_lock_icon"
- android:text="@string/close"
- android:layout_below="@id/help_text_view"
- android:layout_alignParentBottom="true"
- android:layout_alignParentRight="true"
- />
-
- </RelativeLayout>
-
- <ScrollView
- android:id="@+id/scroll_view"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:background="@android:color/holo_red_dark">
-
- <com.android.launcher3.CellLayout
- android:id="@+id/folder_content"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:cacheColorHint="#ff333333"
- android:hapticFeedbackEnabled="false"
- android:background="@android:color/holo_blue_bright"/>
- </ScrollView>
-</com.android.launcher3.RemoteFolder> \ No newline at end of file
+</merge> \ No newline at end of file
diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml
index d1a7536a3..dc597de91 100644
--- a/res/layout/user_folder.xml
+++ b/res/layout/user_folder.xml
@@ -23,12 +23,17 @@
android:paddingStart="@dimen/folder_preview_padding"
android:paddingEnd="@dimen/folder_preview_padding"
android:paddingBottom="@dimen/folder_preview_padding"
- android:layout_gravity="center"
+ android:layout_marginBottom="@dimen/folder_margin"
+ android:layout_gravity="bottom|center_horizontal"
android:background="@drawable/folder_bg">
+ <include layout="@layout/remote_folder"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
<ScrollView
android:id="@+id/scroll_view"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<com.android.launcher3.CellLayout
@@ -41,7 +46,7 @@
<RelativeLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:id="@+id/folder_name_lock_container">
<ImageView
@@ -50,7 +55,6 @@
android:layout_height="@dimen/folder_lock_icon"
android:padding="@dimen/folder_name_padding"
android:layout_alignParentEnd="true"
- android:layout_alignParentBottom="true"
android:src="@drawable/folder_unlocked" />
<com.android.launcher3.FolderEditText
@@ -73,8 +77,7 @@
android:textSize="18sp"
android:layout_toStartOf="@id/folder_lock"
android:layout_alignTop="@id/folder_lock"
- android:layout_alignParentStart="true"
- android:layout_alignParentBottom="true"/>
+ android:layout_alignParentStart="true"/>
</RelativeLayout>
</com.android.launcher3.Folder>
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 82358347c..10b7096dd 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -88,10 +88,4 @@
<!-- Search Manager doesn't exist -->
<string name="search_activity_not_found">A search activity could not be found!</string>
- <!-- Featured Apps Strings -->
- <string name="recommendations_title">Featured Apps</string>
- <string name="recommendations_help_text">This is a dynamic folder that will automatically load with recommended and featured apps from us at Cyanogen Inc. If you would not like to receive these awesome offers, simply disable below and the folder will be removed.</string>
- <string name="disable">DISABLE</string>
- <string name="close">CLOSE</string>
- <string name="required_icon_link"></string>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 088640f89..7725af025 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -105,10 +105,12 @@
<dimen name="folder_lock_margin">6dp</dimen>
<dimen name="folder_name_padding">10dp</dimen>
<dimen name="folder_lock_icon">48dp</dimen>
+ <dimen name="folder_margin">24dp</dimen>
<!-- Folder icon dimens -->
<dimen name="folder_icon">64dp</dimen>
<dimen name="folder_icon_app_preview">22dp</dimen>
+ <dimen name="folder_icon_overlay_margin">10dp</dimen>
<!-- Sizes for managed profile badges -->
<dimen name="profile_badge_size">24dp</dimen>
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index b3b690042..dfd4fd35a 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -37,7 +37,6 @@ import android.support.v4.widget.AutoScrollHelper;
import android.text.InputType;
import android.text.Selection;
import android.text.Spannable;
-import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -49,6 +48,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AccelerateInterpolator;
@@ -102,7 +102,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private int mMaterialExpandDuration;
private int mMaterialExpandStagger;
protected CellLayout mContent;
- private ScrollView mScrollView;
+ protected ScrollView mScrollView;
private final LayoutInflater mInflater;
private final IconCache mIconCache;
private int mState = STATE_NONE;
@@ -132,7 +132,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private boolean mDeleteFolderOnDropCompleted = false;
private boolean mSuppressFolderDeletion = false;
private boolean mItemAddedBackToSelfViaIcon = false;
- View mFolderNameLockContainer;
+ protected View mFolderNameLockContainer;
FolderEditText mFolderName;
ImageView mFolderLock;
private int mScreenWidth;
@@ -218,7 +218,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
super.onFinishInflate();
mScrollView = (ScrollView) findViewById(R.id.scroll_view);
mContent = (CellLayout) findViewById(R.id.folder_content);
- int measureSpec = MeasureSpec.UNSPECIFIED;
mFocusIndicatorHandler = new FocusIndicatorView(getContext());
mContent.addView(mFocusIndicatorHandler, 0);
@@ -237,11 +236,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mFolderName.setFolder(this);
mFolderName.setOnFocusChangeListener(this);
- // We find out how tall the text view wants to be (it is set to wrap_content), so that
- // we can allocate the appropriate amount of space for it.
- mFolderName.measure(measureSpec, measureSpec);
- mFolderNameHeight = mFolderName.getMeasuredHeight();
-
// We disable action mode for now since it messes up the view on phones
mFolderName.setCustomSelectionActionModeCallback(mActionModeCallback);
mFolderName.setOnEditorActionListener(this);
@@ -262,9 +256,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
// Could be null if this Folder an instance of the RemoteFolder subclass
if (mFolderLock != null) {
- mFolderLock.measure(measureSpec, measureSpec);
mFolderLock.setOnClickListener(this);
- mFolderLockHeight = mFolderLock.getMeasuredHeight();
}
DisplayMetrics displayMetrics = this.getResources().getDisplayMetrics();
mScreenWidth = displayMetrics.widthPixels;
@@ -482,8 +474,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
void bind(final FolderInfo info) {
mInfo = info;
- final ArrayList<ShortcutInfo> children = info.contents;
-
+ ArrayList<ShortcutInfo> children = info.contents;
ArrayList<ShortcutInfo> overflow = new ArrayList<ShortcutInfo>();
setupContentForNumItems(children.size());
placeInReadingOrder(children);
@@ -538,11 +529,12 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
* Creates a new UserFolder, inflated from R.layout.user_folder.
*
* @param context The application's context.
+ * @param root The {@link View} parent of this folder.
*
* @return A new UserFolder.
*/
- static Folder fromXml(Context context) {
- return (Folder) LayoutInflater.from(context).inflate(R.layout.user_folder, null);
+ static Folder fromXml(Context context, ViewGroup root) {
+ return (Folder) LayoutInflater.from(context).inflate(R.layout.user_folder, root, false);
}
/**
@@ -663,19 +655,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
Animator circReveal = LauncherAnimUtils.createCircularReveal(this,
circX, circY, 0, mScreenWidth);
- final View[] alphaViewSet;
- if (mInfo.isRemote()) {
- alphaViewSet = new View[] { mContent, mFolderName };
- } else {
- alphaViewSet = new View[] { mFolderNameLockContainer,
+ final View[] alphaViewSet = new View[] { mFolderNameLockContainer,
mContent, mFolderName, mFolderLock };
- }
for (View view : alphaViewSet) {
view.setAlpha(0f);
}
-
circReveal.setDuration(150);
circReveal.addListener(new AnimatorListenerAdapter() {
@Override
@@ -1285,7 +1271,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
return true;
}
- private void setupContentDimensions(int count) {
+ protected void setupContentDimensions(int count) {
ArrayList<View> list = getItemsInReadingOrder();
int countX = mContent.getCountX();
@@ -1322,12 +1308,19 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
return mMaxNumItems;
}
- private void centerAboutIcon() {
+ protected void centerAboutIcon() {
+ requestLayout();
+ int width = getMeasuredWidth();
+ int height = getMeasuredHeight();
+ if (width > 0 && height > 0) {
+ centerAboutIcon(width, height);
+ }
+ }
+
+ private void centerAboutIcon(int width, int height) {
DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer);
- int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
- int height = getFolderHeight();
float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect);
@@ -1386,14 +1379,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
private void setupContentForNumItems(int count) {
setupContentDimensions(count);
-
- DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
- if (lp == null) {
- lp = new DragLayer.LayoutParams(0, 0);
- lp.customPosition = true;
- setLayoutParams(lp);
- }
- centerAboutIcon();
}
protected int getContentAreaHeight() {
@@ -1404,20 +1389,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
return Math.max(mContent.getDesiredWidth(), MIN_CONTENT_DIMEN);
}
- protected int getFolderHeight() {
- int height = getPaddingTop() + getPaddingBottom() + mFolderNameHeight
- + getContentAreaHeight();
- return height;
- }
-
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
- int height = getFolderHeight();
- int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(getContentAreaWidth(),
- MeasureSpec.EXACTLY);
- int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(getContentAreaHeight(),
- MeasureSpec.EXACTLY);
-
if (LauncherAppState.isDisableAllApps()) {
// Don't cap the height of the content to allow scrolling.
mContent.setFixedSize(getContentAreaWidth(), mContent.getDesiredHeight());
@@ -1425,16 +1397,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mContent.setFixedSize(getContentAreaWidth(), getContentAreaHeight());
}
- mScrollView.measure(contentAreaWidthSpec, contentAreaHeightSpec);
- if (TextUtils.isEmpty(mInfo.title)) {
- mFolderName.measure(contentAreaWidthSpec, MeasureSpec.makeMeasureSpec(
- mFolderNameHeight, MeasureSpec.EXACTLY));
- }
-
- mFolderNameLockContainer.measure(contentAreaWidthSpec,
- MeasureSpec.makeMeasureSpec(mFolderNameHeight, MeasureSpec.EXACTLY));
-
- setMeasuredDimension(width, height);
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
private void arrangeChildren(ArrayList<View> list) {
@@ -1680,7 +1643,15 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
}
- private View getViewForInfo(ShortcutInfo item) {
+ @Override
+ public void onRemoveAll() {
+ // Clear the UX after folder contents are removed from the DB
+ mContent.removeAllViews();
+ mLauncher.closeFolder(this);
+ replaceFolderWithFinalItem();
+ }
+
+ protected View getViewForInfo(ShortcutInfo item) {
for (int j = 0; j < mContent.getCountY(); j++) {
for (int i = 0; i < mContent.getCountX(); i++) {
View v = mContent.getChildAt(i, j);
diff --git a/src/com/android/launcher3/FolderIcon.java b/src/com/android/launcher3/FolderIcon.java
index 17ea4899d..c7e0abfb6 100644
--- a/src/com/android/launcher3/FolderIcon.java
+++ b/src/com/android/launcher3/FolderIcon.java
@@ -30,6 +30,7 @@ import android.graphics.drawable.Drawable;
import android.os.Looper;
import android.os.Parcelable;
import android.util.AttributeSet;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -172,9 +173,9 @@ public class FolderIcon extends FrameLayout implements FolderListener {
folderInfo.title));
Folder folder;
if (folderInfo.isRemote()) {
- folder = launcher.getRemoteFolderManager().createRemoteFolder(icon);
+ folder = launcher.getRemoteFolderManager().createRemoteFolder(icon, launcher.getDragLayer());
} else {
- folder = Folder.fromXml(launcher);
+ folder = Folder.fromXml(launcher, launcher.getDragLayer());
}
folder.setDragController(launcher.getDragController());
folder.setFolderIcon(icon);
@@ -237,6 +238,11 @@ public class FolderIcon extends FrameLayout implements FolderListener {
}
}
+ // Create an overlay badge if this FolderIcon is for a RemoteFolder
+ if (folderInfo.isRemote()) {
+ icon = RemoteFolderManager.addBadgeToFolderIcon(icon);
+ }
+
return icon;
}
@@ -726,7 +732,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {
}
if (!mAnimating) {
- for (int i = NUM_ITEMS_IN_PREVIEW; i >= 0; i--) {
+ for (int i = 0; i < NUM_ITEMS_IN_PREVIEW; i++) {
d = null;
if (i < items.size()) {
v = (TextView) items.get(i);
@@ -835,6 +841,12 @@ public class FolderIcon extends FrameLayout implements FolderListener {
requestLayout();
}
+ @Override
+ public void onRemoveAll() {
+ invalidate();
+ requestLayout();
+ }
+
public void onTitleChanged(CharSequence title) {
mFolderName.setText(title.toString());
setContentDescription(String.format(getContext().getString(R.string.folder_name_format),
diff --git a/src/com/android/launcher3/FolderInfo.java b/src/com/android/launcher3/FolderInfo.java
index abc6c2736..2050864da 100644
--- a/src/com/android/launcher3/FolderInfo.java
+++ b/src/com/android/launcher3/FolderInfo.java
@@ -76,6 +76,18 @@ public class FolderInfo extends ItemInfo {
}
/**
+ * Remove all apps and shortcuts. Does not change the DB unless
+ * LauncherModel.deleteFolderContentsFromDatabase(Context, FolderInfo) is called first.
+ */
+ public void removeAll() {
+ contents.clear();
+ for (int i = 0; i < listeners.size(); i++) {
+ listeners.get(i).onRemoveAll();
+ }
+ itemsChanged();
+ }
+
+ /**
* @return true if this info represents a remote folder, false otherwise
*/
public boolean isRemote() {
@@ -134,6 +146,7 @@ public class FolderInfo extends ItemInfo {
interface FolderListener {
public void onAdd(ShortcutInfo item);
public void onRemove(ShortcutInfo item);
+ public void onRemoveAll();
public void onTitleChanged(CharSequence title);
public void onItemsChanged();
}
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 8fe2e841b..5eecf1b19 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -36,14 +36,14 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
-import android.graphics.Paint.Style;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.Rect;
import android.graphics.RectF;
-import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -627,4 +627,15 @@ public final class Utilities {
return false;
}
}
+
+ public static boolean isNetworkConnected(Context context) {
+ ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
+ return activeNetwork != null && activeNetwork.isConnected();
+ }
+
+ public static boolean isConnectedToWiFi(Context context) {
+ ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ return connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected();
+ }
}