summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2015-01-06 15:55:09 -0800
committerMichael Bestas <mikeioannina@gmail.com>2015-12-27 23:24:20 +0200
commit8e9e0037ab8713a74c09b11cc829e7ccc8822304 (patch)
tree65881206a29b446074993622e5d8323422f67721
parenta48f1658f3e155a32286059a7d314ebc638ad859 (diff)
downloadpackages_apps_Settings-8e9e0037ab8713a74c09b11cc829e7ccc8822304.zip
packages_apps_Settings-8e9e0037ab8713a74c09b11cc829e7ccc8822304.tar.gz
packages_apps_Settings-8e9e0037ab8713a74c09b11cc829e7ccc8822304.tar.bz2
Settings: make empty profile trigger screens more useful
Change-Id: I7e4061615f2bb1c1fabd37c8f5b792b04a99a2c8 Signed-off-by: Roman Birg <roman@cyngn.com>
-rw-r--r--res/layout/nfc_writer.xml5
-rw-r--r--res/layout/profile_bluetooth_empty_view.xml34
-rw-r--r--res/layout/profile_wifi_empty_view.xml34
-rw-r--r--src/com/android/settings/profiles/triggers/BluetoothTriggerFragment.java30
-rw-r--r--src/com/android/settings/profiles/triggers/WifiTriggerFragment.java29
5 files changed, 129 insertions, 3 deletions
diff --git a/res/layout/nfc_writer.xml b/res/layout/nfc_writer.xml
index 959217c..d322fa8 100644
--- a/res/layout/nfc_writer.xml
+++ b/res/layout/nfc_writer.xml
@@ -40,9 +40,10 @@
<ImageView
android:id="@+id/nfc_writer_image"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="84dp"
+ android:layout_height="84dp"
android:layout_gravity="center"
+ android:tint="@color/theme_accent"
android:src="@drawable/nfc_writer" />
<TextView android:id="@+id/touch_tag"
diff --git a/res/layout/profile_bluetooth_empty_view.xml b/res/layout/profile_bluetooth_empty_view.xml
new file mode 100644
index 0000000..2165c9a
--- /dev/null
+++ b/res/layout/profile_bluetooth_empty_view.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/empty"
+
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center">
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:layout_centerInParent="true">
+
+ <TextView
+ style="?android:attr/textAppearanceMedium"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="30dip"
+ android:layout_marginEnd="30dip"
+ android:layout_marginBottom="30dip"
+ android:layout_gravity="center"
+ android:text="@string/no_bluetooth_triggers" />
+
+ <ImageView
+ android:layout_width="84dp"
+ android:layout_height="84dp"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_settings_bluetooth" />
+
+ </LinearLayout>
+</RelativeLayout>
diff --git a/res/layout/profile_wifi_empty_view.xml b/res/layout/profile_wifi_empty_view.xml
new file mode 100644
index 0000000..83ffac9
--- /dev/null
+++ b/res/layout/profile_wifi_empty_view.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/empty"
+
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center">
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:layout_centerInParent="true">
+
+ <TextView
+ style="?android:attr/textAppearanceMedium"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="30dip"
+ android:layout_marginEnd="30dip"
+ android:layout_marginBottom="30dip"
+ android:layout_gravity="center"
+ android:text="@string/no_wifi_triggers" />
+
+ <ImageView
+ android:layout_width="84dp"
+ android:layout_height="84dp"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_wifi_signal_4" />
+
+ </LinearLayout>
+</RelativeLayout>
diff --git a/src/com/android/settings/profiles/triggers/BluetoothTriggerFragment.java b/src/com/android/settings/profiles/triggers/BluetoothTriggerFragment.java
index e2967de..5f3e3b1 100644
--- a/src/com/android/settings/profiles/triggers/BluetoothTriggerFragment.java
+++ b/src/com/android/settings/profiles/triggers/BluetoothTriggerFragment.java
@@ -22,8 +22,10 @@ import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
+import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -36,6 +38,7 @@ import cyanogenmod.app.Profile;
import cyanogenmod.app.ProfileManager;
import com.android.settings.R;
+import com.android.settings.Utils;
import com.android.settings.profiles.ProfilesSettings;
import java.util.ArrayList;
@@ -50,6 +53,8 @@ public class BluetoothTriggerFragment extends ListFragment {
Profile mProfile;
ProfileManager mProfileManager;
+ private View mEmptyView;
+
private List<BluetoothTrigger> mTriggers = new ArrayList<BluetoothTrigger>();
private BluetoothTriggerAdapter mListAdapter;
@@ -153,12 +158,35 @@ public class BluetoothTriggerFragment extends ListFragment {
}
@Override
+ public void onStart() {
+ super.onStart();
+ getListView().setEmptyView(mEmptyView);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ mEmptyView = inflater.inflate(R.layout.profile_bluetooth_empty_view, container, false);
+ mEmptyView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent bluetoothSettings = new Intent();
+ bluetoothSettings.setAction(
+ Settings.ACTION_BLUETOOTH_SETTINGS);
+ startActivity(bluetoothSettings);
+ }
+ });
+
+ ViewGroup view = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
+ view.addView(mEmptyView);
+ return view;
+ }
+
+ @Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
reloadTriggerListItems();
mListAdapter = new BluetoothTriggerAdapter(getActivity());
setListAdapter(mListAdapter);
- setEmptyText(getString(R.string.no_bluetooth_triggers));
}
private void removeTrigger(List<Trigger> triggers, int value) {
diff --git a/src/com/android/settings/profiles/triggers/WifiTriggerFragment.java b/src/com/android/settings/profiles/triggers/WifiTriggerFragment.java
index c34808d..93ef233 100644
--- a/src/com/android/settings/profiles/triggers/WifiTriggerFragment.java
+++ b/src/com/android/settings/profiles/triggers/WifiTriggerFragment.java
@@ -19,10 +19,12 @@ import android.app.AlertDialog;
import android.app.ListFragment;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.res.Resources;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
+import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -45,6 +47,8 @@ public class WifiTriggerFragment extends ListFragment {
Profile mProfile;
private ProfileManager mProfileManager;
+ private View mEmptyView;
+
private List<WifiTrigger> mTriggers = new ArrayList<WifiTrigger>();
private WifiTriggerAdapter mListAdapter;
@@ -74,6 +78,31 @@ public class WifiTriggerFragment extends ListFragment {
mWifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
}
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ getListView().setEmptyView(mEmptyView);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ mEmptyView = inflater.inflate(R.layout.profile_bluetooth_empty_view, container, false);
+ mEmptyView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent wifiSettings = new Intent();
+ wifiSettings.setAction(
+ Settings.ACTION_WIFI_SETTINGS);
+ startActivity(wifiSettings);
+ }
+ });
+
+ ViewGroup view = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
+ view.addView(mEmptyView);
+ return view;
+ }
+
@Override
public void onResume() {
super.onResume();