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

Commit 5d5cd14f authored by piafinho's avatar piafinho Committed by Steve Kondik
Browse files

Update settings layout. Added Options to enable Wifi/Bluetooth when power is connected

parent 86febbc1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -824,6 +824,8 @@
                <action android:name="com.android.internal.telephony.MOBILE_DATA_CHANGED" />
                <action android:name="com.android.settings.GPS_STATUS_CHANGED" />
                <action android:name="android.intent.action.USER_PRESENT" />
                <action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
                <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
            </intent-filter>
            <meta-data android:name="android.appwidget.provider" android:resource="@xml/appwidget_info" />
        </receiver>
+172 −12
Original line number Diff line number Diff line
@@ -5,10 +5,16 @@
	<ScrollView android:layout_width="fill_parent"
		android:layout_height="match_parent" android:background="#000000">


				
		<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
			android:layout_width="fill_parent" android:layout_height="wrap_content"
			android:orientation="vertical">

		<TextView android:id="@+id/possibleButtons" android:text="@string/possibleButtons"
				style="?android:attr/listSeparatorTextViewStyle"/>
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />
			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
				android:padding="6dip">
@@ -401,6 +407,11 @@

			</LinearLayout>				

			<View android:layout_width="fill_parent" android:layout_height="10dp"
				android:background="@null" />
							
			<TextView android:id="@+id/widgetSettings" android:text="@string/settings_label"
				style="?android:attr/listSeparatorTextViewStyle"/>
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />
				
@@ -485,15 +496,14 @@

			</LinearLayout>

			<View android:layout_width="fill_parent" android:layout_height="10dp"
				android:background="@null" />

			<TextView android:id="@+id/generalSettings" android:text="@string/settings_label"
			<TextView android:id="@+id/wifiSettings" android:text="@string/wifiSettings"
				style="?android:attr/listSeparatorTextViewStyle"/>
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />

			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />

			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
				android:padding="6dip">
@@ -550,6 +560,67 @@
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />

			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
				android:padding="6dip">

				<LinearLayout android:orientation="vertical"
					android:layout_width="0dip" android:layout_weight="1"
					android:layout_height="fill_parent">

					<TextView android:textSize="20dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#FFFFFF" android:gravity="center_vertical"
						android:text="@string/autoDisable3GWithWifi" />

					<TextView android:textSize="14dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#808080" android:singleLine="true"
						android:text="@string/autoDisable3GWithWifiDescription" />

				</LinearLayout>

				<CheckBox android:id="@+id/autoDisable3GWithWifi" android:checked="false"
					android:layout_width="wrap_content" android:layout_height="wrap_content" />

			</LinearLayout>

			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />

			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
				android:padding="6dip">

				<LinearLayout android:orientation="vertical"
					android:layout_width="0dip" android:layout_weight="1"
					android:layout_height="fill_parent">

					<TextView android:textSize="20dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#FFFFFF" android:gravity="center_vertical"
						android:text="@string/autoEnable3GWithWifi" />

					<TextView android:textSize="14dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#808080" android:singleLine="true"
						android:text="@string/autoEnable3GWithWifiDescription" />

				</LinearLayout>

				<CheckBox android:id="@+id/autoEnable3GWithWifi" android:checked="false"
					android:layout_width="wrap_content" android:layout_height="wrap_content" />

			</LinearLayout>

			<View android:layout_width="fill_parent" android:layout_height="10dp"
				android:background="@null" />
				
		<TextView android:id="@+id/dataSettings" android:text="@string/dataSettings"
				style="?android:attr/listSeparatorTextViewStyle"/>
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />
				

			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
@@ -604,9 +675,16 @@

			</LinearLayout>

			<View android:layout_width="fill_parent" android:layout_height="10dp"
				android:background="@null" />


		<TextView android:id="@+id/poweSettings" android:text="@string/powerSettings"
				style="?android:attr/listSeparatorTextViewStyle"/>
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />
				

			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
				android:padding="6dip">
@@ -618,16 +696,16 @@
					<TextView android:textSize="20dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#FFFFFF" android:gravity="center_vertical"
						android:text="@string/autoDisable3GWithWifi" />
						android:text="@string/autoEnableBluetoothWithPower" />

					<TextView android:textSize="14dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#808080" android:singleLine="true"
						android:text="@string/autoDisable3GWithWifiDescription" />
						android:text="@string/autoEnableBluetoothWithPowerDescription" />

				</LinearLayout>

				<CheckBox android:id="@+id/autoDisable3GWithWifi" android:checked="false"
				<CheckBox android:id="@+id/autoEnableBluetoothWithPower" android:checked="false"
					android:layout_width="wrap_content" android:layout_height="wrap_content" />

			</LinearLayout>
