1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.gallery3d.filtershow.filters; 18 19 import android.content.Context; 20 import android.content.res.Resources; 21 import android.graphics.Color; 22 23 import com.android.gallery3d.R; 24 25 import java.util.ArrayList; 26 import java.util.HashMap; 27 import java.util.Vector; 28 29 public class FiltersManager extends BaseFiltersManager { 30 private static FiltersManager sInstance = null; 31 private static FiltersManager sPreviewInstance = null; 32 private static FiltersManager sHighresInstance = null; 33 FiltersManager()34 public FiltersManager() { 35 init(); 36 } 37 getPreviewManager()38 public static FiltersManager getPreviewManager() { 39 if (sPreviewInstance == null) { 40 sPreviewInstance = new FiltersManager(); 41 } 42 return sPreviewInstance; 43 } 44 getManager()45 public static FiltersManager getManager() { 46 if (sInstance == null) { 47 sInstance = new FiltersManager(); 48 } 49 return sInstance; 50 } 51 getHighresManager()52 public static FiltersManager getHighresManager() { 53 if (sHighresInstance == null) { 54 sHighresInstance = new FiltersManager(); 55 } 56 return sHighresInstance; 57 } 58 reset()59 public static void reset() { 60 sInstance = null; 61 sPreviewInstance = null; 62 sHighresInstance = null; 63 } 64 setResources(Resources resources)65 public static void setResources(Resources resources) { 66 FiltersManager.getManager().setFilterResources(resources); 67 FiltersManager.getPreviewManager().setFilterResources(resources); 68 FiltersManager.getHighresManager().setFilterResources(resources); 69 } 70 } 71