Android Open Source - Kwitter Settings Fragment






From Project

Back to project page Kwitter.

License

The source code is released under:

Apache License

If you think the Android project Kwitter listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.krossovochkin.kwitter.fragments;
//from w w w .j a v a2  s . c  o m
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;

import com.krossovochkin.kwitter.R;
import com.tundem.aboutlibraries.Libs;
import com.tundem.aboutlibraries.ui.LibsActivity;

/**
 * Created by Vasya Drobushkov <vasya.drobushkov@gmail.com> on 13.08.14.
 */
public class SettingsFragment extends PreferenceFragment {

    public static SettingsFragment newInstance() {
        return new SettingsFragment();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.xml.preferences);

        initPreferences();
    }

    private void initPreferences() {
        if (getPreferenceManager() != null) {
            Preference prefLibs = getPreferenceManager().findPreference(getString(R.string.pref_libs_key));
            if (prefLibs != null) {
                prefLibs.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                    @Override
                    public boolean onPreferenceClick(Preference preference) {
                        showAboutLibsActivity();
                        return true;
                    }
                });
            } else {
                throw new IllegalStateException("no preference found");
            }
        }
    }

    private void showAboutLibsActivity() {
        //Create an intent with context and the Activity class
        Intent i = new Intent(getActivity(), LibsActivity.class);
        //Pass the fields of your application to the lib so it can find all external lib information
        i.putExtra(Libs.BUNDLE_FIELDS, Libs.toStringArray(R.string.class.getFields()));
        //Define the libs you want (only those who don't include the information, and are managed by the AboutLibraries library) (OPTIONAL if all used libraries offer the information)
        i.putExtra(Libs.BUNDLE_LIBS, new String[]{
                "picasso",
                "androidviewpagerindicator"
        });

        //Display the library version (OPTIONAL)
        i.putExtra(Libs.BUNDLE_VERSION, true);
        //Display the library license (OPTIONAL
        i.putExtra(Libs.BUNDLE_LICENSE, true);

        //Pass your theme (OPTIONAL)
        i.putExtra(Libs.BUNDLE_THEME, R.style.AppTheme);
        //Pass a custom accent color (OPTIONAL)
        i.putExtra(Libs.BUNDLE_ACCENT_COLOR, getResources().getColor(R.color.colorSecondary));
        //Pass the information if it should use the Translucent decor (OPTIONAL) -> requires ACCENT_COLOR
        i.putExtra(Libs.BUNDLE_TRANSLUCENT_DECOR, true);

        startActivity(i);
    }
}




Java Source Code List

com.krossovochkin.kwitter.activities.AuthActivity.java
com.krossovochkin.kwitter.activities.MainActivity.java
com.krossovochkin.kwitter.activities.SettingsActivity.java
com.krossovochkin.kwitter.adapters.TimelineAdapter.java
com.krossovochkin.kwitter.adapters.ViewPagerAdapter.java
com.krossovochkin.kwitter.fragments.BaseTimelineFragment.java
com.krossovochkin.kwitter.fragments.MainFragment.java
com.krossovochkin.kwitter.fragments.MentionsFragment.java
com.krossovochkin.kwitter.fragments.NavigationDrawerFragment.java
com.krossovochkin.kwitter.fragments.SendTweetFragment.java
com.krossovochkin.kwitter.fragments.SettingsFragment.java
com.krossovochkin.kwitter.fragments.TimelineFragment.java
com.krossovochkin.kwitter.fragments.ViewPagerFragment.java
com.krossovochkin.kwitter.listeners.FavoriteListener.java
com.krossovochkin.kwitter.listeners.GetTimelineListener.java
com.krossovochkin.kwitter.listeners.RetweetListener.java
com.krossovochkin.kwitter.listeners.SendTweetListener.java
com.krossovochkin.kwitter.listeners.TweetActionListener.java
com.krossovochkin.kwitter.listeners.TwitterActionListener.java
com.krossovochkin.kwitter.tasks.FavoriteAsyncTask.java
com.krossovochkin.kwitter.tasks.GetMentionsAsyncTask.java
com.krossovochkin.kwitter.tasks.GetTimelineAsyncTask.java
com.krossovochkin.kwitter.tasks.RetweetAsyncTask.java
com.krossovochkin.kwitter.tasks.SendReplyAsyncTask.java
com.krossovochkin.kwitter.tasks.SendTweetAsyncTask.java
com.krossovochkin.kwitter.toolbox.Constants.java
com.krossovochkin.kwitter.toolbox.FileManager.java
com.krossovochkin.kwitter.toolbox.KeyboardHelper.java
com.krossovochkin.kwitter.toolbox.Settings.java