Search in sources :

Example 1 with SherlockFragmentActivity

use of com.actionbarsherlock.app.SherlockFragmentActivity in project Wallpaper-Manager by Bencodes.

the class WallpaperFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    this.mNode = (NodeWallpaper) super.getArguments().getSerializable(BUNDLE_TAG);
    final ActionBar ab = ((SherlockFragmentActivity) super.getActivity()).getSupportActionBar();
    if (ab != null) {
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setDisplayShowHomeEnabled(false);
        ab.setDisplayShowTitleEnabled(true);
        final String title = super.getResources().getString(R.string.config_full_screen_wallpaper_title);
        if (title == null || title.length() <= 0) {
            ab.setTitle(mNode.name);
        } else {
            ab.setTitle(title);
        }
    }
    this.mPending = (ProgressBar) super.getView().findViewById(R.id.pending);
    this.mImageView = (PhotoView) mView.findViewById(R.id.wp_image);
    ImageLoader.getInstance().displayImage(mNode.url, mImageView, new ImageLoadingListener() {

        @Override
        public void onLoadingStarted() {
            mImageDrawableSet = false;
            mImageView.setVisibility(View.GONE);
            mPending.setVisibility(View.VISIBLE);
        }

        @Override
        public void onLoadingFailed(FailReason failReason) {
            mImageDrawableSet = false;
            Toast.makeText(getActivity(), "Image Failed To Load!", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onLoadingComplete(Bitmap bitmap) {
            mImageDrawableSet = true;
            mImageView.setVisibility(View.VISIBLE);
            mImageView.setImageBitmap(bitmap);
            mImageView.setZoomable(true);
            mPending.setVisibility(View.GONE);
            if (mApplyImageOnDisplay)
                applyImage();
            if (mSaveImageOnDisplay)
                exportImage();
        }

        @Override
        public void onLoadingCancelled() {
        }
    });
}
Also used : Bitmap(android.graphics.Bitmap) ImageLoadingListener(com.nostra13.universalimageloader.core.assist.ImageLoadingListener) SherlockFragmentActivity(com.actionbarsherlock.app.SherlockFragmentActivity) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ActionBar(com.actionbarsherlock.app.ActionBar)

Example 2 with SherlockFragmentActivity

use of com.actionbarsherlock.app.SherlockFragmentActivity in project SherlockNavigationDrawer by nicolasjafelle.

the class SherlockActionBarDrawerToggleCompat method setActionBarDescription.

public static Object setActionBarDescription(Object info, Activity activity, int contentDescRes) {
    if (info == null) {
        info = new SetIndicatorInfo(activity);
    }
    final SetIndicatorInfo sii = (SetIndicatorInfo) info;
    if (sii.setHomeAsUpIndicator != null) {
        try {
            final ActionBar actionBar = ((SherlockFragmentActivity) activity).getSupportActionBar();
            sii.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
        }
    }
    return info;
}
Also used : SherlockFragmentActivity(com.actionbarsherlock.app.SherlockFragmentActivity) ActionBar(com.actionbarsherlock.app.ActionBar)

Example 3 with SherlockFragmentActivity

use of com.actionbarsherlock.app.SherlockFragmentActivity in project little-bear-dictionary by daimajia.

the class AboutMeFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mWeibo = Weibo.getInstance(Constants.WEIBO_APP_KEY, Constants.WEIBO_REDIRECT_URI);
    SherlockFragmentActivity sherlockFragmentActivity = (SherlockFragmentActivity) getActivity();
    mActionBar = sherlockFragmentActivity.getSupportActionBar();
}
Also used : SherlockFragmentActivity(com.actionbarsherlock.app.SherlockFragmentActivity)

Example 4 with SherlockFragmentActivity

use of com.actionbarsherlock.app.SherlockFragmentActivity in project httpclient by pixmob.

the class ActionBarImpl method selectTab.

@Override
public void selectTab(Tab tab) {
    if (getNavigationMode() != NAVIGATION_MODE_TABS) {
        mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
        return;
    }
    FragmentTransaction trans = null;
    if (mActivity instanceof SherlockFragmentActivity) {
        trans = ((SherlockFragmentActivity) mActivity).getSupportFragmentManager().beginTransaction().disallowAddToBackStack();
    }
    if (mSelectedTab == tab) {
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
            mTabScrollView.animateToTab(tab.getPosition());
        }
    } else {
        mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
        }
        mSelectedTab = (TabImpl) tab;
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
        }
    }
    if (trans != null && !trans.isEmpty()) {
        trans.commit();
    }
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) SherlockFragmentActivity(com.actionbarsherlock.app.SherlockFragmentActivity)

Example 5 with SherlockFragmentActivity

use of com.actionbarsherlock.app.SherlockFragmentActivity in project SherlockNavigationDrawer by nicolasjafelle.

the class SherlockActionBarDrawerToggleCompat method setActionBarUpIndicator.

public static Object setActionBarUpIndicator(Object info, Activity activity, Drawable drawable, int contentDescRes) {
    if (info == null) {
        info = new SetIndicatorInfo(activity);
    }
    final SetIndicatorInfo sii = (SetIndicatorInfo) info;
    if (sii.setHomeAsUpIndicator != null) {
        try {
            final ActionBar actionBar = ((SherlockFragmentActivity) activity).getSupportActionBar();
            sii.setHomeAsUpIndicator.invoke(actionBar, drawable);
            sii.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
        } catch (Exception e) {
            Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);
        }
    } else if (sii.upIndicatorView != null) {
        sii.upIndicatorView.setImageDrawable(drawable);
    } else {
        Log.w(TAG, "Couldn't set home-as-up indicator");
    }
    return info;
}
Also used : SherlockFragmentActivity(com.actionbarsherlock.app.SherlockFragmentActivity) ActionBar(com.actionbarsherlock.app.ActionBar)

Aggregations

SherlockFragmentActivity (com.actionbarsherlock.app.SherlockFragmentActivity)5 ActionBar (com.actionbarsherlock.app.ActionBar)3 Bitmap (android.graphics.Bitmap)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 FailReason (com.nostra13.universalimageloader.core.assist.FailReason)1 ImageLoadingListener (com.nostra13.universalimageloader.core.assist.ImageLoadingListener)1