Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c8bde57 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa
Browse files

Fragmentize WifiSettings.

- Add button bar feature toward SettingsPreferenceFragment,
  which has existed in PreferenceActivity and has been used
  (probably) only by Settings app.
- super.onActivityCreated() is not called at the beggining of
  WifiSettings#onActivityCreated(), the parent method assumes
  the child should have prepared PreferenceScreen, while
  WifiSettings cannot do until the parent Activity is ready.
- Call SetHasOptionMenu() should be called AFTER the parent
  Activity is ready. It is not documented, so it would be better
  to file another bug.
- Add exception to proguard...

Change-Id: Iebd27f0cb0abdbee9b4b1cc9b00f4bf127f7815d
parent e742d42d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -83,10 +83,11 @@

        <!-- Top-level settings -->

        <activity android:name=".wifi.WifiSettings"
        <activity-alias android:name=".wifi.WifiSettings"
                android:label="@string/wifi_settings"
                android:configChanges="orientation|keyboardHidden"
                android:clearTaskOnLaunch="true"
                android:targetActivity="Settings"
                >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
@@ -96,7 +97,7 @@
                <category android:name="android.intent.category.VOICE_LAUNCH" />
                <category android:name="com.android.settings.SHORTCUT" />
            </intent-filter>
        </activity>
        </activity-alias>

        <activity android:name=".wifi.AdvancedSettings"
                android:label="@string/wifi_ip_settings_titlebar"
+1 −1
Original line number Diff line number Diff line
# Keep all Fragments in this package, which are used by reflection.
-keep class com.android.settings.*Fragment
-keep class com.android.settings.*Settings
-keep class com.android.settings.wifi.*Settings
-keep class com.android.settings.deviceinfo.*
+40 −0
Original line number Diff line number Diff line
@@ -24,4 +24,44 @@
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />

    <!-- button_bar -->
    <RelativeLayout android:id="@+id/button_bar"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_weight="0"
        android:background="@android:drawable/bottom_bar"
        android:visibility="gone">

        <Button android:id="@+id/back_button"
            android:layout_width="150dip"
            android:layout_height="wrap_content"
            android:layout_margin="5dip"
            android:layout_alignParentLeft="true"
            android:drawablePadding="3dip"
        />
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true">

            <Button android:id="@+id/skip_button"
                android:layout_width="150dip"
                android:layout_height="wrap_content"
                android:layout_margin="5dip"
                android:text="@string/skip_button_label"
                android:visibility="gone"
            />

            <Button android:id="@+id/next_button"
                android:layout_width="150dip"
                android:layout_height="wrap_content"
                android:layout_margin="5dip"
                android:drawableRight="@drawable/ic_btn_next"
                android:drawablePadding="3dip"
                android:text="@string/next_button_label"
            />
        </LinearLayout>
    </RelativeLayout>
</LinearLayout>
+1 −4
Original line number Diff line number Diff line
@@ -32,13 +32,10 @@
        android:persistent="false" />

    <PreferenceScreen
        android:fragment="com.android.settings.wifi.WifiSettings"
        android:key="wifi_settings"
        android:title="@string/wifi_settings"
        android:summary="@string/wifi_settings_summary" >
        <intent
            android:action="android.intent.action.MAIN"
            android:targetPackage="com.android.settings"                
            android:targetClass="com.android.settings.wifi.WifiSettings" />
    </PreferenceScreen>

    <CheckBoxPreference
+7 −6
Original line number Diff line number Diff line
@@ -98,13 +98,14 @@ public class Settings extends Activity
                if (showFragment(intent.getComponent().getClassName(), intent.getExtras())) {
                    mMainPane.setVisibility(View.GONE);
                }
            }
            } else {
                Fragment topLevel = getFragmentManager().findFragmentById(R.id.top_level);
                if (topLevel != null) {
                    ((TopLevelSettings) topLevel).selectFirst();
                }
            }
        }
    }

    boolean showFragment(Preference preference) {
        if (mSinglePane) {
@@ -165,13 +166,13 @@ public class Settings extends Activity
    }

    public void onCreated(SettingsPreferenceFragment fragment) {
        Log.d(TAG, "Fragment created " + fragment);
        Log.d(TAG, "Fragment created " + fragment + " (name: " + fragment.getClass() + ")");
        addToBreadCrumbs(fragment);
    }

    public void onDestroyed(SettingsPreferenceFragment fragment) {
        removeFromBreadCrumbs(fragment);
        Log.d(TAG, "Fragment destroyed " + fragment);
        Log.d(TAG, "Fragment destroyed " + fragment + " (name: " + fragment.getClass() + ")");
    }

    public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) {
Loading