/*
* Copyright (C) 2015, Jhuster, All Rights Reserved
*
* Author: Jhuster(lujun.hust@gmail.com)
*
* https://github.com/Jhuster/JNote
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*/
package com.jhuster.jnote;
import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
public abstract class BaseActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg));
super.onCreate(savedInstanceState);
initVariables();
initViews(savedInstanceState);
loadData();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
default:
break;
}
return true;
}
protected abstract void initVariables();
protected abstract void initViews(Bundle savedInstanceState);
protected abstract void loadData();
}