Search in sources :

Example 51 with FrameLayout

use of android.widget.FrameLayout in project android-topeka by googlesamples.

the class QuizActivity method startQuizFromClickOn.

private void startQuizFromClickOn(final View clickedView) {
    initQuizFragment();
    getSupportFragmentManager().beginTransaction().replace(R.id.quiz_fragment_container, mQuizFragment, FRAGMENT_TAG).commit();
    final FrameLayout container = (FrameLayout) findViewById(R.id.quiz_fragment_container);
    container.setBackgroundColor(ContextCompat.getColor(this, mCategory.getTheme().getWindowBackgroundColor()));
    revealFragmentContainer(clickedView, container);
    // the toolbar should not have more elevation than the content while playing
    setToolbarElevation(false);
}
Also used : FrameLayout(android.widget.FrameLayout)

Example 52 with FrameLayout

use of android.widget.FrameLayout in project PullToRefreshLibrary by harichen.

the class PullToRefreshListView method handleStyledAttributes.

@Override
protected void handleStyledAttributes(TypedArray a) {
    super.handleStyledAttributes(a);
    mListViewExtrasEnabled = a.getBoolean(R.styleable.PullToRefresh_ptrListViewExtrasEnabled, true);
    if (mListViewExtrasEnabled) {
        final FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL);
        // Create Loading Views ready for use later
        FrameLayout frame = new FrameLayout(getContext());
        mHeaderLoadingView = createLoadingLayout(getContext(), Mode.PULL_FROM_START, a);
        mHeaderLoadingView.setVisibility(View.GONE);
        frame.addView(mHeaderLoadingView, lp);
        mRefreshableView.addHeaderView(frame, null, false);
        mLvFooterLoadingFrame = new FrameLayout(getContext());
        mFooterLoadingView = createLoadingLayout(getContext(), Mode.PULL_FROM_END, a);
        mFooterLoadingView.setVisibility(View.GONE);
        mLvFooterLoadingFrame.addView(mFooterLoadingView, lp);
        /**
             * If the value for Scrolling While Refreshing hasn't been
             * explicitly set via XML, enable Scrolling While Refreshing.
             */
        if (!a.hasValue(R.styleable.PullToRefresh_ptrScrollingWhileRefreshingEnabled)) {
            setScrollingWhileRefreshingEnabled(true);
        }
    }
}
Also used : FrameLayout(android.widget.FrameLayout)

Example 53 with FrameLayout

use of android.widget.FrameLayout in project facebook-android-sdk by facebook.

the class WebDialog method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    spinner = new ProgressDialog(getContext());
    spinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    spinner.setMessage(getContext().getString(R.string.com_facebook_loading));
    // Stops people from accidently cancelling the login flow
    spinner.setCanceledOnTouchOutside(false);
    spinner.setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            cancel();
        }
    });
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    contentFrameLayout = new FrameLayout(getContext());
    // First calculate how big the frame layout should be
    resize();
    getWindow().setGravity(Gravity.CENTER);
    // resize the dialog if the soft keyboard comes up
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    /* Create the 'x' image, but don't add to the contentFrameLayout layout yet
         * at this point, we only need to know its drawable width and height
         * to place the webview
         */
    createCrossImage();
    if (this.url != null) {
        /* Now we know 'x' drawable width and height,
            * layout the webview and add it the contentFrameLayout layout
            */
        int crossWidth = crossImageView.getDrawable().getIntrinsicWidth();
        setUpWebView(crossWidth / 2 + 1);
    }
    /* Finally add the 'x' image to the contentFrameLayout layout and
        * add contentFrameLayout to the Dialog view
        */
    contentFrameLayout.addView(crossImageView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    setContentView(contentFrameLayout);
}
Also used : DialogInterface(android.content.DialogInterface) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) ProgressDialog(android.app.ProgressDialog) SuppressLint(android.annotation.SuppressLint)

Example 54 with FrameLayout

use of android.widget.FrameLayout in project fresco by facebook.

the class MyPagerAdapter method destroyItem.

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    FrameLayout page = (FrameLayout) container.getChildAt(position);
    ZoomableDraweeView zoomableDraweeView = (ZoomableDraweeView) page.getChildAt(0);
    zoomableDraweeView.setController(null);
}
Also used : FrameLayout(android.widget.FrameLayout) ZoomableDraweeView(com.facebook.samples.zoomable.ZoomableDraweeView)

Example 55 with FrameLayout

use of android.widget.FrameLayout in project Hummingbird-for-Android by xiprox.

the class FeedTimelineAdapter method getInfiniteScrollListView.

