summaryrefslogtreecommitdiff
path: root/android/experimental/LOAndroid3/src/java/org/libreoffice/ViewFactory.java
blob: c26ad222e0d984840a4c6fae94bc3a70f8aabd00 (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
package org.libreoffice;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;

import org.mozilla.gecko.gfx.LayerView;

public class ViewFactory implements LayoutInflater.Factory {
    private static final String LOGTAG = ViewFactory.class.getSimpleName();
    private static final String LAYER_VIEW_ID = "org.mozilla.gecko.gfx.LayerView";
    private static final ViewFactory INSTANCE = new ViewFactory();

    private ViewFactory() {
    }

    public static LayoutInflater.Factory getInstance() {
        return INSTANCE;
    }

    @Override
    public View onCreateView(String name, Context context, AttributeSet attrs) {
        if (name.equals(LAYER_VIEW_ID)) {
            Log.i(LOGTAG, "Creating custom Gecko view: " + name);
            return new LayerView(context, attrs);
        }

        return null;
    }
}