summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-03-19 14:21:17 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-03-19 14:21:17 -0700
commit7e7035eaf5d8d8a72f5f61f05beb79b842e4f358 (patch)
tree87c85d50f5887d061492d76eeeb8e34546d96f6c /src
parent44fbc491a8209552a79eb34c30d4482e2d962868 (diff)
parent38478f2cfc651b58dd88274c9a3bb7526c91116b (diff)
downloadandroid_packages_apps_Gallery2-7e7035eaf5d8d8a72f5f61f05beb79b842e4f358.zip
android_packages_apps_Gallery2-7e7035eaf5d8d8a72f5f61f05beb79b842e4f358.tar.gz
android_packages_apps_Gallery2-7e7035eaf5d8d8a72f5f61f05beb79b842e4f358.tar.bz2
Merge "Modify:Gallery2 for branch Gallery2"
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java46
-rw-r--r--src/com/android/gallery3d/filtershow/category/CategoryAdapter.java3
-rw-r--r--src/com/android/gallery3d/filtershow/category/CategoryPanel.java11
-rw-r--r--src/com/android/gallery3d/filtershow/category/MainPanel.java41
-rw-r--r--src/com/android/gallery3d/filtershow/editors/EditorPanel.java2
-rw-r--r--src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java21
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java1
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageShow.java2
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/MasterImage.java4
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java2
10 files changed, 124 insertions, 9 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index f001177..67fd3fe 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -84,6 +84,7 @@ import com.android.gallery3d.filtershow.editors.EditorColorBorder;
import com.android.gallery3d.filtershow.editors.EditorCrop;
import com.android.gallery3d.filtershow.editors.EditorDraw;
import com.android.gallery3d.filtershow.editors.EditorGrad;
+import com.android.gallery3d.filtershow.editors.EditorMakeup;
import com.android.gallery3d.filtershow.editors.EditorManager;
import com.android.gallery3d.filtershow.editors.EditorMirror;
import com.android.gallery3d.filtershow.editors.EditorPanel;
@@ -100,6 +101,7 @@ import com.android.gallery3d.filtershow.filters.FilterStraightenRepresentation;
import com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation;
import com.android.gallery3d.filtershow.filters.FiltersManager;
import com.android.gallery3d.filtershow.filters.ImageFilter;
+import com.android.gallery3d.filtershow.filters.SimpleMakeupImageFilter;
import com.android.gallery3d.filtershow.history.HistoryItem;
import com.android.gallery3d.filtershow.history.HistoryManager;
import com.android.gallery3d.filtershow.imageshow.ImageShow;
@@ -120,6 +122,7 @@ import com.android.gallery3d.filtershow.ui.ExportDialog;
import com.android.gallery3d.filtershow.ui.FramedTextButton;
import com.android.gallery3d.util.GalleryUtils;
import com.android.photos.data.GalleryBitmapPool;
+import com.thundersoft.hz.selfportrait.makeup.engine.MakeupEngine;
import java.io.File;
import java.io.FileDescriptor;
@@ -178,6 +181,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
private CategoryAdapter mCategoryGeometryAdapter = null;
private CategoryAdapter mCategoryFiltersAdapter = null;
private CategoryAdapter mCategoryVersionsAdapter = null;
+ private CategoryAdapter mCategoryMakeupAdapter = null;
private int mCurrentPanel = MainPanel.LOOKS;
private Vector<FilterUserPresetRepresentation> mVersions =
new Vector<FilterUserPresetRepresentation>();
@@ -380,6 +384,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
fillTools();
fillEffects();
fillVersions();
+ fillMakeup();
}
public void setupStatePanel() {
@@ -468,6 +473,25 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
}
+ private void fillMakeup() {
+ if(!SimpleMakeupImageFilter.HAS_TS_MAKEUP) {
+ return;
+ }
+
+ FiltersManager filtersManager = FiltersManager.getManager();
+ ArrayList<FilterRepresentation> makeups = filtersManager.getMakeup();
+ if (mCategoryMakeupAdapter != null) {
+ mCategoryMakeupAdapter.clear();
+ }
+ mCategoryMakeupAdapter = new CategoryAdapter(this);
+ for (FilterRepresentation makeup : makeups) {
+ if (makeup.getTextId() != 0) {
+ makeup.setName(getString(makeup.getTextId()));
+ }
+ mCategoryMakeupAdapter.add(new Action(this, makeup));
+ }
+ }
+
private void fillTools() {
FiltersManager filtersManager = FiltersManager.getManager();
ArrayList<FilterRepresentation> filtersRepresentations = filtersManager.getTools();
@@ -529,6 +553,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
mEditorPlaceHolder.addEditor(new EditorMirror());
mEditorPlaceHolder.addEditor(new EditorRotate());
mEditorPlaceHolder.addEditor(new EditorStraighten());
+ mEditorPlaceHolder.addEditor(new EditorMakeup());
}
private void setDefaultValues() {
@@ -583,6 +608,10 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
return mCategoryBordersAdapter;
}
+ public CategoryAdapter getCategoryMakeupAdapter() {
+ return mCategoryMakeupAdapter;
+ }
+
public CategoryAdapter getCategoryGeometryAdapter() {
return mCategoryGeometryAdapter;
}
@@ -736,16 +765,16 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
MasterImage master = MasterImage.getImage();
Rect originalBounds = master.getOriginalBounds();
if (master.supportsHighRes()) {
- int highresPreviewSize = master.getOriginalBitmapLarge().getWidth() * 2;
- if (highresPreviewSize > originalBounds.width()) {
- highresPreviewSize = originalBounds.width();
- }
+ int highresPreviewSize = Math.min(MasterImage.MAX_BITMAP_DIM, getScreenImageSize());
+ Log.d(LOGTAG, "FilterShowActivity.LoadHighresBitmapTask.doInBackground(): after, highresPreviewSize is " + highresPreviewSize);
Rect bounds = new Rect();
Bitmap originalHires = ImageLoader.loadOrientedConstrainedBitmap(master.getUri(),
master.getActivity(), highresPreviewSize,
master.getOrientation(), bounds);
master.setOriginalBounds(bounds);
master.setOriginalBitmapHighres(originalHires);
+ Log.d(LOGTAG, "FilterShowActivity.LoadHighresBitmapTask.doInBackground(): originalHires.WH is (" + originalHires.getWidth()
+ + ", " + originalHires.getHeight() +"), bounds is " + bounds.toString());
mBoundService.setOriginalBitmapHighres(originalHires);
master.warnListeners();
}
@@ -758,6 +787,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
if (highresBitmap != null) {
float highResPreviewScale = (float) highresBitmap.getWidth()
/ (float) MasterImage.getImage().getOriginalBounds().width();
+ Log.d(LOGTAG, "FilterShowActivity.LoadHighresBitmapTask.onPostExecute(): highResPreviewScale is " + highResPreviewScale);
mBoundService.setHighresPreviewScaleFactor(highResPreviewScale);
}
MasterImage.getImage().warnListeners();
@@ -785,6 +815,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
public LoadBitmapTask() {
mBitmapSize = getScreenImageSize();
+ Log.d(LOGTAG, "FilterShowActivity.LoadBtimapTask(): mBitmapSize is " + mBitmapSize);
}
@Override
@@ -841,6 +872,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
float previewScale = (float) largeBitmap.getWidth()
/ (float) MasterImage.getImage().getOriginalBounds().width();
+ Log.d(LOGTAG, "FilterShowActivity.LoadBitmapTask.onPostExecute(): previewScale is " + previewScale);
mBoundService.setPreviewScaleFactor(previewScale);
if (!mShowingTinyPlanet) {
mCategoryFiltersAdapter.removeTinyPlanet();
@@ -849,6 +881,9 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
mCategoryBordersAdapter.imageLoaded();
mCategoryGeometryAdapter.imageLoaded();
mCategoryFiltersAdapter.imageLoaded();
+ if(mCategoryMakeupAdapter != null) {
+ mCategoryMakeupAdapter.imageLoaded();
+ }
mLoadBitmapTask = null;
MasterImage.getImage().warnListeners();
@@ -1022,6 +1057,9 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
if (mShareActionProvider != null) {
mShareActionProvider.setOnShareTargetSelectedListener(this);
}
+ if(SimpleMakeupImageFilter.HAS_TS_MAKEUP) {
+ MakeupEngine.getMakeupObj().setContext(getBaseContext());
+ }
}
@Override
diff --git a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
index 09f02dd..50f0e94 100644
--- a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
+++ b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
@@ -79,6 +79,9 @@ public class CategoryAdapter extends ArrayAdapter<Action> {
mSelectedPosition = 0;
mAddButtonText = getContext().getString(R.string.filtershow_add_button_looks);
}
+// if (category == MainPanel.MAKEUP) {
+// mSelectedPosition = 0;
+// }
if (category == MainPanel.BORDERS) {
mSelectedPosition = 0;
}
diff --git a/src/com/android/gallery3d/filtershow/category/CategoryPanel.java b/src/com/android/gallery3d/filtershow/category/CategoryPanel.java
index fb51bf5..66b352f 100644
--- a/src/com/android/gallery3d/filtershow/category/CategoryPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/CategoryPanel.java
@@ -29,7 +29,7 @@ import android.widget.ListView;
import android.widget.TextView;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.FilterShowActivity;
-
+import android.util.Log;
public class CategoryPanel extends Fragment implements View.OnClickListener {
public static final String FRAGMENT_TAG = "CategoryPanel";
@@ -89,6 +89,13 @@ public class CategoryPanel extends Fragment implements View.OnClickListener {
}
break;
}
+ case MainPanel.MAKEUP: {
+ mAdapter = activity.getCategoryMakeupAdapter();
+ if (mAdapter != null) {
+ mAdapter.initializeSelection(MainPanel.MAKEUP);
+ }
+ break;
+ }
}
updateAddButtonVisibility();
}
@@ -148,7 +155,7 @@ public class CategoryPanel extends Fragment implements View.OnClickListener {
return;
}
FilterShowActivity activity = (FilterShowActivity) getActivity();
- if (activity.isShowingImageStatePanel() && mAdapter.showAddButton()) {
+ if (activity.isShowingImageStatePanel() && mAdapter != null && mAdapter.showAddButton()) {
mAddButton.setVisibility(View.VISIBLE);
if (mAdapter != null) {
mAddButton.setText(mAdapter.getAddButtonText());
diff --git a/src/com/android/gallery3d/filtershow/category/MainPanel.java b/src/com/android/gallery3d/filtershow/category/MainPanel.java
index 082bf14..1dbe420 100644
--- a/src/com/android/gallery3d/filtershow/category/MainPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/MainPanel.java
@@ -24,9 +24,10 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.LinearLayout;
-
+import android.util.Log;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.FilterShowActivity;
+import com.android.gallery3d.filtershow.filters.SimpleMakeupImageFilter;
import com.android.gallery3d.filtershow.imageshow.MasterImage;
import com.android.gallery3d.filtershow.state.StatePanel;
@@ -39,6 +40,7 @@ public class MainPanel extends Fragment {
private ImageButton bordersButton;
private ImageButton geometryButton;
private ImageButton filtersButton;
+ private ImageButton makeupButton;
public static final String FRAGMENT_TAG = "MainPanel";
public static final int LOOKS = 0;
@@ -46,6 +48,7 @@ public class MainPanel extends Fragment {
public static final int GEOMETRY = 2;
public static final int FILTERS = 3;
public static final int VERSIONS = 4;
+ public static final int MAKEUP = 5;
private int mCurrentSelected = -1;
private int mPreviousToggleVersions = -1;
@@ -72,6 +75,12 @@ public class MainPanel extends Fragment {
filtersButton.setSelected(value);
break;
}
+ case MAKEUP: {
+ if(makeupButton != null) {
+ makeupButton.setSelected(value);
+ }
+ break;
+ }
}
}
@@ -97,6 +106,19 @@ public class MainPanel extends Fragment {
bordersButton = (ImageButton) mMainView.findViewById(R.id.borderButton);
geometryButton = (ImageButton) mMainView.findViewById(R.id.geometryButton);
filtersButton = (ImageButton) mMainView.findViewById(R.id.colorsButton);
+ if(SimpleMakeupImageFilter.HAS_TS_MAKEUP) {
+ makeupButton = (ImageButton) mMainView.findViewById(R.id.makeupButton);
+ makeupButton.setVisibility(View.VISIBLE);
+ }
+
+ if(makeupButton != null) {
+ makeupButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showPanel(MAKEUP);
+ }
+ });
+ }
looksButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -173,6 +195,19 @@ public class MainPanel extends Fragment {
selection(mCurrentSelected, true);
}
+ public void loadCategoryMakeupPanel() {
+ if (makeupButton == null || mCurrentSelected == MAKEUP) {
+ return;
+ }
+ boolean fromRight = isRightAnimation(MAKEUP);
+ selection(mCurrentSelected, false);
+ CategoryPanel categoryPanel = new CategoryPanel();
+ categoryPanel.setAdapter(MAKEUP);
+ setCategoryFragment(categoryPanel, fromRight);
+ mCurrentSelected = MAKEUP;
+ selection(mCurrentSelected, true);
+ }
+
public void loadCategoryGeometryPanel() {
if (mCurrentSelected == GEOMETRY) {
return;
@@ -239,6 +274,10 @@ public class MainPanel extends Fragment {
loadCategoryVersionsPanel();
break;
}
+ case MAKEUP: {
+ loadCategoryMakeupPanel();
+ break;
+ }
}
}
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorPanel.java b/src/com/android/gallery3d/filtershow/editors/EditorPanel.java
index a60b672..0581835 100644
--- a/src/com/android/gallery3d/filtershow/editors/EditorPanel.java
+++ b/src/com/android/gallery3d/filtershow/editors/EditorPanel.java
@@ -20,6 +20,7 @@ import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -50,6 +51,7 @@ public class EditorPanel extends Fragment {
super.onAttach(activity);
FilterShowActivity filterShowActivity = (FilterShowActivity) activity;
mEditor = filterShowActivity.getEditor(mEditorID);
+ Log.d(LOGTAG, "EditorPanle.onAttach(): mEditorID is " + mEditorID + ", mEditor is " + mEditor);
}
public void cancelCurrentFilter() {
diff --git a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
index 8350ff3..e93175a 100644
--- a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
+++ b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java
@@ -36,6 +36,7 @@ public abstract class BaseFiltersManager implements FiltersManagerInterface {
protected ArrayList<FilterRepresentation> mBorders = new ArrayList<FilterRepresentation>();
protected ArrayList<FilterRepresentation> mTools = new ArrayList<FilterRepresentation>();
protected ArrayList<FilterRepresentation> mEffects = new ArrayList<FilterRepresentation>();
+ protected ArrayList<FilterRepresentation> mMakeup = new ArrayList<FilterRepresentation>();
private static int mImageBorderSize = 4; // in percent
protected void init() {
@@ -140,6 +141,12 @@ public abstract class BaseFiltersManager implements FiltersManagerInterface {
filters.add(ImageFilterFx.class);
filters.add(ImageFilterBorder.class);
filters.add(ImageFilterColorBorder.class);
+ if(SimpleMakeupImageFilter.HAS_TS_MAKEUP) {
+ filters.add(ImageFilterMakeupWhiten.class);
+ filters.add(ImageFilterMakeupSoften.class);
+ filters.add(ImageFilterMakeupTrimface.class);
+ filters.add(ImageFilterMakeupBigeye.class);
+ }
}
public ArrayList<FilterRepresentation> getLooks() {
@@ -158,8 +165,11 @@ public abstract class BaseFiltersManager implements FiltersManagerInterface {
return mEffects;
}
- public void addBorders(Context context) {
+ public ArrayList<FilterRepresentation> getMakeup() {
+ return mMakeup;
+ }
+ public void addBorders(Context context) {
// Do not localize
String[] serializationNames = {
"FRAME_4X5",
@@ -305,6 +315,15 @@ public abstract class BaseFiltersManager implements FiltersManagerInterface {
mEffects.add(getRepresentation(ImageFilterKMeans.class));
}
+ public void addMakeups(Context context) {
+ if(SimpleMakeupImageFilter.HAS_TS_MAKEUP) {
+ mMakeup.add(getRepresentation(ImageFilterMakeupWhiten.class));
+ mMakeup.add(getRepresentation(ImageFilterMakeupSoften.class));
+ mMakeup.add(getRepresentation(ImageFilterMakeupTrimface.class));
+ mMakeup.add(getRepresentation(ImageFilterMakeupBigeye.class));
+ }
+ }
+
public void addTools(Context context) {
int[] textId = {
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
index 0fb157d..36675b7 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
@@ -47,6 +47,7 @@ public class FilterRepresentation {
public static final byte TYPE_NORMAL = 5;
public static final byte TYPE_TINYPLANET = 6;
public static final byte TYPE_GEOMETRY = 7;
+ public static final byte TYPE_MAKEUP = 8;
protected static final String NAME_TAG = "Name";
public FilterRepresentation(String name) {
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java b/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
index 2022ffd..d7c2eb4 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
@@ -288,7 +288,7 @@ public class ImageShow extends View implements OnGestureListener,
drawImageAndAnimate(canvas, highresPreview);
}
- drawHighresImage(canvas, fullHighres);
+// drawHighresImage(canvas, fullHighres);
drawCompareImage(canvas, getGeometryOnlyImage());
canvas.restore();
diff --git a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
index 4b43d76..5e27f42 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
@@ -25,6 +25,7 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.net.Uri;
+import android.util.Log;
import com.android.gallery3d.exif.ExifTag;
import com.android.gallery3d.filtershow.FilterShowActivity;
@@ -211,6 +212,9 @@ public class MasterImage implements RenderingRequestCaller {
int sh = (int) (sw * (float) mOriginalBitmapLarge.getHeight() / mOriginalBitmapLarge
.getWidth());
mOriginalBitmapSmall = Bitmap.createScaledBitmap(mOriginalBitmapLarge, sw, sh, true);
+ Log.d(LOGTAG, "MasterImage.loadBitmap(): OriginalBitmapLarge.WH is (" + mOriginalBitmapLarge.getWidth() + ", "
+ + mOriginalBitmapLarge.getHeight() + "), OriginalBitmapSmall.WH is (" + sw + ", " + sh + "), originalBounds is "
+ + originalBounds.toString());
mZoomOrientation = mOrientation;
warnListeners();
return true;
diff --git a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
index e5736d4..e334e87 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
@@ -304,12 +304,14 @@ public class ProcessingService extends Service {
filtersManager.addBorders(this);
filtersManager.addTools(this);
filtersManager.addEffects();
+ filtersManager.addMakeups(this);
FiltersManager highresFiltersManager = FiltersManager.getHighresManager();
highresFiltersManager.addLooks(this);
highresFiltersManager.addBorders(this);
highresFiltersManager.addTools(this);
highresFiltersManager.addEffects();
+// highresFiltersManager.addMakeups(this);
}
private void tearDownPipeline() {