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

Commit 0e0b3dc6 authored by nicolasroard's avatar nicolasroard Committed by Android Git Automerger
Browse files

am 32cc4dd7: Fix UI performances / glitches

* commit '32cc4dd7':
  Fix UI performances / glitches
parents ae6b5c35 32cc4dd7
Loading
Loading
Loading
Loading
+51 −51
Original line number Original line Diff line number Diff line
@@ -27,6 +27,22 @@
            android:orientation="horizontal"
            android:orientation="horizontal"
            android:animateLayoutChanges="true">
            android:animateLayoutChanges="true">



        <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="1">

            <ProgressBar
                    android:id="@+id/loading"
                    style="@android:style/Widget.Holo.ProgressBar.Large"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:indeterminate="true"
                    android:indeterminateOnly="true"
                    android:background="@null"/>

            <LinearLayout
            <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_height="match_parent"
@@ -62,13 +78,15 @@


                </LinearLayout>
                </LinearLayout>


            <FrameLayout android:id="@+id/state_panel_container"
                <FrameLayout
                        android:id="@+id/state_panel_container"
                        android:layout_width="match_parent"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_height="wrap_content"
                        android:visibility="visible"/>
                        android:visibility="visible"/>


            </LinearLayout>
            </LinearLayout>


        </FrameLayout>


        <LinearLayout
        <LinearLayout
                android:id="@+id/mainPanel"
                android:id="@+id/mainPanel"
@@ -77,30 +95,12 @@
                android:orientation="vertical"
                android:orientation="vertical"
                android:animateLayoutChanges="true">
                android:animateLayoutChanges="true">


            <FrameLayout android:id="@+id/main_panel_container"
            <FrameLayout
                    android:id="@+id/main_panel_container"
                    android:layout_width="350dip"
                    android:layout_width="350dip"
                    android:layout_height="0dip"
                    android:layout_height="0dip"
                    android:layout_weight="1"/>
                    android:layout_weight="1"/>


            <FrameLayout
                    android:layout_gravity="bottom"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:visibility="gone">


                <ProgressBar
                        android:id="@+id/loading"
                        style="@android:style/Widget.Holo.ProgressBar.Large"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:indeterminate="true"
                        android:indeterminateOnly="true"
                        android:background="@color/background_screen"/>

            </FrameLayout>

        </LinearLayout>
        </LinearLayout>


    </LinearLayout>
    </LinearLayout>
+36 −37
Original line number Original line Diff line number Diff line
@@ -26,6 +26,21 @@
            android:layout_height="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            android:orientation="vertical">


        <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">

            <ProgressBar
                    android:id="@+id/loading"
                    style="@android:style/Widget.Holo.ProgressBar.Large"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:indeterminate="true"
                    android:indeterminateOnly="true"
                    android:background="@null"/>

            <LinearLayout
            <LinearLayout
                    android:layout_weight="1"
                    android:layout_weight="1"
                    android:layout_width="match_parent"
                    android:layout_width="match_parent"
@@ -52,8 +67,11 @@
                        android:layout_height="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"/>
                        android:layout_weight="1"/>



            </LinearLayout>
            </LinearLayout>


        </FrameLayout>

        <com.android.gallery3d.filtershow.CenteredLinearLayout
        <com.android.gallery3d.filtershow.CenteredLinearLayout
                xmlns:custom="http://schemas.android.com/apk/res/com.android.gallery3d"
                xmlns:custom="http://schemas.android.com/apk/res/com.android.gallery3d"
                android:id="@+id/mainPanel"
                android:id="@+id/mainPanel"
@@ -69,25 +87,6 @@
                         android:layout_height="0dip"
                         android:layout_height="0dip"
                         android:layout_weight="1" />
                         android:layout_weight="1" />


            <FrameLayout
                    android:layout_gravity="bottom"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:visibility="gone">


                <ProgressBar
                        android:id="@+id/loading"
                        style="@android:style/Widget.Holo.ProgressBar.Large"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:indeterminate="true"
                        android:indeterminateOnly="true"
                        android:background="@color/background_screen"/>

            </FrameLayout>

        </com.android.gallery3d.filtershow.CenteredLinearLayout>
        </com.android.gallery3d.filtershow.CenteredLinearLayout>


    </LinearLayout>
    </LinearLayout>
+3 −2
Original line number Original line Diff line number Diff line
@@ -73,8 +73,9 @@
                android:layout_gravity="center"
                android:layout_gravity="center"
                android:max="100"
                android:max="100"
                android:progress="100"
                android:progress="100"
                android:layout_width="400dp"
                android:layout_width="wrap_content"
                android:layout_columnSpan="3"/>
                android:layout_columnSpan="3"
                android:minWidth="250dp"/>


        <TextView
        <TextView
                android:id="@+id/qualityTextView"
                android:id="@+id/qualityTextView"
+1 −0
Original line number Original line Diff line number Diff line
@@ -141,6 +141,7 @@
    <dimen name="thumbnail_size">96dip</dimen>
    <dimen name="thumbnail_size">96dip</dimen>
    <dimen name="thumbnail_margin">3dip</dimen>
    <dimen name="thumbnail_margin">3dip</dimen>
    <dimen name="action_item_height">175dip</dimen>
    <dimen name="action_item_height">175dip</dimen>
    <dimen name="touch_circle_size">8dp</dimen>


    <!-- configuration for album set page -->
    <!-- configuration for album set page -->
    <dimen name="album_set_item_image_height">120dp</dimen>
    <dimen name="album_set_item_image_height">120dp</dimen>
+59 −7
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.ColorDrawable;
@@ -164,6 +165,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL


    private Uri mSelectedImageUri = null;
    private Uri mSelectedImageUri = null;


    private ArrayList<Action> mActions = new ArrayList<Action>();
    private UserPresetsManager mUserPresetsManager = null;
    private UserPresetsManager mUserPresetsManager = null;
    private UserPresetsAdapter mUserPresetsAdapter = null;
    private UserPresetsAdapter mUserPresetsAdapter = null;
    private CategoryAdapter mCategoryLooksAdapter = null;
    private CategoryAdapter mCategoryLooksAdapter = null;
@@ -250,7 +252,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
    public void updateUIAfterServiceStarted() {
    public void updateUIAfterServiceStarted() {
        fillCategories();
        fillCategories();
        loadMainPanel();
        loadMainPanel();
        setDefaultPreset();
        extractXMPData();
        extractXMPData();
        processIntent();
        processIntent();
    }
    }
@@ -384,7 +385,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
        setupEditors();
        setupEditors();


        mEditorPlaceHolder.hide();
        mEditorPlaceHolder.hide();
        mImageShow.bindAsImageLoadListener();
        mImageShow.attach();


        setupStatePanel();
        setupStatePanel();
    }
    }
