Back to project page FeedListViewDemo.
The source code is released under:
MIT License
If you think the Android project FeedListViewDemo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.bxbxbai.androiddemos.activity; /*from w w w .j a va2 s . co m*/ import android.app.ActionBar; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.MenuItem; import android.view.View; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.romainpiel.shimmer.Shimmer; import com.romainpiel.shimmer.ShimmerTextView; import io.bxbxbai.androiddemos.R; import io.bxbxbai.androiddemos.utils.ToastUtils; /** * Created by baia on 14-9-21. */ public abstract class BaseActivity extends FragmentActivity { protected ActionBar actionBar; private ShimmerTextView mActionBarTitle; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initActionBar(); } private void initActionBar() { actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); View view = View.inflate(this, R.layout.action_bar_title, null); mActionBarTitle = (ShimmerTextView) view.findViewById(R.id.tv_shimmer); new Shimmer().start(mActionBarTitle); actionBar.setCustomView(view); // These two lines not needed, // just to get the look of facebook (changing background color & hiding the ic_app) getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#3b5998"))); getActionBar().setIcon(R.drawable.ic_app); } public void setTitle(int resId) { mActionBarTitle.setText(resId); } public void setTitle(CharSequence text) { mActionBarTitle.setText(text); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; case R.id.action_settings: startActivity(new Intent(this, FeedListActivity.class)); return true; default: return super.onOptionsItemSelected(item); } } @Override public void onDestroy() { super.onDestroy(); } protected void executeRequest(Request<?> request) { } protected Response.ErrorListener errorListener() { return new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { ToastUtils.showLong(error.getMessage()); } }; } }