Merge tag 'r4275.1_FP2_gms59_1.5.1' into fp2-sibon-staging-16.07.00rc2
Change-Id: Ifbab5605135d5156c983b6d6f997a4e770cd5bef
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 32bd6fd..60fd126 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -18,8 +18,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fairphone.fplauncher3"
- android:versionCode="7"
- android:versionName="7 (FP2 - 1.1)">
+ android:versionCode="8"
+ android:versionName="8 (FP2 - 1.1)">
<uses-sdk
android:minSdkVersion="17"
diff --git a/ic_launcher-web.png b/ic_launcher-web.png
new file mode 100644
index 0000000..b5c25ac
--- /dev/null
+++ b/ic_launcher-web.png
Binary files differ
diff --git a/res/anim/bottom_to_top.xml b/res/anim/bottom_to_top.xml
new file mode 100644
index 0000000..846fd7b
--- /dev/null
+++ b/res/anim/bottom_to_top.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<translate xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="150"
+ android:fromYDelta="5%"
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:toYDelta="0%">
+</translate>
\ No newline at end of file
diff --git a/res/anim/search_appear.xml b/res/anim/search_appear.xml
new file mode 100644
index 0000000..3338923
--- /dev/null
+++ b/res/anim/search_appear.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="400"
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:shareInterpolator="true"
+ android:startOffset="200">
+ <alpha
+ android:fromAlpha="0"
+ android:toAlpha="1" />
+ <translate
+ android:fromXDelta="100%"
+ android:toXDelta="0%" />
+</set>
\ No newline at end of file
diff --git a/res/anim/search_vanish.xml b/res/anim/search_vanish.xml
new file mode 100644
index 0000000..68834ce
--- /dev/null
+++ b/res/anim/search_vanish.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="400"
+ android:fillAfter="true"
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:shareInterpolator="true"
+ android:startOffset="200">
+ <alpha
+ android:fromAlpha="1"
+ android:toAlpha="0" />
+ <translate
+ android:fromXDelta="0%"
+ android:toXDelta="100%" />
+</set>
\ No newline at end of file
diff --git a/res/anim/top_to_bottom.xml b/res/anim/top_to_bottom.xml
new file mode 100644
index 0000000..9a71605
--- /dev/null
+++ b/res/anim/top_to_bottom.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<translate xmlns:android="http://schemas.android.com/apk/res/android"
+ android:duration="150"
+ android:fromYDelta="0%"
+ android:interpolator="@android:anim/decelerate_interpolator"
+ android:toYDelta="5%">
+</translate>
\ No newline at end of file
diff --git a/res/drawable-hdpi/ic_all_apps_search.png b/res/drawable-hdpi/ic_all_apps_search.png
new file mode 100644
index 0000000..00934f2
--- /dev/null
+++ b/res/drawable-hdpi/ic_all_apps_search.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_close.png b/res/drawable-hdpi/ic_close.png
new file mode 100644
index 0000000..ea21b1b
--- /dev/null
+++ b/res/drawable-hdpi/ic_close.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_all_apps_search.png b/res/drawable-mdpi/ic_all_apps_search.png
new file mode 100644
index 0000000..e16c624
--- /dev/null
+++ b/res/drawable-mdpi/ic_all_apps_search.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_close.png b/res/drawable-mdpi/ic_close.png
new file mode 100644
index 0000000..cfb1679
--- /dev/null
+++ b/res/drawable-mdpi/ic_close.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_all_apps_search.png b/res/drawable-xhdpi/ic_all_apps_search.png
new file mode 100644
index 0000000..cebd6ac
--- /dev/null
+++ b/res/drawable-xhdpi/ic_all_apps_search.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_close.png b/res/drawable-xhdpi/ic_close.png
new file mode 100644
index 0000000..0aaf7e2
--- /dev/null
+++ b/res/drawable-xhdpi/ic_close.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_all_apps_search.png b/res/drawable-xxhdpi/ic_all_apps_search.png
new file mode 100644
index 0000000..91cf822
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_all_apps_search.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_close.png b/res/drawable-xxhdpi/ic_close.png
new file mode 100644
index 0000000..61817c9
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_close.png
Binary files differ
diff --git a/res/layout/fp_aging_app_drawer.xml b/res/layout/fp_aging_app_drawer.xml
index ae9b689..e540ad8 100644
--- a/res/layout/fp_aging_app_drawer.xml
+++ b/res/layout/fp_aging_app_drawer.xml
@@ -1,110 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/agingDrawerScroll"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/aging_app_drawer_linear"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:layout_marginBottom="0dp"
+ android:animateLayoutChanges="true"
android:background="@color/white"
- android:clipToPadding="false"
- android:paddingTop="24dp"
- android:scrollbars="none" >
+ android:clickable="true"
+ android:orientation="vertical"
+ android:paddingTop="24dp">
- <LinearLayout
- android:id="@+id/agingDrawerMain"
+ <SearchView
+ android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical" >
+ android:layout_gravity="end"
+ android:layout_marginBottom="0dp"
+ android:layout_marginRight="24dp"
+ android:layout_marginTop="24dp"
+ android:focusable="true"
+ android:focusableInTouchMode="true"
+ android:iconifiedByDefault="false"
+ android:searchIcon="@drawable/ic_all_apps_search"
+ android:visibility="gone" />
+
+ <ScrollView
+ android:id="@+id/agingDrawerScroll"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginBottom="0dp"
+ android:background="@color/white"
+ android:clipToPadding="false"
+ android:fillViewport="true"
+ android:padding="0dp"
+ android:scrollbars="none">
+
<LinearLayout
+ android:id="@+id/agingDrawerMain"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <TextView
- android:id="@+id/activeAppsTitle"
- style="@style/AllAppsTitleBlue"
- android:layout_width="match_parent"
- android:layout_weight="9"
- android:layout_height="wrap_content"
- android:text="@string/active_apps"
- android:singleLine="true"/>
-
- <ImageView
- android:id="@+id/aging_drawer_menu_btn"
- android:layout_width="25dp"
- android:layout_height="55dp"
- android:src="@drawable/ic_more_vert_white_24dp"
- android:tint="@color/blue"
- android:layout_weight="1"
- android:scaleType="centerInside"
- android:layout_gravity="center"
- android:alpha="0.0"/>
- </LinearLayout>
-
- <TextView
- android:id="@+id/activeAppsDescription"
- style="@style/AllAppsDescription"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/no_active_apps"
- android:visibility="gone" />
-
- <com.fairphone.fplauncher3.applifecycle.ExpandedGridview
- android:id="@+id/usedAppsGridView"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="15dp"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:layout_marginTop="15dp"
- android:clipToPadding="false"
- android:horizontalSpacing="5dp"
- android:listSelector="@color/transparent"
- android:numColumns="4"
- android:overScrollMode="never"
- android:scrollbars="none"
- android:verticalSpacing="5dp" />
-
- <LinearLayout
- android:id="@+id/unusedGroup"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:background="@color/grey"
+ android:layout_height="match_parent"
+ android:layout_marginBottom="0dp"
+ android:baselineAligned="false"
android:orientation="vertical"
- android:paddingBottom="48dp" >
+ android:padding="0dp"
+ android:paddingBottom="0dp"
+ android:paddingTop="0dp">
- <TextView
- android:id="@+id/unusedAppsTitle"
- style="@style/AllAppsTitle"
+ <LinearLayout
+ android:id="@+id/usedGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:singleLine="true"
- android:text="@string/idle_apps" />
+ android:layout_marginBottom="0dp"
+ android:orientation="vertical"
+ android:padding="0dp">
- <TextView
- android:id="@+id/unusedAppsDescription"
- style="@style/AllAppsDescription"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/no_idle_apps"
- android:visibility="gone" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:padding="0dp">
- <com.fairphone.fplauncher3.applifecycle.ExpandedGridview
- android:id="@+id/unusedAppsGridView"
+ <TextView
+ android:id="@+id/activeAppsTitle"
+ style="@style/AllAppsTitleBlue"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="8"
+ android:singleLine="true"
+ android:text="@string/active_apps"
+ android:visibility="visible" />
+
+ <ImageView
+ android:id="@+id/aging_drawer_menu_btn"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
+ android:layout_marginRight="8dp"
+ android:layout_weight="1"
+ android:alpha="0.0"
+ android:contentDescription="@string/aging_time_menu"
+ android:scaleType="centerInside"
+ android:src="@drawable/ic_more_vert_white_24dp"
+ android:tint="@color/blue"
+ android:visibility="visible" />
+
+ <ImageView
+ android:id="@+id/all_apps_search_btn"
+ android:layout_width="48dp"
+ android:layout_height="48dp"
+ android:layout_gravity="center"
+ android:layout_marginRight="8dp"
+ android:layout_weight="1"
+ android:contentDescription="@string/magnifying_glass"
+ android:src="@drawable/ic_all_apps_search"
+ android:tint="@color/blue"
+ android:visibility="visible" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/activeAppsDescription"
+ style="@style/AllAppsDescription"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/no_active_apps"
+ android:visibility="gone" />
+
+ <com.fairphone.fplauncher3.applifecycle.ExpandedGridview
+ android:id="@+id/usedAppsGridView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="15dp"
+ android:layout_marginLeft="10dp"
+ android:layout_marginRight="10dp"
+ android:clipToPadding="false"
+ android:horizontalSpacing="5dp"
+ android:listSelector="@color/transparent"
+ android:numColumns="4"
+ android:overScrollMode="never"
+ android:scrollbars="none"
+ android:verticalSpacing="5dp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/unusedGroup"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="15dp"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:layout_marginTop="15dp"
- android:clipToPadding="false"
- android:horizontalSpacing="5dp"
- android:listSelector="@color/transparent"
- android:numColumns="4"
- android:overScrollMode="never"
- android:scrollbars="none"
- android:verticalSpacing="5dp" />
+ android:layout_height="match_parent"
+ android:background="@color/grey"
+ android:orientation="vertical"
+ android:paddingBottom="15dp">
+
+ <TextView
+ android:id="@+id/unusedAppsTitle"
+ style="@style/AllAppsTitle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:text="@string/idle_apps" />
+
+ <TextView
+ android:id="@+id/unusedAppsDescription"
+ style="@style/AllAppsDescription"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone" />
+
+ <com.fairphone.fplauncher3.applifecycle.ExpandedGridview
+ android:id="@+id/unusedAppsGridView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="15dp"
+ android:layout_marginLeft="10dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="15dp"
+ android:clipToPadding="false"
+ android:horizontalSpacing="5dp"
+ android:listSelector="@color/transparent"
+ android:numColumns="4"
+ android:overScrollMode="never"
+ android:padding="0dp"
+ android:scrollbars="none"
+ android:verticalSpacing="5dp" />
+ </LinearLayout>
</LinearLayout>
- </LinearLayout>
-</ScrollView>
\ No newline at end of file
+ </ScrollView>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/fp_oobe_texts.xml b/res/layout/fp_oobe_texts.xml
index 629cf15..74119b8 100644
--- a/res/layout/fp_oobe_texts.xml
+++ b/res/layout/fp_oobe_texts.xml
@@ -88,7 +88,7 @@
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
- android:text="@string/workspace_cling_longpress_description" />
+ android:text="@string/oobe_longpress_description" />
<Button
android:id="@+id/got_it_button"
@@ -98,8 +98,7 @@
android:layout_marginRight="71dp"
android:layout_marginTop="30dp"
android:background="@drawable/button_border"
- android:text="@string/workspace_cling_longpress_dismiss"
- android:textAllCaps="true"
+ android:text="@string/oobe_got_it"
android:textSize="16sp"
android:textColor="@color/oobe_blue_light" />
</LinearLayout>
@@ -138,8 +137,7 @@
android:layout_centerHorizontal="true"
android:layout_marginBottom="15.7dp"
android:background="@drawable/button_border"
- android:text="@string/workspace_cling_longpress_dismiss"
- android:textAllCaps="true"
+ android:text="@string/oobe_got_it"
android:textColor="@color/oobe_blue_light" />
</RelativeLayout>
@@ -308,8 +306,7 @@
android:layout_centerHorizontal="true"
android:layout_marginBottom="15.7dp"
android:background="@drawable/button_border"
- android:text="@string/workspace_cling_longpress_dismiss"
- android:textAllCaps="true"
+ android:text="@string/oobe_got_it"
android:textColor="@color/oobe_blue_light" />
</RelativeLayout>
diff --git a/res/menu/aging_drawer_menu.xml b/res/menu/aging_drawer_menu.xml
index a753c76..7b0218b 100644
--- a/res/menu/aging_drawer_menu.xml
+++ b/res/menu/aging_drawer_menu.xml
@@ -7,11 +7,11 @@
<item
android:id="@+id/two_weeks_to_idle"
- android:title="@string/two_weeks_idle" />
+ android:title="@string/two_weeks_idle"
+ android:checked="true"/>
<item
android:id="@+id/one_month_to_idle"
- android:title="@string/one_month_idle"
- android:checked="true"/>
+ android:title="@string/one_month_idle"/>
</group>
-</menu>
\ No newline at end of file
+</menu>
diff --git a/res/values-fr/fairphone_strings.xml b/res/values-fr/fairphone_strings.xml
index 9656c2e..1c02a48 100644
--- a/res/values-fr/fairphone_strings.xml
+++ b/res/values-fr/fairphone_strings.xml
@@ -43,7 +43,7 @@
<string name="oobe_done">Terminé</string>
<string name="oobe_try_it_yourself">Essayez par vous-même</string>
<string name="oobe_got_it">OK</string>
- <string name="oobe_longpress_title">Fonds d\'écran, Widgets & Apps</string>
+ <string name="oobe_longpress_title">Fonds d\'écran, Widgets & Applications</string>
<string name="oobe_longpress_description">Appuyez de manière prolongée sur l\'arrière-plan pour le personnaliser</string>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index fd42c33..24ab5d9 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -38,9 +38,9 @@
<color name="transparent">#00000000</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
- <color name="grey">#E8E8E8</color>
+ <color name="grey">#e8e8e8</color>
<color name="grey_dark">#333333</color>
- <color name="blue">#2AA8E0</color>
+ <color name="blue">#2aa8e0</color>
<color name="blue_dark">#123C59</color>
<color name="blue_light">#AADCF2</color>
<color name="background_blue_dark">#123C59</color>
diff --git a/res/values/config.xml b/res/values/config.xml
index 91b6dc3..df5e88f 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -119,7 +119,7 @@
</string>
<!-- App lifecycle -->
- <integer name="app_frequent_use_default">@integer/app_frequent_use_one_month</integer>
+ <integer name="app_frequent_use_default">@integer/app_frequent_use_two_weeks</integer>
<integer name="app_frequent_use_one_week">5</integer>
<integer name="app_frequent_use_two_weeks">15</integer>
<integer name="app_frequent_use_one_month">28</integer>
@@ -129,4 +129,4 @@
<integer name="edge_swipe_text_integer_size">20</integer>
<integer name="edge_swipe_text_integer_size_small">16</integer>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/res/values/fairphone_strings.xml b/res/values/fairphone_strings.xml
index 52e7d6d..63d0c5a 100644
--- a/res/values/fairphone_strings.xml
+++ b/res/values/fairphone_strings.xml
@@ -16,7 +16,7 @@
<string name="fp_theme_light">Light</string>
<string name="fp_all_apps_widget_name">All apps</string>
<string name="no_active_apps">You have no active apps yet.</string>
- <string name="no_idle_apps">You have no idle apps yet. If you don’t use an app for more than one month, it will automatically appear here.</string>
+ <string name="no_idle_apps">You have no idle apps yet. If you don’t use an app for more than %s, it will automatically appear here.</string>
<string name="active_apps">Active Apps</string>
<string name="idle_apps">Idle Apps</string>
<string name="pin_target_label">Pin</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c2220f3..af28534 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -331,6 +331,10 @@
<string name="oobe_edit_drag_trade_title">Drag favorites</string>
<string name="oobe_edit_drag_trade_text">To swap position</string>
+ <string name="no_idle_app_found">No idle apps found</string>
+ <string name="no_active_app_found">No active apps found</string>
+ <string name="magnifying_glass">Magnifying glass</string>
+ <string name="aging_time_menu">Aging time menu</string>
<!--
diff --git a/src/com/fairphone/fplauncher3/Launcher.java b/src/com/fairphone/fplauncher3/Launcher.java
index dcbe140..7079a29 100644
--- a/src/com/fairphone/fplauncher3/Launcher.java
+++ b/src/com/fairphone/fplauncher3/Launcher.java
@@ -100,7 +100,6 @@
import android.widget.TextView;
import android.widget.Toast;
-import com.fairphone.fplauncher3.R;
import com.fairphone.fplauncher3.DropTarget.DragObject;
import com.fairphone.fplauncher3.PagedView.PageSwitchListener;
import com.fairphone.fplauncher3.applifecycle.AppDrawerView;
@@ -108,9 +107,9 @@
import com.fairphone.fplauncher3.compat.LauncherActivityInfoCompat;
import com.fairphone.fplauncher3.compat.LauncherAppsCompat;
import com.fairphone.fplauncher3.compat.PackageInstallerCompat;
+import com.fairphone.fplauncher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.fairphone.fplauncher3.compat.UserHandleCompat;
import com.fairphone.fplauncher3.compat.UserManagerCompat;
-import com.fairphone.fplauncher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.fairphone.fplauncher3.edgeswipe.EdgeSwipeMenu;
import com.fairphone.fplauncher3.edgeswipe.editor.AppDiscoverer;
import com.fairphone.fplauncher3.edgeswipe.editor.EditFavoritesActivity;
@@ -162,7 +161,7 @@
private static final int REQUEST_BIND_APPWIDGET = 11;
private static final int REQUEST_RECONFIGURE_APPWIDGET = 12;
-
+
private static final int REQUEST_PICK_SETTINGS = 98;
private static final int REQUEST_EDIT_FAVORITES = 99;
@@ -1094,15 +1093,15 @@
if (mWorkspace.getCustomContentCallbacks() != null) {
mWorkspace.getCustomContentCallbacks().onHide();
}
-
+
AppSwitcherManager.saveAppSwitcherData(this);
AppSwitcherManager.unregisterAppSwitcherBroadcastReceivers(this);
AppDiscoverer.getInstance().saveAppAgingData(this);
-
- if(isAgingAppDrawerVisible()){
- hideAgingAppDrawer();
- }
+
+ if (isAgingAppDrawerVisible()) {
+ hideAgingAppDrawer();
+ }
}
public interface CustomContentCallbacks {
@@ -2417,15 +2416,15 @@
@Override
public void onBackPressed() {
if (isAllAppsVisible()) {
- hideAgingAppDrawer();
+ mAgingAppDrawer.hideSearchOrClose();
if (mAppsCustomizeContent.getContentType() ==
AppsCustomizePagedView.ContentType.Applications) {
showWorkspace(true);
} else {
showOverviewMode(true);
}
- } else if(isAgingAppDrawerVisible()){
- hideAgingAppDrawer();
+ } else if (isAgingAppDrawerVisible()) {
+ mAgingAppDrawer.hideSearchOrClose();
} else if (mWorkspace.isInOverviewMode() && !mWorkspace.isSwitchingState()) {
mWorkspace.exitOverviewMode(true);
} else if (mWorkspace.getOpenFolder() != null) {
diff --git a/src/com/fairphone/fplauncher3/applifecycle/AppDrawerView.java b/src/com/fairphone/fplauncher3/applifecycle/AppDrawerView.java
index dc3be0c..40f0b0f 100644
--- a/src/com/fairphone/fplauncher3/applifecycle/AppDrawerView.java
+++ b/src/com/fairphone/fplauncher3/applifecycle/AppDrawerView.java
@@ -16,8 +16,6 @@
package com.fairphone.fplauncher3.applifecycle;
-import java.util.ArrayList;
-
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
@@ -26,12 +24,15 @@
import android.util.AttributeSet;
import android.util.Log;
import android.util.Pair;
+import android.view.KeyEvent;
import android.view.MenuItem;
+import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.ScrollView;
import android.widget.TextView;
@@ -54,12 +55,13 @@
import com.fairphone.fplauncher3.edgeswipe.editor.AppDiscoverer;
import com.fairphone.fplauncher3.widgets.appswitcher.ApplicationRunInformation;
+import java.util.ArrayList;
+
/**
* Edit favorites activity implements functionality to edit your favorite apps
* that will appear with the edge swipe.
*/
-public class AppDrawerView extends FrameLayout implements DragSource, LauncherTransitionable, OnLongClickListener
-{
+public class AppDrawerView extends FrameLayout implements DragSource, LauncherTransitionable, OnLongClickListener {
private static final String TAG = AppDrawerView.class.getSimpleName();
public static final int DRAGGING_DELAY_MILLIS = 150;
public static final String APP_LIFECYCLE_PREFERENCES = "APP_LIFECYCLE_PREFERENCES";
@@ -89,38 +91,36 @@
private Launcher mLauncher;
+ private AppSearchResultsHelper mSearchHelper;
+
+
private boolean mInTransition;
private ImageView app_drawer_settings;
private PopupMenu mAppSettingsPopup;
- public AppDrawerView(Context context)
- {
+ public AppDrawerView(Context context) {
super(context);
init(context);
}
- public AppDrawerView(Context context, AttributeSet attrs)
- {
+ public AppDrawerView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
- public AppDrawerView(Context context, AttributeSet attrs, int defStyleAttr)
- {
+ public AppDrawerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
@SuppressLint("NewApi")
- public AppDrawerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
- {
+ public AppDrawerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr);
init(context);
}
- protected void init(Context context)
- {
- mContext = context;
+ protected void init(Context context) {
+ mContext = context.getApplicationContext();
this.removeAllViews();
View view = inflate(mContext, R.layout.fp_aging_app_drawer, null);
@@ -128,7 +128,22 @@
setupAllAppsList(view);
+ setupSearchButton(view);
+
addView(view);
+
+ ((LinearLayout)view).getLayoutTransition().setDuration(300);
+ }
+
+ private void setupSearchButton(View view) {
+ View searchBtn = view.findViewById(R.id.all_apps_search_btn);
+
+ searchBtn.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mSearchHelper.showSearchView();
+ }
+ });
}
private void refreshAppLists() {
@@ -137,19 +152,19 @@
mUnusedApps = appLists.second;
}
- public void refreshView(Context context, Launcher launcher)
- {
+ public void refreshView(Context context, Launcher launcher) {
mLauncher = launcher;
init(context);
+ mSearchHelper = new AppSearchResultsHelper(AppDrawerView.this, mLauncher);
}
/**
* Setup the list with all the apps installed on the device.
- *
+ *
* @param view
*/
- private void setupAllAppsList(View view)
- {
+ @SuppressLint("StringFormatInvalid")
+ private void setupAllAppsList(View view) {
mScroll = (ScrollView) view.findViewById(R.id.agingDrawerScroll);
mScroll.setSmoothScrollingEnabled(true);
@@ -161,7 +176,10 @@
setupListAdapters();
- app_drawer_settings = (ImageView)view.findViewById(R.id.aging_drawer_menu_btn);
+ String noIdleAppMessage = String.format(getResources().getString(R.string.no_idle_apps), "one month");
+ unusedAppsDescription.setText(noIdleAppMessage);
+
+ app_drawer_settings = (ImageView) view.findViewById(R.id.aging_drawer_menu_btn);
setupAppSettingsMenu();
app_drawer_settings.setOnClickListener(new OnClickListener() {
@@ -178,31 +196,61 @@
}
}
});
+
+ view.findViewById(R.id.agingDrawerScroll).setOnTouchListener(new OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_MOVE) {
+ if (mSearchHelper.isActive()) {
+ mSearchHelper.hideKeyboard();
+ }
+ }
+ return false;
+ }
+ });
+ mAllAppsGridView.setOnTouchListener(new OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ if (mSearchHelper.isActive()) {
+ mSearchHelper.hideKeyboard();
+ }
+ }
+ return true;
+ }
+ });
+ mUnusedAppsGridView.setOnTouchListener(new OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ if (mSearchHelper.isActive()) {
+ mSearchHelper.hideKeyboard();
+ }
+ }
+ return true;
+ }
+ });
+
}
private void setupListAdapters() {
setupListAdapter(mAllAppsGridView, mAllAppsListAdapter, mUsedApps, false);
setupListAdapter(mUnusedAppsGridView, mUnusedAppsListAdapter, mUnusedApps, true);
- if (mUsedApps.isEmpty())
- {
+ if (mUsedApps.isEmpty()) {
activeAppsDescription.setVisibility(View.VISIBLE);
- }
- else
- {
+ } else {
activeAppsDescription.setVisibility(View.GONE);
}
- if (mUnusedApps.isEmpty())
- {
+ if (mUnusedApps.isEmpty()) {
unusedAppsDescription.setVisibility(View.VISIBLE);
- }
- else
- {
+ } else {
unusedAppsDescription.setVisibility(View.GONE);
}
}
+ @SuppressLint("StringFormatInvalid")
private void setupAppSettingsMenu() {
mAppSettingsPopup = new PopupMenu(mContext, app_drawer_settings);
mAppSettingsPopup.getMenuInflater()
@@ -219,26 +267,34 @@
public boolean onMenuItemClick(MenuItem item) {
Resources resources = mContext.getResources();
int itemId = item.getItemId();
+ String noIdleAppMessage;
switch (itemId) {
case R.id.one_week_to_idle:
ApplicationRunInformation.setAppIdleLimitInDays(mContext, resources.getInteger(R.integer.app_frequent_use_one_week));
+ noIdleAppMessage = String.format(resources.getString(R.string.no_idle_apps), "one week");
+ unusedAppsDescription.setText(noIdleAppMessage);
break;
case R.id.two_weeks_to_idle:
ApplicationRunInformation.setAppIdleLimitInDays(mContext, resources.getInteger(R.integer.app_frequent_use_two_weeks));
+ noIdleAppMessage = String.format(resources.getString(R.string.no_idle_apps), "two weeks");
+ unusedAppsDescription.setText(noIdleAppMessage);
break;
case R.id.one_month_to_idle:
ApplicationRunInformation.setAppIdleLimitInDays(mContext, resources.getInteger(R.integer.app_frequent_use_one_month));
+ noIdleAppMessage = String.format(resources.getString(R.string.no_idle_apps), "one month");
+ unusedAppsDescription.setText(noIdleAppMessage);
default:
ApplicationRunInformation.setAppIdleLimitInDays(mContext, resources.getInteger(R.integer.app_frequent_use_default));
+ noIdleAppMessage = String.format(resources.getString(R.string.no_idle_apps), "one month");
+ unusedAppsDescription.setText(noIdleAppMessage);
break;
}
setAppIdleChoice(mContext, itemId);
- if (item.isChecked()){
+ if (item.isChecked()) {
item.setChecked(false);
- }
- else {
+ } else {
item.setChecked(true);
}
@@ -249,12 +305,12 @@
});
}
- public static int getAppIdleChoice(Context context){
+ public static int getAppIdleChoice(Context context) {
SharedPreferences sharedPreferences = context.getSharedPreferences(APP_LIFECYCLE_PREFERENCES, Activity.MODE_PRIVATE);
- return sharedPreferences.getInt(APP_AGE_LIMIT_CHOISE_RESOURCE, R.id.one_month_to_idle);
+ return sharedPreferences.getInt(APP_AGE_LIMIT_CHOISE_RESOURCE, R.id.two_weeks_to_idle);
}
- public static void setAppIdleChoice(Context context, int choiceId){
+ public static void setAppIdleChoice(Context context, int choiceId) {
SharedPreferences sharedPreferences = context.getSharedPreferences(APP_LIFECYCLE_PREFERENCES, Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
@@ -262,8 +318,7 @@
editor.commit();
}
- public void setupListAdapter(GridView listView, AgingAppsListAdapter appsListAdapter, ArrayList<AppInfo> appList, boolean isUnused)
- {
+ public void setupListAdapter(GridView listView, AgingAppsListAdapter appsListAdapter, ArrayList<AppInfo> appList, boolean isUnused) {
appsListAdapter = new AgingAppsListAdapter(mContext, mLauncher, this, isUnused);
appsListAdapter.setAllApps(appList);
@@ -271,61 +326,49 @@
listView.setAdapter(appsListAdapter);
}
- public void refreshListAdapters()
- {
+ public void refreshListAdapters() {
refreshAppLists();
mAllAppsGridView.removeAllViewsInLayout();
mUnusedAppsGridView.removeAllViewsInLayout();
setupListAdapters();
}
- private void beginDraggingApplication(View v)
- {
+ private void beginDraggingApplication(View v) {
mLauncher.getWorkspace().beginDragShared(v, this);
}
/**
* Clean up after dragging.
*
- * @param target
- * where the item was dragged to (can be null if the item was
- * flung)
+ * @param target where the item was dragged to (can be null if the item was
+ * flung)
*/
- private void endDragging(View target, boolean isFlingToDelete, boolean success)
- {
- if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() && !(target instanceof DeleteDropTarget) && !(target instanceof Folder)))
- {
+ private void endDragging(View target, boolean isFlingToDelete, boolean success) {
+ if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() && !(target instanceof DeleteDropTarget) && !(target instanceof Folder))) {
// Exit spring loaded mode if we have not successfully dropped or
// have not handled the
// drop in Workspace
mLauncher.exitSpringLoadedDragMode();
mLauncher.unlockScreenOrientation(false);
- }
- else
- {
+ } else {
mLauncher.unlockScreenOrientation(false);
}
}
- protected boolean beginDragging(final View v)
- {
+ protected boolean beginDragging(final View v) {
- if (v instanceof BubbleTextView)
- {
+ if (v instanceof BubbleTextView) {
beginDraggingApplication(v);
}
// We delay entering spring-loaded mode slightly to make sure the UI
// thready is free of any work.
- postDelayed(new Runnable()
- {
+ postDelayed(new Runnable() {
@Override
- public void run()
- {
+ public void run() {
// We don't enter spring-loaded mode if the drag has been
// cancelled
- if (mLauncher.getDragController().isDragging())
- {
+ if (mLauncher.getDragController().isDragging()) {
// Go into spring loaded mode (must happen before we
// startDrag())
mLauncher.enterSpringLoadedDragMode();
@@ -337,41 +380,34 @@
}
@Override
- public View getContent()
- {
- if (getChildCount() > 0)
- {
+ public View getContent() {
+ if (getChildCount() > 0) {
return getChildAt(0);
}
return null;
}
@Override
- public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace)
- {
+ public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) {
mInTransition = true;
}
@Override
- public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace)
- {
+ public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
}
@Override
- public void onLauncherTransitionStep(Launcher l, float t)
- {
+ public void onLauncherTransitionStep(Launcher l, float t) {
}
@Override
- public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace)
- {
+ public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) {
mInTransition = false;
// mForceDrawAllChildrenNextFrame = !toWorkspace;
}
@Override
- public boolean onLongClick(View v)
- {
+ public boolean onLongClick(View v) {
// Return early if this is not initiated from a touch
// if (!v.isInTouchMode()) return false;
// When we have exited all apps or are in transition, disregard long
@@ -389,8 +425,7 @@
}
@Override
- public void onDropCompleted(View target, DragObject d, boolean isFlingToDelete, boolean success)
- {
+ public void onDropCompleted(View target, DragObject d, boolean isFlingToDelete, boolean success) {
// Return early and wait for onFlingToDeleteCompleted if this was the
// result of a fling
if (isFlingToDelete) {
@@ -402,23 +437,19 @@
// Display an error message if the drag failed due to there not being
// enough space on the
// target layout we were dropping on.
- if (!success)
- {
+ if (!success) {
boolean showOutOfSpaceMessage = false;
- if (target instanceof Workspace)
- {
+ if (target instanceof Workspace) {
int currentScreen = mLauncher.getCurrentWorkspaceScreen();
Workspace workspace = (Workspace) target;
CellLayout layout = (CellLayout) workspace.getChildAt(currentScreen);
ItemInfo itemInfo = (ItemInfo) d.dragInfo;
- if (layout != null)
- {
+ if (layout != null) {
CellLayout.calculateSpans(itemInfo);
showOutOfSpaceMessage = !layout.findCellForSpan(null, itemInfo.spanX, itemInfo.spanY);
}
}
- if (showOutOfSpaceMessage)
- {
+ if (showOutOfSpaceMessage) {
mLauncher.showOutOfSpaceMessage();
}
@@ -427,35 +458,49 @@
}
@Override
- public void onFlingToDeleteCompleted()
- {
+ public void onFlingToDeleteCompleted() {
// We just dismiss the drag when we fling, so cleanup here
endDragging(null, true, true);
}
@Override
- public boolean supportsFlingToDelete()
- {
+ public boolean supportsFlingToDelete() {
return true;
}
@Override
- public boolean supportsAppInfoDropTarget()
- {
+ public boolean supportsAppInfoDropTarget() {
return true;
}
@Override
- public boolean supportsDeleteDropTarget()
- {
+ public boolean supportsDeleteDropTarget() {
return false;
}
@Override
- public float getIntrinsicIconScaleFactor()
- {
+ public float getIntrinsicIconScaleFactor() {
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
return (float) grid.allAppsIconSizePx / grid.iconSizePx;
}
+
+ public void hideSearchOrClose() {
+ Log.v(TAG, this.getClass().getName() + ".hideSearchOrClose() -> active=" + mSearchHelper.isActive());
+ if (mSearchHelper.isActive()) {
+ mSearchHelper.smartHide();
+ } else {
+ mLauncher.hideAgingAppDrawer();
+ }
+ }
+
+ @Override
+ public boolean dispatchKeyEventPreIme(KeyEvent event) {
+ if (event.getAction() == KeyEvent.ACTION_UP && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+ hideSearchOrClose();
+ return true;
+ } else {
+ return super.dispatchKeyEventPreIme(event);
+ }
+ }
}
diff --git a/src/com/fairphone/fplauncher3/applifecycle/AppSearchResultsHelper.java b/src/com/fairphone/fplauncher3/applifecycle/AppSearchResultsHelper.java
new file mode 100644
index 0000000..e59320e
--- /dev/null
+++ b/src/com/fairphone/fplauncher3/applifecycle/AppSearchResultsHelper.java
@@ -0,0 +1,365 @@
+package com.fairphone.fplauncher3.applifecycle;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.ResultReceiver;
+import android.text.TextUtils;
+import android.util.Log;
+import android.util.Pair;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.AdapterView;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.SearchView;
+import android.widget.TextView;
+
+import com.fairphone.fplauncher3.AppInfo;
+import com.fairphone.fplauncher3.Launcher;
+import com.fairphone.fplauncher3.R;
+import com.fairphone.fplauncher3.edgeswipe.editor.AppDiscoverer;
+
+import java.util.ArrayList;
+
+
+public class AppSearchResultsHelper {
+
+ private final static String TAG = AppSearchResultsHelper.class.getName();
+ private AppDrawerView mDrawerView;
+ private SearchView mSearchView;
+ private Launcher mLauncher;
+ private ArrayList<AppInfo> mActiveApps;
+ private ArrayList<AppInfo> mIdleApps;
+ private AgingAppsListAdapter mAdapterActive;
+ private AgingAppsListAdapter mAdapterIdle;
+
+ private boolean mIsKeyboardShowing = false;
+ private boolean mActive = false;
+ private boolean mAnimating = false;
+
+ public boolean isActive() {
+ return mActive;
+ }
+
+ public AppSearchResultsHelper(AppDrawerView drawerView, Launcher launcher) {
+ mDrawerView = drawerView;
+ mSearchView = (SearchView) mDrawerView.findViewById(R.id.searchView);
+ mLauncher = launcher;
+
+ init();
+ setupSearchView();
+ }
+
+ private void init() {
+ Pair<ArrayList<AppInfo>, ArrayList<AppInfo>> appLists = AppDiscoverer.getInstance().getUsedAndUnusedApps(mLauncher.getApplicationContext());
+ mActiveApps = new ArrayList<>();
+ mIdleApps = new ArrayList<>();
+ mActiveApps.addAll(appLists.first);
+ mIdleApps.addAll(appLists.second);
+
+ ExpandedGridview allAppsGridview = (ExpandedGridview) mDrawerView.findViewById(R.id.usedAppsGridView);
+ ExpandedGridview idleAppsGridview = (ExpandedGridview) mDrawerView.findViewById(R.id.unusedAppsGridView);
+
+ mAdapterActive = new AgingAppsListAdapter(mLauncher.getApplicationContext(), mLauncher, mDrawerView, false);
+ mAdapterActive.setAllApps(mActiveApps);
+
+ mAdapterIdle = new AgingAppsListAdapter(mLauncher.getApplicationContext(), mLauncher, mDrawerView, true);
+ mAdapterIdle.setAllApps(mIdleApps);
+
+ checkSearchResultSizes(mActiveApps, mIdleApps);
+
+ allAppsGridview.setAdapter(mAdapterActive);
+ allAppsGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
+ AppInfo appInfo = (AppInfo) adapterView.getItemAtPosition(position);
+ startNewActivity(mLauncher.getApplicationContext(), appInfo.getComponentName().getPackageName());
+ }
+ });
+
+ idleAppsGridview.setAdapter(mAdapterIdle);
+ idleAppsGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
+ AppInfo appInfo = (AppInfo) adapterView.getItemAtPosition(position);
+ startNewActivity(mLauncher.getApplicationContext(), appInfo.getComponentName().getPackageName());
+ }
+ });
+ }
+
+ private void startNewActivity(Context context, String packageName) {
+ Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(intent);
+ }
+
+ private void setupSearchView() {
+ mSearchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ if (!mIsKeyboardShowing) {
+ showKeyboard(v);
+ } else {
+ mIsKeyboardShowing = true;
+ }
+ } else if (mIsKeyboardShowing) {
+ hideKeyboard();
+ }
+ }
+ });
+ mSearchView.setIconifiedByDefault(false);
+
+ colorSearchArea();
+
+ mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
+ @Override
+ public boolean onQueryTextSubmit(String query) {
+ executeQuery(query);
+ hideKeyboard();
+ return true;
+ }
+
+ @Override
+ public boolean onQueryTextChange(String newText) {
+ executeQuery(newText);
+ return true;
+ }
+ });
+ }
+
+ private void showKeyboard(View v) {
+ InputMethodManager imm = (InputMethodManager) mLauncher.getSystemService(Context.INPUT_METHOD_SERVICE);
+ if (imm != null) {
+ boolean success = false;
+ if (v != null) {
+ View focused = v.findFocus();
+ success = imm.showSoftInput(focused, InputMethodManager.SHOW_FORCED, new ResultReceiver(focused.getHandler()) {
+ @Override
+ protected void onReceiveResult(int resultCode, Bundle resultData) {
+ super.onReceiveResult(resultCode, resultData);
+ mIsKeyboardShowing = (resultCode == InputMethodManager.RESULT_UNCHANGED_SHOWN) || (resultCode == InputMethodManager.RESULT_SHOWN);
+ }
+ });
+ } else {
+ Log.d(TAG, "showKeyboard: no focused view");
+ }
+ if (!success) {
+ imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);
+ mIsKeyboardShowing = true;
+ }
+ } else {
+ Log.d(TAG, "showKeyboard: no soft input service");
+ }
+ }
+
+ protected void hideKeyboard() {
+ InputMethodManager imm = (InputMethodManager) mLauncher.getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(mSearchView.getApplicationWindowToken(), 0);
+ mIsKeyboardShowing = false;
+ mSearchView.clearFocus();
+ mDrawerView.findViewById(R.id.agingDrawerScroll).requestFocusFromTouch();
+ }
+
+ public void smartHide() {
+ if (mActive && !mAnimating) {
+ if (mIsKeyboardShowing) {
+ hideKeyboard();
+ } else if (!TextUtils.isEmpty(mSearchView.getQuery())) {
+ mSearchView.setQuery("", false);
+ } else {
+ hideSearchView();
+ }
+ }
+ }
+
+ public void showSearchView() {
+ if (!mAnimating) {
+ mAnimating = true;
+
+ // otherwise it may crash
+ View focused = mLauncher.getCurrentFocus();
+ if (focused != null) {
+ focused.clearFocus();
+ }
+
+ View agingAppsMenuIcon = mDrawerView.findViewById(R.id.aging_drawer_menu_btn);
+ View searchButton = mDrawerView.findViewById(R.id.all_apps_search_btn);
+
+ //Open the searchview bar
+ Animation fadeOut = AnimationUtils.loadAnimation(mLauncher.getApplicationContext(), R.anim.fade_out_fast);
+ fadeOut.setFillAfter(true);
+ searchButton.startAnimation(fadeOut);
+ agingAppsMenuIcon.startAnimation(fadeOut);
+
+ mDrawerView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ mSearchView.setVisibility(View.VISIBLE);
+ mSearchView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ Animation searchAppear = AnimationUtils.loadAnimation(mLauncher.getApplicationContext(), R.anim.search_appear);
+ searchAppear.setAnimationListener(new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ mSearchView.setLayerType(View.LAYER_TYPE_NONE, null);
+ mDrawerView.setLayerType(View.LAYER_TYPE_NONE, null);
+ mAnimating = false;
+ mActive = true;
+ mSearchView.requestFocusFromTouch();
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+ });
+ mSearchView.startAnimation(searchAppear);
+ }
+ }
+
+ private void hideSearchView() {
+ if (!mAnimating) {
+ mAnimating = true;
+ mDrawerView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ mSearchView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+
+ // otherwise it may crash
+ View focused = mLauncher.getCurrentFocus();
+ if (focused != null) {
+ focused.clearFocus();
+ }
+
+ Animation searchVanish = AnimationUtils.loadAnimation(mLauncher.getApplicationContext(), R.anim.search_vanish);
+ searchVanish.setAnimationListener(new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ mSearchView.setLayerType(View.LAYER_TYPE_NONE, null);
+ mSearchView.setVisibility(View.GONE);
+
+ View scrollView = mDrawerView.findViewById(R.id.agingDrawerScroll);
+ scrollView.scrollTo(0, 0);
+
+ Animation fadeOut = AnimationUtils.loadAnimation(mLauncher.getApplicationContext(), R.anim.fade_in_slow);
+ fadeOut.setFillAfter(true);
+ fadeOut.setAnimationListener(new Animation.AnimationListener() {
+ @Override
+ public void onAnimationStart(Animation animation) {
+
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ mDrawerView.setLayerType(View.LAYER_TYPE_NONE, null);
+ mActive = false;
+ mAnimating = false;
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+ });
+ View agingAppsMenuIcon = mDrawerView.findViewById(R.id.aging_drawer_menu_btn);
+ View searchButton = mDrawerView.findViewById(R.id.all_apps_search_btn);
+ agingAppsMenuIcon.startAnimation(fadeOut);
+ searchButton.startAnimation(fadeOut);
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+
+ }
+ });
+
+
+ mSearchView.startAnimation(searchVanish);
+ }
+ }
+
+ private void colorSearchArea() {
+ mSearchView.setBackgroundColor(Color.WHITE);
+ int searchAreaId = mSearchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
+ TextView textView = (TextView) mSearchView.findViewById(searchAreaId);
+ textView.setTextColor(mLauncher.getResources().getColor(R.color.blue));
+ textView.setHintTextColor(mLauncher.getResources().getColor(R.color.blue_alpha_50));
+ textView.setBackgroundColor(Color.WHITE);
+ int searchGlassId = mLauncher.getResources().getIdentifier("android:id/search_mag_icon", null, null);
+ ImageView searchGlassIcon = (ImageView) mSearchView.findViewById(searchGlassId);
+ if (searchGlassIcon != null) {
+ searchGlassIcon.setScaleType(ImageView.ScaleType.CENTER);
+ searchGlassIcon.setColorFilter(Color.rgb(42, 168, 224));
+ searchGlassIcon.setImageResource(R.drawable.ic_all_apps_search);
+ }
+ int closeId = mLauncher.getResources().getIdentifier("android:id/search_close_btn", null, null);
+ ImageView closeBtn = (ImageView) mSearchView.findViewById(closeId);
+ if (closeBtn != null) {
+ closeBtn.setColorFilter(mLauncher.getResources().getColor(R.color.blue));
+ closeBtn.setBackgroundColor(Color.WHITE);
+ }
+ int searchPlateId = mLauncher.getResources().getIdentifier("android:id/search_plate", null, null);
+ LinearLayout searchPlateIcon = (LinearLayout) mSearchView.findViewById(searchPlateId);
+ if (searchPlateIcon != null)
+ searchPlateIcon.setBackgroundColor(mLauncher.getResources().getColor(R.color.blue));
+
+ }
+
+
+ private void executeQuery(String query) {
+
+ ArrayList<AppInfo> searchResultsActive = new ArrayList<>();
+ ArrayList<AppInfo> searchResultsIdle = new ArrayList<>();
+ for (AppInfo appInfo : mActiveApps) {
+ String app = appInfo.getApplicationTitle();
+ if (app.toLowerCase().startsWith(query.toLowerCase())) {
+ searchResultsActive.add(appInfo);
+ }
+ }
+ for (AppInfo appInfo : mIdleApps) {
+ String app = appInfo.getApplicationTitle();
+ if (app.toLowerCase().startsWith(query.toLowerCase())) {
+ searchResultsIdle.add(appInfo);
+ }
+ }
+
+ checkSearchResultSizes(searchResultsActive, searchResultsIdle);
+
+ mAdapterActive.setAllApps(searchResultsActive);
+ mAdapterActive.notifyDataSetChanged();
+ mAdapterIdle.setAllApps(searchResultsIdle);
+ mAdapterIdle.notifyDataSetChanged();
+ }
+
+ private void checkSearchResultSizes(ArrayList<AppInfo> activeApps, ArrayList<AppInfo> idleApps) {
+ if (activeApps.size() == 0) {
+ TextView activeAppsDescription = (TextView) mDrawerView.findViewById(R.id.activeAppsDescription);
+ activeAppsDescription.setText(R.string.no_active_app_found);
+ activeAppsDescription.setVisibility(View.VISIBLE);
+ } else {
+ TextView activeAppsDescription = (TextView) mDrawerView.findViewById(R.id.activeAppsDescription);
+ activeAppsDescription.setVisibility(View.GONE);
+ }
+
+ if (idleApps.size() == 0) {
+ TextView activeAppsDescription = (TextView) mDrawerView.findViewById(R.id.unusedAppsDescription);
+ activeAppsDescription.setText(R.string.no_idle_app_found);
+ activeAppsDescription.setVisibility(View.VISIBLE);
+ } else {
+ TextView activeAppsDescription = (TextView) mDrawerView.findViewById(R.id.unusedAppsDescription);
+ activeAppsDescription.setVisibility(View.GONE);
+ }
+ }
+
+
+}
diff --git a/src/com/fairphone/fplauncher3/edgeswipe/editor/AllAppsListAdapter.java b/src/com/fairphone/fplauncher3/edgeswipe/editor/AllAppsListAdapter.java
index 23ccd2c..59077b9 100644
--- a/src/com/fairphone/fplauncher3/edgeswipe/editor/AllAppsListAdapter.java
+++ b/src/com/fairphone/fplauncher3/edgeswipe/editor/AllAppsListAdapter.java
@@ -22,6 +22,7 @@
import android.app.Activity;
import android.content.res.Resources;
+import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
@@ -96,4 +97,5 @@
{
return position;
}
+
}
diff --git a/src/com/fairphone/fplauncher3/widgets/appswitcher/ApplicationRunInformation.java b/src/com/fairphone/fplauncher3/widgets/appswitcher/ApplicationRunInformation.java
index ddf6dfd..264d0ce 100644
--- a/src/com/fairphone/fplauncher3/widgets/appswitcher/ApplicationRunInformation.java
+++ b/src/com/fairphone/fplauncher3/widgets/appswitcher/ApplicationRunInformation.java
@@ -328,7 +328,7 @@
}
public static int getAppIdleLimitInDays(Context context){
- int frequentUseDays = context.getResources().getInteger(R.integer.app_frequent_use_one_month);
+ int frequentUseDays = context.getResources().getInteger(R.integer.app_frequent_use_default);
SharedPreferences sharedPreferences = context.getSharedPreferences(AppDrawerView.APP_LIFECYCLE_PREFERENCES, Activity.MODE_PRIVATE);
return sharedPreferences.getInt(AppDrawerView.APP_AGE_LIMIT_IN_DAYS, frequentUseDays);
}