@@ -646,16 +724,45 @@
					<TextView android:textSize="20dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#FFFFFF" android:gravity="center_vertical"
						android:text="@string/autoEnable3GWithWifi" />
						android:text="@string/autoDisableBluetoothWithPower" />

					<TextView android:textSize="14dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#808080" android:singleLine="true"
						android:text="@string/autoEnable3GWithWifiDescription" />
						android:text="@string/autoDisableBluetoothWithPowerDescription" />

				</LinearLayout>

				<CheckBox android:id="@+id/autoEnable3GWithWifi" android:checked="false"
				<CheckBox android:id="@+id/autoDisableBluetoothWithPower" android:checked="false"
					android:layout_width="wrap_content" android:layout_height="wrap_content" />

			</LinearLayout>
			
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />
				

			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
				android:padding="6dip">

				<LinearLayout android:orientation="vertical"
					android:layout_width="0dip" android:layout_weight="1"
					android:layout_height="fill_parent">

					<TextView android:textSize="20dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#FFFFFF" android:gravity="center_vertical"
						android:text="@string/autoEnableWifiWithPower" />

					<TextView android:textSize="14dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#808080" android:singleLine="true"
						android:text="@string/autoEnableWifiWithPowerDescription" />

				</LinearLayout>

				<CheckBox android:id="@+id/autoEnableWifiWithPower" android:checked="false"
					android:layout_width="wrap_content" android:layout_height="wrap_content" />

			</LinearLayout>
@@ -663,6 +770,41 @@
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />

			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
				android:padding="6dip">

				<LinearLayout android:orientation="vertical"
					android:layout_width="0dip" android:layout_weight="1"
					android:layout_height="fill_parent">

					<TextView android:textSize="20dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#FFFFFF" android:gravity="center_vertical"
						android:text="@string/autoDisableWifiWithPower" />

					<TextView android:textSize="14dip" android:layout_width="fill_parent"
						android:layout_height="0dip" android:layout_weight="1"
						android:textColor="#808080" android:singleLine="true"
						android:text="@string/autoDisableWifiWithPowerDescription" />

				</LinearLayout>

				<CheckBox android:id="@+id/autoDisableWifiWithPower" android:checked="false"
					android:layout_width="wrap_content" android:layout_height="wrap_content" />

			</LinearLayout>			

			<View android:layout_width="fill_parent" android:layout_height="10dp"
				android:background="@null" />


		<TextView android:id="@+id/generalSettings" android:text="@string/generalSettings"
				style="?android:attr/listSeparatorTextViewStyle"/>
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />

				
			<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
				android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
				android:padding="6dip">
@@ -732,6 +874,12 @@
		        android:prompt="@string/networkModeSpinner"
		    />
		    
			<View android:layout_width="fill_parent" android:layout_height="4dp"
				android:background="@null" />

			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />

		<TextView android:textSize="20dip" android:layout_width="fill_parent"
			android:layout_height="0dip" android:layout_weight="1"
			android:textColor="#FFFFFF" android:gravity="center_vertical"
@@ -745,6 +893,9 @@
		        android:prompt="@string/ringModeSpinner"
		    />

			<View android:layout_width="fill_parent" android:layout_height="4dp"
				android:background="@null" />

			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />

@@ -761,6 +912,12 @@
		        android:prompt="@string/brightnessSpinner"
		    />
		    
			<View android:layout_width="fill_parent" android:layout_height="4dp"
				android:background="@null" />

			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />
		    
		<TextView android:textSize="20dip" android:layout_width="fill_parent"
			android:layout_height="0dip" android:layout_weight="1"
			android:textColor="#FFFFFF" android:gravity="center_vertical"
@@ -777,6 +934,9 @@
			<View android:layout_width="fill_parent" android:layout_height="1dp"
				android:background="?android:attr/listDivider" />
				
		<View android:layout_width="fill_parent" android:layout_height="10dp"
				android:background="@null" />
				
			<LinearLayout android:id="@+id/LinearLayout01"
				android:layout_width="fill_parent" android:layout_height="wrap_content"
				android:orientation="horizontal" android:gravity="center">
