Android: Remove support for API < 16
Starting with Qt 5.7 we removed support for API < 16 (Android v4.1) [ChangeLog][Android] Support for Android API < 16 was removed. Change-Id: I8bf396a9d70ab0996965e0c9f629800aa1fa6a45 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
parent
53697fe078
commit
e3689949ba
@ -1,2 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = jar
|
@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0"
|
||||
package="org.qtproject.qt5.android.accessibility">
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
</manifest>
|
@ -1,3 +0,0 @@
|
||||
TARGET = QtAndroidAccessibility-bundled
|
||||
CONFIG += bundled_jar_file
|
||||
include(jar.pri)
|
@ -1,2 +0,0 @@
|
||||
TARGET = QtAndroidAccessibility
|
||||
include(jar.pri)
|
@ -1,15 +0,0 @@
|
||||
CONFIG += java
|
||||
DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar
|
||||
API_VERSION = android-16
|
||||
|
||||
PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/accessibility
|
||||
|
||||
JAVACLASSPATH += $$PWD/src/ \
|
||||
$$DESTDIR/QtAndroid-bundled.jar
|
||||
JAVASOURCES += \
|
||||
$$PATHPREFIX/QtAccessibilityDelegate.java \
|
||||
$$PATHPREFIX/QtNativeAccessibility.java
|
||||
|
||||
# install
|
||||
target.path = $$[QT_INSTALL_PREFIX]/jar
|
||||
INSTALLS += target
|
@ -1,2 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += bundledjar.pro distributedjar.pro
|
@ -1,3 +1,3 @@
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
SUBDIRS = jar java templates accessibility
|
||||
SUBDIRS = jar java templates
|
||||
|
@ -6,6 +6,8 @@ PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/
|
||||
|
||||
JAVACLASSPATH += $$PWD/src/
|
||||
JAVASOURCES += \
|
||||
$$PATHPREFIX/accessibility/QtAccessibilityDelegate.java \
|
||||
$$PATHPREFIX/accessibility/QtNativeAccessibility.java \
|
||||
$$PATHPREFIX/QtActivityDelegate.java \
|
||||
$$PATHPREFIX/QtEditText.java \
|
||||
$$PATHPREFIX/QtInputConnection.java \
|
||||
@ -14,9 +16,7 @@ JAVASOURCES += \
|
||||
$$PATHPREFIX/QtNative.java \
|
||||
$$PATHPREFIX/QtNativeLibrariesDir.java \
|
||||
$$PATHPREFIX/QtSurface.java \
|
||||
$$PATHPREFIX/ExtractStyle.java \
|
||||
$$PATHPREFIX/QtPopupMenu.java \
|
||||
$$PATHPREFIX/QtPopupMenu14.java
|
||||
$$PATHPREFIX/ExtractStyle.java
|
||||
|
||||
# install
|
||||
target.path = $$[QT_INSTALL_PREFIX]/jar
|
||||
|
@ -1813,11 +1813,7 @@ public class ExtractStyle {
|
||||
jsonWriter.name("simple_spinner_item").value(extractItemStyle(android.R.layout.simple_spinner_item, "simple_spinner_item", -1));
|
||||
jsonWriter.name("simple_spinner_dropdown_item").value(extractItemStyle(android.R.layout.simple_spinner_dropdown_item, "simple_spinner_dropdown_item",android.R.style.TextAppearance_Large));
|
||||
jsonWriter.name("simple_dropdown_item_1line").value(extractItemStyle(android.R.layout.simple_dropdown_item_1line, "simple_dropdown_item_1line",android.R.style.TextAppearance_Large));
|
||||
if (Build.VERSION.SDK_INT > 10) {
|
||||
Class<?> layoutClass = Class.forName("android.R$layout");
|
||||
int styleId = layoutClass.getDeclaredField("simple_selectable_list_item").getInt(null);
|
||||
jsonWriter.name("simple_selectable_list_item").value(extractItemStyle(styleId, "simple_selectable_list_item",android.R.style.TextAppearance_Large));
|
||||
}
|
||||
jsonWriter.name("simple_selectable_list_item").value(extractItemStyle(android.R.layout.simple_selectable_list_item, "simple_selectable_list_item",android.R.style.TextAppearance_Large));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -2018,9 +2014,7 @@ public class ExtractStyle {
|
||||
extractProgressBar(jsonWriter, "progressBarStyleSmall", null);
|
||||
extractProgressBar(jsonWriter, "progressBarStyle", null);
|
||||
extractAbsSeekBar(jsonWriter, "seekBarStyle", "QSlider");
|
||||
if (Build.VERSION.SDK_INT > 13) {
|
||||
extractSwitch(jsonWriter, "switchStyle", null);
|
||||
}
|
||||
extractSwitch(jsonWriter, "switchStyle", null);
|
||||
extractCompoundButton(jsonWriter, "checkboxStyle", "QCheckBox");
|
||||
jsonWriter.name("editTextStyle").value(extractTextAppearanceInformations("editTextStyle", "QLineEdit", null, -1));
|
||||
extractCompoundButton(jsonWriter, "radioButtonStyle", "QRadioButton");
|
||||
@ -2030,15 +2024,13 @@ public class ExtractStyle {
|
||||
jsonWriter.name("listSeparatorTextViewStyle").value(extractTextAppearanceInformations("listSeparatorTextViewStyle", null, null, -1));
|
||||
extractItemsStyle(jsonWriter);
|
||||
extractCompoundButton(jsonWriter, "buttonStyleToggle", null);
|
||||
if (Build.VERSION.SDK_INT > 10) {
|
||||
extractCalendar(jsonWriter, "calendarViewStyle", "QCalendarWidget");
|
||||
extractToolBar(jsonWriter, "actionBarStyle", "QToolBar");
|
||||
jsonWriter.name("actionButtonStyle").value(extractTextAppearanceInformations("actionButtonStyle", "QToolButton", null, -1));
|
||||
jsonWriter.name("actionBarTabTextStyle").value(extractTextAppearanceInformations("actionBarTabTextStyle", null, null, -1));
|
||||
jsonWriter.name("actionBarTabStyle").value(extractTextAppearanceInformations("actionBarTabStyle", null, null, -1));
|
||||
jsonWriter.name("actionOverflowButtonStyle").value(extractImageViewInformations("actionOverflowButtonStyle", null));
|
||||
extractTabBar(jsonWriter, "actionBarTabBarStyle", "QTabBar");
|
||||
}
|
||||
extractCalendar(jsonWriter, "calendarViewStyle", "QCalendarWidget");
|
||||
extractToolBar(jsonWriter, "actionBarStyle", "QToolBar");
|
||||
jsonWriter.name("actionButtonStyle").value(extractTextAppearanceInformations("actionButtonStyle", "QToolButton", null, -1));
|
||||
jsonWriter.name("actionBarTabTextStyle").value(extractTextAppearanceInformations("actionBarTabTextStyle", null, null, -1));
|
||||
jsonWriter.name("actionBarTabStyle").value(extractTextAppearanceInformations("actionBarTabStyle", null, null, -1));
|
||||
jsonWriter.name("actionOverflowButtonStyle").value(extractImageViewInformations("actionOverflowButtonStyle", null));
|
||||
extractTabBar(jsonWriter, "actionBarTabBarStyle", "QTabBar");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.PopupMenu;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@ -80,6 +81,8 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate;
|
||||
|
||||
public class QtActivityDelegate
|
||||
{
|
||||
private Activity m_activity = null;
|
||||
@ -135,35 +138,23 @@ public class QtActivityDelegate
|
||||
m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
int flags = View.class.getDeclaredField("SYSTEM_UI_FLAG_HIDE_NAVIGATION").getInt(null);
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_STABLE").getInt(null);
|
||||
flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION").getInt(null);
|
||||
flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN").getInt(null);
|
||||
flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_FULLSCREEN").getInt(null);
|
||||
int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
flags |= View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 19)
|
||||
flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_IMMERSIVE_STICKY").getInt(null);
|
||||
}
|
||||
Method m = View.class.getMethod("setSystemUiVisibility", int.class);
|
||||
m.invoke(m_activity.getWindow().getDecorView(), flags | View.INVISIBLE);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 19)
|
||||
flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_IMMERSIVE_STICKY").getInt(null);
|
||||
|
||||
m_activity.getWindow().getDecorView().setSystemUiVisibility(flags | View.INVISIBLE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||
m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
try {
|
||||
int ui_flag_visible = View.class.getDeclaredField("SYSTEM_UI_FLAG_VISIBLE").getInt(null);
|
||||
Method m = View.class.getMethod("setSystemUiVisibility", int.class);
|
||||
m.invoke(m_activity.getWindow().getDecorView(), ui_flag_visible);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
m_activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
m_layout.requestLayout();
|
||||
}
|
||||
@ -286,8 +277,7 @@ public class QtActivityDelegate
|
||||
imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_NEXT;
|
||||
break;
|
||||
case EnterKeyPrevious:
|
||||
if (Build.VERSION.SDK_INT > 10)
|
||||
imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_PREVIOUS;
|
||||
imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_PREVIOUS;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -300,7 +290,7 @@ public class QtActivityDelegate
|
||||
| android.text.InputType.TYPE_NUMBER_FLAG_SIGNED);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT > 10 && (inputHints & ImhHiddenText) != 0)
|
||||
if ((inputHints & ImhHiddenText) != 0)
|
||||
inputType |= 0x10 /* TYPE_NUMBER_VARIATION_PASSWORD */;
|
||||
} else if ((inputHints & ImhDialableCharactersOnly) != 0) {
|
||||
inputType = android.text.InputType.TYPE_CLASS_PHONE;
|
||||
@ -478,13 +468,7 @@ public class QtActivityDelegate
|
||||
m_super_onKeyUp = m_activity.getClass().getMethod("super_onKeyUp", Integer.TYPE, KeyEvent.class);
|
||||
m_super_onConfigurationChanged = m_activity.getClass().getMethod("super_onConfigurationChanged", Configuration.class);
|
||||
m_super_onActivityResult = m_activity.getClass().getMethod("super_onActivityResult", Integer.TYPE, Integer.TYPE, Intent.class);
|
||||
if (Build.VERSION.SDK_INT >= 12) {
|
||||
try {
|
||||
m_super_dispatchGenericMotionEvent = m_activity.getClass().getMethod("super_dispatchGenericMotionEvent", MotionEvent.class);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
m_super_dispatchGenericMotionEvent = m_activity.getClass().getMethod("super_dispatchGenericMotionEvent", MotionEvent.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
@ -500,10 +484,8 @@ public class QtActivityDelegate
|
||||
+ "\tNECESSITAS_API_LEVEL=" + necessitasApiLevel
|
||||
+ "\tHOME=" + m_activity.getFilesDir().getAbsolutePath()
|
||||
+ "\tTMPDIR=" + m_activity.getFilesDir().getAbsolutePath();
|
||||
if (Build.VERSION.SDK_INT < 14)
|
||||
additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Droid Sans;Droid Sans Fallback";
|
||||
else
|
||||
additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Roboto;Droid Sans;Droid Sans Fallback";
|
||||
|
||||
additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Roboto;Droid Sans;Droid Sans Fallback";
|
||||
|
||||
additionalEnvironmentVariables += getAppIconSize(activity);
|
||||
|
||||
@ -884,21 +866,7 @@ public class QtActivityDelegate
|
||||
|
||||
public void initializeAccessibility()
|
||||
{
|
||||
// Initialize accessibility
|
||||
try {
|
||||
final String a11yDelegateClassName = "org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate";
|
||||
Class<?> qtDelegateClass = Class.forName(a11yDelegateClassName);
|
||||
Constructor constructor = qtDelegateClass.getConstructor(android.app.Activity.class,
|
||||
android.view.ViewGroup.class,
|
||||
this.getClass());
|
||||
Object accessibilityDelegate = constructor.newInstance(m_activity, m_layout, this);
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Class not found is fine since we are compatible with Android API < 16, but the function will
|
||||
// only be available with that API level.
|
||||
} catch (Exception e) {
|
||||
// Unknown exception means something went wrong.
|
||||
Log.w("Qt A11y", "Unknown exception: " + e.toString());
|
||||
}
|
||||
new QtAccessibilityDelegate(m_activity, m_layout, this);
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration configuration)
|
||||
@ -1118,17 +1086,9 @@ public class QtActivityDelegate
|
||||
|
||||
public void resetOptionsMenu()
|
||||
{
|
||||
if (Build.VERSION.SDK_INT > 10) {
|
||||
try {
|
||||
Activity.class.getMethod("invalidateOptionsMenu").invoke(m_activity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
if (m_optionsMenuIsVisible)
|
||||
m_activity.closeOptionsMenu();
|
||||
m_activity.invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
private boolean m_contextMenuVisible = false;
|
||||
public void onCreateContextMenu(ContextMenu menu,
|
||||
View v,
|
||||
@ -1164,15 +1124,22 @@ public class QtActivityDelegate
|
||||
m_layout.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT < 11 || w <= 0 || h <= 0) {
|
||||
m_activity.openContextMenu(m_layout);
|
||||
} else if (Build.VERSION.SDK_INT < 14) {
|
||||
m_layout.setLayoutParams(m_editText, new QtLayout.LayoutParams(w, h, x, y), false);
|
||||
QtPopupMenu.getInstance().showMenu(m_editText);
|
||||
} else {
|
||||
m_layout.setLayoutParams(m_editText, new QtLayout.LayoutParams(w, h, x, y), false);
|
||||
QtPopupMenu14.getInstance().showMenu(m_editText);
|
||||
}
|
||||
m_layout.setLayoutParams(m_editText, new QtLayout.LayoutParams(w, h, x, y), false);
|
||||
PopupMenu popup = new PopupMenu(m_activity, m_editText);
|
||||
QtActivityDelegate.this.onCreatePopupMenu(popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
return QtActivityDelegate.this.onContextItemSelected(menuItem);
|
||||
}
|
||||
});
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu popupMenu) {
|
||||
QtActivityDelegate.this.onContextMenuClosed(popupMenu.getMenu());
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
@ -1182,46 +1149,12 @@ public class QtActivityDelegate
|
||||
m_activity.closeContextMenu();
|
||||
}
|
||||
|
||||
private boolean hasPermanentMenuKey()
|
||||
{
|
||||
try {
|
||||
return Build.VERSION.SDK_INT < 11 || (Build.VERSION.SDK_INT >= 14 &&
|
||||
(Boolean)ViewConfiguration.class.getMethod("hasPermanentMenuKey").invoke(ViewConfiguration.get(m_activity)));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private Object getActionBar()
|
||||
{
|
||||
try {
|
||||
return Activity.class.getMethod("getActionBar").invoke(m_activity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setActionBarVisibility(boolean visible)
|
||||
{
|
||||
if (hasPermanentMenuKey() || !visible) {
|
||||
if (Build.VERSION.SDK_INT > 10 && getActionBar() != null) {
|
||||
try {
|
||||
Class.forName("android.app.ActionBar").getMethod("hide").invoke(getActionBar());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT > 10 && getActionBar() != null)
|
||||
try {
|
||||
Class.forName("android.app.ActionBar").getMethod("show").invoke(getActionBar());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (ViewConfiguration.get(m_activity).hasPermanentMenuKey() || !visible)
|
||||
m_activity.getActionBar().hide();
|
||||
else
|
||||
m_activity.getActionBar().show();
|
||||
}
|
||||
|
||||
public void insertNativeView(int id, View view, int x, int y, int w, int h) {
|
||||
|
@ -100,14 +100,12 @@ public class QtMessageDialogHelper
|
||||
if (m_icon == 0)
|
||||
return null;
|
||||
|
||||
if (Build.VERSION.SDK_INT > 10) {
|
||||
try {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
m_theme.resolveAttribute(Class.forName("android.R$attr").getDeclaredField("alertDialogIcon").getInt(null), typedValue, true);
|
||||
return m_activity.getResources().getDrawable(typedValue.resourceId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
m_theme.resolveAttribute(android.R.attr.alertDialogIcon, typedValue, true);
|
||||
return m_activity.getResources().getDrawable(typedValue.resourceId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Information, Warning, Critical, Question
|
||||
@ -115,7 +113,7 @@ public class QtMessageDialogHelper
|
||||
{
|
||||
case 1: // Information
|
||||
try {
|
||||
return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_dialog_info").getInt(null));
|
||||
return m_activity.getResources().getDrawable(android.R.drawable.ic_dialog_info);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -129,14 +127,14 @@ public class QtMessageDialogHelper
|
||||
// break;
|
||||
case 3: // Critical
|
||||
try {
|
||||
return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_dialog_alert").getInt(null));
|
||||
return m_activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case 4: // Question
|
||||
try {
|
||||
return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_menu_help").getInt(null));
|
||||
return m_activity.getResources().getDrawable(android.R.drawable.ic_menu_help);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -310,15 +308,11 @@ public class QtMessageDialogHelper
|
||||
for (ButtonStruct button: m_buttonsList)
|
||||
{
|
||||
Button bv;
|
||||
if (Build.VERSION.SDK_INT > 10) {
|
||||
try {
|
||||
bv = new Button(m_activity, null, Class.forName("android.R$attr").getDeclaredField("borderlessButtonStyle").getInt(null));
|
||||
} catch (Exception e) {
|
||||
bv = new Button(m_activity);
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
bv = new Button(m_activity, null, Class.forName("android.R$attr").getDeclaredField("borderlessButtonStyle").getInt(null));
|
||||
} catch (Exception e) {
|
||||
bv = new Button(m_activity);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
bv.setText(button.m_text);
|
||||
@ -327,14 +321,12 @@ public class QtMessageDialogHelper
|
||||
{
|
||||
LinearLayout.LayoutParams layout = null;
|
||||
View spacer = new View(m_activity);
|
||||
if (Build.VERSION.SDK_INT > 10) {
|
||||
try {
|
||||
layout = new LinearLayout.LayoutParams(1, RelativeLayout.LayoutParams.MATCH_PARENT);
|
||||
spacer.setBackgroundDrawable(getStyledDrawable("dividerVertical"));
|
||||
buttonsLayout.addView(spacer, layout);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
layout = new LinearLayout.LayoutParams(1, RelativeLayout.LayoutParams.MATCH_PARENT);
|
||||
spacer.setBackgroundDrawable(getStyledDrawable("dividerVertical"));
|
||||
buttonsLayout.addView(spacer, layout);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
LinearLayout.LayoutParams layout = null;
|
||||
@ -343,23 +335,21 @@ public class QtMessageDialogHelper
|
||||
firstButton = false;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT > 10) {
|
||||
try {
|
||||
View horizontalDevider = new View(m_activity);
|
||||
horizontalDevider.setId(id++);
|
||||
horizontalDevider.setBackgroundDrawable(getStyledDrawable("dividerHorizontal"));
|
||||
RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 1);
|
||||
relativeParams.setMargins(0, 10, 0, 0);
|
||||
if (lastView != null) {
|
||||
relativeParams.addRule(RelativeLayout.BELOW, lastView.getId());
|
||||
}
|
||||
else
|
||||
relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
|
||||
dialogLayout.addView(horizontalDevider, relativeParams);
|
||||
lastView = horizontalDevider;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
View horizontalDevider = new View(m_activity);
|
||||
horizontalDevider.setId(id++);
|
||||
horizontalDevider.setBackgroundDrawable(getStyledDrawable("dividerHorizontal"));
|
||||
RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 1);
|
||||
relativeParams.setMargins(0, 10, 0, 0);
|
||||
if (lastView != null) {
|
||||
relativeParams.addRule(RelativeLayout.BELOW, lastView.getId());
|
||||
}
|
||||
else
|
||||
relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
|
||||
dialogLayout.addView(horizontalDevider, relativeParams);
|
||||
lastView = horizontalDevider;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||
if (lastView != null) {
|
||||
@ -367,10 +357,7 @@ public class QtMessageDialogHelper
|
||||
}
|
||||
else
|
||||
relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
|
||||
if (Build.VERSION.SDK_INT < 11)
|
||||
relativeParams.setMargins(2, 12, 2, 4);
|
||||
else
|
||||
relativeParams.setMargins(2, 0, 2, 0);
|
||||
relativeParams.setMargins(2, 0, 2, 0);
|
||||
dialogLayout.addView(buttonsLayout, relativeParams);
|
||||
}
|
||||
scrollView.addView(dialogLayout);
|
||||
|
@ -328,16 +328,14 @@ public class QtNative
|
||||
{
|
||||
int pointerType = 0;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
switch (event.getToolType(0)) {
|
||||
case MotionEvent.TOOL_TYPE_STYLUS:
|
||||
pointerType = 1; // QTabletEvent::Pen
|
||||
break;
|
||||
case MotionEvent.TOOL_TYPE_ERASER:
|
||||
pointerType = 3; // QTabletEvent::Eraser
|
||||
break;
|
||||
// TODO TOOL_TYPE_MOUSE
|
||||
}
|
||||
switch (event.getToolType(0)) {
|
||||
case MotionEvent.TOOL_TYPE_STYLUS:
|
||||
pointerType = 1; // QTabletEvent::Pen
|
||||
break;
|
||||
case MotionEvent.TOOL_TYPE_ERASER:
|
||||
pointerType = 3; // QTabletEvent::Eraser
|
||||
break;
|
||||
// TODO TOOL_TYPE_MOUSE
|
||||
}
|
||||
|
||||
if (pointerType != 0) {
|
||||
|
@ -1,66 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 BogDan Vatra <bogdan@kde.org>
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Android port of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
package org.qtproject.qt5.android;
|
||||
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
public class QtPopupMenu {
|
||||
private QtPopupMenu() { }
|
||||
|
||||
private static class QtPopupMenuHolder {
|
||||
private static final QtPopupMenu INSTANCE = new QtPopupMenu();
|
||||
}
|
||||
|
||||
public static QtPopupMenu getInstance() {
|
||||
return QtPopupMenuHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public void showMenu(View anchor)
|
||||
{
|
||||
PopupMenu popup = new PopupMenu(QtNative.activity(), anchor);
|
||||
QtNative.activityDelegate().onCreatePopupMenu(popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
boolean res = QtNative.onContextItemSelected(menuItem.getItemId(), menuItem.isChecked());
|
||||
if (res)
|
||||
QtNative.activityDelegate().onContextMenuClosed(null);
|
||||
return res;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 BogDan Vatra <bogdan@kde.org>
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the Android port of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
package org.qtproject.qt5.android;
|
||||
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
public class QtPopupMenu14 {
|
||||
private QtPopupMenu14() { }
|
||||
|
||||
private static class QtPopupMenu14Holder {
|
||||
private static final QtPopupMenu14 INSTANCE = new QtPopupMenu14();
|
||||
}
|
||||
|
||||
public static QtPopupMenu14 getInstance() {
|
||||
return QtPopupMenu14Holder.INSTANCE;
|
||||
}
|
||||
|
||||
public void showMenu(View anchor)
|
||||
{
|
||||
PopupMenu popup = new PopupMenu(QtNative.activity(), anchor);
|
||||
QtNative.activityDelegate().onCreatePopupMenu(popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
return QtNative.activityDelegate().onContextItemSelected(menuItem);
|
||||
}
|
||||
});
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu popupMenu) {
|
||||
QtNative.activityDelegate().onContextMenuClosed(popupMenu.getMenu());
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
}
|
@ -62,9 +62,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
|
||||
else
|
||||
getHolder().setFormat(PixelFormat.RGBA_8888);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT < 11)
|
||||
getHolder().setType(SurfaceHolder.SURFACE_TYPE_GPU);
|
||||
|
||||
setId(id);
|
||||
m_gestureDetector =
|
||||
new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
|
||||
|
@ -3,4 +3,5 @@
|
||||
<string name="ministro_not_found_msg">Serviciul Ministro nu poate fi găsit.\nAplicaţia nu poate porni.</string>
|
||||
<string name="ministro_needed_msg">Această aplicaţie necesită serviciul Ministro.\nDoriţi să-l instalaţi?</string>
|
||||
<string name="fatal_error_msg">Aplicaţia dumneavoastră a întâmpinat o eroare fatală şi nu poate continua.</string>
|
||||
<string name="unsupported_android_version">Versiune Android nesuportată.</string>
|
||||
</resources>
|
||||
|
@ -4,4 +4,5 @@
|
||||
<string name="ministro_not_found_msg">Can\'t find Ministro service.\nThe application can\'t start.</string>
|
||||
<string name="ministro_needed_msg">This application requires Ministro service. Would you like to install it?</string>
|
||||
<string name="fatal_error_msg">Your application encountered a fatal error and cannot continue.</string>
|
||||
<string name="unsupported_android_version">Unsupported Android version.</string>
|
||||
</resources>
|
||||
|
@ -183,11 +183,7 @@ public class QtActivity extends Activity
|
||||
|
||||
public QtActivity()
|
||||
{
|
||||
if (Build.VERSION.SDK_INT <= 10) {
|
||||
QT_ANDROID_THEMES = new String[] {"Theme_Light"};
|
||||
QT_ANDROID_DEFAULT_THEME = "Theme_Light";
|
||||
}
|
||||
else if ((Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) || Build.VERSION.SDK_INT >= 21){
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"};
|
||||
QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light";
|
||||
} else {
|
||||
@ -843,7 +839,6 @@ public class QtActivity extends Activity
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
try {
|
||||
m_activityInfo = getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
|
||||
for (Field f : Class.forName("android.R$style").getDeclaredFields()) {
|
||||
@ -858,21 +853,30 @@ public class QtActivity extends Activity
|
||||
return;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
// fatal error, show the error and quit
|
||||
AlertDialog errorDialog = new AlertDialog.Builder(QtActivity.this).create();
|
||||
if (m_activityInfo.metaData.containsKey("android.app.unsupported_android_version"))
|
||||
errorDialog.setMessage(m_activityInfo.metaData.getString("android.app.unsupported_android_version"));
|
||||
else
|
||||
errorDialog.setMessage("Unsupported Android version.");
|
||||
errorDialog.setButton(getResources().getString(android.R.string.ok), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
errorDialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
setTheme(Class.forName("android.R$style").getDeclaredField(QT_ANDROID_DEFAULT_THEME).getInt(null));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT > 10) {
|
||||
try {
|
||||
requestWindowFeature(Window.class.getField("FEATURE_ACTION_BAR").getInt(null));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
}
|
||||
requestWindowFeature(Window.FEATURE_ACTION_BAR);
|
||||
|
||||
if (QtApplication.m_delegateObject != null && QtApplication.onCreate != null) {
|
||||
QtApplication.invokeDelegateMethod(QtApplication.onCreate, savedInstanceState);
|
||||
|
@ -50,7 +50,7 @@
|
||||
<!-- auto screen scale factor -->
|
||||
</activity>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
|
||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
|
@ -16,13 +16,11 @@ CONFIG += optimize_full
|
||||
QMAKE_DOCS = $$PWD/doc/qtcore.qdocconf
|
||||
|
||||
ANDROID_JAR_DEPENDENCIES = \
|
||||
jar/QtAndroid.jar \
|
||||
jar/QtAndroidAccessibility.jar
|
||||
jar/QtAndroid.jar
|
||||
ANDROID_LIB_DEPENDENCIES = \
|
||||
plugins/platforms/android/libqtforandroid.so
|
||||
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
|
||||
jar/QtAndroid-bundled.jar \
|
||||
jar/QtAndroidAccessibility-bundled.jar
|
||||
jar/QtAndroid-bundled.jar
|
||||
ANDROID_PERMISSIONS = \
|
||||
android.permission.INTERNET \
|
||||
android.permission.WRITE_EXTERNAL_STORAGE
|
||||
|
@ -321,10 +321,6 @@ int AndroidConnectivityManager::getNetworkPreference() const
|
||||
|
||||
bool AndroidConnectivityManager::isActiveNetworkMetered() const
|
||||
{
|
||||
// This function was added in JB
|
||||
if (QtAndroidPrivate::androidSdkVersion() < 16)
|
||||
return false;
|
||||
|
||||
return m_connectivityManager.callMethod<jboolean>("isActiveNetworkMetered");
|
||||
}
|
||||
|
||||
|
@ -68,10 +68,6 @@ namespace QtAndroidAccessibility
|
||||
|
||||
void initialize()
|
||||
{
|
||||
// API level > 16 is required.
|
||||
if (QtAndroidPrivate::androidSdkVersion() < 16)
|
||||
return;
|
||||
|
||||
QJNIObjectPrivate::callStaticMethod<void>(QtAndroid::applicationClass(),
|
||||
"initializeAccessibility");
|
||||
}
|
||||
@ -299,9 +295,6 @@ if (!clazz) { \
|
||||
|
||||
bool registerNatives(JNIEnv *env)
|
||||
{
|
||||
if (QtAndroidPrivate::androidSdkVersion() < 16)
|
||||
return true; // We need API level 16 or higher
|
||||
|
||||
jclass clazz;
|
||||
FIND_AND_CHECK_CLASS("org/qtproject/qt5/android/accessibility/QtNativeAccessibility");
|
||||
jclass appClass = static_cast<jclass>(env->NewGlobalRef(clazz));
|
||||
|
@ -87,14 +87,7 @@ namespace QtAndroidMenu
|
||||
void showContextMenu(QAndroidPlatformMenu *menu, const QRect &anchorRect, JNIEnv *env)
|
||||
{
|
||||
QMutexLocker lock(&visibleMenuMutex);
|
||||
if (QtAndroidPrivate::androidSdkVersion() > 10 &&
|
||||
QtAndroidPrivate::androidSdkVersion() < 14 &&
|
||||
anchorRect.isValid()) {
|
||||
pendingContextMenus.clear();
|
||||
} else if (visibleMenu) {
|
||||
pendingContextMenus.append(visibleMenu);
|
||||
}
|
||||
|
||||
pendingContextMenus.append(visibleMenu);
|
||||
visibleMenu = menu;
|
||||
menu->aboutToShow();
|
||||
env->CallStaticVoidMethod(applicationClass(), openContextMenuMethodID, anchorRect.x(), anchorRect.y(), anchorRect.width(), anchorRect.height());
|
||||
|
Loading…
x
Reference in New Issue
Block a user