summaryrefslogtreecommitdiffstats
path: root/RemoteFolder/src/com/android/launcher3/RemoteFolderUpdater.java
blob: 954595e1fabf137182fcd9523323eacdd10779a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.android.launcher3;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.view.View;
import java.util.List;
import android.util.Log;

public class RemoteFolderUpdater {

    private static final String TAG = "RemoteFolderUpdater";

    private static final Object sLock = new Object();
    private static RemoteFolderUpdater sInstance;

    public interface RemoteFolderUpdateListener {
        void onSuccess(List<RemoteFolderInfo> remoteFolderInfoList);
        void onFailure(String error);
    }

    public static RemoteFolderUpdater getInstance() {
        synchronized (sLock) {
            if (sInstance == null) {
                sInstance = new RemoteFolderUpdater();
            }

            return sInstance;
        }
    }

    private RemoteFolderUpdater() { }

    /**
     * Requests data needed by remote folders.
     * @param context
     * @param size
     * @param listener
     */
    public synchronized void requestSync(Context context, final int size, final RemoteFolderUpdateListener listener) {
        if (listener != null) {
            listener.onFailure("RemoteFolderUpdater may not have been properly setup");
        }
    }

    /**
     * Register a callback to track clicks on our individual Remote Folder items. Make sure the
     * intent associated with each item has a unique ID.
     *
     * @param view The individual item the user may click (or just clicked)
     * @param intent The intent associated with the ShortcutInfo that belongs to our view
     */
    public void registerViewForInteraction(View view, Intent intent) {
        Log.e(TAG, "Couldn't register view for user interaction, RemoteFolderUpdater may not have been properly setup");
    }

    /**
     * Holds important information that the launcher will need for each item in the remote folder.
     */
    public class RemoteFolderInfo {

        public void setRecommendationData(View view) {
            return;
        }

        public String getTitle() {
            return null;
        }

        public Bitmap getIcon() {
            return null;
        }

        public String getIconUrl() {
            return null;
        }

        public Intent getIntent() {
            return null;
        }
    }

}