+16 −3
Original line number Diff line number Diff line
@@ -2622,6 +2622,11 @@ found in the list of installed applications.</string>
    <string name="toggleLockScreenDescription">Enable/disable lock screen</string>

    
    <string name="widgetSettings">Widget Instance Settings</string>
    <string name="wifiSettings">Wifi Events settings</string>
    <string name="dataSettings">Data Events settings</string>
    <string name="powerSettings">Power Events settings</string>

    <string name="generalSettings">General Settings</string>

    <string name="autoDisable3G">Data disables 3G</string>
@@ -2631,10 +2636,14 @@ found in the list of installed applications.</string>
    <string name="useRoundCorners">Round corners</string>
    <string name="useVertical">Vertical Layout</string>
    <string name="useTransparent">Transparent Widget</string>
    <string name="autoEnableSyncWithWifi">Automatic enable Sync</string>
    <string name="autoDisableSyncWithWifi">Automatic disable Sync</string>
    <string name="autoEnableSyncWithWifi">Wifi enables Sync</string>
    <string name="autoDisableSyncWithWifi">Wifi disables Sync</string>
    <string name="ringModeVibrateAsOn">Vibrate as ON</string>
    <string name="monitorDataRoaming">Monitor Data Roaming</string>
    <string name="autoEnableBluetoothWithPower">Ext. PWR enables Bluetooth</string>
    <string name="autoDisableBluetoothWithPower">Ext. PWD disables Bluetooth</string>
    <string name="autoEnableWifiWithPower">Ext. PWD enables Wifi</string>
    <string name="autoDisableWifiWithPower">Ext. PWD disables Wifi</string>
  
    <string name="autoDisable3GDescription">2G when mobile data is disabled</string>
    <string name="autoEnable3GDescription">3G when mobile data is enabled</string>
@@ -2647,6 +2656,10 @@ found in the list of installed applications.</string>
    <string name="autoDisableSyncWithWifiDescription">Disable sync when WIFI is disabled</string>
    <string name="ringModeVibrateAsOnDescription">Show Sound as on when vibrate only</string>
    <string name="monitorDataRoamingDescription">Data status red if data roaming is enabled</string>
    <string name="autoEnableBluetoothWithPowerDescription">Bluetooth enabled when Power connected</string>
    <string name="autoDisableBluetoothWithPowerDescription">Bluetooth disabled when Power disconnected</string>
    <string name="autoEnableWifiWithPowerDescription">Wifi enabled when Power connected</string>
    <string name="autoDisableWifiWithPowerDescription">Wifi disabled when Power disconnected</string>

    <string name="networkModeSpinner">Choose Network Modes</string>
    <string name="brightnessSpinner">Choose Brightness levels</string>
