Loading app/src/main/java/org/indin/blisslaunchero/DesktopActivity.java +73 −93 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ public class DesktopActivity extends AppCompatActivity { private Drawable hotBackground; private Drawable defaultBackground; private Drawable transparentBackground; private int iconSize; private boolean dragDropEnabled = true; private boolean minimumWidthDetermined = false; Loading @@ -112,6 +112,9 @@ public class DesktopActivity extends AppCompatActivity { private int screenHeight; private int mWidthPixels; private int mHeightPixels; private int iconHeight; private int iconWidth; private int folderIconWidth; @Override protected void onCreate(Bundle savedInstanceState) { Loading @@ -138,6 +141,8 @@ public class DesktopActivity extends AppCompatActivity { storage = new Storage(getApplicationContext()); prepareBroadcastReceivers(); pager.getViewTreeObserver().addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() { @Override Loading @@ -154,6 +159,7 @@ public class DesktopActivity extends AppCompatActivity { } }); } /** Loading Loading @@ -196,7 +202,6 @@ public class DesktopActivity extends AppCompatActivity { @Override protected void onStart() { super.onStart(); prepareBroadcastReceivers(); } @Override Loading @@ -212,6 +217,11 @@ public class DesktopActivity extends AppCompatActivity { @Override protected void onStop() { super.onStop(); } @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(installReceiver); unregisterReceiver(uninstallReceiver); } Loading Loading @@ -304,8 +314,14 @@ public class DesktopActivity extends AppCompatActivity { maxAppsPerPage = nRows * nCols; screenWidth = Resources.getSystem().getDisplayMetrics().widthPixels; iconHeight = (screenHeight) / nRows; iconWidth = (screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / nCols; folderIconWidth = (screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / 5; maxDistanceForFolderCreation = getResources() .getDimensionPixelSize(R.dimen.maxDistanceForFolderCreation) * screenWidth / 480; .getDimensionPixelSize(R.dimen.maxDistanceForFolderCreation) * screenWidth / 540; hotBackground = getResources().getDrawable(R.drawable.rounded_corners_icon_hot, null); defaultBackground = getResources().getDrawable(R.drawable.rounded_corners_icon, null); Loading Loading @@ -525,7 +541,7 @@ public class DesktopActivity extends AppCompatActivity { dock.setEnabled(true); return; } nPages = (int) Math.ceil((float) launchableApps.size() / (float) maxAppsPerPage); nPages = (int) Math.ceil((float) launchableApps.size() / maxAppsPerPage); Log.i(TAG, "createUI: npages: " + nPages + ", max: " + maxAppsPerPage); pages = new ArrayList<>(); for (int i = 0; i < nPages; i++) { Loading Loading @@ -557,47 +573,6 @@ public class DesktopActivity extends AppCompatActivity { } /*private void fixMinimumGridWidth() { AsyncTask.execute(new Runnable() { @Override public void run() { try { Thread.sleep(2000); runOnUiThread(new Runnable() { @Override public void run() { _fixMinimumGridWidth(); } }); } catch (Exception e) { e.printStackTrace(); } } }); }*/ /*private void _fixMinimumGridWidth() { // Find the grid with the maximum width maxWidth = 0; for (int i = 0; i < pages.size(); i++) { GridLayout grid = getGridFromPage(pages.get(i)); if (grid.getWidth() > maxWidth) { maxWidth = grid.getWidth(); } } Log.i(TAG, "Setting minimum width to " + maxWidth); if (maxWidth < screenWidth / 3) { maxWidth = screenWidth - 30; } for (int i = 0; i < pages.size(); i++) { GridLayout grid = getGridFromPage(pages.get(i)); grid.setMinimumWidth(maxWidth); } //dock.setMinimumWidth(maxWidth); minimumWidthDetermined = true; }*/ private GridLayout preparePage() { GridLayout grid = (GridLayout) getLayoutInflater().inflate(R.layout.apps_page, null); if (minimumWidthDetermined) { Loading @@ -615,6 +590,8 @@ public class DesktopActivity extends AppCompatActivity { Storage.StorageData storageData = storage.load(); int nPages = storageData.getNPages(); pages = new ArrayList<>(); List<AppItem> storedItems = new ArrayList<>(); for (int i = 0; i < nPages; i++) { GridLayout page = preparePage(); pages.add(page); Loading @@ -623,7 +600,14 @@ public class DesktopActivity extends AppCompatActivity { JSONArray pageData = storageData.pages.getJSONArray(i); for (int j = 0; j < pageData.length(); j++) { JSONObject currentItemData = pageData.getJSONObject(j); View appView = prepareAppFromJSON(currentItemData); AppItem appItem = prepareAppFromJSON(currentItemData); if (appItem.isFolder()) { storedItems.addAll(appItem.getSubApps()); } else { storedItems.add(appItem); } View appView = prepareApp(appItem); if (appView != null) { addAppToPage(page, appView); } Loading @@ -634,10 +618,26 @@ public class DesktopActivity extends AppCompatActivity { } // Always keep an extra empty page handy if (pages.get(pages.size() - 1).getChildCount() > 2) { launchableApps.removeAll(storedItems); for (int i = 0; i < launchableApps.size(); i++) { if (pages.get(pages.size() - 1).getChildCount() < maxAppsPerPage) { View appView = prepareApp(launchableApps.get(i)); if (appView != null) { addAppToPage(pages.get(pages.size() - 1), appView); } } else { pages.add(preparePage()); View appView = prepareApp(launchableApps.get(i)); if (appView != null) { addAppToPage(pages.get(pages.size() - 1), appView); } } } /*// Always keep an extra empty page handy if (pages.get(pages.size() - 1).getChildCount() > 2) { pages.add(preparePage()); }*/ for (int i = 0; i < pages.size(); i++) { pager.addView(pages.get(i)); Loading @@ -649,7 +649,8 @@ public class DesktopActivity extends AppCompatActivity { for (int i = 0; i < storageData.getNDocked(); i++) { try { JSONObject currentDockItemData = storageData.dock.getJSONArray(0).getJSONObject(i); View appView = prepareAppFromJSON(currentDockItemData); AppItem appItem = prepareAppFromJSON(currentDockItemData); View appView = prepareApp(appItem); if (appView != null) { addToDock(appView, INVALID); } Loading Loading @@ -707,11 +708,8 @@ public class DesktopActivity extends AppCompatActivity { 0, getResources().getDimensionPixelSize(R.dimen.app_col_margin), 0); iconLayoutParams.height = (screenHeight) / nRows; iconLayoutParams.width = ((screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / page.getColumnCount()); iconLayoutParams.height = iconHeight; iconLayoutParams.width = iconWidth; view.findViewById(R.id.app_label).setVisibility(View.VISIBLE); view.setLayoutParams(iconLayoutParams); page.addView(view); Loading @@ -726,11 +724,9 @@ public class DesktopActivity extends AppCompatActivity { 0, getResources().getDimensionPixelSize(R.dimen.app_col_margin), 0); iconLayoutParams.height = (screenHeight) / nRows; iconLayoutParams.width = ((screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / page.getColumnCount()); iconLayoutParams.height = iconHeight; iconLayoutParams.width = iconWidth; view.findViewById(R.id.app_label).setVisibility(View.VISIBLE); view.setLayoutParams(iconLayoutParams); page.addView(view, index); Loading @@ -740,7 +736,7 @@ public class DesktopActivity extends AppCompatActivity { * Creates a View that can be displayed by the launcher using just stored * JSON data. */ private View prepareAppFromJSON(JSONObject currentItemData) throws Exception { private AppItem prepareAppFromJSON(JSONObject currentItemData) throws Exception { String componentName = currentItemData.getString("componentName"); View output = null; if (currentItemData.getBoolean("isFolder")) { Loading @@ -765,15 +761,13 @@ public class DesktopActivity extends AppCompatActivity { } folderItem.setIcon(GraphicsUtil.generateFolderIcon(this, folderItem)); output = prepareApp(folderItem); //output = prepareApp(folderItem); return folderItem; } else { AppItem appItem = prepareAppItemFromComponent(componentName); if (appItem != null) { output = prepareApp(appItem); return appItem; } } return output; } private AppItem prepareAppItemFromComponent(String componentName) { for (int i = 0; i < launchableApps.size(); i++) { Loading Loading @@ -838,7 +832,7 @@ public class DesktopActivity extends AppCompatActivity { View.DragShadowBuilder dragShadowBuilder = new BlissDragShadowBuilder(icon); v.startDrag(null, dragShadowBuilder, v, 0); isDragging = true; if (v.getParent() instanceof GridLayout) { if (v.getParent().getParent() instanceof HorizontalPager) { parentPage = getCurrentAppsPageNumber(); } else { parentPage = -99; Loading Loading @@ -888,6 +882,11 @@ public class DesktopActivity extends AppCompatActivity { folderApps.removeAllViews(); for (int i = 0; i < app.getSubApps().size(); i++) { View appView = prepareApp(app.getSubApps().get(i)); GridLayout.Spec rowSpec = GridLayout.spec(GridLayout.UNDEFINED); GridLayout.Spec colSpec = GridLayout.spec(GridLayout.UNDEFINED); appView.setLayoutParams(new GridLayout.LayoutParams(rowSpec, colSpec)); appView.getLayoutParams().width = folderIconWidth; appView.getLayoutParams().height = iconHeight; folderApps.addView(appView); } activeFolder = app; Loading Loading @@ -1042,23 +1041,6 @@ public class DesktopActivity extends AppCompatActivity { } } else if (dragEvent.getAction() == DragEvent.ACTION_DRAG_ENDED) { if (getCurrentAppsPageNumber() > 0 && getGridFromPage( pages.get(getCurrentAppsPageNumber() - 1)).getChildCount() <= 0) { pages.remove(getCurrentAppsPageNumber() - 1); indicator.removeViewAt(getCurrentAppsPageNumber()); pager.removeViewAt(getCurrentAppsPageNumber()); pager.scrollLeft(); } if (getCurrentAppsPageNumber() < pages.size() - 1 && getGridFromPage( pages.get(getCurrentAppsPageNumber() + 1)).getChildCount() <= 0) { pages.remove(getCurrentAppsPageNumber() + 1); indicator.removeViewAt(getCurrentAppsPageNumber() + 2); pager.removeViewAt(getCurrentAppsPageNumber() + 2); } } movingApp = (View) dragEvent.getLocalState(); return true; Loading Loading @@ -1211,13 +1193,13 @@ public class DesktopActivity extends AppCompatActivity { addAppToPage(gridLayout, movingApp); } } if (view instanceof LinearLayout && view.getId() == R.id.dock) { if (view instanceof GridLayout && view.getId() == R.id.dock) { addToDock(movingApp, INVALID); } } movingApp.setVisibility(View.VISIBLE); } else { if (collidingApp.getParent() instanceof GridLayout) { if (collidingApp.getParent().getParent() instanceof HorizontalPager) { createFolder(false); } else { createFolder(true); Loading Loading @@ -1297,7 +1279,8 @@ public class DesktopActivity extends AppCompatActivity { */ private void discardCollidingApp() { if (collidingApp != null) { makeAppCold(collidingApp, collidingApp.getParent() instanceof LinearLayout); makeAppCold(collidingApp, !(collidingApp.getParent().getParent() instanceof HorizontalPager)); collidingApp = null; folderInterest = false; } Loading @@ -1315,11 +1298,8 @@ public class DesktopActivity extends AppCompatActivity { 0, getResources().getDimensionPixelSize(R.dimen.app_col_margin), 0); iconLayoutParams.height = (screenHeight) / nRows; iconLayoutParams.width = ((screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / dock.getColumnCount()); iconLayoutParams.height = iconHeight; iconLayoutParams.width = iconWidth; view.findViewById(R.id.app_label).setVisibility(View.GONE); view.setLayoutParams(iconLayoutParams); if (index != INVALID) { Loading Loading @@ -1496,8 +1476,8 @@ public class DesktopActivity extends AppCompatActivity { View v = page.getChildAt(i); Rect r = new Rect((int) v.getX(), (int) v.getY(), (int) v.getX() + v.getWidth(), (int) v.getY() + v.getHeight()); Rect r2 = new Rect((int) (x - iconSize / 2), (int) (y - iconSize / 2), (int) (x + iconSize / 2), (int) (y + iconSize / 2)); Rect r2 = new Rect((int) (x - iconWidth / 2), (int) (y - iconWidth / 2), (int) (x + iconWidth / 2), (int) (y + iconWidth / 2)); if (Rect.intersects(r, r2)) { return i; } Loading app/src/main/java/org/indin/blisslaunchero/GraphicsUtil.java +1 −1 Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ public class GraphicsUtil { if ((image == null) || !(image instanceof BitmapDrawable)) { return image; } double scale = 0.8; double scale = 0.64; Bitmap original = Bitmap.createScaledBitmap(((BitmapDrawable)image).getBitmap(), (int)(image.getIntrinsicWidth() * scale), (int)(image.getIntrinsicWidth() * scale), true); Loading app/src/main/java/org/indin/blisslaunchero/Storage.java +1 −1 Original line number Diff line number Diff line Loading @@ -140,6 +140,6 @@ public class Storage { } public void setWallpaperShown() { prefs.edit().putBoolean("WALLPAPER_SHOWN", true).commit(); prefs.edit().putBoolean("WALLPAPER_SHOWN", true).apply(); } } app/src/main/res/layout/activity_main.xml +4 −3 Original line number Diff line number Diff line Loading @@ -13,7 +13,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/page_indicator" android:layout_alignParentTop="true" /> android:layout_alignParentTop="true" android:layout_marginTop="16dp"/> <LinearLayout android:id="@+id/page_indicator" Loading Loading @@ -69,13 +70,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_margin="20dp" android:layout_margin="16dp" android:alignmentMode="alignBounds" android:background="@drawable/folder_window" android:columnCount="3" android:rowCount="4" android:minHeight="230dp" android:minWidth="240dp" android:rowCount="4" android:useDefaultMargins="true"> </GridLayout> Loading app/src/main/res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ <dimen name="hitBoxSize">60dp</dimen> <dimen name="scrollCorner">8dp</dimen> <dimen name="iconPadding">8dp</dimen> <dimen name="dockHeight">84dp</dimen> <dimen name="dockHeight">96dp</dimen> <dimen name="pager_margin">24dp</dimen> <dimen name="app_icon_margin">8dp</dimen> <dimen name="app_col_margin">8dp</dimen> Loading Loading
app/src/main/java/org/indin/blisslaunchero/DesktopActivity.java +73 −93 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ public class DesktopActivity extends AppCompatActivity { private Drawable hotBackground; private Drawable defaultBackground; private Drawable transparentBackground; private int iconSize; private boolean dragDropEnabled = true; private boolean minimumWidthDetermined = false; Loading @@ -112,6 +112,9 @@ public class DesktopActivity extends AppCompatActivity { private int screenHeight; private int mWidthPixels; private int mHeightPixels; private int iconHeight; private int iconWidth; private int folderIconWidth; @Override protected void onCreate(Bundle savedInstanceState) { Loading @@ -138,6 +141,8 @@ public class DesktopActivity extends AppCompatActivity { storage = new Storage(getApplicationContext()); prepareBroadcastReceivers(); pager.getViewTreeObserver().addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() { @Override Loading @@ -154,6 +159,7 @@ public class DesktopActivity extends AppCompatActivity { } }); } /** Loading Loading @@ -196,7 +202,6 @@ public class DesktopActivity extends AppCompatActivity { @Override protected void onStart() { super.onStart(); prepareBroadcastReceivers(); } @Override Loading @@ -212,6 +217,11 @@ public class DesktopActivity extends AppCompatActivity { @Override protected void onStop() { super.onStop(); } @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(installReceiver); unregisterReceiver(uninstallReceiver); } Loading Loading @@ -304,8 +314,14 @@ public class DesktopActivity extends AppCompatActivity { maxAppsPerPage = nRows * nCols; screenWidth = Resources.getSystem().getDisplayMetrics().widthPixels; iconHeight = (screenHeight) / nRows; iconWidth = (screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / nCols; folderIconWidth = (screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / 5; maxDistanceForFolderCreation = getResources() .getDimensionPixelSize(R.dimen.maxDistanceForFolderCreation) * screenWidth / 480; .getDimensionPixelSize(R.dimen.maxDistanceForFolderCreation) * screenWidth / 540; hotBackground = getResources().getDrawable(R.drawable.rounded_corners_icon_hot, null); defaultBackground = getResources().getDrawable(R.drawable.rounded_corners_icon, null); Loading Loading @@ -525,7 +541,7 @@ public class DesktopActivity extends AppCompatActivity { dock.setEnabled(true); return; } nPages = (int) Math.ceil((float) launchableApps.size() / (float) maxAppsPerPage); nPages = (int) Math.ceil((float) launchableApps.size() / maxAppsPerPage); Log.i(TAG, "createUI: npages: " + nPages + ", max: " + maxAppsPerPage); pages = new ArrayList<>(); for (int i = 0; i < nPages; i++) { Loading Loading @@ -557,47 +573,6 @@ public class DesktopActivity extends AppCompatActivity { } /*private void fixMinimumGridWidth() { AsyncTask.execute(new Runnable() { @Override public void run() { try { Thread.sleep(2000); runOnUiThread(new Runnable() { @Override public void run() { _fixMinimumGridWidth(); } }); } catch (Exception e) { e.printStackTrace(); } } }); }*/ /*private void _fixMinimumGridWidth() { // Find the grid with the maximum width maxWidth = 0; for (int i = 0; i < pages.size(); i++) { GridLayout grid = getGridFromPage(pages.get(i)); if (grid.getWidth() > maxWidth) { maxWidth = grid.getWidth(); } } Log.i(TAG, "Setting minimum width to " + maxWidth); if (maxWidth < screenWidth / 3) { maxWidth = screenWidth - 30; } for (int i = 0; i < pages.size(); i++) { GridLayout grid = getGridFromPage(pages.get(i)); grid.setMinimumWidth(maxWidth); } //dock.setMinimumWidth(maxWidth); minimumWidthDetermined = true; }*/ private GridLayout preparePage() { GridLayout grid = (GridLayout) getLayoutInflater().inflate(R.layout.apps_page, null); if (minimumWidthDetermined) { Loading @@ -615,6 +590,8 @@ public class DesktopActivity extends AppCompatActivity { Storage.StorageData storageData = storage.load(); int nPages = storageData.getNPages(); pages = new ArrayList<>(); List<AppItem> storedItems = new ArrayList<>(); for (int i = 0; i < nPages; i++) { GridLayout page = preparePage(); pages.add(page); Loading @@ -623,7 +600,14 @@ public class DesktopActivity extends AppCompatActivity { JSONArray pageData = storageData.pages.getJSONArray(i); for (int j = 0; j < pageData.length(); j++) { JSONObject currentItemData = pageData.getJSONObject(j); View appView = prepareAppFromJSON(currentItemData); AppItem appItem = prepareAppFromJSON(currentItemData); if (appItem.isFolder()) { storedItems.addAll(appItem.getSubApps()); } else { storedItems.add(appItem); } View appView = prepareApp(appItem); if (appView != null) { addAppToPage(page, appView); } Loading @@ -634,10 +618,26 @@ public class DesktopActivity extends AppCompatActivity { } // Always keep an extra empty page handy if (pages.get(pages.size() - 1).getChildCount() > 2) { launchableApps.removeAll(storedItems); for (int i = 0; i < launchableApps.size(); i++) { if (pages.get(pages.size() - 1).getChildCount() < maxAppsPerPage) { View appView = prepareApp(launchableApps.get(i)); if (appView != null) { addAppToPage(pages.get(pages.size() - 1), appView); } } else { pages.add(preparePage()); View appView = prepareApp(launchableApps.get(i)); if (appView != null) { addAppToPage(pages.get(pages.size() - 1), appView); } } } /*// Always keep an extra empty page handy if (pages.get(pages.size() - 1).getChildCount() > 2) { pages.add(preparePage()); }*/ for (int i = 0; i < pages.size(); i++) { pager.addView(pages.get(i)); Loading @@ -649,7 +649,8 @@ public class DesktopActivity extends AppCompatActivity { for (int i = 0; i < storageData.getNDocked(); i++) { try { JSONObject currentDockItemData = storageData.dock.getJSONArray(0).getJSONObject(i); View appView = prepareAppFromJSON(currentDockItemData); AppItem appItem = prepareAppFromJSON(currentDockItemData); View appView = prepareApp(appItem); if (appView != null) { addToDock(appView, INVALID); } Loading Loading @@ -707,11 +708,8 @@ public class DesktopActivity extends AppCompatActivity { 0, getResources().getDimensionPixelSize(R.dimen.app_col_margin), 0); iconLayoutParams.height = (screenHeight) / nRows; iconLayoutParams.width = ((screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / page.getColumnCount()); iconLayoutParams.height = iconHeight; iconLayoutParams.width = iconWidth; view.findViewById(R.id.app_label).setVisibility(View.VISIBLE); view.setLayoutParams(iconLayoutParams); page.addView(view); Loading @@ -726,11 +724,9 @@ public class DesktopActivity extends AppCompatActivity { 0, getResources().getDimensionPixelSize(R.dimen.app_col_margin), 0); iconLayoutParams.height = (screenHeight) / nRows; iconLayoutParams.width = ((screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / page.getColumnCount()); iconLayoutParams.height = iconHeight; iconLayoutParams.width = iconWidth; view.findViewById(R.id.app_label).setVisibility(View.VISIBLE); view.setLayoutParams(iconLayoutParams); page.addView(view, index); Loading @@ -740,7 +736,7 @@ public class DesktopActivity extends AppCompatActivity { * Creates a View that can be displayed by the launcher using just stored * JSON data. */ private View prepareAppFromJSON(JSONObject currentItemData) throws Exception { private AppItem prepareAppFromJSON(JSONObject currentItemData) throws Exception { String componentName = currentItemData.getString("componentName"); View output = null; if (currentItemData.getBoolean("isFolder")) { Loading @@ -765,15 +761,13 @@ public class DesktopActivity extends AppCompatActivity { } folderItem.setIcon(GraphicsUtil.generateFolderIcon(this, folderItem)); output = prepareApp(folderItem); //output = prepareApp(folderItem); return folderItem; } else { AppItem appItem = prepareAppItemFromComponent(componentName); if (appItem != null) { output = prepareApp(appItem); return appItem; } } return output; } private AppItem prepareAppItemFromComponent(String componentName) { for (int i = 0; i < launchableApps.size(); i++) { Loading Loading @@ -838,7 +832,7 @@ public class DesktopActivity extends AppCompatActivity { View.DragShadowBuilder dragShadowBuilder = new BlissDragShadowBuilder(icon); v.startDrag(null, dragShadowBuilder, v, 0); isDragging = true; if (v.getParent() instanceof GridLayout) { if (v.getParent().getParent() instanceof HorizontalPager) { parentPage = getCurrentAppsPageNumber(); } else { parentPage = -99; Loading Loading @@ -888,6 +882,11 @@ public class DesktopActivity extends AppCompatActivity { folderApps.removeAllViews(); for (int i = 0; i < app.getSubApps().size(); i++) { View appView = prepareApp(app.getSubApps().get(i)); GridLayout.Spec rowSpec = GridLayout.spec(GridLayout.UNDEFINED); GridLayout.Spec colSpec = GridLayout.spec(GridLayout.UNDEFINED); appView.setLayoutParams(new GridLayout.LayoutParams(rowSpec, colSpec)); appView.getLayoutParams().width = folderIconWidth; appView.getLayoutParams().height = iconHeight; folderApps.addView(appView); } activeFolder = app; Loading Loading @@ -1042,23 +1041,6 @@ public class DesktopActivity extends AppCompatActivity { } } else if (dragEvent.getAction() == DragEvent.ACTION_DRAG_ENDED) { if (getCurrentAppsPageNumber() > 0 && getGridFromPage( pages.get(getCurrentAppsPageNumber() - 1)).getChildCount() <= 0) { pages.remove(getCurrentAppsPageNumber() - 1); indicator.removeViewAt(getCurrentAppsPageNumber()); pager.removeViewAt(getCurrentAppsPageNumber()); pager.scrollLeft(); } if (getCurrentAppsPageNumber() < pages.size() - 1 && getGridFromPage( pages.get(getCurrentAppsPageNumber() + 1)).getChildCount() <= 0) { pages.remove(getCurrentAppsPageNumber() + 1); indicator.removeViewAt(getCurrentAppsPageNumber() + 2); pager.removeViewAt(getCurrentAppsPageNumber() + 2); } } movingApp = (View) dragEvent.getLocalState(); return true; Loading Loading @@ -1211,13 +1193,13 @@ public class DesktopActivity extends AppCompatActivity { addAppToPage(gridLayout, movingApp); } } if (view instanceof LinearLayout && view.getId() == R.id.dock) { if (view instanceof GridLayout && view.getId() == R.id.dock) { addToDock(movingApp, INVALID); } } movingApp.setVisibility(View.VISIBLE); } else { if (collidingApp.getParent() instanceof GridLayout) { if (collidingApp.getParent().getParent() instanceof HorizontalPager) { createFolder(false); } else { createFolder(true); Loading Loading @@ -1297,7 +1279,8 @@ public class DesktopActivity extends AppCompatActivity { */ private void discardCollidingApp() { if (collidingApp != null) { makeAppCold(collidingApp, collidingApp.getParent() instanceof LinearLayout); makeAppCold(collidingApp, !(collidingApp.getParent().getParent() instanceof HorizontalPager)); collidingApp = null; folderInterest = false; } Loading @@ -1315,11 +1298,8 @@ public class DesktopActivity extends AppCompatActivity { 0, getResources().getDimensionPixelSize(R.dimen.app_col_margin), 0); iconLayoutParams.height = (screenHeight) / nRows; iconLayoutParams.width = ((screenWidth - 10 * getResources().getDimensionPixelSize( R.dimen.app_col_margin)) / dock.getColumnCount()); iconLayoutParams.height = iconHeight; iconLayoutParams.width = iconWidth; view.findViewById(R.id.app_label).setVisibility(View.GONE); view.setLayoutParams(iconLayoutParams); if (index != INVALID) { Loading Loading @@ -1496,8 +1476,8 @@ public class DesktopActivity extends AppCompatActivity { View v = page.getChildAt(i); Rect r = new Rect((int) v.getX(), (int) v.getY(), (int) v.getX() + v.getWidth(), (int) v.getY() + v.getHeight()); Rect r2 = new Rect((int) (x - iconSize / 2), (int) (y - iconSize / 2), (int) (x + iconSize / 2), (int) (y + iconSize / 2)); Rect r2 = new Rect((int) (x - iconWidth / 2), (int) (y - iconWidth / 2), (int) (x + iconWidth / 2), (int) (y + iconWidth / 2)); if (Rect.intersects(r, r2)) { return i; } Loading
app/src/main/java/org/indin/blisslaunchero/GraphicsUtil.java +1 −1 Original line number Diff line number Diff line Loading @@ -127,7 +127,7 @@ public class GraphicsUtil { if ((image == null) || !(image instanceof BitmapDrawable)) { return image; } double scale = 0.8; double scale = 0.64; Bitmap original = Bitmap.createScaledBitmap(((BitmapDrawable)image).getBitmap(), (int)(image.getIntrinsicWidth() * scale), (int)(image.getIntrinsicWidth() * scale), true); Loading
app/src/main/java/org/indin/blisslaunchero/Storage.java +1 −1 Original line number Diff line number Diff line Loading @@ -140,6 +140,6 @@ public class Storage { } public void setWallpaperShown() { prefs.edit().putBoolean("WALLPAPER_SHOWN", true).commit(); prefs.edit().putBoolean("WALLPAPER_SHOWN", true).apply(); } }
app/src/main/res/layout/activity_main.xml +4 −3 Original line number Diff line number Diff line Loading @@ -13,7 +13,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/page_indicator" android:layout_alignParentTop="true" /> android:layout_alignParentTop="true" android:layout_marginTop="16dp"/> <LinearLayout android:id="@+id/page_indicator" Loading Loading @@ -69,13 +70,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_margin="20dp" android:layout_margin="16dp" android:alignmentMode="alignBounds" android:background="@drawable/folder_window" android:columnCount="3" android:rowCount="4" android:minHeight="230dp" android:minWidth="240dp" android:rowCount="4" android:useDefaultMargins="true"> </GridLayout> Loading
app/src/main/res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ <dimen name="hitBoxSize">60dp</dimen> <dimen name="scrollCorner">8dp</dimen> <dimen name="iconPadding">8dp</dimen> <dimen name="dockHeight">84dp</dimen> <dimen name="dockHeight">96dp</dimen> <dimen name="pager_margin">24dp</dimen> <dimen name="app_icon_margin">8dp</dimen> <dimen name="app_col_margin">8dp</dimen> Loading