PageRenderTime 30ms CodeModel.GetById 17ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/SlidingMenu/src/com/slidingmenu/lib/app/SlidingPreferenceActivity.java

http://mtg-familiar.googlecode.com/
Java | 151 lines | 79 code | 21 blank | 51 comment | 3 complexity | cbf7c3b949dca30bf8791b0f8198038d MD5 | raw file
  1package com.slidingmenu.lib.app;
  2
  3import com.slidingmenu.lib.SlidingMenu;
  4
  5import android.os.Bundle;
  6import android.preference.PreferenceActivity;
  7import android.view.KeyEvent;
  8import android.view.View;
  9import android.view.ViewGroup.LayoutParams;
 10
 11public class SlidingPreferenceActivity extends PreferenceActivity implements SlidingActivityBase {
 12
 13	private SlidingActivityHelper mHelper;
 14
 15	/* (non-Javadoc)
 16	 * @see android.app.Activity#onCreate(android.os.Bundle)
 17	 */
 18	@Override
 19	public void onCreate(Bundle savedInstanceState) {
 20		mHelper = new SlidingActivityHelper(this);
 21		super.onCreate(savedInstanceState);
 22		mHelper.onCreate(savedInstanceState);
 23	}
 24
 25	/* (non-Javadoc)
 26	 * @see android.app.Activity#onPostCreate(android.os.Bundle)
 27	 */
 28	@Override
 29	public void onPostCreate(Bundle savedInstanceState) {
 30		super.onPostCreate(savedInstanceState);
 31		mHelper.onPostCreate(savedInstanceState);
 32	}
 33
 34	/* (non-Javadoc)
 35	 * @see android.app.Activity#findViewById(int)
 36	 */
 37	@Override
 38	public View findViewById(int id) {
 39		View v = super.findViewById(id);
 40		if (v != null)
 41			return v;
 42		return mHelper.findViewById(id);
 43	}
 44
 45	/* (non-Javadoc)
 46	 * @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
 47	 */
 48	@Override
 49	protected void onSaveInstanceState(Bundle outState) {
 50		super.onSaveInstanceState(outState);
 51		mHelper.onSaveInstanceState(outState);
 52	}
 53
 54	/* (non-Javadoc)
 55	 * @see android.app.Activity#setContentView(int)
 56	 */
 57	@Override
 58	public void setContentView(int id) {
 59		setContentView(getLayoutInflater().inflate(id, null));
 60	}
 61
 62	/* (non-Javadoc)
 63	 * @see android.app.Activity#setContentView(android.view.View)
 64	 */
 65	@Override
 66	public void setContentView(View v) {
 67		setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
 68	}
 69
 70	/* (non-Javadoc)
 71	 * @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
 72	 */
 73	@Override
 74	public void setContentView(View v, LayoutParams params) {
 75		super.setContentView(v, params);
 76		mHelper.registerAboveContentView(v, params);
 77	}
 78
 79	/* (non-Javadoc)
 80	 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
 81	 */
 82	public void setBehindContentView(int id) {
 83		setBehindContentView(getLayoutInflater().inflate(id, null));
 84	}
 85
 86	/* (non-Javadoc)
 87	 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
 88	 */
 89	public void setBehindContentView(View v) {
 90		setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
 91	}
 92
 93	/* (non-Javadoc)
 94	 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
 95	 */
 96	public void setBehindContentView(View v, LayoutParams params) {
 97		mHelper.setBehindContentView(v, params);
 98	}
 99
100	/* (non-Javadoc)
101	 * @see com.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
102	 */
103	public SlidingMenu getSlidingMenu() {
104		return mHelper.getSlidingMenu();
105	}
106
107	/* (non-Javadoc)
108	 * @see com.slidingmenu.lib.app.SlidingActivityBase#toggle()
109	 */
110	public void toggle() {
111		mHelper.toggle();
112	}
113
114	/* (non-Javadoc)
115	 * @see com.slidingmenu.lib.app.SlidingActivityBase#showAbove()
116	 */
117	public void showContent() {
118		mHelper.showContent();
119	}
120
121	/* (non-Javadoc)
122	 * @see com.slidingmenu.lib.app.SlidingActivityBase#showBehind()
123	 */
124	public void showMenu() {
125		mHelper.showMenu();
126	}
127	
128	/* (non-Javadoc)
129	 * @see com.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
130	 */
131	public void showSecondaryMenu() {
132		mHelper.showSecondaryMenu();
133	}
134
135	/* (non-Javadoc)
136	 * @see com.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
137	 */
138	public void setSlidingActionBarEnabled(boolean b) {
139		mHelper.setSlidingActionBarEnabled(b);
140	}
141
142	/* (non-Javadoc)
143	 * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
144	 */
145	@Override
146	public boolean onKeyUp(int keyCode, KeyEvent event) {
147		boolean b = mHelper.onKeyUp(keyCode, event);
148		if (b) return b;
149		return super.onKeyUp(keyCode, event);
150	}
151}