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

Commit 1168ac0e authored by Amit Kumar's avatar Amit Kumar
Browse files

Merge branch 'memory-fix' into master

parents 66e484db 0aa58a94
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -7,8 +7,11 @@ android {
        minSdkVersion rootProject.ext.minSdkVersion
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionCode 1
        versionName "1.0"
        versionName "1.0.0-alpha"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        renderscriptTargetApi 18
        renderscriptSupportModeEnabled true
    }
    }
    buildTypes {
    buildTypes {
        release {
        release {
@@ -19,6 +22,15 @@ android {
            applicationIdSuffix '.debug'
            applicationIdSuffix '.debug'
            signingConfig signingConfigs.debug
            signingConfig signingConfigs.debug
        }
        }

        applicationVariants.all { variant ->
            if (variant.buildType.name == "debug") {
                variant.outputs.all { output ->
                    outputFileName = "BlissLauncher-${variant.getFlavorName()}-${variant.versionName}.apk"
                }
            }

        }
    }
    }


    signingConfigs {
    signingConfigs {
+0 −1
Original line number Original line Diff line number Diff line
@@ -77,7 +77,6 @@
        <service android:name=".features.weather.WeatherUpdateService"/>
        <service android:name=".features.weather.WeatherUpdateService"/>
        <service android:name=".features.weather.DeviceStatusService"/>
        <service android:name=".features.weather.DeviceStatusService"/>
        <service android:name=".features.weather.WeatherSourceListenerService"/>
        <service android:name=".features.weather.WeatherSourceListenerService"/>
        <service android:name=".features.launcher.AppProvider"/>


        <receiver android:name="core.broadcast.PackageAddedRemovedHandler"/>
        <receiver android:name="core.broadcast.PackageAddedRemovedHandler"/>


+1 −18
Original line number Original line Diff line number Diff line
@@ -2,11 +2,7 @@ package foundation.e.blisslauncher;


import android.app.Application;
import android.app.Application;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;


import foundation.e.blisslauncher.core.DeviceProfile;
import foundation.e.blisslauncher.core.DeviceProfile;
import foundation.e.blisslauncher.core.IconsHandler;
import foundation.e.blisslauncher.core.IconsHandler;
@@ -70,20 +66,7 @@ public class BlissLauncher extends Application {
    }
    }


    private void connectAppProvider() {
    private void connectAppProvider() {
        Intent intent = new Intent(this, AppProvider.class);
        mAppProvider = AppProvider.getInstance(this);
        startService(intent);

        bindService(intent, new ServiceConnection() {
            @Override
            public void onServiceConnected(ComponentName name, IBinder service) {
                AppProvider.LocalBinder localBinder = (AppProvider.LocalBinder) service;
                mAppProvider = localBinder.getService();
            }

            @Override
            public void onServiceDisconnected(ComponentName name) {
            }
        }, Context.BIND_AUTO_CREATE);
    }
    }


    public AppProvider getAppProvider() {
    public AppProvider getAppProvider() {
+38 −8
Original line number Original line Diff line number Diff line
@@ -7,6 +7,7 @@ import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
import android.support.v4.view.GestureDetectorCompat;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Log;
import android.view.MotionEvent;
import android.view.MotionEvent;
@@ -22,6 +23,9 @@ import java.util.HashSet;
import java.util.Set;
import java.util.Set;


import foundation.e.blisslauncher.R;
import foundation.e.blisslauncher.R;
import foundation.e.blisslauncher.features.launcher.DetectSwipeGestureListener;
import foundation.e.blisslauncher.features.launcher.LauncherActivity;
import foundation.e.blisslauncher.features.launcher.OnSwipeDownListener;


public class HorizontalPager extends ViewGroup {
public class HorizontalPager extends ViewGroup {
    private static final String TAG = "HorizontalPager";
    private static final String TAG = "HorizontalPager";
@@ -47,7 +51,8 @@ public class HorizontalPager extends ViewGroup {
    private float mLastMotionY;
    private float mLastMotionY;


    private final static int TOUCH_STATE_REST = 0;
    private final static int TOUCH_STATE_REST = 0;
    private final static int TOUCH_STATE_SCROLLING = 1;
    private final static int TOUCH_STATE_HORIZONTAL_SCROLLING = 1;
    private final static int TOUCH_STATE_VERTICAL_SCROLLING = 2;


    private int mTouchState = TOUCH_STATE_REST;
    private int mTouchState = TOUCH_STATE_REST;


@@ -56,6 +61,7 @@ public class HorizontalPager extends ViewGroup {


    private Set<OnScrollListener> mListeners = new HashSet<>();
    private Set<OnScrollListener> mListeners = new HashSet<>();
    private boolean mIsUiCreated;
    private boolean mIsUiCreated;
    private GestureDetectorCompat gestureDetectorCompat;


    public HorizontalPager(Context context, AttributeSet attrs) {
    public HorizontalPager(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
        this(context, attrs, 0);
@@ -80,6 +86,16 @@ public class HorizontalPager extends ViewGroup {
        final ViewConfiguration configuration = ViewConfiguration.get(getContext());
        final ViewConfiguration configuration = ViewConfiguration.get(getContext());
        mTouchSlop = configuration.getScaledTouchSlop();
        mTouchSlop = configuration.getScaledTouchSlop();
        mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
        mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

        // Create a common gesture listener object.
        DetectSwipeGestureListener gestureListener = new DetectSwipeGestureListener();

        // Set activity in the listener.
        if (getContext() instanceof LauncherActivity) {
            gestureListener.setListener((OnSwipeDownListener) getContext());
        }

        gestureDetectorCompat = new GestureDetectorCompat(getContext(), gestureListener);
    }
    }


    public void setDock(DockGridLayout dock) {
    public void setDock(DockGridLayout dock) {
@@ -279,7 +295,8 @@ public class HorizontalPager extends ViewGroup {
                 * otherwise don't.  mScroller.isFinished should be false when
                 * otherwise don't.  mScroller.isFinished should be false when
                 * being flinged.
                 * being flinged.
                 */
                 */
                mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST : TOUCH_STATE_SCROLLING;
                mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST
                        : TOUCH_STATE_HORIZONTAL_SCROLLING;
                break;
                break;


            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_CANCEL:
@@ -308,9 +325,12 @@ public class HorizontalPager extends ViewGroup {


        if (xMoved || yMoved) {
        if (xMoved || yMoved) {


            if (xMoved) {
            if (yMoved && (y - mLastMotionY) > 0 && yDiff > xDiff && currentPage != 0) {
                mTouchState = TOUCH_STATE_VERTICAL_SCROLLING;
                ((OnSwipeDownListener) getContext()).onSwipeStart();
            } else if (xMoved && yDiff < xDiff) {
                // Scroll if the user moved far enough along the X axis
                // Scroll if the user moved far enough along the X axis
                mTouchState = TOUCH_STATE_SCROLLING;
                mTouchState = TOUCH_STATE_HORIZONTAL_SCROLLING;
                enableChildrenCache();
                enableChildrenCache();
            }
            }
            // Either way, cancel any pending longpress
            // Either way, cancel any pending longpress
@@ -338,6 +358,11 @@ public class HorizontalPager extends ViewGroup {
    @SuppressLint("ClickableViewAccessibility")
    @SuppressLint("ClickableViewAccessibility")
    @Override
    @Override
    public boolean onTouchEvent(MotionEvent ev) {
    public boolean onTouchEvent(MotionEvent ev) {
        /*if (gestureDetectorCompat.onTouchEvent(ev)) {
            return true;
        } else {

        }*/
        if (mVelocityTracker == null) {
        if (mVelocityTracker == null) {
            mVelocityTracker = VelocityTracker.obtain();
            mVelocityTracker = VelocityTracker.obtain();
        }
        }
@@ -346,7 +371,6 @@ public class HorizontalPager extends ViewGroup {
        final int action = ev.getAction();
        final int action = ev.getAction();
        final float x = ev.getX();
        final float x = ev.getX();
        final float y = ev.getY();
        final float y = ev.getY();
        Log.i(TAG, "motion x: " + x);
        if (mIsUiCreated) {
        if (mIsUiCreated) {
            switch (action) {
            switch (action) {
                case MotionEvent.ACTION_DOWN:
                case MotionEvent.ACTION_DOWN:
@@ -360,11 +384,15 @@ public class HorizontalPager extends ViewGroup {


                    // Remember where the motion event started
                    // Remember where the motion event started
                    mLastMotionX = x;
                    mLastMotionX = x;
                    mLastMotionY = y;
                    break;
                    break;
                case MotionEvent.ACTION_MOVE:
                case MotionEvent.ACTION_MOVE:
                    if (mTouchState == TOUCH_STATE_REST) {
                    if (mTouchState == TOUCH_STATE_REST) {
                        checkStartScroll(x, y);
                        checkStartScroll(x, y);
                    } else if (mTouchState == TOUCH_STATE_SCROLLING) {
                    } else if (mTouchState == TOUCH_STATE_VERTICAL_SCROLLING) {
                        int diffY = (int) (y - mLastMotionY);
                        ((OnSwipeDownListener) getContext()).onSwipe(diffY);
                    } else if (mTouchState == TOUCH_STATE_HORIZONTAL_SCROLLING) {
                        // Scroll to follow the motion event
                        // Scroll to follow the motion event
                        int deltaX = (int) (mLastMotionX - x);
                        int deltaX = (int) (mLastMotionX - x);
                        mLastMotionX = x;
                        mLastMotionX = x;
@@ -384,7 +412,10 @@ public class HorizontalPager extends ViewGroup {
                    }
                    }
                    break;
                    break;
                case MotionEvent.ACTION_UP:
                case MotionEvent.ACTION_UP:
                    if (mTouchState == TOUCH_STATE_SCROLLING) {
                    if (mTouchState == TOUCH_STATE_VERTICAL_SCROLLING) {
                        ((OnSwipeDownListener) getContext()).onSwipeFinish();
                    }
                    if (mTouchState == TOUCH_STATE_HORIZONTAL_SCROLLING) {
                        final VelocityTracker velocityTracker = mVelocityTracker;
                        final VelocityTracker velocityTracker = mVelocityTracker;
                        velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
                        velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
                        int velocityX = (int) velocityTracker.getXVelocity();
                        int velocityX = (int) velocityTracker.getXVelocity();
@@ -409,7 +440,6 @@ public class HorizontalPager extends ViewGroup {
                    break;
                    break;
                case MotionEvent.ACTION_CANCEL:
                case MotionEvent.ACTION_CANCEL:
                    mTouchState = TOUCH_STATE_REST;
                    mTouchState = TOUCH_STATE_REST;

            }
            }
        }
        }


+9 −9
Original line number Original line Diff line number Diff line
@@ -56,26 +56,26 @@ public class GraphicsUtil {
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        Canvas canvas = new Canvas(bitmap);


        int xOrigin = bitmap.getWidth() / 15;
        int xOrigin = bitmap.getWidth() / 10;
        int yOrigin = bitmap.getHeight() / 15;
        int yOrigin = bitmap.getHeight() / 10;
        int x = xOrigin;
        int x = xOrigin;
        int y = yOrigin;
        int y = yOrigin;
        int xIncrement = bitmap.getWidth() / 15;
        int xIncrement = bitmap.getWidth() / 10;
        int yIncrement = bitmap.getHeight() / 15;
        int yIncrement = bitmap.getHeight() / 10;
        int count = 0;
        int count = 0;
        int total = 0;
        int total = 0;
        for (Drawable d : sources) {
        for (Drawable d : sources) {
            d.setBounds(x, y, (int) (x + width / 2.5f), (int) (y + height / 2.5f));
            d.setBounds(x, y, (int) (x + width / 5f), (int) (y + height / 5f));
            d.draw(canvas);
            d.draw(canvas);
            x += (int) (width / 2.5f + xIncrement);
            x += (int) (width / 5f + xIncrement);
            count++;
            count++;
            total++;
            total++;
            if (count == 2) {
            if (count == 3) {
                count = 0;
                count = 0;
                y += (int) (height / 2.5f + yIncrement);
                y += (int) (height / 5f + yIncrement);
                x = xOrigin;
                x = xOrigin;
            }
            }
            if (total > 3) {
            if (total > 8) {
                break;
                break;
            }
            }
        }
        }
Loading