當前位置: 首頁>>代碼示例>>Java>>正文


Java SherlockFragmentActivity類代碼示例

本文整理匯總了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();
    }
 
開發者ID:ivanovpv,項目名稱:darksms,代碼行數:27,代碼來源:ConversationsCursorRowAdapter.java

示例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();
        }
    }
}
 
開發者ID:tamzi,項目名稱:sophia,代碼行數:17,代碼來源:ActionBarWrapper.java

示例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;
        }
    }
}
 
開發者ID:tamzi,項目名稱:sophia,代碼行數:20,代碼來源:ActionBarWrapper.java

示例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;
        }
    });
}
 
開發者ID:huibinfeng0810,項目名稱:github-v2,代碼行數:24,代碼來源:RawCommentFragment.java

示例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);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:endpoints-codelab-android,代碼行數:21,代碼來源:PullToRefreshAttacher.java

示例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);
    }
}
 
開發者ID:Mobideck,項目名稱:appdeck-android,代碼行數:24,代碼來源:LoaderCursorSupport.java

示例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;
}
 
開發者ID:Mobideck,項目名稱:appdeck-android,代碼行數:27,代碼來源:AbsPullToRefreshAttacher.java

示例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);
}
 
開發者ID:micromacer,項目名稱:Player-by-TweekProject,代碼行數:24,代碼來源:NavUtils.java

示例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);
}
 
開發者ID:micromacer,項目名稱:Player-by-TweekProject,代碼行數:24,代碼來源:CarouselTab.java

示例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);
    }
}
 
開發者ID:micromacer,項目名稱:Player-by-TweekProject,代碼行數:27,代碼來源:CarouselTab.java

示例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;
}
 
開發者ID:micromacer,項目名稱:Player-by-TweekProject,代碼行數:26,代碼來源:ImageCache.java

示例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;
}
 
開發者ID:jackpf,項目名稱:BlockchainSearch,代碼行數:22,代碼來源:SherlockActionBarDrawerToggleCompat.java

示例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;
}
 
開發者ID:jackpf,項目名稱:BlockchainSearch,代碼行數:17,代碼來源:SherlockActionBarDrawerToggleCompat.java

示例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;
}
 
開發者ID:tarksgit,項目名稱:Favorite-Android-Client-Example,代碼行數:18,代碼來源:FadingActionBarHelper.java

示例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;
    }
 
開發者ID:SilentCircle,項目名稱:silent-contacts-android,代碼行數:37,代碼來源:ContactDeletionInteraction.java


注:本文中的com.actionbarsherlock.app.SherlockFragmentActivity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。