Skip to content

Instantly share code, notes, and snippets.

@rishabhmhjn
Created July 9, 2014 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rishabhmhjn/27bf6d25ae7a7878e096 to your computer and use it in GitHub Desktop.
Save rishabhmhjn/27bf6d25ae7a7878e096 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="fill_parent" />
<include
layout="@layout/smooth_progress_bar" />
</FrameLayout>
package me.unfollowers.droid.ui;
import me.unfollowers.droid.R;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
/**
* @author rishabhmhjn
*
*/
public abstract class ActionBarProgressActivity extends ActionBarActivity {
private ProgressBar mProgressBar;
public static final int CONTENT_FRAME_ID = R.id.content_frame;
public static int getContentFrameId() {
return CONTENT_FRAME_ID;
}
@Override
public void setContentView(View view) {
progressBarInit().addView(view);
}
@Override
public void setContentView(int layoutResID) {
getLayoutInflater().inflate(layoutResID, progressBarInit(), true);
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
progressBarInit().addView(view, params);
}
private ViewGroup progressBarInit() {
super.setContentView(R.layout.actionbar_progress_activity_layout);
mProgressBar = (ProgressBar) findViewById(R.id.activity_progress_bar);
return (ViewGroup) findViewById(CONTENT_FRAME_ID);
}
public ProgressBar getProgressBar() {
return mProgressBar;
}
@Override
public void setSupportProgressBarVisibility(boolean visible) {
getProgressBar().setVisibility(visible ? View.VISIBLE : View.GONE);
}
}
<fr.castorflex.android.smoothprogressbar.SmoothProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="gone" >
</fr.castorflex.android.smoothprogressbar.SmoothProgressBar>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment