diff options
Diffstat (limited to 'src/com/android/gallery3d/filtershow/FilterShowActivity.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index f00117702..67fd3fe32 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 |