@Override
public View getInfiniteScrollListView(final int position, View convertView, ViewGroup parent) {
    if (getCount() != 0) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rootView = new View(context);
        final Story item = mItems.get(position);
        storyType = item.getStoryType();
        if (storyType.equals(Story.STORY_TYPE_COMMENT))
            rootView = inflater.inflate(R.layout.item_story_comment, null);
        else if (storyType.equals(Story.STORY_TYPE_MEDIA))
            rootView = inflater.inflate(R.layout.item_story_media, null);
        if (storyType.equals(Story.STORY_TYPE_COMMENT)) {
            FrameLayout mAvatarHolder = (FrameLayout) rootView.findViewById(R.id.item_story_comment_avatar_holder);
            ImageView mAvatar = (ImageView) rootView.findViewById(R.id.item_story_comment_avatar);
            TextView mUsername = (TextView) rootView.findViewById(R.id.item_story_comment_username);
            RelativeTimeTextView mTime = (RelativeTimeTextView) rootView.findViewById(R.id.item_story_comment_time);
            TextView mText = (TextView) rootView.findViewById(R.id.item_story_comment_text);
            mAvatarHolder.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View view) {
                    Intent intent = new Intent(context, ProfileActivity.class);
                    intent.putExtra(ProfileActivity.ARG_USERNAME, item.getPoster().getName());
                    context.startActivity(intent);
                }
            });
            /* The following 2 won't be used until we find out how to obtain the necessary data */
            View mDivider = rootView.findViewById(R.id.item_story_comment_divider);
            LinearLayout mComments = (LinearLayout) rootView.findViewById(R.id.item_story_comment_comments);
            Picasso.with(context).load(item.getPoster().getAvatar()).transform(new CircleTransformation()).into(mAvatar);
            mUsername.setText(item.getPoster().getName());
            for (Substory substory : item.getSubstories()) {
                if (substory.getSubstoryType().equals(Substory.SUBSTORY_TYPE_COMMENT)) {
                    mTime.setReferenceTime(substory.getCreatedAt());
                    mText.setText(substory.getComment());
                }
            }
        }
        if (storyType.equals(Story.STORY_TYPE_MEDIA)) {
            final CardView mCard = (CardView) rootView.findViewById(R.id.item_story_media_card);
            FrameLayout mCoverHolder = (FrameLayout) rootView.findViewById(R.id.item_story_media_cover_holder);
            final ImageView mCover = (ImageView) rootView.findViewById(R.id.item_story_media_cover);
            final TextView mTitle = (TextView) rootView.findViewById(R.id.item_story_media_title);
            final LinearLayout mSubstories = (LinearLayout) rootView.findViewById(R.id.item_story_media_substories);
            final TextView mMoreIndicator = (TextView) rootView.findViewById(R.id.item_story_media_more);
            AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, Utils.dpToPx(context, 160));
            rootView.setLayoutParams(params);
            expanded[position] = false;
            mCoverHolder.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View view) {
                    Intent intent = new Intent(context, AnimeDetailsActivity.class);
                    intent.putExtra(AnimeDetailsActivity.ARG_ID, item.getMedia().getId());
                    intent.putExtra(AnimeDetailsActivity.ARG_ANIME_OBJ, item.getMedia());
                    ActivityOptionsCompat transition = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, Pair.create((View) mCover, "anime_cover"));
                    Utils.startActivityWithTransition(context, intent, transition);
                }
            });
            /* Hide the VIEW MORE button if there are no more than a single substory */
            if (item.getSubstoriesCount() == 1)
                mMoreIndicator.setVisibility(View.GONE);
            if (item.getSubstoriesCount() > 1) {
                rootView.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View view) {
                        if (!expanded[position]) {
                            for (int i = 0; i < mSubstories.getChildCount(); i++) {
                                View v = mSubstories.getChildAt(i);
                                v.setVisibility(View.VISIBLE);
                            }
                            AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT);
                            mCard.setLayoutParams(params);
                            expanded[position] = true;
                        } else {
                            for (int i = 0; i < mSubstories.getChildCount(); i++) {
                                if (i > 0) {
                                    View v = mSubstories.getChildAt(i);
                                    v.setVisibility(View.GONE);
                                }
                            }
                            AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, Utils.dpToPx(context, 160));
                            mCard.setLayoutParams(params);
                            expanded[position] = false;
                            notifyDataSetChanged();
                        }
                    }
                });
            }
            Picasso.with(context).load(item.getMedia().getCoverImage()).into(mCover);
            mTitle.setText(item.getMedia().getTitle());
            List<Substory> sortedSubstories = Utils.sortSubstoriesByDate(item.getSubstories());
            mSubstories.removeAllViews();
            for (Substory substory : sortedSubstories) {
                View view = inflater.inflate(R.layout.item_substory, null);
                FrameLayout avatarHolder = (FrameLayout) view.findViewById(R.id.item_substory_avatar_holder);
                ImageView avatar = (ImageView) view.findViewById(R.id.item_substory_avatar);
                TextView username = (TextView) view.findViewById(R.id.item_substory_username);
                RelativeTimeTextView time = (RelativeTimeTextView) view.findViewById(R.id.item_substory_time);
                Picasso.with(context).load(item.getUser().getAvatar()).transform(new CircleTransformation()).into(avatar);
                avatarHolder.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View view) {
                        Intent intent = new Intent(context, ProfileActivity.class);
                        intent.putExtra(ProfileActivity.ARG_USERNAME, item.getUser().getName());
                        context.startActivity(intent);
                    }
                });
                username.setText(item.getUser().getName());
                time.setReferenceTime(substory.getCreatedAt());
                if (substory.getSubstoryType().equals(Substory.SUBSTORY_TYPE_WATCHED_EPISODE)) {
                    String textToSet = getString(R.string.content_watched_episode) + " " + substory.getEpisodeNumber();
                    ((TextView) view.findViewById(R.id.item_substory_text)).setText(textToSet);
                }
                if (substory.getSubstoryType().equals(Substory.SUBSTORY_TYPE_WATCHLIST_STATUS_UPDATE)) {
                    String textToSet = "";
                    String watchlistStatusUpdate = substory.getNewStatus();
                    if (watchlistStatusUpdate.equals(Substory.WATCHLIST_STATUS_CURRENTLY_WATCHING))
                        textToSet = getString(R.string.content_is_currently_watching);
                    if (watchlistStatusUpdate.equals(Substory.WATCHLIST_STATUS_COMPLETED))
                        textToSet = getString(R.string.content_has_completed);
                    if (watchlistStatusUpdate.equals(Substory.WATCHLIST_STATUS_DROPPED))
                        textToSet = getString(R.string.content_has_dropped);
                    if (watchlistStatusUpdate.equals(Substory.WATCHLIST_STATUS_ON_HOLD))
                        textToSet = getString(R.string.content_has_placed_on_hold);
                    if (watchlistStatusUpdate.equals(Substory.WATCHLIST_STATUS_PLAN_TO_WATCH))
                        textToSet = getString(R.string.content_is_planning_to_watch);
                    ((TextView) view.findViewById(R.id.item_substory_text)).setText(textToSet);
                }
                if (mSubstories.getChildCount() >= 1)
                    view.setVisibility(View.GONE);
                mSubstories.addView(view);
            }
        }
        return rootView;
    } else
        return getInfiniteScrollListView(position, convertView, parent);
}
Also used : ProfileActivity(tr.bcxip.hummingbird.ProfileActivity) CardView(android.support.v7.widget.CardView) AbsListView(android.widget.AbsListView) AnimeDetailsActivity(tr.bcxip.hummingbird.AnimeDetailsActivity) ProfileActivity(tr.bcxip.hummingbird.ProfileActivity) Activity(android.app.Activity) Intent(android.content.Intent) RelativeTimeTextView(tr.bcxip.hummingbird.widget.RelativeTimeTextView) ImageView(android.widget.ImageView) RelativeTimeTextView(tr.bcxip.hummingbird.widget.RelativeTimeTextView) View(android.view.View) CardView(android.support.v7.widget.CardView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) CircleTransformation(tr.bcxip.hummingbird.utils.CircleTransformation) Substory(tr.bcxip.hummingbird.api.objects.Substory) LayoutInflater(android.view.LayoutInflater) FrameLayout(android.widget.FrameLayout) RelativeTimeTextView(tr.bcxip.hummingbird.widget.RelativeTimeTextView) TextView(android.widget.TextView) AnimeDetailsActivity(tr.bcxip.hummingbird.AnimeDetailsActivity) ImageView(android.widget.ImageView) Story(tr.bcxip.hummingbird.api.objects.Story) LinearLayout(android.widget.LinearLayout)

Aggregations

FrameLayout (android.widget.FrameLayout)634 View (android.view.View)244 TextView (android.widget.TextView)143 ViewGroup (android.view.ViewGroup)128 ImageView (android.widget.ImageView)95 LinearLayout (android.widget.LinearLayout)89 ListView (android.widget.ListView)54 AdapterView (android.widget.AdapterView)49 Button (android.widget.Button)44 LayoutInflater (android.view.LayoutInflater)42 Bitmap (android.graphics.Bitmap)41 LayoutParams (android.view.ViewGroup.LayoutParams)37 AbsListView (android.widget.AbsListView)37 Context (android.content.Context)35 Intent (android.content.Intent)28 Activity (android.app.Activity)25 TextureView (android.view.TextureView)25 ColorDrawable (android.graphics.drawable.ColorDrawable)23 FileOutputStream (java.io.FileOutputStream)23 Drawable (android.graphics.drawable.Drawable)20