Commit 869ceb94 authored by Amit Kumar's avatar Amit Kumar
Browse files

Fix major issues and improvement

parent 0726e13e
......@@ -6,10 +6,6 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk
android:minSdkVersion="22"
android:targetSdkVersion="26"/>
<application
android:name=".BlissLauncher"
android:allowBackup="true"
......
......@@ -69,6 +69,15 @@ public class DeviceProfile {
public int iconDrawablePaddingPx;
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
public int uninstallIconSizePx;
public int uninstallIconPadding;
......@@ -216,9 +225,18 @@ public class DeviceProfile {
: tempUninstallIconSize;
uninstallIconPadding = iconSizePx * 10 / 192;
Log.i(TAG, "iconDrawablePadding: " + iconDrawablePaddingPx / 2);
Log.i(TAG, "uninstallSIze: " + uninstallIconSizePx);
Log.i(TAG, "uninstallSIzePadding: " + uninstallIconPadding);
calendarIconWidth = iconSizePx;
monthTextviewHeight = iconSizePx * 40 / 192;
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)
+ Utilities.calculateTextHeight(iconTextSizePx);
......
......@@ -10,13 +10,18 @@ import android.view.View;
public class BlissDragShadowBuilder extends View.DragShadowBuilder {
private final int mX;
private final int mY;
private Point mScaleFactor;
// Defines the constructor for myDragShadowBuilder
public BlissDragShadowBuilder(View v) {
public BlissDragShadowBuilder(View v, float x, float y) {
// Stores the View parameter passed to myDragShadowBuilder.
super(v);
mX = (int) x;
mY = (int) y;
}
// 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 {
int height;
// 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
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
// through the size parameter.
......@@ -40,7 +45,7 @@ public class BlissDragShadowBuilder extends View.DragShadowBuilder {
mScaleFactor = size;
// 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
......
......@@ -261,10 +261,20 @@ public class AppUtil {
isAdaptive = true;
appIcon = new AdaptiveIconProvider().load(context, packageName);
if (appIcon == null) {
Drawable iconDrawable = appInfo.loadIcon(packageManager);
/*GraphicsUtil graphicsUtil = new GraphicsUtil(context);
appIcon = graphicsUtil.convertToRoundedCorner(context,
graphicsUtil.addBackground(appInfo.loadIcon(packageManager),
false));*/
graphicsUtil.addBackground(iconDrawable, 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 {
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) {
if (!ImageUtils.hasTransparency(bitmap)) {
......
......@@ -147,11 +147,10 @@ public class IconPackUtil {
* first character of the app label
*/
public static Drawable getIconBackground(Context context, char firstCharacter) {
if (Character.toLowerCase(firstCharacter) % 2 == 0) {
return iconBackground1;
} else {
return iconBackground2;
if (iconBackground1 == null) {
iconBackground1 = ContextCompat.getDrawable(context, R.drawable.iconback_d);
}
return iconBackground1;
}
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"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<corners android:radius="10dp"/>
</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="180.0"
android:viewportWidth="180.0">
<path
android:fillColor="#FFFFFFFF"
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"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#444444" />
<corners android:radius="10dp"/>
</shape>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="180dp"
android:height="180dp"
android:viewportHeight="180.0"
android:viewportWidth="180.0">
<path
android:fillColor="#444444"
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>
......@@ -20,7 +20,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:gravity="center_horizontal"
android:id="@+id/calendar_date_textview"
android:textColor="#000"
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