Projects >> MGoBlog >>c7eedd44385354123a321a527e60c7c38de16328

Chunk
Conflicting content
package com.atami.mgodroid.ui;

<<<<<<< HEAD
import android.graphics.Color;
=======
>>>>>>> a2e1c87aa3f2edd91426ac616386a1a6dba7c6ed
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
Solution content
package com.atami.mgodroid.ui;

import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
File
MGoBlogActivity.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
public class MGoBlogActivity extends BaseActivity {

<<<<<<< HEAD
	private static final String TAG = "MGoBlogActivity";
	private static final String STATE_ACTIVE_POSITION = "com.atami.mgodroid.activePosition";

	private MenuDrawer mMenuDrawer;

	private int mActivePosition = 1;
	private Handler mHandler;
	private Runnable mToggleUpRunnable;
	private boolean mDisplayUp = true;

	private boolean mIsDualPane;

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

		if (savedInstanceState != null) {
			mActivePosition = savedInstanceState.getInt(STATE_ACTIVE_POSITION);
		}

		mIsDualPane = getResources().getBoolean(R.bool.has_two_panes);

		// TODO: MenuDrawer will crash when switching from non static drawer to
		// static. Issue is at
		// https://github.com/SimonVT/android-menudrawer/issues/62
		if (mIsDualPane) {
			mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT,
					Position.LEFT, true);
		} else {
			mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT,
					Position.LEFT, false);
		}

		mMenuDrawer.setContentView(R.layout.node_index_container);

		buildMenuDrawer();

		if (savedInstanceState == null) {
			getSupportFragmentManager()
					.beginTransaction()
					.replace(R.id.node_index_container,
							NodeIndexListFragment.newInstance("promote", "1"),
							"MGoBlog")
					.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
					.commit();
		}
	}

	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt(STATE_ACTIVE_POSITION, mActivePosition);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			mMenuDrawer.toggleMenu();

			return true;
		}

		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onBackPressed() {
		final int drawerState = mMenuDrawer.getDrawerState();
		if (drawerState == MenuDrawer.STATE_OPEN
				|| drawerState == MenuDrawer.STATE_OPENING) {
			mMenuDrawer.closeMenu();
			return;
		}

		super.onBackPressed();
	}

	private void buildMenuDrawer() {
=======
    private static final String TAG = "MGoBlogActivity";
    private static final String STATE_ACTIVE_POSITION = "com.atami.mgodroid.activePosition";

    private MenuDrawer mMenuDrawer;

    private int mActivePosition = 1;
    private Handler mHandler;
    private Runnable mToggleUpRunnable;
    private boolean mDisplayUp = true;

    private boolean mIsDualPane;

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

        if (savedInstanceState != null) {
            mActivePosition = savedInstanceState.getInt(STATE_ACTIVE_POSITION);
        }

        mIsDualPane = getResources().getBoolean(R.bool.has_two_panes);


        //TODO: MenuDrawer will crash when switching from non static drawer to static. Issue is at
        //https://github.com/SimonVT/android-menudrawer/issues/62
        if (mIsDualPane) {
            mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT, Position.LEFT, true);
        } else {
            mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT, Position.LEFT, false);
        }

        mMenuDrawer.setContentView(R.layout.node_index_container);

        buildMenuDrawer();

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction().replace(R.id.node_index_container,
                    NodeIndexListFragment.newInstance("promote", "1"), "MGoBlog").setTransition(FragmentTransaction
                    .TRANSIT_FRAGMENT_OPEN).commit();
        }
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt(STATE_ACTIVE_POSITION, mActivePosition);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                mMenuDrawer.toggleMenu();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onBackPressed() {
        final int drawerState = mMenuDrawer.getDrawerState();
        if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING) {
            mMenuDrawer.closeMenu();
            return;
        }

        super.onBackPressed();
    }

    private void buildMenuDrawer() {
>>>>>>> a2e1c87aa3f2edd91426ac616386a1a6dba7c6ed
        List items = new ArrayList();
        items.add(new DrawerCategory("Navigation"));
        items.add(new DrawerItem("MGoBlog", R.drawable.ic_action_blog, R.drawable.ic_action_blog_selected));
Solution content
public class MGoBlogActivity extends BaseActivity {

<<<<<<< HEAD
	private static final String TAG = "MGoBlogActivity";
	private static final String STATE_ACTIVE_POSITION = "com.atami.mgodroid.activePosition";

	private MenuDrawer mMenuDrawer;

	private int mActivePosition = 1;
	private Handler mHandler;
	private Runnable mToggleUpRunnable;
	private boolean mDisplayUp = true;

	private boolean mIsDualPane;

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

		if (savedInstanceState != null) {
			mActivePosition = savedInstanceState.getInt(STATE_ACTIVE_POSITION);
		}

		mIsDualPane = getResources().getBoolean(R.bool.has_two_panes);

		// TODO: MenuDrawer will crash when switching from non static drawer to
		// static. Issue is at
		// https://github.com/SimonVT/android-menudrawer/issues/62
		if (mIsDualPane) {
			mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT,
					Position.LEFT, true);
		} else {
			mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT,
					Position.LEFT, false);
		}

		mMenuDrawer.setContentView(R.layout.node_index_container);

		buildMenuDrawer();

		if (savedInstanceState == null) {
			getSupportFragmentManager()
					.beginTransaction()
					.replace(R.id.node_index_container,
							NodeIndexListFragment.newInstance("promote", "1"),
							"MGoBlog")
					.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
					.commit();
		}
	}

	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt(STATE_ACTIVE_POSITION, mActivePosition);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			mMenuDrawer.toggleMenu();

			return true;
		}

		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onBackPressed() {
		final int drawerState = mMenuDrawer.getDrawerState();
		if (drawerState == MenuDrawer.STATE_OPEN
				|| drawerState == MenuDrawer.STATE_OPENING) {
			mMenuDrawer.closeMenu();
			return;
		}

		super.onBackPressed();
	}

	private void buildMenuDrawer() {

        List items = new ArrayList();
        items.add(new DrawerCategory("Navigation"));
        items.add(new DrawerItem("MGoBlog", R.drawable.ic_action_blog, R.drawable.ic_action_blog_selected));
File
MGoBlogActivity.java
Developer's decision
Manual
Kind of conflict
Annotation
Attribute
Method declaration
Method signature
Chunk
Conflicting content
            mHandler.postDelayed(mToggleUpRunnable, 500);

<<<<<<< HEAD
            
=======
>>>>>>> a2e1c87aa3f2edd91426ac616386a1a6dba7c6ed
            mMenuDrawer.setOnDrawerStateChangeListener(new MenuDrawer.OnDrawerStateChangeListener() {
                @Override
                public void onDrawerStateChange(int oldState, int newState) {
Solution content
            mHandler.postDelayed(mToggleUpRunnable, 500);


            mMenuDrawer.setOnDrawerStateChangeListener(new MenuDrawer.OnDrawerStateChangeListener() {
                @Override
                public void onDrawerStateChange(int oldState, int newState) {
File
MGoBlogActivity.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
                        if (!mDisplayUp) getActionBar().setDisplayHomeAsUpEnabled(true);
                        mMenuDrawer.setOnDrawerStateChangeListener(null);
                    }
<<<<<<< HEAD
=======
                }
            });
        }
    }

    private static class DrawerItem {

        String mTitle;
        int mIconRes;

        DrawerItem(String title, int iconRes) {
            mTitle = title;
            mIconRes = iconRes;
        }
    }

    private static class DrawerCategory {

        String mTitle;

        DrawerCategory(String title) {
            mTitle = title;
        }
    }

    private class MenuDrawerAdapter extends BaseAdapter {

        private List mItems;

        MenuDrawerAdapter(List items) {
            mItems = items;
        }

        @Override
        public int getCount() {
            return mItems.size();
        }

        @Override
        public Object getItem(int position) {
            return mItems.get(position);
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public int getItemViewType(int position) {
            return getItem(position) instanceof
                    DrawerItem ? 0 : 1;
        }

        @Override
        public int getViewTypeCount() {
            return 2;
        }

        @Override
        public boolean isEnabled(int position) {
            return getItem(position) instanceof DrawerItem;
        }

        @Override
        public boolean areAllItemsEnabled() {
            return false;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View v = convertView;
            Object item = getItem(position);

            if (item instanceof DrawerCategory) {
                if (v == null) {
                    v = getLayoutInflater().inflate(R.layout.menu_row_category, parent, false);
>>>>>>> a2e1c87aa3f2edd91426ac616386a1a6dba7c6ed
                }
            });
        }
Solution content
                        if (!mDisplayUp) getActionBar().setDisplayHomeAsUpEnabled(true);
                        mMenuDrawer.setOnDrawerStateChangeListener(null);
                    }
                }
            });
        }
File
MGoBlogActivity.java
Developer's decision
Version 1
Kind of conflict
Annotation
Attribute
Class declaration
Class signature
If statement
Method declaration
Method invocation
Method signature
Variable