+5 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.settings.widget.buttons.GPSButton;
import com.android.settings.widget.buttons.LockScreenButton;
import com.android.settings.widget.buttons.MobileDataButton;
import com.android.settings.widget.buttons.NetworkModeButton;
import com.android.settings.widget.buttons.PowerButton;
import com.android.settings.widget.buttons.ScreenTimeoutButton;
import com.android.settings.widget.buttons.SoundButton;
import com.android.settings.widget.buttons.SyncButton;
@@ -244,6 +245,10 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider {
		} else if (NetworkModeButton.NETWORK_MODE_CHANGED.equals(intent.getAction())) {
			logD("Received Network mode state change");
			NetworkModeButton.getInstance().onReceive(context, intent);
		} else if (Intent.ACTION_POWER_CONNECTED.equals(intent.getAction()) ||
				Intent.ACTION_POWER_DISCONNECTED.equals(intent.getAction())) {
			logD("Received power mode state change");
			PowerButton.getInstance().onReceive(context, intent);
		} else if (intent.hasCategory(Intent.CATEGORY_ALTERNATIVE)) {
			Uri data = intent.getData();
			int buttonId = Integer.parseInt(data.getSchemeSpecificPart());
+14 −0
Original line number Diff line number Diff line
@@ -53,6 +53,12 @@ public class WidgetSettings extends Activity {
	public static final String AUTO_ENABLE_3G_WITH_WIFI = "autoEnable3GWithWifi";
	public static final String AUTO_DISABLE_3G_WITH_WIFI = "autoDisable3GWithWifi";

	public static final String AUTO_ENABLE_BLUETOOTH_WITH_POWER = "autoEnableBluetoothWithPower";
	public static final String AUTO_DISABLE_BLUETOOTH_WITH_POWER = "autoDisableBluetoothWithPower";

	public static final String AUTO_ENABLE_WIFI_WITH_POWER = "autoEnableWifiWithPower";
	public static final String AUTO_DISABLE_WIFI_WITH_POWER = "autoDisableWifiWithPower";

	public static final String NETWORK_MODE_SPINNER = "networkModeSpinner";
	public static final String BRIGHTNESS_SPINNER = "brightnessSpinner";
	public static final String RING_MODE_SPINNER = "ringModeSpinner";
@@ -101,6 +107,10 @@ public class WidgetSettings extends Activity {
		((CheckBox)findViewById(R.id.autoEnable3G)).setChecked(preferencesGeneral.getBoolean(AUTO_ENABLE_3G, false));
		((CheckBox)findViewById(R.id.autoDisable3GWithWifi)).setChecked(preferencesGeneral.getBoolean(AUTO_DISABLE_3G_WITH_WIFI, false));
		((CheckBox)findViewById(R.id.autoEnable3GWithWifi)).setChecked(preferencesGeneral.getBoolean(AUTO_ENABLE_3G_WITH_WIFI, false));
		((CheckBox)findViewById(R.id.autoEnableBluetoothWithPower)).setChecked(preferencesGeneral.getBoolean(AUTO_ENABLE_BLUETOOTH_WITH_POWER, false));
		((CheckBox)findViewById(R.id.autoDisableBluetoothWithPower)).setChecked(preferencesGeneral.getBoolean(AUTO_DISABLE_BLUETOOTH_WITH_POWER, false));
		((CheckBox)findViewById(R.id.autoEnableWifiWithPower)).setChecked(preferencesGeneral.getBoolean(AUTO_ENABLE_WIFI_WITH_POWER, false));
		((CheckBox)findViewById(R.id.autoDisableWifiWithPower)).setChecked(preferencesGeneral.getBoolean(AUTO_DISABLE_WIFI_WITH_POWER, false));
		((CheckBox)findViewById(R.id.autoDisableSyncWithWifi)).setChecked(preferencesGeneral.getBoolean(AUTO_DISABLE_SYNC_WITH_WIFI, false));
		((CheckBox)findViewById(R.id.autoEnableSyncWithWifi)).setChecked(preferencesGeneral.getBoolean(AUTO_ENABLE_SYNC_WITH_WIFI, false));
		((CheckBox)findViewById(R.id.monitorDataRoaming)).setChecked(preferencesGeneral.getBoolean(MONITOR_DATA_ROAMING, false));		
@@ -210,6 +220,10 @@ public class WidgetSettings extends Activity {
        	editorGeneral.putBoolean(AUTO_ENABLE_SYNC_WITH_WIFI, ((CheckBox)findViewById(R.id.autoEnableSyncWithWifi)).isChecked());
        	editorGeneral.putBoolean(AUTO_DISABLE_3G_WITH_WIFI, ((CheckBox)findViewById(R.id.autoDisable3GWithWifi)).isChecked());
        	editorGeneral.putBoolean(AUTO_ENABLE_3G_WITH_WIFI, ((CheckBox)findViewById(R.id.autoEnable3GWithWifi)).isChecked());
        	editorGeneral.putBoolean(AUTO_ENABLE_BLUETOOTH_WITH_POWER, ((CheckBox)findViewById(R.id.autoEnableBluetoothWithPower)).isChecked());
        	editorGeneral.putBoolean(AUTO_DISABLE_BLUETOOTH_WITH_POWER, ((CheckBox)findViewById(R.id.autoDisableBluetoothWithPower)).isChecked());
        	editorGeneral.putBoolean(AUTO_ENABLE_WIFI_WITH_POWER, ((CheckBox)findViewById(R.id.autoEnableWifiWithPower)).isChecked());
        	editorGeneral.putBoolean(AUTO_DISABLE_WIFI_WITH_POWER, ((CheckBox)findViewById(R.id.autoDisableWifiWithPower)).isChecked());
        	editorGeneral.putBoolean(MONITOR_DATA_ROAMING, ((CheckBox)findViewById(R.id.monitorDataRoaming)).isChecked());
        	editorGeneral.putBoolean(RING_MODE_VIBRATE_AS_ON, ((CheckBox)findViewById(R.id.ringModeVibrateAsOn)).isChecked());

Loading