Commit b6bd923a authored by Amit Kumar's avatar Amit Kumar
Browse files

Fixes #1, fixes #2, fixes #3, fixes #4, fixes #5 and fixes #6

parent 0726e13e
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk
android:minSdkVersion="22"
android:targetSdkVersion="26"/>
<application <application
android:name=".BlissLauncher" android:name=".BlissLauncher"
android:allowBackup="true" android:allowBackup="true"
......
...@@ -69,6 +69,15 @@ public class DeviceProfile { ...@@ -69,6 +69,15 @@ public class DeviceProfile {
public int iconDrawablePaddingPx; public int iconDrawablePaddingPx;
public int iconDrawablePaddingOriginalPx; public int iconDrawablePaddingOriginalPx;
// Calendar icon
public int dateTextSize;
public int monthTextSize;
public int dateTextviewHeight;
public int monthTextviewHeight;
public int calendarIconWidth;
public int dateTextBottomPadding;
public int dateTextTopPadding;
//Uninstall icon //Uninstall icon
public int uninstallIconSizePx; public int uninstallIconSizePx;
public int uninstallIconPadding; public int uninstallIconPadding;
...@@ -216,9 +225,18 @@ public class DeviceProfile { ...@@ -216,9 +225,18 @@ public class DeviceProfile {
: tempUninstallIconSize; : tempUninstallIconSize;
uninstallIconPadding = iconSizePx * 10 / 192; uninstallIconPadding = iconSizePx * 10 / 192;
Log.i(TAG, "iconDrawablePadding: " + iconDrawablePaddingPx / 2); calendarIconWidth = iconSizePx;
Log.i(TAG, "uninstallSIze: " + uninstallIconSizePx); monthTextviewHeight = iconSizePx * 40 / 192;
Log.i(TAG, "uninstallSIzePadding: " + uninstallIconPadding); monthTextSize = iconSizePx * 48 / 192;
dateTextviewHeight = iconSizePx * 152 / 192;
dateTextSize = iconSizePx * 154 / 192;
dateTextTopPadding = (dateTextviewHeight - (int) (1.14 * Utilities.calculateTextHeight(
dateTextSize / 2))) / 2;
dateTextBottomPadding = (dateTextviewHeight - (int) (0.86 * Utilities.calculateTextHeight(
dateTextSize / 2))) / 2;
Log.i(TAG, "datepadding: " + dateTextTopPadding + "*" + dateTextBottomPadding);
cellHeightWithoutPaddingPx = iconSizePx + Utilities.pxFromDp(4, dm) cellHeightWithoutPaddingPx = iconSizePx + Utilities.pxFromDp(4, dm)
+ Utilities.calculateTextHeight(iconTextSizePx); + Utilities.calculateTextHeight(iconTextSizePx);
......
...@@ -10,13 +10,18 @@ import android.view.View; ...@@ -10,13 +10,18 @@ import android.view.View;
public class BlissDragShadowBuilder extends View.DragShadowBuilder { public class BlissDragShadowBuilder extends View.DragShadowBuilder {
private final int mX;
private final int mY;
private Point mScaleFactor; private Point mScaleFactor;
// Defines the constructor for myDragShadowBuilder // Defines the constructor for myDragShadowBuilder
public BlissDragShadowBuilder(View v) { public BlissDragShadowBuilder(View v, float x, float y) {
// Stores the View parameter passed to myDragShadowBuilder. // Stores the View parameter passed to myDragShadowBuilder.
super(v); super(v);
mX = (int) x;
mY = (int) y;
} }
// Defines a callback that sends the drag shadow dimensions and touch point back to the // Defines a callback that sends the drag shadow dimensions and touch point back to the
...@@ -28,10 +33,10 @@ public class BlissDragShadowBuilder extends View.DragShadowBuilder { ...@@ -28,10 +33,10 @@ public class BlissDragShadowBuilder extends View.DragShadowBuilder {
int height; int height;
// Sets the width of the shadow to half the width of the original View // Sets the width of the shadow to half the width of the original View
width = (int) (getView().getWidth() * 1.2); width = (int) (getView().getWidth() * 1);
// Sets the height of the shadow to half the height of the original View // Sets the height of the shadow to half the height of the original View
height = (int) (getView().getHeight() * 1.2); height = (int) (getView().getHeight() * 1);
// Sets the size parameter's width and height values. These get back to the system // Sets the size parameter's width and height values. These get back to the system
// through the size parameter. // through the size parameter.
...@@ -40,7 +45,7 @@ public class BlissDragShadowBuilder extends View.DragShadowBuilder { ...@@ -40,7 +45,7 @@ public class BlissDragShadowBuilder extends View.DragShadowBuilder {
mScaleFactor = size; mScaleFactor = size;
// Sets the touch point's position to be in the middle of the drag shadow // Sets the touch point's position to be in the middle of the drag shadow
touch.set(width/2, height/2); touch.set(mX, mY);
} }
@Override @Override
......
...@@ -261,10 +261,20 @@ public class AppUtil { ...@@ -261,10 +261,20 @@ public class AppUtil {
isAdaptive = true; isAdaptive = true;
appIcon = new AdaptiveIconProvider().load(context, packageName); appIcon = new AdaptiveIconProvider().load(context, packageName);
if (appIcon == null) { if (appIcon == null) {
Drawable iconDrawable = appInfo.loadIcon(packageManager);
/*GraphicsUtil graphicsUtil = new GraphicsUtil(context); /*GraphicsUtil graphicsUtil = new GraphicsUtil(context);
appIcon = graphicsUtil.convertToRoundedCorner(context, appIcon = graphicsUtil.convertToRoundedCorner(context,
graphicsUtil.addBackground(appInfo.loadIcon(packageManager), graphicsUtil.addBackground(iconDrawable, false));*/
false));*/ if (Utilities.ATLEAST_OREO
&& iconDrawable instanceof AdaptiveIconDrawable) {
appIcon = new AdaptiveIconDrawableCompat(
((AdaptiveIconDrawable) iconDrawable).getBackground(),
((AdaptiveIconDrawable) iconDrawable).getForeground());
} else {
GraphicsUtil graphicsUtil = new GraphicsUtil(context);
appIcon = graphicsUtil.convertToRoundedCorner(context,
graphicsUtil.addBackground(iconDrawable, false));
}
} }
} }
......
...@@ -101,46 +101,6 @@ public class GraphicsUtil { ...@@ -101,46 +101,6 @@ public class GraphicsUtil {
return image; return image;
} }
public Drawable maskImage(Context context, Drawable image) {
if ((image == null) || !(image instanceof BitmapDrawable)) {
return image;
}
double scale = 1;
Drawable maskDrawable;
if (IconPackUtil.getIconMask() != null) {
maskDrawable = IconPackUtil.getIconMask();
} else {
maskDrawable = ContextCompat.getDrawable(context, R.drawable.iconmask);
}
Bitmap orig_mask = ((BitmapDrawable) maskDrawable).getBitmap();
Bitmap mask = Bitmap.createScaledBitmap(orig_mask,
image.getIntrinsicWidth(),
image.getIntrinsicHeight(), true);
Log.i(TAG, "maskImage: " + mask.getHeight() + "*" + mask.getWidth());
Bitmap original = ((BitmapDrawable) image).getBitmap();
Bitmap bmp = original.copy(Bitmap.Config.RGB_565, true);
Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
Paint paint = new Paint(
Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG | Paint.FILTER_BITMAP_FLAG);
paint.setColor(0XFF000000);
RectF rectf = new RectF(0, 0, mask.getWidth(), mask.getHeight());
int rx = (int) ConverterUtil.dp2Px(10, context);
canvas.drawRoundRect(rectf, rx, rx, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
/*Shader shader = new BitmapShader(original, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
paint.setShader(shader);*/
canvas.drawBitmap(original, 0, 0, paint);
return new BitmapDrawable(context.getResources(), result);
}
public Bitmap addBackground(Bitmap bitmap, boolean isFolder) { public Bitmap addBackground(Bitmap bitmap, boolean isFolder) {
if (!ImageUtils.hasTransparency(bitmap)) { if (!ImageUtils.hasTransparency(bitmap)) {
......
...@@ -147,11 +147,10 @@ public class IconPackUtil { ...@@ -147,11 +147,10 @@ public class IconPackUtil {
* first character of the app label * first character of the app label
*/ */
public static Drawable getIconBackground(Context context, char firstCharacter) { public static Drawable getIconBackground(Context context, char firstCharacter) {
if (Character.toLowerCase(firstCharacter) % 2 == 0) { if (iconBackground1 == null) {
return iconBackground1; iconBackground1 = ContextCompat.getDrawable(context, R.drawable.iconback_d);
} else {
return iconBackground2;
} }
return iconBackground1;
} }
public static Bitmap getWallpaper() { public static Bitmap getWallpaper() {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp"/>
<solid android:color="#FF0800"/>
</shape>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:viewportHeight="240.0"
android:viewportWidth="240.0">
<path
android:fillColor="#FF000000"
android:pathData="M142,180H38c-21,0 -38,-17 -38,-38V38C0,17 17,0 38,0h104c21,0 38,17 38,38v104C180,163 163,180 142,180z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="192.0"
android:viewportWidth="192.0">
<path
android:fillColor="#FF000000"
android:pathData="M50,0L70,0 A30,30,0,0 1 100,30 L100,70 A30,30,0,0 1 70,100 L30,100 A30,30,0,0 1 0,70 L 0,30 A30,30,0,0 1 30,0z" />
</vector>
<?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android"
<shape android:width="18dp"
xmlns:android="http://schemas.android.com/apk/res/android" android:height="18dp"
android:shape="rectangle"> android:viewportHeight="180.0"
<solid android:color="#ffffff" /> android:viewportWidth="180.0">
<corners android:radius="10dp"/> <path
</shape> android:fillColor="#FFFFFFFF"
\ No newline at end of file android:pathData="M142,180H38c-21,0 -38,-17 -38,-38V38C0,17 17,0 38,0h104c21,0 38,17 38,38v104C180,163 163,180 142,180z" />
</vector>
<?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android"
<shape android:width="180dp"
xmlns:android="http://schemas.android.com/apk/res/android" android:height="180dp"
android:shape="rectangle"> android:viewportHeight="180.0"
android:viewportWidth="180.0">
<solid android:color="#444444" /> <path
android:fillColor="#444444"
<corners android:radius="10dp"/> android:pathData="M142,180H38c-21,0 -38,-17 -38,-38V38C0,17 17,0 38,0h104c21,0 38,17 38,38v104C180,163 163,180 142,180z" />
</vector>
</shape>
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center_horizontal"
android:id="@+id/calendar_date_textview" android:id="@+id/calendar_date_textview"
android:textColor="#000" android:textColor="#000"
fontPath="Roboto-Regular.ttf" fontPath="Roboto-Regular.ttf"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment