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

Commit e94e7663 authored by Jack Yoo's avatar Jack Yoo Committed by Linux Build Service Account
Browse files

Gallery2: Adjusting TrueScanner UI interaction

To make it work with new UI frame.

Change-Id: Ib538d7921835c0f5231d3f4fba18dd9c8e4f35b4
CRs-Fixed: 1020968
parent 98e2574f
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
<!--
  Copyright (c) 2016, The Linux Foundation. All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are
  met:
      * Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
      * Redistributions in binary form must reproduce the above
        copyright notice, this list of conditions and the following
        disclaimer in the documentation and/or other materials provided
        with the distribution.
      * Neither the name of The Linux Foundation nor the names of its
        contributors may be used to endorse or promote products derived
        from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="75.9dp"
    android:height="45.9dp"
    android:viewportWidth="75.9"
    android:viewportHeight="45.9">

    <path
        android:fillColor="#E2E2E2"
        android:pathData="M58.3,35.8H15.6c-7.7,0-14.1-6.3-14.1-14.1v0C1.5,14,7.8,7.7,15.6,7.7h42.7c7.7,0,14.1,6.3,14.1,14.1v0
C72.3,29.5,66,35.8,58.3,35.8z" />
    <path
        android:fillColor="#E2E2E2"
        android:pathData="M 21.2 2 C 32.1352380466 2 41 10.8647619534 41 21.8 C 41 32.7352380466 32.1352380466 41.6 21.2 41.6 C 10.2647619534 41.6 1.4 32.7352380466 1.4 21.8 C 1.4 10.8647619534 10.2647619534 2 21.2 2 Z" />
</vector>
+42 −0
Original line number Diff line number Diff line
<!--
  Copyright (c) 2016, The Linux Foundation. All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are
  met:
      * Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
      * Redistributions in binary form must reproduce the above
        copyright notice, this list of conditions and the following
        disclaimer in the documentation and/or other materials provided
        with the distribution.
      * Neither the name of The Linux Foundation nor the names of its
        contributors may be used to endorse or promote products derived
        from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="75.9dp"
    android:height="45.9dp"
    android:viewportWidth="75.9"
    android:viewportHeight="45.9">

    <path
        android:fillColor="#9CC2E7"
        android:pathData="M58.3,35.8H15.6c-7.7,0-14.1-6.3-14.1-14.1v0C1.5,14,7.8,7.7,15.6,7.7h42.7c7.7,0,14.1,6.3,14.1,14.1v0
C72.3,29.5,66,35.8,58.3,35.8z" />
    <path
        android:fillColor="#5E92CD"
        android:pathData="M 52.2 2 C 63.1352380466 2 72 10.8647619534 72 21.8 C 72 32.7352380466 63.1352380466 41.6 52.2 41.6 C 41.2647619534 41.6 32.4 32.7352380466 32.4 21.8 C 32.4 10.8647619534 41.2647619534 2 52.2 2 Z" />
</vector>
+2 −0
Original line number Diff line number Diff line
@@ -1189,6 +1189,8 @@ CHAR LIMIT = NONE] -->
    <string name="drawer_desc" translatable="false">drawer</string>
    <string name="truescanner_normal">Normal</string>
    <string name="truescanner_white">WhiteBoard</string>
    <string name="truescanner">TrueScanner</string>
    <string name="truescanner_remove_glare">Remove Glare</string>
    <string name="hazebuster_acts">Haze Buster</string>
    <string name="seestraight_acts">See Straight</string>
    <string name="seestraight_input_image_is_small">Input image is too small to process.</string>
+18 −2
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ import com.android.gallery3d.filtershow.category.EditorCropPanel;
import com.android.gallery3d.filtershow.category.MainPanel;
import com.android.gallery3d.filtershow.category.StraightenPanel;
import com.android.gallery3d.filtershow.category.SwipableView;
import com.android.gallery3d.filtershow.category.TrueScannerPanel;
import com.android.gallery3d.filtershow.data.UserPresetsManager;
import com.android.gallery3d.filtershow.editors.BasicEditor;
import com.android.gallery3d.filtershow.editors.Editor;
@@ -410,6 +411,22 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
            }.run();
            return;
        }
        if (currentId == TrueScannerEditor.ID) {
            new Runnable() {
                @Override
                public void run() {
                    TrueScannerPanel panel = new TrueScannerPanel();
                    FragmentTransaction transaction =
                            getSupportFragmentManager().beginTransaction();
                    transaction.remove(getSupportFragmentManager().findFragmentByTag(
                            MainPanel.FRAGMENT_TAG));
                    transaction.replace(R.id.main_panel_container, panel,
                            MainPanel.FRAGMENT_TAG);
                    transaction.commit();
                }
            }.run();
            return;
        }
        Runnable showEditor = new Runnable() {
            @Override
            public void run() {
@@ -444,8 +461,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
    }

    private boolean useStraightenPanel(int EditorID) {
        return (EditorID == EditorStraighten.ID || EditorID == TrueScannerEditor.ID
                || EditorID == HazeBusterEditor.ID || EditorID == SeeStraightEditor.ID);
        return (EditorID == EditorStraighten.ID || EditorID == HazeBusterEditor.ID || EditorID == SeeStraightEditor.ID);
    }

    public void leaveSeekBarPanel() {
+97 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.

 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *     * Neither the name of The Linux Foundation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.

 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.android.gallery3d.filtershow.category;


import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.support.annotation.Nullable;
import com.android.gallery3d.filtershow.FilterShowActivity;
import com.android.gallery3d.filtershow.editors.TrueScannerEditor;

import org.codeaurora.gallery.R;

public class TrueScannerPanel extends BasicGeometryPanel {
    private TrueScannerEditor mTrueScannerEditor;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        FilterShowActivity filterShowActivity = (FilterShowActivity) activity;
        mTrueScannerEditor = (TrueScannerEditor) filterShowActivity.getEditor(TrueScannerEditor.ID);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mEditorName.setText(R.string.truescanner);

        mBottomPanel.setVisibility(View.VISIBLE);
        mTrueScannerEditor.initCords();
        final FilterShowActivity activity = (FilterShowActivity) getActivity();
        mExitButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                activity.cancelCurrentFilter();
                activity.backToMain();
                activity.setActionBar();
            }
        });
        mApplyButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mTrueScannerEditor.finalApplyCalled();
                activity.backToMain();
                activity.setActionBar();
            }
        });
    }

    @Override
    protected void initPanels() {
        super.initPanels();
        int size = mPanels.length;
        for (int i = 0; i < size; i++) {
            View view = mPanels[i];
            view.setVisibility(View.GONE);
        }
    }

    @Override
    public void onDetach() {
        if (mTrueScannerEditor != null) {
            mTrueScannerEditor.detach();
        }
        super.onDetach();
    }

}
Loading