blob: e01436d7ab7da17a976b5e0fe253ffa70311e7d8 [file] [log] [blame]
Bjorn Bringert1307f632013-10-03 22:31:03 +01001package com.android.launcher3;
2
3import android.content.ComponentName;
4import android.text.TextUtils;
5import android.util.Log;
6
7public abstract class AppFilter {
8
9 private static final boolean DBG = false;
10 private static final String TAG = "AppFilter";
11
12 public abstract boolean shouldShowApp(ComponentName app);
13
14 public static AppFilter loadByName(String className) {
15 if (TextUtils.isEmpty(className)) return null;
16 if (DBG) Log.d(TAG, "Loading AppFilter: " + className);
17 try {
18 Class<?> cls = Class.forName(className);
19 return (AppFilter) cls.newInstance();
20 } catch (ClassNotFoundException e) {
21 Log.e(TAG, "Bad AppFilter class", e);
22 return null;
23 } catch (InstantiationException e) {
24 Log.e(TAG, "Bad AppFilter class", e);
25 return null;
26 } catch (IllegalAccessException e) {
27 Log.e(TAG, "Bad AppFilter class", e);
28 return null;
29 } catch (ClassCastException e) {
30 Log.e(TAG, "Bad AppFilter class", e);
31 return null;
32 }
33 }
34
35}