package activities;

import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import java.util.ArrayList;

import adapters.MainActivityPageAdapter;
import fragments.Home;
import me.dstny.activities.R;

public class MainActivity extends Activity {

    private ArrayList<Fragment> fragments;
    private FragmentManager fm;
    private FragmentTransaction ft;
    private ViewPager viewPager;
    private MainActivityPageAdapter mainActivityPageAdapter;
    private Home homeFragment;

    private Button callButton;
    private Button postButton;
    private Button donateButton;
    private Button mailButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        homeFragment = new Home();
        fragments = new ArrayList<Fragment>();
        fragments.add(homeFragment);
        viewPager = (ViewPager) findViewById(R.id.viewpager);
        fm = getFragmentManager();
        mainActivityPageAdapter = new MainActivityPageAdapter(fm, fragments);
        viewPager.setAdapter(mainActivityPageAdapter);
        viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageSelected(int position) {
            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {

            }

            @Override
            public void onPageScrollStateChanged(int arg0) {
            }
        });
        viewPager.setCurrentItem(0);
        viewPager.setOffscreenPageLimit(3);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        callButton = (Button) findViewById(R.id.call_button);
        postButton = (Button) findViewById(R.id.post_button);
        donateButton = (Button) findViewById(R.id.donate_button);
        mailButton = (Button) findViewById(R.id.mail_button);
    }

    public void callButtonPressed(View view) {
    }

    public void postButtonPressed(View view) {
    }

    public void donateButtonPressed(View view) {
    }

    public void mailButtonPressed(View view) {
    }

    public void settingsButtonPressed(View view) {
        Intent intent = new Intent(MainActivity.this, Settings.class);
        startActivity(intent);
        finish();
    }
}

@@ -486,24 +486,54 @@
 ageAdapter;%0A
+import data.PreferencesLayer;%0A
 import fragm
@@ -2361,167 +2361,481 @@
     
-%7D%0A%0A    public void postButtonPressed(View view) %7B%0A    %7D%0A%0A    public void donateButtonPressed(View view) %7B%0A    %7D%0A%0A    public void mailButtonPressed(View view) %7B
+    PreferencesLayer.getInstance().setCallPref(callButton.isActivated());%0A    %7D%0A%0A    public void postButtonPressed(View view) %7B%0A        PreferencesLayer.getInstance().setPostPref(postButton.isActivated());%0A    %7D%0A%0A    public void donateButtonPressed(View view) %7B%0A        PreferencesLayer.getInstance().setPostPref(donateButton.isActivated());%0A    %7D%0A%0A    public void mailButtonPressed(View view) %7B%0A        PreferencesLayer.getInstance().setMailPref(mailButton.isActivated());
 %0A   

Set the preferences when button clicked.