/*
* Copyright 2012 GitHub Inc.
*
* 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 com.github.mobile.ui;
import android.os.Bundle;
import com.github.kevinsawicki.wishlist.ViewFinder;
import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockFragmentActivity;
import java.io.Serializable;
/**
* Base sherlock activity
*/
public class BaseActivity extends RoboSherlockFragmentActivity {
/**
* Finder bound to this activity's view
*/
protected ViewFinder finder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finder = new ViewFinder(this);
}
/**
* Get intent extra
*
* @param name
* @return serializable
*/
@SuppressWarnings("unchecked")
protected <V extends Serializable> V getSerializableExtra(final String name) {
return (V) getIntent().getSerializableExtra(name);
}
/**
* Get intent extra
*
* @param name
* @return int
*/
protected int getIntExtra(final String name) {
return getIntent().getIntExtra(name, -1);
}
/**
* Get intent extra
*
* @param name
* @return string
*/
protected String getStringExtra(final String name) {
return getIntent().getStringExtra(name);
}
/**
* Get intent extra
*
* @param name
* @return string array
*/
protected String[] getStringArrayExtra(final String name) {
return getIntent().getStringArrayExtra(name);
}
}