@@ -403,10 +404,27 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
    }
    }


    private void fillVersions() {
    private void fillVersions() {
        if (mCategoryVersionsAdapter != null) {
            mCategoryVersionsAdapter.clear();
        }
        mCategoryVersionsAdapter = new CategoryAdapter(this);
        mCategoryVersionsAdapter = new CategoryAdapter(this);
        mCategoryVersionsAdapter.setShowAddButton(true);
        mCategoryVersionsAdapter.setShowAddButton(true);
    }
    }


    public void registerAction(Action action) {
        if (mActions.contains(action)) {
            return;
        }
        mActions.add(action);
    }

    private void loadActions() {
        for (int i = 0; i < mActions.size(); i++) {
            Action action = mActions.get(i);
            action.setImageFrame(new Rect(0, 0, 96, 96), 0);
        }
    }

    public void updateVersions() {
    public void updateVersions() {
        mCategoryVersionsAdapter.clear();
        mCategoryVersionsAdapter.clear();
        FilterUserPresetRepresentation originalRep = new FilterUserPresetRepresentation(
        FilterUserPresetRepresentation originalRep = new FilterUserPresetRepresentation(
@@ -455,6 +473,9 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
    private void fillEffects() {
    private void fillEffects() {
        FiltersManager filtersManager = FiltersManager.getManager();
        FiltersManager filtersManager = FiltersManager.getManager();
        ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getEffects();
        ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getEffects();
        if (mCategoryFiltersAdapter != null) {
            mCategoryFiltersAdapter.clear();
        }
        mCategoryFiltersAdapter = new CategoryAdapter(this);
        mCategoryFiltersAdapter = new CategoryAdapter(this);
        for (FilterRepresentation representation : filtersRepresentations) {
        for (FilterRepresentation representation : filtersRepresentations) {
            if (representation.getTextId() != 0) {
            if (representation.getTextId() != 0) {
@@ -467,6 +488,9 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
    private void fillTools() {
    private void fillTools() {
        FiltersManager filtersManager = FiltersManager.getManager();
        FiltersManager filtersManager = FiltersManager.getManager();
        ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getTools();
        ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getTools();
        if (mCategoryGeometryAdapter != null) {
            mCategoryGeometryAdapter.clear();
        }
        mCategoryGeometryAdapter = new CategoryAdapter(this);
        mCategoryGeometryAdapter = new CategoryAdapter(this);
        for (FilterRepresentation representation : filtersRepresentations) {
        for (FilterRepresentation representation : filtersRepresentations) {
            mCategoryGeometryAdapter.add(new Action(this, representation));
            mCategoryGeometryAdapter.add(new Action(this, representation));
@@ -549,6 +573,9 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
            }
            }
        }
        }


        if (mCategoryBordersAdapter != null) {
            mCategoryBordersAdapter.clear();
        }
        mCategoryBordersAdapter = new CategoryAdapter(this);
        mCategoryBordersAdapter = new CategoryAdapter(this);
        for (FilterRepresentation representation : borders) {
        for (FilterRepresentation representation : borders) {
            if (representation.getTextId() != 0) {
            if (representation.getTextId() != 0) {
@@ -713,6 +740,11 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
        }
        }
    }
    }


    public void stopLoadingIndicator() {
        final View loading = findViewById(R.id.loading);
        loading.setVisibility(View.GONE);
    }

    private class LoadBitmapTask extends AsyncTask<Uri, Boolean, Boolean> {
    private class LoadBitmapTask extends AsyncTask<Uri, Boolean, Boolean> {
        int mBitmapSize;
        int mBitmapSize;


@@ -764,14 +796,12 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
                Log.v(LOGTAG,"RenderScript context destroyed during load");
                Log.v(LOGTAG,"RenderScript context destroyed during load");
                return;
                return;
            }
            }
            final View loading = findViewById(R.id.loading);
            loading.setVisibility(View.GONE);
            final View imageShow = findViewById(R.id.imageShow);
            final View imageShow = findViewById(R.id.imageShow);
            imageShow.setVisibility(View.VISIBLE);
            imageShow.setVisibility(View.VISIBLE);



            Bitmap largeBitmap = MasterImage.getImage().getOriginalBitmapLarge();
            Bitmap largeBitmap = MasterImage.getImage().getOriginalBitmapLarge();
            mBoundService.setOriginalBitmap(largeBitmap);
            mBoundService.setOriginalBitmap(largeBitmap);
            MasterImage.getImage().resetGeometryImages(true);


            float previewScale = (float) largeBitmap.getWidth()
            float previewScale = (float) largeBitmap.getWidth()
                    / (float) MasterImage.getImage().getOriginalBounds().width();
                    / (float) MasterImage.getImage().getOriginalBounds().width();
@@ -785,13 +815,20 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
            mCategoryFiltersAdapter.imageLoaded();
            mCategoryFiltersAdapter.imageLoaded();
            mLoadBitmapTask = null;
            mLoadBitmapTask = null;


            MasterImage.getImage().warnListeners();
            loadActions();

            if (mOriginalPreset != null) {
            if (mOriginalPreset != null) {
                MasterImage.getImage().setLoadedPreset(mOriginalPreset);
                MasterImage.getImage().setLoadedPreset(mOriginalPreset);
                MasterImage.getImage().setPreset(mOriginalPreset,
                MasterImage.getImage().setPreset(mOriginalPreset,
                        mOriginalPreset.getLastRepresentation(), true);
                        mOriginalPreset.getLastRepresentation(), true);
                mOriginalPreset = null;
                mOriginalPreset = null;
            } else {
                setDefaultPreset();
            }
            }


            MasterImage.getImage().resetGeometryImages(true);

            if (mAction == TINY_PLANET_ACTION) {
            if (mAction == TINY_PLANET_ACTION) {
                showRepresentation(mCategoryFiltersAdapter.getTinyPlanet());
                showRepresentation(mCategoryFiltersAdapter.getTinyPlanet());
            }
            }
@@ -1087,6 +1124,9 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
        FiltersManager filtersManager = FiltersManager.getManager();
        FiltersManager filtersManager = FiltersManager.getManager();
        ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getLooks();
        ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getLooks();


        if (mCategoryLooksAdapter != null) {
            mCategoryLooksAdapter.clear();
        }
        mCategoryLooksAdapter = new CategoryAdapter(this);
        mCategoryLooksAdapter = new CategoryAdapter(this);
        int verticalItemHeight = (int) getResources().getDimension(R.dimen.action_item_height);
        int verticalItemHeight = (int) getResources().getDimension(R.dimen.action_item_height);
        mCategoryLooksAdapter.setItemHeight(verticalItemHeight);
        mCategoryLooksAdapter.setItemHeight(verticalItemHeight);
@@ -1170,8 +1210,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
        if (!mShowingTinyPlanet && (mLoadBitmapTask == null)) {
        if (!mShowingTinyPlanet && (mLoadBitmapTask == null)) {
            mCategoryFiltersAdapter.removeTinyPlanet();
            mCategoryFiltersAdapter.removeTinyPlanet();
        }
        }
        final View loading = findViewById(R.id.loading);
        stopLoadingIndicator();
        loading.setVisibility(View.GONE);
    }
    }


    public void setupMasterImage() {
    public void setupMasterImage() {
@@ -1183,6 +1222,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
        mMasterImage.setHistoryManager(historyManager);
        mMasterImage.setHistoryManager(historyManager);
        mMasterImage.setStateAdapter(imageStateAdapter);
        mMasterImage.setStateAdapter(imageStateAdapter);
        mMasterImage.setActivity(this);
        mMasterImage.setActivity(this);
        mMasterImage.setFirstLoad(true);


        if (Runtime.getRuntime().maxMemory() > LIMIT_SUPPORTS_HIGHRES) {
        if (Runtime.getRuntime().maxMemory() > LIMIT_SUPPORTS_HIGHRES) {
            mMasterImage.setSupportsHighRes(true);
            mMasterImage.setSupportsHighRes(true);
@@ -1374,11 +1414,23 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
        return super.dispatchTouchEvent(ev);
        return super.dispatchTouchEvent(ev);
    }
    }


    public Point mHintTouchPoint = new Point();

    public Point hintTouchPoint(View view) {
        int location[] = new int[2];
        view.getLocationOnScreen(location);
        int x = mHintTouchPoint.x - location[0];
        int y = mHintTouchPoint.y - location[1];
        return new Point(x, y);
    }

    public void startTouchAnimation(View target, float x, float y) {
    public void startTouchAnimation(View target, float x, float y) {
        final CategorySelected hint =
        final CategorySelected hint =
                (CategorySelected) findViewById(R.id.categorySelectedIndicator);
                (CategorySelected) findViewById(R.id.categorySelectedIndicator);
        int location[] = new int[2];
        int location[] = new int[2];
        target.getLocationOnScreen(location);
        target.getLocationOnScreen(location);
        mHintTouchPoint.x = (int) (location[0] + x);
        mHintTouchPoint.y = (int) (location[1] + y);
        int locationHint[] = new int[2];
        int locationHint[] = new int[2];
        ((View)hint.getParent()).getLocationOnScreen(locationHint);
        ((View)hint.getParent()).getLocationOnScreen(locationHint);
        int dx = (int) (x - (hint.getWidth())/2);
        int dx = (int) (x - (hint.getWidth())/2);
Loading