Profiles: Bring-up and inject into Settings via IA

 * Make use of the new information architecture for the Settings app
   and place the status bar settings into System category.

 * Set intent priority to a value between those that Google uses for
   "Languages & input" and "Date & time" entried in order to place our
   preference in between those two.

 * Use empty summary so that the title is centered vertically,
   matching "Developer options" and "Reset" entries.

Change-Id: I732d51ef81df7af0ce2488cb935592d2d1f52cf5
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 86c3871..19d4a38 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -161,31 +161,24 @@
         <activity android:name=".gestures.KeyHandler" />
         -->
 
-        <!-- Profiles settings (dashboard) -->
-        <!--
+        <!-- Profiles settings (System category) -->
         <activity-alias
             android:name=".profiles.ProfilesSettings"
             android:label="@string/profiles_settings_title"
+            android:icon="@drawable/ic_settings_profiles"
             android:targetActivity="PartsActivity">
-            <intent-filter android:priority="1">
-                <action android:name="com.android.settings.action.EXTRA_SETTINGS" />
+            <intent-filter android:priority="255">
+                <action android:name="org.lineageos.lineageparts.action.SETTINGS" />
                 <action android:name="org.lineageos.lineageparts.PROFILES_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data
                 android:name="com.android.settings.category"
-                android:value="com.android.settings.category.personal" />
+                android:value="com.android.settings.category.ia.system" />
             <meta-data
-                android:name="com.android.settings.icon"
-                android:resource="@drawable/ic_settings_profiles" />
-            <meta-data
-                android:name="org.lineageos.settings.summary.receiver"
-                android:value="org.lineageos.lineageparts.PartsUpdater" />
-            <meta-data
-                android:name="org.lineageos.settings.summary.key"
-                android:value="profiles_settings" />
+                android:name="com.android.settings.summary"
+                android:resource="@string/summary_empty" />
         </activity-alias>
-        -->
 
         <!-- Status bar settings (dashboard) -->
         <!--
@@ -253,7 +246,6 @@
         </activity-alias>
         -->
 
-        <!--
         <activity android:name=".profiles.NFCProfile">
             <intent-filter>
                 <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
@@ -261,14 +253,11 @@
                 <data android:mimeType="cm/profile" />
             </intent-filter>
         </activity>
-        -->
 
-        <!--
         <activity
             android:name=".profiles.NFCProfileSelect"
             android:label="@string/profile_select"
             android:excludeFromRecents="true"/>
-        -->
 
     </application>
 </manifest>
diff --git a/src/org/lineageos/lineageparts/PartsActivity.java b/src/org/lineageos/lineageparts/PartsActivity.java
index a1d510c..cfb6851 100644
--- a/src/org/lineageos/lineageparts/PartsActivity.java
+++ b/src/org/lineageos/lineageparts/PartsActivity.java
@@ -34,9 +34,7 @@
 
 import com.android.settingslib.drawer.SettingsDrawerActivity;
 
-/*
 import org.lineageos.lineageparts.profiles.NFCProfileTagCallback;
-*/
 import org.lineageos.lineageparts.widget.SwitchBar;
 import org.lineageos.internal.lineageparts.PartInfo;
 import org.lineageos.internal.lineageparts.PartsList;
@@ -55,9 +53,7 @@
     public static final String EXTRA_SHOW_FRAGMENT_TITLE_RESID =
             ":settings:show_fragment_title_resid";
 
-    /*
     private NFCProfileTagCallback mNfcProfileCallback;
-    */
 
     private CharSequence mInitialTitle;
 
@@ -141,21 +137,17 @@
         return true;
     }
 
-    /*
     public void setNfcProfileCallback(NFCProfileTagCallback callback) {
         mNfcProfileCallback = callback;
     }
-    */
 
     @Override
     protected void onNewIntent(Intent intent) {
         if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
             Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
-            /*
             if (mNfcProfileCallback != null) {
                 mNfcProfileCallback.onTagRead(detectedTag);
             }
-            */
             return;
         }
         super.onNewIntent(intent);
