Example usage for android.preference PreferenceScreen bind

List of usage examples for android.preference PreferenceScreen bind

Introduction

In this page you can find the example usage for android.preference PreferenceScreen bind.

Prototype

public void bind(ListView listView) 

Source Link

Document

Binds a ListView to the preferences contained in this PreferenceScreen via #getRootAdapter() .

Usage

From source file:com.nkahoang.screenstandby.PreferenceListFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null && lv != null) {
        preferenceScreen.bind(lv);
    }/*from   w w  w .  ja v a  2  s  . co m*/
}

From source file:org.xingjitong.ui.PreferencesListFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        preferenceScreen.bind(preferencesList);
    }//  ww w.ja v a 2s.c  om
}

From source file:eu.inmite.apps.smsjizdenka.framework.fragment.PreferenceListFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        preferenceScreen.bind(lv);
    }/*w  w  w  . j av a 2s .com*/
}

From source file:org.solovyev.android.games.game2048.PreferenceManagerCompat.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        final ListView lv = fragment.getListView();
        if (lv != null) {
            preferenceScreen.bind(lv);
        }/*from  ww  w .  j  a  v a2 s  .c om*/
    }
}

From source file:com.sim2dial.dialer.ui.PreferencesListFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null && preferencesList != null) {
        preferenceScreen.bind(preferencesList);
    }/*from   w  w w . j ava  2s  . c o m*/
}

From source file:apps.veery.com.util.PreferenceFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        preferenceScreen.bind(getListView());
    }/*ww w .  j  a  v  a2s. c o m*/
}

From source file:com.limelight.testvideosdk.PreferenceFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        preferenceScreen.bind(getListView());
    }// w  ww.j a  va 2 s  .  co m
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
        // Workaround android bug for SDK 10 and below - see
        // https://github.com/android/platform_frameworks_base/commit/2d43d283fc0f22b08f43c6db4da71031168e7f59
        getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                // If the list has headers, subtract them from the
                // index.
                if (parent instanceof ListView) {
                    position -= ((ListView) parent).getHeaderViewsCount();
                }
                Object item = preferenceScreen.getRootAdapter().getItem(position);
                if (!(item instanceof Preference))
                    return;
                final Preference preference = (Preference) item;
                try {
                    Method performClick = Preference.class.getDeclaredMethod("performClick",
                            PreferenceScreen.class);
                    performClick.setAccessible(true);
                    performClick.invoke(preference, preferenceScreen);
                } catch (InvocationTargetException e) {
                } catch (IllegalAccessException e) {
                } catch (NoSuchMethodException e) {
                }
            }
        });
    }
}

From source file:com.anprosit.android.dagger.ui.v4.PreferenceFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        preferenceScreen.bind(getListView());
    }/*from  ww  w .j  ava 2  s  .  c  o m*/

    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
        // Workaround android bug for SDK 10 and below - see
        // https://github.com/android/platform_frameworks_base/commit/2d43d283fc0f22b08f43c6db4da71031168e7f59
        getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                // If the list has headers, subtract them from the index.
                if (parent instanceof ListView) {
                    position -= ((ListView) parent).getHeaderViewsCount();
                }

                Object item = preferenceScreen.getRootAdapter().getItem(position);
                if (!(item instanceof Preference))
                    return;

                final Preference preference = (Preference) item;
                try {
                    Method performClick = Preference.class.getDeclaredMethod("performClick",
                            PreferenceScreen.class);
                    performClick.setAccessible(true);
                    performClick.invoke(preference, preferenceScreen);
                } catch (InvocationTargetException e) {
                } catch (IllegalAccessException e) {
                } catch (NoSuchMethodException e) {
                }
            }
        });
    }
}

From source file:tm.alashow.datmusic.ui.widget.preferencefragment.PreferenceFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        preferenceScreen.bind(getListView());
    }//  w  w  w  .java2  s  .  c om

    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
        // Workaround android bug for SDK 10 and below - see
        // https://github.com/android/platform_frameworks_base/commit/2d43d283fc0f22b08f43c6db4da71031168e7f59
        getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                // If the list has headers, subtract them from the index.
                if (parent instanceof ListView) {
                    position -= ((ListView) parent).getHeaderViewsCount();
                }

                Object item = preferenceScreen.getRootAdapter().getItem(position);
                if (!(item instanceof Preference)) {
                    return;
                }

                final Preference preference = (Preference) item;
                try {
                    Method performClick = Preference.class.getDeclaredMethod("performClick",
                            PreferenceScreen.class);
                    performClick.setAccessible(true);
                    performClick.invoke(preference, preferenceScreen);
                } catch (InvocationTargetException e) {
                } catch (IllegalAccessException e) {
                } catch (NoSuchMethodException e) {
                }
            }
        });
    }
}

From source file:eu.chainfire.geolog.ui.PreferenceListFragment.java

private void bindPreferences() {
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        try {// w w  w.  j  av a 2  s  .  co  m
            if (lv == null)
                lv = getListView();
            preferenceScreen.bind(lv);
        } catch (Exception e) {
        }
    }
}