Android Open Source - WhatsAppTracker Settings Activity






From Project

Back to project page WhatsAppTracker.

License

The source code is released under:

Apache License

If you think the Android project WhatsAppTracker 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

/*
 Copyright (C) 2014 Newton Bujiku/*from  w w  w .  ja  va  2  s  .  c  o m*/

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

*/
package com.gottibujiku.whatsapptracker;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.os.Build;
import android.view.MenuItem;

import com.readystatesoftware.systembartint.SystemBarTintManager;

/**
 * Settings activity for enabling notifications and changing refresh rate
 *
 * @author Newton Bujiku
 * @since August 2014
 */
public class SettingsActivity extends Activity {


    private ActionBar actionBar;
    private static final String SETTINGS = "Settings";


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

        //set up the action bar
        actionBar = getActionBar();
        actionBar.setTitle(SETTINGS);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        if (savedInstanceState == null) {
            getFragmentManager().beginTransaction()
                    .add(android.R.id.content, new PlaceholderFragment())
                    .commit();
        }
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        switch (id) {

            case android.R.id.home:
                finish();
                return true;

        }


        return super.onOptionsItemSelected(item);
    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends PreferenceFragment {


        @Override
        public void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);
            // Load the preferences from an XML resource
            addPreferencesFromResource(R.xml.preferences);

            //Tint the system bars

            SystemBarTintManager tintManager = new SystemBarTintManager(getActivity());
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setNavigationBarTintEnabled(true);
            tintManager.setTintColor(getResources().getColor(R.color.action_bar));

            SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

                getActivity().findViewById(android.R.id.content).setPadding(
                        config.getPixelInsetRight(), config.getPixelInsetTop(true),
                        config.getPixelInsetRight(), 0);

            }

            return;
        }
    }
}




Java Source Code List

com.gottibujiku.fragments.AboutDialog.java
com.gottibujiku.receivers.TrackerBootReceiver.java
com.gottibujiku.receivers.TrackerReceiver.java
com.gottibujiku.services.TrackerService.java
com.gottibujiku.util.Util.java
com.gottibujiku.whatsapptracker.ApplicationTest.java
com.gottibujiku.whatsapptracker.MainActivity.java
com.gottibujiku.whatsapptracker.SettingsActivity.java
com.gottibujiku.whatsapptracker.TrackerApplication.java