@@ -270,4 +262,3 @@
         setTitle(mInitialTitle);
     }
 }
-
diff --git a/src/org/lineageos/lineageparts/profiles/ProfilesPreference.java b/src/org/lineageos/lineageparts/profiles/ProfilesPreference.java
index b7cfdb3..17e1bd5 100644
--- a/src/org/lineageos/lineageparts/profiles/ProfilesPreference.java
+++ b/src/org/lineageos/lineageparts/profiles/ProfilesPreference.java
@@ -28,7 +28,6 @@
 import org.lineageos.lineageparts.R;
 import org.lineageos.lineageparts.SettingsPreferenceFragment;
 
-/*
 public class ProfilesPreference extends CheckBoxPreference implements View.OnClickListener {
     private static final String TAG = ProfilesPreference.class.getSimpleName();
     private static final float DISABLED_ALPHA = 0.4f;
@@ -137,4 +136,3 @@
                 R.string.profile_profile_manage, null, null, PROFILE_DETAILS);
     }
 }
-*/
diff --git a/src/org/lineageos/lineageparts/profiles/ProfilesSettings.java b/src/org/lineageos/lineageparts/profiles/ProfilesSettings.java
index 0785282..aaff296 100644
--- a/src/org/lineageos/lineageparts/profiles/ProfilesSettings.java
+++ b/src/org/lineageos/lineageparts/profiles/ProfilesSettings.java
@@ -48,7 +48,6 @@
 import lineageos.app.ProfileManager;
 import lineageos.providers.LineageSettings;
 
-/*
 public class ProfilesSettings extends SettingsPreferenceFragment
         implements LineageBaseSystemSettingSwitchBar.SwitchBarChangeCallback,
         Preference.OnPreferenceChangeListener {
@@ -320,4 +319,3 @@
         }
     };
 }
-*/
diff --git a/src/org/lineageos/lineageparts/profiles/SetupActionsFragment.java b/src/org/lineageos/lineageparts/profiles/SetupActionsFragment.java
index 9442256..ef4f509 100644
--- a/src/org/lineageos/lineageparts/profiles/SetupActionsFragment.java
+++ b/src/org/lineageos/lineageparts/profiles/SetupActionsFragment.java
@@ -58,7 +58,6 @@
 import android.widget.SeekBar;
 import android.widget.TextView;
 
-/*
 import lineageos.app.Profile;
 import lineageos.app.ProfileGroup;
 import lineageos.app.ProfileManager;
@@ -796,11 +795,11 @@
 
         int defaultIndex = 0; // normal by default
         if (setting.isOverride()) {
-            if (setting.getValue().equals(values[0] /* normal *//*)) {
+            if (setting.getValue().equals(values[0] /* normal */)) {
                 defaultIndex = 0;
-            } else if (setting.getValue().equals(values[1] /* vibrate *//*)) {
+            } else if (setting.getValue().equals(values[1] /* vibrate */)) {
                 defaultIndex = 1; // enabled
-            } else if (setting.getValue().equals(values[2] /* mute *//*)) {
+            } else if (setting.getValue().equals(values[2] /* mute */)) {
                 defaultIndex = 2; // mute
             }
         } else {
@@ -1160,4 +1159,3 @@
                 R.string.profile_profile_manage, null, this, NEW_TRIGGER_REQUEST_CODE);
     }
 }
-*/
diff --git a/src/org/lineageos/lineageparts/profiles/SetupTriggersFragment.java b/src/org/lineageos/lineageparts/profiles/SetupTriggersFragment.java
index 7fd9d8b..109ac60 100644
--- a/src/org/lineageos/lineageparts/profiles/SetupTriggersFragment.java
+++ b/src/org/lineageos/lineageparts/profiles/SetupTriggersFragment.java
@@ -31,7 +31,6 @@
 import lineageos.app.Profile;
 import lineageos.app.ProfileManager;
 
