am 39281d01: Merge "Use new backgrounds in wifi setup for xl" into honeycomb

* commit '39281d0163aa410391a128d1d2c8194c88e732fb':
  Use new backgrounds in wifi setup for xl
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b80b7b4..c7fbfa4 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -136,6 +136,7 @@
 
         <activity android:name=".wifi.WifiSettingsForSetupWizardXL"
                   android:theme="@android:style/Theme.Holo.NoActionBar"
+                  android:windowBackground="@drawable/setups_bg_default"
                   android:clearTaskOnLaunch="true"
                   android:screenOrientation="landscape"
                   android:exported="true" />
diff --git a/res/drawable-hdpi/setups_bg_complete.png b/res/drawable-hdpi/setups_bg_complete.png
new file mode 100644
index 0000000..d922859
--- /dev/null
+++ b/res/drawable-hdpi/setups_bg_complete.png
Binary files differ
diff --git a/res/drawable-hdpi/setups_bg_default.png b/res/drawable-hdpi/setups_bg_default.png
new file mode 100644
index 0000000..5883b1d
--- /dev/null
+++ b/res/drawable-hdpi/setups_bg_default.png
Binary files differ
diff --git a/res/drawable-hdpi/setups_bg_wifi.png b/res/drawable-hdpi/setups_bg_wifi.png
new file mode 100644
index 0000000..6b83d9b
--- /dev/null
+++ b/res/drawable-hdpi/setups_bg_wifi.png
Binary files differ
diff --git a/res/drawable-mdpi/setups_bg_complete.png b/res/drawable-mdpi/setups_bg_complete.png
new file mode 100644
index 0000000..a0cd961
--- /dev/null
+++ b/res/drawable-mdpi/setups_bg_complete.png
Binary files differ
diff --git a/res/drawable-mdpi/setups_bg_default.png b/res/drawable-mdpi/setups_bg_default.png
new file mode 100644
index 0000000..f05bf96
--- /dev/null
+++ b/res/drawable-mdpi/setups_bg_default.png
Binary files differ
diff --git a/res/drawable-mdpi/setups_bg_wifi.png b/res/drawable-mdpi/setups_bg_wifi.png
new file mode 100644
index 0000000..4fa1619
--- /dev/null
+++ b/res/drawable-mdpi/setups_bg_wifi.png
Binary files differ
diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
index f4cafdf..476ba58 100644
--- a/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
+++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizardXL.java
@@ -118,6 +118,8 @@
 
     private DetailedState mPreviousState = DetailedState.DISCONNECTED;
 
+    private int mBackgroundId = R.drawable.setups_bg_default;
+
     // At first, we set "Skip" button disabled so that users won't press it soon after the screen
     // migration. The button is enabled after the wifi module returns some result
     // (a list of available network, etc.) One possible problem is that the notification from the
@@ -261,6 +263,8 @@
             // this can be false here. We want to treat it as "after connect action".
             mAfterConnectAction = true;
 
+            trySetBackground(R.drawable.setups_bg_complete);
+
             mProgressBar.setIndeterminate(false);
             mProgressBar.setProgress(2);
 
@@ -376,6 +380,8 @@
             edit = true;
         }
 
+        trySetBackground(R.drawable.setups_bg_default);
+
         // We don't want to keep scanning Wi-Fi networks during users' configuring one network.
         mWifiSettings.pauseWifiScan();
 
@@ -432,6 +438,8 @@
     /* package */ void onConnectButtonPressed() {
         mAfterConnectAction = true;
 
+        trySetBackground(R.drawable.setups_bg_wifi);
+
         mWifiSettings.submit(mWifiConfig.getController());
 
         // updateConnectionState() isn't called soon after the user's "connect" action,
@@ -478,6 +486,8 @@
     }
 
     private void onBackButtonPressed() {
+        trySetBackground(R.drawable.setups_bg_default);
+
         if (mAfterConnectAction) {
             if (DEBUG) Log.d(TAG, "Back button pressed after connect action.");
             mAfterConnectAction = false;
@@ -570,6 +580,8 @@
         mConnectButton.setVisibility(View.VISIBLE);
         mConnectButton.setEnabled(true);
 
+        trySetBackground(R.drawable.setups_bg_default);
+
         if (!TextUtils.isEmpty(mEditingTitle)) {
             mTitleView.setText(mEditingTitle);
         } else {
@@ -637,4 +649,14 @@
     public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
         super.onCreateContextMenu(menu, view, menuInfo);
     }
+
+    /**
+     * Replace the current background with a new background whose id is resId if needed.
+     */
+    private void trySetBackground(int resId) {
+        if (mBackgroundId != resId) {
+            getWindow().setBackgroundDrawable(getResources().getDrawable(resId));
+            mBackgroundId = resId;
+        }
+    }
 }