/*
 * Copyright 2013-2015 The GDG Frisbee Project
 *
 * 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 org.gdg.frisbee.android.activity;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.MenuItem;

import com.viewpagerindicator.TitlePageIndicator;

import org.gdg.frisbee.android.R;
import org.gdg.frisbee.android.fragment.*;

import butterknife.InjectView;

/**
 * GDG Aachen
 * org.gdg.frisbee.android.activity
 * <p/>
 * User: maui
 * Date: 22.04.13
 * Time: 23:03
 */
public class AboutActivity extends GdgActivity {
    private static String LOG_TAG = "GDG-AboutActivity";

    @InjectView(R.id.pager)
    ViewPager mViewPager;

    @InjectView(R.id.titles)
    TitlePageIndicator mIndicator;

    private AboutPagerAdapter mViewPagerAdapter;

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

        setContentView(R.layout.activity_about);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowTitleEnabled(true);
        getSupportActionBar().setDisplayUseLogoEnabled(true);
        getSupportActionBar().setTitle(R.string.about);


        mIndicator.setOnPageChangeListener(this);

        mViewPagerAdapter = new AboutPagerAdapter(this, getSupportFragmentManager());
        mViewPager.setAdapter(mViewPagerAdapter);
        mIndicator.setViewPager(mViewPager);
    }

    protected String getTrackedViewName() {
        return "About/"+getResources().getStringArray(R.array.about_tabs)[getCurrentPage()];
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        if(item.getItemId() == android.R.id.home) {
            finish();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    public class AboutPagerAdapter extends FragmentStatePagerAdapter {
        private Context mContext;

        public AboutPagerAdapter(Context ctx, FragmentManager fm) {
            super(fm);
            mContext = ctx;
        }

        @Override
        public int getItemPosition(Object object) {
            return POSITION_NONE;
        }

        @Override
        public int getCount() {
            return mContext.getResources().getStringArray(R.array.about_tabs).length;
        }

        @Override
        public Fragment getItem(int position) {
            switch(position) {
                case 0:
                    return new AboutFragment();
                case 1:
                    return new ContributorsFragment();
                case 2:
                    return new TranslatorsFragment();
                case 3:
                    return new ChangelogFragment();
                case 4:
                    return new GetInvolvedFragment();
                case 5:
                    return new ExtLibrariesFragment();
            }
            return null;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            return mContext.getResources().getStringArray(R.array.about_tabs)[position];
        }
    }
}

@@ -1079,275 +1079,418 @@
 ent.
-*;%0D%0A%0D%0Aimport butterknife.InjectView;%0D%0A%0D%0A/**%0D%0A * GDG Aachen%0D%0A * org.gdg.frisbee.android.activity%0D%0A * %3Cp/%3E%0D%0A * User: maui%0D%0A * Date: 22.04.13%0D%0A * Time: 23:03%0D%0A */%0D%0Apublic class AboutActivity extends GdgActivity %7B%0D%0A    private static String LOG_TAG = %22GDG-AboutActivity%22;
+AboutFragment;%0D%0Aimport org.gdg.frisbee.android.fragment.ChangelogFragment;%0D%0Aimport org.gdg.frisbee.android.fragment.ContributorsFragment;%0D%0Aimport org.gdg.frisbee.android.fragment.ExtLibrariesFragment;%0D%0Aimport org.gdg.frisbee.android.fragment.GetInvolvedFragment;%0D%0Aimport org.gdg.frisbee.android.fragment.TranslatorsFragment;%0D%0A%0D%0Aimport butterknife.InjectView;%0D%0A%0D%0Apublic class AboutActivity extends GdgActivity %7B
 %0D%0A%0D%0A
@@ -1619,60 +1619,8 @@
 %0D%0A%0D%0A
-    private AboutPagerAdapter mViewPagerAdapter;%0D%0A%0D%0A
     
@@ -2035,18 +2035,16 @@
 ut);%0D%0A%0D%0A
-%0D%0A
         
@@ -2110,18 +2110,20 @@
 ager
+.set
 Adapter
- = 
+(
 new 
@@ -2178,58 +2178,8 @@
 r())
-;%0D%0A        mViewPager.setAdapter(mViewPagerAdapter
 );%0D%0A
@@ -2305,9 +2305,11 @@
 ut/%22
-+
+ + 
 getR
@@ -2469,16 +2469,17 @@
       if
+ 
 (item.ge
@@ -3237,16 +3237,17 @@
   switch
+ 
 (positio

reformat AboutActivity