-/*
 import org.lineageos.lineageparts.R;
 import org.lineageos.lineageparts.SettingsPreferenceFragment;
 import org.lineageos.lineageparts.PartsActivity;
@@ -171,4 +170,3 @@
 
 
 }
-*/
diff --git a/src/org/lineageos/lineageparts/profiles/TriggerPagerAdapter.java b/src/org/lineageos/lineageparts/profiles/TriggerPagerAdapter.java
index d5add85..c952df7 100644
--- a/src/org/lineageos/lineageparts/profiles/TriggerPagerAdapter.java
+++ b/src/org/lineageos/lineageparts/profiles/TriggerPagerAdapter.java
@@ -24,11 +24,9 @@
 import android.view.ViewGroup;
 
 import org.lineageos.lineageparts.R;
-/*
 import org.lineageos.lineageparts.profiles.triggers.BluetoothTriggerFragment;
 import org.lineageos.lineageparts.profiles.triggers.NfcTriggerFragment;
 import org.lineageos.lineageparts.profiles.triggers.WifiTriggerFragment;
-*/
 import com.google.android.collect.Lists;
 
 import java.lang.ref.WeakReference;
@@ -174,53 +172,39 @@
         /**
          * The artist fragment
          */
-        /*
         WIFI(WifiTriggerFragment.class, R.string.profile_tabs_wifi),
-        */
         /**
          * The album fragment
          */
-        /*
         BLUETOOTH(BluetoothTriggerFragment.class, R.string.profile_tabs_bluetooth),
-        */
         /**
          * The song fragment
          */
-        /*
         NFC(NfcTriggerFragment.class, R.string.profile_tabs_nfc);
-        */
 
-        /*
         private Class<? extends Fragment> mFragmentClass;
         private int mNameRes;
-        */
 
         /**
          * Constructor of <code>MusicFragments</code>
          *
          * @param fragmentClass The fragment class
          */
-        /*
         private TriggerFragments(final Class<? extends Fragment> fragmentClass, int nameRes) {
             mFragmentClass = fragmentClass;
             mNameRes = nameRes;
         }
-        */
 
         /**
          * Method that returns the fragment class.
          *
          * @return Class<? extends Fragment> The fragment class.
          */
-        /*
         public Class<? extends Fragment> getFragmentClass() {
             return mFragmentClass;
         }
-        */
 
-        /*
         public int getTitleRes() { return mNameRes; }
-        */
     }
 
     /**
diff --git a/src/org/lineageos/lineageparts/profiles/actions/item/ConnectionOverrideItem.java b/src/org/lineageos/lineageparts/profiles/actions/item/ConnectionOverrideItem.java
index bad2e61..a32aa33 100644
--- a/src/org/lineageos/lineageparts/profiles/actions/item/ConnectionOverrideItem.java
+++ b/src/org/lineageos/lineageparts/profiles/actions/item/ConnectionOverrideItem.java
@@ -24,7 +24,6 @@
 
 import lineageos.profiles.ConnectionSettings;
 
-/*
 public class ConnectionOverrideItem extends BaseItem {
     int mConnectionId;
     ConnectionSettings mConnectionSettings;
@@ -131,4 +130,3 @@
         return mConnectionId;
     }
 }
-*/
diff --git a/src/org/lineageos/lineageparts/profiles/actions/item/VolumeStreamItem.java b/src/org/lineageos/lineageparts/profiles/actions/item/VolumeStreamItem.java
index e02ddb5..975d858 100644
--- a/src/org/lineageos/lineageparts/profiles/actions/item/VolumeStreamItem.java
+++ b/src/org/lineageos/lineageparts/profiles/actions/item/VolumeStreamItem.java
@@ -25,11 +25,8 @@
 import org.lineageos.lineageparts.R;
 import org.lineageos.lineageparts.profiles.actions.ItemListAdapter;
 
