Bug 698220: The tabs should be restored when awesomebar is rotated. [r=mfinkle]
☠☠ backed out by e66ab555b322 ☠ ☠
authorSriram Ramasubramanian <sriram@mozilla.com>
Mon, 31 Oct 2011 13:07:23 -0700
changeset 81720 c1881e7e046c05bf0ee3b282678bc7b1183bcdaf
parent 81719 c09a52af4cd8573f602571d96a9254f3f2ecf9a0
child 81721 388c49fba3fd0235071d72d33c8364b7adc677b4
push id21573
push userblassey@mozilla.com
push dateTue, 06 Dec 2011 18:57:07 +0000
treeherdermozilla-central@0e397568c71e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs698220
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 698220: The tabs should be restored when awesomebar is rotated. [r=mfinkle]
embedding/android/AndroidManifest.xml.in
embedding/android/AwesomeBar.java
--- a/embedding/android/AndroidManifest.xml.in
+++ b/embedding/android/AndroidManifest.xml.in
@@ -124,16 +124,17 @@
             <intent-filter>
                 <action android:name="android.intent.action.CREATE_SHORTCUT" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
 
         <activity android:name="org.mozilla.gecko.AwesomeBar"
                   android:theme="@android:style/Theme.Translucent"
+                  android:configChanges="orientation"
                   android:windowSoftInputMode="stateAlwaysVisible|adjustResize"
                   android:windowIsTranslucent="true"
                   android:windowContentOverlay="@null"
                   android:windowNoTitle="true"
                   android:windowIsFloating="true"
                   android:backgroundDimEnabled="false">
         </activity>
 
--- a/embedding/android/AwesomeBar.java
+++ b/embedding/android/AwesomeBar.java
@@ -39,16 +39,17 @@
 
 package org.mozilla.gecko;
 
 import java.io.File;
 
 import android.app.Activity;
 import android.content.Intent;
 import android.content.Context;
+import android.content.res.Configuration;
 import android.os.Bundle;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.Window;
 import android.view.inputmethod.InputMethodManager;
@@ -60,16 +61,17 @@ public class AwesomeBar extends Activity
     static final String CURRENT_URL_KEY = "currenturl";
     static final String TYPE_KEY = "type";
     static enum Type { ADD, EDIT };
 
     private static final String LOG_NAME = "AwesomeBar";
 
     private String mType;
     private AwesomeBarTabs mAwesomeTabs;
+    private EditText mText;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         Log.d(LOG_NAME, "creating awesomebar");
 
         requestWindowFeature(Window.FEATURE_NO_TITLE);
@@ -77,66 +79,71 @@ public class AwesomeBar extends Activity
 
         mAwesomeTabs = (AwesomeBarTabs) findViewById(R.id.awesomebar_tabs);
         mAwesomeTabs.setOnUrlOpenListener(new AwesomeBarTabs.OnUrlOpenListener() {
             public void onUrlOpen(AwesomeBarTabs tabs, String url) {
                 openUrlAndFinish(url);
             }
         });
 
-        final EditText text = (EditText)findViewById(R.id.awesomebar_text);
+        mText = (EditText)findViewById(R.id.awesomebar_text);
 
         Intent intent = getIntent();
         String currentUrl = intent.getStringExtra(CURRENT_URL_KEY);
         mType = intent.getStringExtra(TYPE_KEY);
         if (currentUrl != null) {
-            text.setText(currentUrl);
-            text.selectAll();
+            mText.setText(currentUrl);
+            mText.selectAll();
         }
 
-        text.addTextChangedListener(new TextWatcher() {
+        mText.addTextChangedListener(new TextWatcher() {
             public void afterTextChanged(Editable s) {
                 // do nothing
             }
 
             public void beforeTextChanged(CharSequence s, int start, int count,
                                           int after) {
                 // do nothing
             }
 
             public void onTextChanged(CharSequence s, int start, int before,
                                       int count) {
                 mAwesomeTabs.filter(s.toString());
             }
         });
 
-        text.setOnKeyListener(new View.OnKeyListener() {
+        mText.setOnKeyListener(new View.OnKeyListener() {
             public boolean onKey(View v, int keyCode, KeyEvent event) {
                 if (keyCode == KeyEvent.KEYCODE_ENTER) {
                     if (event.getAction() != KeyEvent.ACTION_DOWN)
                         return true;
 
-                    openUrlAndFinish(text.getText().toString());
+                    openUrlAndFinish(mText.getText().toString());
                     return true;
                 } else {
                     return false;
                 }
             }
         });
 
-        text.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+        mText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
             public void onFocusChange(View v, boolean hasFocus) {
                 if (!hasFocus) {
                     InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                     imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
                 }
             }
         });
     }
 
+    @Override
+    public void onConfigurationChanged(Configuration newConfiguration) {
+        super.onConfigurationChanged(newConfiguration);
+    }
+
     private void openUrlAndFinish(String url) {
         Intent resultIntent = new Intent();
         resultIntent.putExtra(URL_KEY, url);
         resultIntent.putExtra(TYPE_KEY, mType);
 
         setResult(Activity.RESULT_OK, resultIntent);
         finish();
     }