package com.paulvarry.intra42.tab.home;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.MenuItem;

import com.paulvarry.intra42.Adapter.ViewPagerAdapter;
import com.paulvarry.intra42.R;
import com.paulvarry.intra42.ui.BasicTabActivity;
import com.paulvarry.intra42.ui.tools.Navigation;

public class HomeActivity extends BasicTabActivity
        implements HomeFragment.OnFragmentInteractionListener, HomeEventsFragment.OnFragmentInteractionListener,
        HomeSlotsFragment.OnFragmentInteractionListener, HomeCorrectionsFragment.OnFragmentInteractionListener {

    public static Intent getIntent(Context context) {
        return new Intent(context, HomeActivity.class);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.allowHamburger();
        super.onCreate(savedInstanceState);
        super.setSelectedMenu(Navigation.MENU_SELECTED_HOME);

    }

    @Override
    public void setupViewPager(ViewPager viewPager) {
        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
        adapter.addFragment(HomeFragment.newInstance(), getString(R.string.tab_home_home));
        adapter.addFragment(HomeEventsFragment.newInstance(), getString(R.string.tab_home_agenda));
        adapter.addFragment(HomeSlotsFragment.newInstance(), getString(R.string.tab_home_slots));
        adapter.addFragment(HomeCorrectionsFragment.newInstance(), getString(R.string.tab_home_corrections));
        viewPager.setAdapter(adapter);
    }

    @Override
    public String getUrlIntra() {
        return "https://intra.42.fr/";
    }

    @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();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_open_intra) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onFragmentInteraction(Uri uri) {

    }

    @Override
    public boolean getDataOnOtherThread() {
        return true;
    }

    @Override
    public boolean getDataOnMainThread() {
        return true;
    }

    @Override
    public String getToolbarName() {
        return null;
    }

}

@@ -1719,505 +1719,8 @@
  %7D%0A%0A
-    @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        // Handle action bar item clicks here. The action bar will%0A        // automatically handle clicks on the Home/Up button, so long%0A        // as you specify a parent activity in AndroidManifest.xml.%0A        int id = item.getItemId();%0A%0A        //noinspection SimplifiableIfStatement%0A        if (id == R.id.action_open_intra) %7B%0A            return true;%0A        %7D%0A%0A        return super.onOptionsItemSelected(item);%0A    %7D%0A%0A
     

fix "show web version" on home screen