diff --git a/.idea/libraries/android_android_24.xml b/.idea/libraries/android_android_24.xml
deleted file mode 100644
index 48a5e9834..000000000
--- a/.idea/libraries/android_android_24.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/recyclerview_v7_23_1_1.xml b/.idea/libraries/recyclerview_v7_23_1_1.xml
deleted file mode 100644
index 3cea20a58..000000000
--- a/.idea/libraries/recyclerview_v7_23_1_1.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/recyclerview_v7_25_3_1.xml b/.idea/libraries/recyclerview_v7_25_3_1.xml
new file mode 100644
index 000000000..7e7e739d3
--- /dev/null
+++ b/.idea/libraries/recyclerview_v7_25_3_1.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_annotations_23_1_1.xml b/.idea/libraries/support_annotations_23_1_1.xml
deleted file mode 100644
index 4d3a81e01..000000000
--- a/.idea/libraries/support_annotations_23_1_1.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/support_annotations_25_3_1.xml b/.idea/libraries/support_annotations_25_3_1.xml
new file mode 100644
index 000000000..b36c738f1
--- /dev/null
+++ b/.idea/libraries/support_annotations_25_3_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_compat_25_3_1.xml b/.idea/libraries/support_compat_25_3_1.xml
new file mode 100644
index 000000000..01029738b
--- /dev/null
+++ b/.idea/libraries/support_compat_25_3_1.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_core_ui_25_3_1.xml b/.idea/libraries/support_core_ui_25_3_1.xml
new file mode 100644
index 000000000..914cfdeba
--- /dev/null
+++ b/.idea/libraries/support_core_ui_25_3_1.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_core_utils_25_3_1.xml b/.idea/libraries/support_core_utils_25_3_1.xml
new file mode 100644
index 000000000..520e3a366
--- /dev/null
+++ b/.idea/libraries/support_core_utils_25_3_1.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_fragment_25_3_1.xml b/.idea/libraries/support_fragment_25_3_1.xml
new file mode 100644
index 000000000..96ce3589c
--- /dev/null
+++ b/.idea/libraries/support_fragment_25_3_1.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_media_compat_25_3_1.xml b/.idea/libraries/support_media_compat_25_3_1.xml
new file mode 100644
index 000000000..2a14aaf71
--- /dev/null
+++ b/.idea/libraries/support_media_compat_25_3_1.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_23_1_1.xml b/.idea/libraries/support_v4_23_1_1.xml
deleted file mode 100644
index bc1f64a70..000000000
--- a/.idea/libraries/support_v4_23_1_1.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_25_3_1.xml b/.idea/libraries/support_v4_25_3_1.xml
new file mode 100644
index 000000000..81e47aaa9
--- /dev/null
+++ b/.idea/libraries/support_v4_25_3_1.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d6011e2cc..290b33b98 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -155,6 +155,12 @@
+
+
+
+
+
+
-
@@ -47,7 +46,6 @@
-
@@ -55,7 +53,6 @@
-
@@ -65,37 +62,29 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
@@ -107,12 +96,16 @@
-
+
-
-
-
+
+
+
+
+
+
+
+
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 13ec2bbdf..a44ed5c59 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.0'
}
}
@@ -12,15 +12,15 @@ apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
android {
- compileSdkVersion 24
- buildToolsVersion "24.0.3"
+ compileSdkVersion 25
+ buildToolsVersion "25.0.3"
defaultConfig {
applicationId "io.github.runassudo.flauncher"
minSdkVersion 16
- targetSdkVersion 23
- versionCode 5
- versionName "0.1.4"
+ targetSdkVersion 25
+ versionCode 6
+ versionName "0.1.5"
}
buildTypes {
debug {
@@ -46,8 +46,8 @@ repositories {
}
dependencies {
- compile 'com.android.support:support-v4:23.1.1'
- compile 'com.android.support:recyclerview-v7:23.1.1'
+ compile 'com.android.support:support-v4:25.3.1'
+ compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5'
}
diff --git a/src/io/github/runassudo/flauncher/BadgeIconReceiver.java b/src/io/github/runassudo/flauncher/BadgeIconReceiver.java
new file mode 100644
index 000000000..b4ebd90e3
--- /dev/null
+++ b/src/io/github/runassudo/flauncher/BadgeIconReceiver.java
@@ -0,0 +1,60 @@
+package io.github.runassudo.flauncher;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.util.Log;
+
+import io.github.runassudo.flauncher.compat.UserHandleCompat;
+
+import java.util.HashSet;
+
+public class BadgeIconReceiver extends BroadcastReceiver {
+
+ private static final String BADGE_ICON_EXTRA_BADGE_COUNT = "badge_count";
+ private static final String BADGE_ICON_EXTRA_PACKAGENAME = "badge_count_package_name";
+ private static final String BADGE_ICON_EXTRA_ACTIVITY_NAME = "badge_count_class_name";
+ private static final String TAG = "BadgeIconReceiver";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+
+ //Toast.makeText(context, "badge icon update", Toast.LENGTH_SHORT).show();
+ Log.d(TAG, "badge icon update");
+
+ if ( intent != null ) {
+ Bundle extras = intent.getExtras();
+
+ if (extras != null) {
+
+ int count = extras.getInt(BADGE_ICON_EXTRA_BADGE_COUNT);
+ String pkg = extras.getString(BADGE_ICON_EXTRA_PACKAGENAME);
+
+ //Log.d(TAG, "count:" + String.valueOf(count));
+ //Log.d(TAG, "package:" + pkg);
+ //Log.d(TAG, "activity:" + extras.getString(BADGE_ICON_EXTRA_ACTIVITY_NAME));
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putInt(pkg, count);
+ editor.commit();
+
+ UserHandleCompat myUserHandle = UserHandleCompat.myUserHandle();
+
+ if ( LauncherAppState.getInstance() != null && LauncherAppState.getInstance().getModel() != null) {
+ LauncherAppState.getInstance().getModel().mIconCache.updateDbIcons(null);
+ LauncherAppState.getInstance().getModel().mIconCache.updateIconsForPkg(pkg, myUserHandle);
+
+ HashSet h = new HashSet<>();
+ h.add(pkg);
+ LauncherAppState.getInstance().getModel().onPackageIconsUpdated(h, myUserHandle);
+ }
+
+ }
+ }
+ }
+}
+
diff --git a/src/io/github/runassudo/flauncher/IconCache.java b/src/io/github/runassudo/flauncher/IconCache.java
index 519bb6bc6..d992798f2 100644
--- a/src/io/github/runassudo/flauncher/IconCache.java
+++ b/src/io/github/runassudo/flauncher/IconCache.java
@@ -20,6 +20,7 @@
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
@@ -35,9 +36,11 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
+import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.SystemClock;
+import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
@@ -391,6 +394,64 @@ private void addIconToDB(ContentValues values, ComponentName key,
entry.icon = Utilities.createBadgedIconBitmap(
app.getIcon(mIconDpi), app.getUser(), mContext);
}
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////
+ // Added 28/07/2017
+ // to support BadgeIconReceiver
+ //////////////////////////////////////////////////////////////////////////////////////////
+ //Log.d(TAG, "badge icon Reading package:" + app.getComponentName().getPackageName());
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
+ int count = prefs.getInt(app.getComponentName().getPackageName(), 0);
+ //Log.d(TAG, "badge icon Reading_value: " + String.valueOf(count));
+
+ if ( count > 0 ) {
+ Log.d(TAG, "updating badge icon for package " + app.getComponentName().getPackageName() + " set value:" + String.valueOf(count));
+ String gText = String.valueOf(count);
+
+ Canvas canvas = new Canvas(entry.icon);
+
+ Paint mBadgePaint;
+ Paint mBadgePaint1;
+ Paint mTextPaint;
+ Rect mTxtRect = new Rect();
+
+ float mTextSize = mContext.getResources().getDimension(R.dimen.drop_target_text_size);
+
+ mBadgePaint = new Paint();
+ mBadgePaint.setColor(Color.RED);
+ mBadgePaint.setAntiAlias(true);
+ mBadgePaint.setStyle(Paint.Style.FILL);
+ mBadgePaint1 = new Paint();
+ mBadgePaint1.setColor(Color.GRAY);
+ mBadgePaint1.setAntiAlias(true);
+ mBadgePaint1.setStyle(Paint.Style.FILL);
+
+ mTextPaint = new Paint();
+ mTextPaint.setColor(Color.WHITE);
+ mTextPaint.setTypeface(Typeface.DEFAULT);
+ mTextPaint.setTextSize(mTextSize);
+ mTextPaint.setAntiAlias(true);
+ mTextPaint.setTextAlign(Paint.Align.CENTER);
+
+ float width = entry.icon.getWidth();
+ float radius = (width / 100) * 20;
+ float centerX = (width - radius - 3);
+ float centerY = radius + 2;
+ if(gText.length() <= 2) {
+ canvas.drawCircle(centerX, centerY, (int)(radius+1), mBadgePaint1);
+ canvas.drawCircle(centerX, centerY, (int)(radius), mBadgePaint);
+ } else{
+ canvas.drawCircle(centerX, centerY, (int)(radius+3), mBadgePaint1);
+ canvas.drawCircle(centerX, centerY, (int)(radius+2), mBadgePaint);
+ }
+ mTextPaint.getTextBounds(gText, 0, gText.length(), mTxtRect);
+ float textHeight = mTxtRect.bottom - mTxtRect.top;
+ float textY = centerY + (textHeight / 2f);
+ canvas.drawText(gText, centerX, textY, mTextPaint);
+ }
+ //////////////////////////////////////////////////////////////////////////////////////////
+
entry.title = app.getLabel();
entry.contentDescription = mUserManager.getBadgedLabelForUser(entry.title, app.getUser());
mCache.put(new ComponentKey(app.getComponentName(), app.getUser()), entry);