本文整理汇总了Java中com.actionbarsherlock.app.SherlockFragmentActivity类的典型用法代码示例。如果您正苦于以下问题:Java SherlockFragmentActivity类的具体用法?Java SherlockFragmentActivity怎么用?Java SherlockFragmentActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SherlockFragmentActivity类属于com.actionbarsherlock.app包,在下文中一共展示了SherlockFragmentActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ConversationsCursorRowAdapter
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
public ConversationsCursorRowAdapter(SherlockFragmentActivity activity, int layout, String match) { // add param true for higthlite
super(activity, layout, null,
new String[] { MessageDAO.RECIPIENT_IDS, MessageDAO.SNIPPET, MessageDAO.DATE},
new int[] { R.id.respondent, R.id.body, R.id.millis}, 0);
this.activity =activity;
me = Me.getMe();
this.layout = layout;
this.conversationIdIndex = 0; //cursor.getColumnIndex(MessageDAO._ID);
this.recipientIdsIndex = 1; //cursor.getColumnIndex(MessageDAO.RECIPIENT_IDS);
this.bodyIndex = 2; //cursor.getColumnIndex(MessageDAO.SNIPPET);
this.dateIndex = 3; //cursor.getColumnIndex(MessageDAO.DATE);
this.unreadIndex=4; //cursor.getColumnIndex(MessageDAO.UNPROCESSED_COUNT);
this.match = match;
this.notifyDataSetChanged();
this.layoutInflater = LayoutInflater.from(activity);
options = new DisplayImageOptions.Builder()
// .showImageOnLoading(R.drawable.contact)
.showImageForEmptyUri(R.drawable.contact)
.showImageOnFail(R.drawable.contact)
.resetViewBeforeLoading(true)
.cacheInMemory(true)
.cacheOnDisc(true)
.displayer(new RoundedBitmapDisplayer(20))
.build();
}
示例2: onTabReselected
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
@Override
public void onTabReselected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) {
FragmentTransaction trans = null;
if (mActivity instanceof SherlockFragmentActivity) {
trans = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
}
mListener.onTabReselected(this, trans);
if (trans != null && !trans.isEmpty()) {
trans.commit();
}
}
}
示例3: onTabSelected
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
@Override
public void onTabSelected(android.app.ActionBar.Tab tab, android.app.FragmentTransaction ft) {
if (mListener != null) {
if (mFragmentTransaction == null && mActivity instanceof SherlockFragmentActivity) {
mFragmentTransaction = ((SherlockFragmentActivity)mActivity).getSupportFragmentManager().beginTransaction()
.disallowAddToBackStack();
}
mListener.onTabSelected(this, mFragmentTransaction);
if (mFragmentTransaction != null) {
if (!mFragmentTransaction.isEmpty()) {
mFragmentTransaction.commit();
}
mFragmentTransaction = null;
}
}
}
示例4: onViewCreated
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
commentText = finder.find(id.et_comment);
commentText.addTextChangedListener(new TextWatcherAdapter() {
@Override
public void afterTextChanged(Editable s) {
SherlockFragmentActivity activity = getSherlockActivity();
if (activity != null)
activity.invalidateOptionsMenu();
}
});
commentText.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
commentText.requestFocusFromTouch();
return false;
}
});
}
示例5: getContextForInflater
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
/**
* @return Context which should be used for inflating the header layout
*/
public Context getContextForInflater(Activity activity) {
if (activity instanceof SherlockActivity) {
return ((SherlockActivity) activity).getSupportActionBar().getThemedContext();
} else if (activity instanceof SherlockListActivity) {
return ((SherlockListActivity) activity).getSupportActionBar().getThemedContext();
} else if (activity instanceof SherlockFragmentActivity) {
return ((SherlockFragmentActivity) activity).getSupportActionBar()
.getThemedContext();
} else if (activity instanceof SherlockExpandableListActivity) {
return ((SherlockExpandableListActivity) activity).getSupportActionBar()
.getThemedContext();
} else if (activity instanceof SherlockPreferenceActivity) {
return ((SherlockPreferenceActivity) activity).getSupportActionBar()
.getThemedContext();
}
return super.getContextForInflater(activity);
}
示例6: onCreateOptionsMenu
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// Place an action bar item for searching.
MenuItem item = menu.add("Search");
item.setIcon(android.R.drawable.ic_menu_search);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
SherlockFragmentActivity activity = (SherlockFragmentActivity)getActivity();
View searchView = SearchViewCompat.newSearchView(activity.getSupportActionBar().getThemedContext());
if (searchView != null) {
SearchViewCompat.setOnQueryTextListener(searchView,
new OnQueryTextListenerCompat() {
@Override
public boolean onQueryTextChange(String newText) {
// Called when the action bar search text has changed. Update
// the search filter, and restart the loader to do a new query
// with this filter.
mCurFilter = !TextUtils.isEmpty(newText) ? newText : null;
getLoaderManager().restartLoader(0, null, CursorLoaderListFragment.this);
return true;
}
});
item.setActionView(searchView);
}
}
示例7: getContextForInflater
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
/**
* @return Context which should be used for inflating the header layout
*/
public Context getContextForInflater(Activity activity) {
ActionBar ab = null;
if (activity instanceof SherlockActivity) {
ab = ((SherlockActivity) activity).getSupportActionBar();
} else if (activity instanceof SherlockListActivity) {
ab = ((SherlockListActivity) activity).getSupportActionBar();
} else if (activity instanceof SherlockFragmentActivity) {
ab = ((SherlockFragmentActivity) activity).getSupportActionBar();
} else if (activity instanceof SherlockExpandableListActivity) {
ab = ((SherlockExpandableListActivity) activity).getSupportActionBar();
} else if (activity instanceof SherlockPreferenceActivity) {
ab = ((SherlockPreferenceActivity) activity).getSupportActionBar();
}
Context context = null;
if (ab != null) {
context = ab.getThemedContext();
}
if (context == null) {
context = activity;
}
return context;
}
示例8: openAlbumProfile
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
/**
* Opens the profile of an album.
*
* @param context The {@link SherlockFragmentActivity} to use.
* @param albumName The name of the album
* @param artistName The name of the album artist
*/
public static void openAlbumProfile(final SherlockFragmentActivity context,
final String albumName, final String artistName) {
// Create a new bundle to transfer the album info
final Bundle bundle = new Bundle();
bundle.putString(Config.ALBUM_YEAR, MusicUtils.getReleaseDateForAlbum(context, albumName));
bundle.putString(Config.ARTIST_NAME, artistName);
bundle.putString(Config.MIME_TYPE, MediaStore.Audio.Albums.CONTENT_TYPE);
bundle.putLong(Config.ID, MusicUtils.getIdForAlbum(context, albumName));
bundle.putString(Config.NAME, albumName);
// Create the intent to launch the profile activity
final Intent intent = new Intent(context, ProfileActivity.class);
intent.putExtras(bundle);
context.startActivity(intent);
}
示例9: blurPhoto
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
/**
* Used to blur the artist image in the album profile.
*
* @param context The {@link Context} to use.
* @param artist The artist nmae used to fetch the cached artist image.
* @param album The album name used to fetch the album art in case the
* artist image is missing.
*/
public void blurPhoto(final SherlockFragmentActivity context, final String artist,
final String album) {
// First check for the artist image
Bitmap artistImage = mFetcher.getCachedBitmap(artist);
// Second check for cached artwork
if (artistImage == null) {
artistImage = mFetcher.getCachedArtwork(album);
}
// If all else, use the default image
if (artistImage == null) {
artistImage = BitmapFactory.decodeResource(getResources(), R.drawable.theme_preview);
}
final Bitmap blur = BitmapUtils.createBlurredBitmap(artistImage);
mPhoto.setImageBitmap(blur);
}
示例10: setArtistAlbumPhoto
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
/**
* Used to set the album art in the artist profile.
*
* @param context The {@link Context} to use.
* @param artist The name of the artist in the profile the user is viewing.
*/
public void setArtistAlbumPhoto(final SherlockFragmentActivity context, final String artist) {
final String lastAlbum = MusicUtils.getLastAlbumForArtist(context, artist);
if (!TextUtils.isEmpty(lastAlbum)) {
// Set the last album the artist played
mFetcher.loadAlbumImage(artist, lastAlbum,
String.valueOf(MusicUtils.getIdForAlbum(context, lastAlbum)), mPhoto);
// Play the album
mPhoto.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
final long[] albumList = MusicUtils.getSongListForAlbum(getContext(),
String.valueOf(MusicUtils.getIdForAlbum(context, lastAlbum)));
MusicUtils.playAll(getContext(), albumList, 0, false);
}
});
} else {
setDefault(context);
}
}
示例11: findOrCreateCache
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
/**
* Find and return an existing ImageCache stored in a {@link RetainFragment}
* , if not found a new one is created using the supplied params and saved
* to a {@link RetainFragment}
*
* @param activity The calling {@link FragmentActivity}
* @return An existing retained ImageCache object or a new one if one did
* not exist
*/
public static final ImageCache findOrCreateCache(final SherlockFragmentActivity activity) {
// Search for, or create an instance of the non-UI RetainFragment
final RetainFragment retainFragment = findOrCreateRetainFragment(activity
.getSupportFragmentManager());
// See if we already have an ImageCache stored in RetainFragment
ImageCache cache = (ImageCache)retainFragment.getObject();
// No existing ImageCache, create one and store it in RetainFragment
if (cache == null) {
cache = getInstance(activity);
retainFragment.setObject(cache);
}
return cache;
}
示例12: setActionBarUpIndicator
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
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;
}
示例13: setActionBarDescription
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
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;
}
示例14: getActionBar
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
private ActionBar getActionBar(Activity activity) {
if (activity instanceof SherlockActivity) {
return ((SherlockActivity) activity).getSupportActionBar();
}
if (activity instanceof SherlockFragmentActivity) {
return ((SherlockFragmentActivity) activity).getSupportActionBar();
}
if (activity instanceof SherlockListActivity) {
return ((SherlockListActivity) activity).getSupportActionBar();
}
ActionBar actionBar = getActionBarWithReflection(activity, "getSupportActionBar");
if (actionBar == null) {
throw new RuntimeException("Activity should derive from one of the ActionBarSherlock activities "
+ "or implement a method called getSupportActionBar");
}
return actionBar;
}
示例15: startWithTestLoaderManager
import com.actionbarsherlock.app.SherlockFragmentActivity; //导入依赖的package包/类
/**
* Starts the interaction and optionally set up a {@link TestLoaderManager}.
*
* @param activity the activity within which to start the interaction
* @param contactUri the URI of the contact to delete
* @param finishActivityWhenDone whether to finish the activity upon completion of the
* interaction
* @param testLoaderManager the {@link TestLoaderManager} to use to load the data, may be null
* in which case the default {@link LoaderManager} is used
* @return the newly created interaction
*/
// @VisibleForTesting
static ContactDeletionInteraction startWithTestLoaderManager(SherlockFragmentActivity activity, Uri contactUri,
boolean finishActivityWhenDone,
/* TestLoaderManager*/ Object testLoaderManager) {
if (contactUri == null) {
return null;
}
FragmentManager fragmentManager = activity.getSupportFragmentManager();
ContactDeletionInteraction fragment = (ContactDeletionInteraction) fragmentManager.findFragmentByTag(FRAGMENT_TAG);
if (fragment == null) {
fragment = new ContactDeletionInteraction();
// fragment.setTestLoaderManager(testLoaderManager);
fragment.setContactUri(contactUri);
fragment.setFinishActivityWhenDone(finishActivityWhenDone);
fragmentManager.beginTransaction().add(fragment, FRAGMENT_TAG)
.commitAllowingStateLoss();
}
else {
// fragment.setTestLoaderManager(testLoaderManager);
fragment.setContactUri(contactUri);
fragment.setFinishActivityWhenDone(finishActivityWhenDone);
}
return fragment;
}