-/*
 import lineageos.profiles.StreamSettings;
-*/
 
-/*
 public class VolumeStreamItem extends BaseItem {
     private int mStreamId;
     private StreamSettings mStreamSettings;
@@ -73,8 +70,11 @@
     @Override
     public View getView(LayoutInflater inflater, View convertView, ViewGroup parent) {
         View view = super.getView(inflater, convertView, parent);
+        /*
         final boolean volumeLinkNotification = Settings.Secure.getInt(inflater.getContext()
                 .getContentResolver(), Settings.Secure.VOLUME_LINK_NOTIFICATION, 1) == 1;
+        */
+        final boolean volumeLinkNotification = false;
         if (mStreamId == AudioManager.STREAM_NOTIFICATION && volumeLinkNotification) {
             view.findViewById(android.R.id.title).setEnabled(false);
             view.findViewById(android.R.id.summary).setEnabled(false);
@@ -105,4 +105,3 @@
         return mStreamSettings;
     }
 }
-*/
diff --git a/src/org/lineageos/lineageparts/profiles/triggers/BluetoothTriggerFragment.java b/src/org/lineageos/lineageparts/profiles/triggers/BluetoothTriggerFragment.java
index 545effc..0bd83f5 100644
--- a/src/org/lineageos/lineageparts/profiles/triggers/BluetoothTriggerFragment.java
+++ b/src/org/lineageos/lineageparts/profiles/triggers/BluetoothTriggerFragment.java
@@ -38,15 +38,12 @@
 import lineageos.app.ProfileManager;
 
 import org.lineageos.lineageparts.R;
-/*
 import org.lineageos.lineageparts.profiles.ProfilesSettings;
-*/
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
-/*
 public class BluetoothTriggerFragment extends ListFragment {
 
     private BluetoothAdapter mBluetoothAdapter;
@@ -278,4 +275,3 @@
         }
     }
 }
-*/
diff --git a/src/org/lineageos/lineageparts/profiles/triggers/NfcTriggerFragment.java b/src/org/lineageos/lineageparts/profiles/triggers/NfcTriggerFragment.java
index 6450c51..adb684c 100644
--- a/src/org/lineageos/lineageparts/profiles/triggers/NfcTriggerFragment.java
+++ b/src/org/lineageos/lineageparts/profiles/triggers/NfcTriggerFragment.java
@@ -32,13 +32,10 @@
 
 import org.lineageos.lineageparts.R;
 import org.lineageos.lineageparts.PartsActivity;
-/*
 import org.lineageos.lineageparts.profiles.NFCProfileTagCallback;
 import org.lineageos.lineageparts.profiles.NFCProfileUtils;
 import org.lineageos.lineageparts.profiles.ProfilesSettings;
-*/
 
-/*
 public class NfcTriggerFragment extends Fragment implements NFCProfileTagCallback {
     Profile mProfile;
 
@@ -123,4 +120,3 @@
         return inflater.inflate(R.layout.nfc_writer, container, false);
     }
 }
-*/
diff --git a/src/org/lineageos/lineageparts/profiles/triggers/WifiTriggerFragment.java b/src/org/lineageos/lineageparts/profiles/triggers/WifiTriggerFragment.java
index 52e89f7..9d5ad38 100644
--- a/src/org/lineageos/lineageparts/profiles/triggers/WifiTriggerFragment.java
+++ b/src/org/lineageos/lineageparts/profiles/triggers/WifiTriggerFragment.java
@@ -37,14 +37,11 @@
 import lineageos.app.ProfileManager;
 
 import org.lineageos.lineageparts.R;
-/*
 import org.lineageos.lineageparts.profiles.ProfilesSettings;
-*/
 
 import java.util.ArrayList;
 import java.util.List;
 
-/*
 public class WifiTriggerFragment extends ListFragment {
     WifiManager mWifiManager;
     Profile mProfile;
@@ -289,4 +286,3 @@
         }
     }
 }
-*/