Bug 568927 - Hide task on window minimize on Android, r=mwu,alexp

This commit is contained in:
Matt Brubeck 2010-06-16 10:20:54 -07:00
parent 6d6ff9188a
commit b9aa5ea0d3
5 changed files with 21 additions and 1 deletions

View File

@ -17,7 +17,8 @@
<activity android:name="App"
android:label="@MOZ_APP_DISPLAYNAME@"
android:configChanges="keyboard|keyboardHidden|orientation|mcc|mnc"
android:windowSoftInputMode="stateUnspecified|adjustResize">
android:windowSoftInputMode="stateUnspecified|adjustResize"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

View File

@ -214,6 +214,10 @@ class GeckoAppShell
}
}
public static void moveTaskToBack() {
GeckoApp.mAppContext.moveTaskToBack(true);
}
public static void returnIMEQueryResult(String result, int selectionStart, int selectionEnd) {
GeckoApp.surfaceView.inputConnection.mSelectionStart = selectionStart;
GeckoApp.surfaceView.inputConnection.mSelectionEnd = selectionEnd;

View File

@ -100,6 +100,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
jGetHandlersForMimeType = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getHandlersForMimeType", "(Ljava/lang/String;)[Ljava/lang/String;");
jOpenUriExternal = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "openUriExternal", "(Ljava/lang/String;Ljava/lang/String;)Z");
jGetMimeTypeFromExtension = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getMimeTypeFromExtension", "(Ljava/lang/String;)Ljava/lang/String;");
jMoveTaskToBack = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "moveTaskToBack", "()V");
InitAndroidJavaWrappers(jEnv);
// jEnv should NOT be cached here by anything -- the jEnv here
@ -260,6 +261,12 @@ AndroidBridge::GetMimeTypeFromExtension(const nsCString& aFileExt, nsCString& aM
aMimeType.Assign(NS_ConvertUTF16toUTF8(jniStr.get()));
}
void
AndroidBridge::MoveTaskToBack()
{
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jMoveTaskToBack);
}
void
AndroidBridge::SetSurfaceView(jobject obj)
{

View File

@ -110,6 +110,8 @@ public:
void GetMimeTypeFromExtension(const nsCString& aFileExt, nsCString& aMimeType);
void MoveTaskToBack();
struct AutoLocalJNIFrame {
AutoLocalJNIFrame(int nEntries = 128) : mEntries(nEntries) {
AndroidBridge::Bridge()->JNI()->PushLocalFrame(mEntries);
@ -159,6 +161,7 @@ protected:
jmethodID jGetHandlersForMimeType;
jmethodID jOpenUriExternal;
jmethodID jGetMimeTypeFromExtension;
jmethodID jMoveTaskToBack;
};
}

View File

@ -411,6 +411,11 @@ nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
NS_IMETHODIMP
nsWindow::SetSizeMode(PRInt32 aMode)
{
switch (aMode) {
case nsSizeMode_Minimized:
AndroidBridge::Bridge()->MoveTaskToBack();
break;
}
return NS_OK;
}