Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QtEmbeddedViewInterfaceFactory.java
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4package org.qtproject.qt.android;
5
6import android.content.Context;
7import android.app.Activity;
8import android.app.Service;
9
10import java.util.HashMap;
11
12class QtEmbeddedViewInterfaceFactory {
13 private static final HashMap<Context, QtEmbeddedViewInterface> m_interfaces = new HashMap<>();
14 private static final Object m_interfaceLock = new Object();
15
16 static QtEmbeddedViewInterface create(Context context) {
17 synchronized (m_interfaceLock) {
18 if (!m_interfaces.containsKey(context)) {
19 if (context instanceof Activity)
20 m_interfaces.put(context, new QtEmbeddedDelegate((Activity)context));
21 else if (context instanceof Service)
22 m_interfaces.put(context, new QtServiceEmbeddedDelegate((Service)context));
23 }
24
25 return m_interfaces.get(context);
26 }
27 }
28
29 static void remove(Context context) {
30 synchronized (m_interfaceLock) {
31 m_interfaces.remove(context);
32 }
33 }
34}
QPainter Context
static const QString context()
Definition java.cpp:398
view create()