[Android Apps and Games] rompnit:
So I wanted to share with you all how to create an "About ROM" fragment. This way will give you the option of a different logo depending on the selected theme :)

Screenshots:

- First off.. Create a new fragment as you would any other. We'll come back to this.

- Because we want the logo to change between light/dark themes, we need to create an attribute for it. Go to values\attrs.xml and add :

<attr name="my_logo" format="reference"/>

- Add your logos to the drawable folder. We'll use 'logo_light.png' & 'logo_dark.png' for naming (my png size is set at 490x191 for reference).

- Open values-v21\styles.xml and add the resources appropriately.

For "Theme.AppCompat.NoActionBar" add

<item name="my_logo">@drawable/logo_dark</item>

For "Theme.AppCompat.Light.NoActionBar" add

<item name="my_logo">@drawable/logo_light</item>

- Now we need to create a new "layout resource file" in res\layout. Name it 'my_logo'.

- So within my_logo.xml, replace everything with this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent">

<ImageView
android:layout_width="fill_parent"
android:layout_marginLeft="45dp"
android:layout_marginRight="45dp"
android:layout_height="wrap_content"
android:src="?my_logo" />
</LinearLayout>

- Getting back to the new fragment you created, this is the way mine is laid out:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

<PreferenceScreen
android:layout_width="match_parent"
android:layout_height="135dp"
android:layout="@layout/my_logo" >
</PreferenceScreen>

<PreferenceCategory
android:title="External Links" />
<PreferenceScreen
android:icon="@drawable/xda"
android:title="XDA ROM Thread"
android:summary="Click to visit the ROM thread">
<intent
android:action="android.intent.action.VIEW"
android:data="http://xdaforums.com/sprint-galaxy-s5/development/rom-v5-0-mod-control-floating-windows-t3016692" />
</PreferenceScreen>
<PreferenceScreen
android:icon="@drawable/darksyde"
android:title="Team Darksyde Themes"
android:summary="By willowmaker420 and JoeyDuran ">
<intent
android:action="android.intent.action.VIEW"
android:data="http://xdaforums.com/sprint-galaxy-s5/themes-apps/theme-mod-t3043481" />
</PreferenceScreen>
<PreferenceCategory
android:title="MOAR ROM Developers" />
<PreferenceScreen
android:icon="@drawable/tdunham"
android:title="tdunham"
android:summary="The mod master" >
<intent
android:icon="@drawable/tdunham"
android:action="android.intent.action.VIEW"
android:data="http://xdaforums.com/member.php?u=1042140" />
</PreferenceScreen>
<PreferenceScreen
android:icon="@drawable/rompnit"
android:title="rompnit"
android:summary="What's he do?">
<intent
android:icon="@drawable/rompnit"
android:action="android.intent.action.VIEW"
android:data="http://xdaforums.com/member.php?u=1167171" />
</PreferenceScreen>

</PreferenceScreen>

** You have the logo at the top referenced from "@layout/my_logo", followed by the links to various things..

- Finally 'intent' will pull the icons automatically, and in this case because they are links it will pull a generic system icon so we need to kill that. The side effect it.. it will kill automatic pulling of icons across all intent. Because of this you will need to define your icons like above using android:icon="@drawable/my_icon_here" or an icon just won't show (No biggie in many cases).

- To kill the icons open HandlePreferenceFragments.java and find 'public void allGroups'

-- Remove everything in RED

public void allGroups(Preference p) {
PreferenceScreen ps = (PreferenceScreen) p;
ps.setOnPreferenceClickListener(this);
[COLOR="Red"]
if(ps.getIntent()!=null){
Intent intent = ps.getIntent();
try {
Drawable iconFromIntent = c.getPackageManager().getActivityIcon(intent);
ps.setIcon(iconFromIntent);
} catch (PackageManager.NameNotFoundException e) {
Map<Preference, PreferenceScreen> preferenceParentTree = buildPreferenceParentTree();
PreferenceScreen preferenceParent = preferenceParentTree.get(ps);
preferenceParent.removePreference(ps);
}
}
/*Initiate icon view for preferences with keys that are interpreted as Intent
*For more info see OnPreferenceClick method*/
if (ps.getKey() != null) {
if (ps.getKey().contains(".")) {
int lastDot = ps.getKey().lastIndexOf(".");
String pkgName = ps.getKey().substring(0, lastDot);
try {
//if application package exists, we will set the icon successfully
Drawable icon = c.getPackageManager().getApplicationIcon(pkgName);
ps.setIcon(icon);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
/*In case of exception, icon will not be set and we will remove the preference to avoid crashes on clicks
*To find the parent for each preference screen we use HashMap to build the parent tree*/
Map<Preference, PreferenceScreen> preferenceParentTree = buildPreferenceParentTree();
PreferenceScreen preferenceParent = preferenceParentTree.get(ps);
preferenceParent.removePreference(ps);

}
}
}[/COLOR]

for (int i = 0; i < ps.getPreferenceCount(); i++) {
Preference p1 = ps.getPreference(i);
if (p1 instanceof PreferenceScreen) {
/*As we descend further on a preference tree, if we meet another PreferenceScreen, we repeat the allGroups method.
*This method will loop untill we don't have nested screeens anymore.*/
allGroups(p1);

}
}
}

-- So the final method should look like this:

public void allGroups(Preference p) {
PreferenceScreen ps = (PreferenceScreen) p;
ps.setOnPreferenceClickListener(this);

for (int i = 0; i < ps.getPreferenceCount(); i++) {
Preference p1 = ps.getPreference(i);
if (p1 instanceof PreferenceScreen) {
/*As we descend further on a preference tree, if we meet another PreferenceScreen, we repeat the allGroups method.
*This method will loop until we don't have nested screens anymore.*/
allGroups(p1);

}
}
}

That's all! :D