Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3cf67b6 authored by Romain Hunault's avatar Romain Hunault 💻
Browse files

Merge branch 'sprint_cordoba' into 'master'

[RELEASE] Sprint cordoba

Closes #138 and #159

See merge request e/apps/BlissLauncher!18
parents d1dee091 adeae52f
Loading
Loading
Loading
Loading
Loading
+9 −7
Original line number Original line Diff line number Diff line
apply plugin: 'com.android.application'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'


// Manifest version information!
// Manifest version information!
def versionMajor = 1
def versionMajor = 1
def versionMinor = 2
def versionMinor = 3
def versionPatch = 4
def versionPatch = 0


android {
android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    compileSdkVersion rootProject.ext.compileSdkVersion
@@ -16,7 +16,7 @@ android {
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"


        renderscriptTargetApi 18
        renderscriptTargetApi 28
        renderscriptSupportModeEnabled true
        renderscriptSupportModeEnabled true
    }
    }
    buildTypes {
    buildTypes {
@@ -83,8 +83,6 @@ dependencies {
    apiNougatImplementation 'org.cyanogenmod:platform.sdk:6.0'
    apiNougatImplementation 'org.cyanogenmod:platform.sdk:6.0'
    apiOreoImplementation files('libs/lineage-sdk.jar')
    apiOreoImplementation files('libs/lineage-sdk.jar')


    debugImplementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    debugImplementation 'com.google.firebase:firebase-core:16.0.6'
    debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
    debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'


    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'org.greenrobot:eventbus:3.1.1'
@@ -111,6 +109,11 @@ dependencies {
    // Rx Relay
    // Rx Relay
    implementation "com.jakewharton.rxrelay2:rxrelay:${rootProject.ext.rxRelayVersion}"
    implementation "com.jakewharton.rxrelay2:rxrelay:${rootProject.ext.rxRelayVersion}"


    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    // Blur Library
    implementation project(':hoko-blur')

    // Room
    // Room
    implementation "android.arch.persistence.room:runtime:1.1.1"
    implementation "android.arch.persistence.room:runtime:1.1.1"
    annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
    annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
@@ -140,5 +143,4 @@ dependencies {
    androidTestImplementation "com.android.support.test:rules:${rootProject.ext.runnerRulesVersion}"
    androidTestImplementation "com.android.support.test:rules:${rootProject.ext.runnerRulesVersion}"
}
}


apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'com.getkeepsafe.dexcount'
+3 −0
Original line number Original line Diff line number Diff line
@@ -31,12 +31,15 @@
    <uses-permission android:name="lineageos.permission.ACCESS_WEATHER_MANAGER" />
    <uses-permission android:name="lineageos.permission.ACCESS_WEATHER_MANAGER" />
    <uses-permission android:name="lineageos.permission.READ_WEATHER" />
    <uses-permission android:name="lineageos.permission.READ_WEATHER" />


    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/>
    <application
    <application
        android:name=".BlissLauncher"
        android:name=".BlissLauncher"
        android:icon="@mipmap/ic_launcher"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:theme="@style/AppTheme"
        android:hardwareAccelerated="true"
        tools:ignore="AllowBackup,GoogleAppIndexingWarning">
        tools:ignore="AllowBackup,GoogleAppIndexingWarning">
        <activity
        <activity
            android:name=".features.launcher.LauncherActivity"
            android:name=".features.launcher.LauncherActivity"
+4 −2
Original line number Original line Diff line number Diff line
@@ -6,6 +6,7 @@ import android.content.Context;


import foundation.e.blisslauncher.core.DeviceProfile;
import foundation.e.blisslauncher.core.DeviceProfile;
import foundation.e.blisslauncher.core.IconsHandler;
import foundation.e.blisslauncher.core.IconsHandler;
import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider;
import foundation.e.blisslauncher.core.customviews.WidgetHost;
import foundation.e.blisslauncher.core.customviews.WidgetHost;
import foundation.e.blisslauncher.features.launcher.AppProvider;
import foundation.e.blisslauncher.features.launcher.AppProvider;
import io.github.inflationx.calligraphy3.CalligraphyConfig;
import io.github.inflationx.calligraphy3.CalligraphyConfig;
@@ -21,8 +22,6 @@ public class BlissLauncher extends Application {
    private static WidgetHost sAppWidgetHost;
    private static WidgetHost sAppWidgetHost;
    private static AppWidgetManager sAppWidgetManager;
    private static AppWidgetManager sAppWidgetManager;


    private static final String TAG = "BlissLauncher";

    @Override
    @Override
    public void onCreate() {
    public void onCreate() {
        super.onCreate();
        super.onCreate();
@@ -39,6 +38,9 @@ public class BlissLauncher extends Application {
        sAppWidgetHost = new WidgetHost(getApplicationContext(),
        sAppWidgetHost = new WidgetHost(getApplicationContext(),
                R.id.APPWIDGET_HOST_ID);
                R.id.APPWIDGET_HOST_ID);
        sAppWidgetHost.startListening();
        sAppWidgetHost.startListening();

        connectAppProvider();
        BlurWallpaperProvider.Companion.getInstance(this);
    }
    }


    public static BlissLauncher getApplication(Context context) {
    public static BlissLauncher getApplication(Context context) {
+37 −6
Original line number Original line Diff line number Diff line
@@ -10,7 +10,6 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.RectF;
import android.util.DisplayMetrics;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.Display;
import android.view.WindowManager;
import android.view.WindowManager;


@@ -28,6 +27,7 @@ public class DeviceProfile {


    public static Path path;
    public static Path path;
    private final float widthCm;
    private final float widthCm;
    private int statusBarHeight;
    public int cellHeightWithoutPaddingPx;
    public int cellHeightWithoutPaddingPx;
    public int hotseatCellHeightWithoutPaddingPx;
    public int hotseatCellHeightWithoutPaddingPx;
    public int fillResIconDpi;
    public int fillResIconDpi;
@@ -158,13 +158,18 @@ public class DeviceProfile {
        widthPx = realSize.x;
        widthPx = realSize.x;
        double x = widthPx / dm.xdpi;
        double x = widthPx / dm.xdpi;
        widthCm = (float) (x * 2.540001f);
        widthCm = (float) (x * 2.540001f);
        Log.i(TAG, "DeviceProfile: " + availableWidthPx);
        Log.i(TAG, "DeviceProfile: " + widthPx);
        heightPx = realSize.y;
        heightPx = realSize.y;


        context = getContext(context, Configuration.ORIENTATION_PORTRAIT);
        context = getContext(context, Configuration.ORIENTATION_PORTRAIT);
        Resources res = context.getResources();
        Resources res = context.getResources();


        // status bar height
        statusBarHeight = 0;
        int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            statusBarHeight = res.getDimensionPixelSize(resourceId);
        }

        ComponentName cn = new ComponentName(context.getPackageName(),
        ComponentName cn = new ComponentName(context.getPackageName(),
                this.getClass().getName());
                this.getClass().getName());


@@ -248,8 +253,6 @@ public class DeviceProfile {
        dateTextBottomPadding = (dateTextviewHeight - (int) (0.86 * Utilities.calculateTextHeight(
        dateTextBottomPadding = (dateTextviewHeight - (int) (0.86 * Utilities.calculateTextHeight(
                (float) dateTextSize / 2))) / 2;
                (float) 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);


@@ -351,6 +354,34 @@ public class DeviceProfile {
        return resizedPath;
        return resizedPath;
    }
    }


    public boolean hasSoftNavigationBar(Context context) {
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        DisplayMetrics dm = new DisplayMetrics();
        display.getMetrics(dm);

        Point smallestSize = new Point();
        Point largestSize = new Point();
        display.getCurrentSizeRange(smallestSize, largestSize);

        int availableHeight = largestSize.y;

        Point realSize = new Point();
        display.getRealSize(realSize);
        int realHeight = realSize.y;
        context = getContext(context, Configuration.ORIENTATION_PORTRAIT);
        Resources res = context.getResources();

        // status bar height
        statusBarHeight = 0;
        int resourceId = res.getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            statusBarHeight = res.getDimensionPixelSize(resourceId);
        }

        return (realHeight - availableHeight - statusBarHeight) > 0;
    }

    private int getLauncherIconDensity(int requiredSize) {
    private int getLauncherIconDensity(int requiredSize) {
        // Densities typically defined by an app.
        // Densities typically defined by an app.
        int[] densityBuckets = new int[]{
        int[] densityBuckets = new int[]{
+25 −0
Original line number Original line Diff line number Diff line
package foundation.e.blisslauncher.core

import android.os.Handler
import android.os.Looper

val mainHandler by lazy { Handler(Looper.getMainLooper()) }


fun runOnMainThread(r: () -> Unit) {
    runOnThread(mainHandler, r)
}

fun runOnThread(handler: Handler, r: () -> Unit) {
    if (handler.looper.thread.id == Looper.myLooper()?.thread?.id) {
        r()
    } else {
        handler.post(r)
    }
}

inline fun <T> Iterable<T>.safeForEach(action: (T) -> Unit) {
    val tmp = ArrayList<T>()
    tmp.addAll(this)
    for (element in tmp) action(element)
}
 No newline at end of file
Loading