Search in sources :

Example 36 with ViewGroup

use of android.view.ViewGroup in project cordova-android-chromeview by thedracle.

the class CordovaWebView method showCustomView.

public void showCustomView(View view, WebChromeClient.CustomViewCallback callback) {
    // This code is adapted from the original Android Browser code, licensed under the Apache License, Version 2.0
    Log.d(TAG, "showing Custom View");
    // if a view already exists then immediately terminate the new one
    if (mCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }
    // Store the view and its callback for later (to kill it properly)
    mCustomView = view;
    mCustomViewCallback = callback;
    // Add the custom view to its container.
    ViewGroup parent = (ViewGroup) this.getParent();
    parent.addView(view, COVER_SCREEN_GRAVITY_CENTER);
    // Hide the content view.
    this.setVisibility(View.GONE);
    // Finally show the custom view container.
    parent.setVisibility(View.VISIBLE);
    parent.bringToFront();
}
Also used : ViewGroup(android.view.ViewGroup)

Example 37 with ViewGroup

use of android.view.ViewGroup in project BGARefreshLayout-Android by bingoogolapple.

the class BGARefreshLayout method setCustomHeaderView.

/**
     * 设置下拉刷新控件下方的自定义控件
     *
     * @param customHeaderView 下拉刷新控件下方的自定义控件
     * @param scrollable       是否可以滚动
     */
public void setCustomHeaderView(View customHeaderView, boolean scrollable) {
    if (mCustomHeaderView != null && mCustomHeaderView.getParent() != null) {
        ViewGroup parent = (ViewGroup) mCustomHeaderView.getParent();
        parent.removeView(mCustomHeaderView);
    }
    mCustomHeaderView = customHeaderView;
    if (mCustomHeaderView != null) {
        mCustomHeaderView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
        mWholeHeaderView.addView(mCustomHeaderView);
        mIsCustomHeaderViewScrollable = scrollable;
    }
}
Also used : ViewGroup(android.view.ViewGroup)

Example 38 with ViewGroup

use of android.view.ViewGroup in project PhotoView by bm-x.

the class ViewPagerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_pager);
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setPageMargin((int) (getResources().getDisplayMetrics().density * 15));
    mPager.setAdapter(new PagerAdapter() {

        @Override
        public int getCount() {
            return imgsId.length;
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            PhotoView view = new PhotoView(ViewPagerActivity.this);
            view.enable();
            view.setScaleType(ImageView.ScaleType.FIT_CENTER);
            view.setImageResource(imgsId[position]);
            container.addView(view);
            return view;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }
    });
}
Also used : PhotoView(com.bm.library.PhotoView) ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) View(android.view.View) PhotoView(com.bm.library.PhotoView) PagerAdapter(android.support.v4.view.PagerAdapter)

Example 39 with ViewGroup

use of android.view.ViewGroup in project glimmr by brk3.

the class CommentsFragment method onCommentsReady.

@Override
public void onCommentsReady(List<Comment> comments, Exception e) {
    mProgressBar.setVisibility(View.GONE);
    if (FlickrHelper.getInstance().handleFlickrUnavailable(mActivity, e)) {
        return;
    }
    if (comments == null) {
        Log.e(TAG, "onCommentsReady: comments are null");
        return;
    }
    if (BuildConfig.DEBUG) {
        Log.d(getLogTag(), "onCommentsReady, comments.size(): " + comments.size());
    }
    mAdapter = new ArrayAdapter<Comment>(mActivity, R.layout.comment_list_row, (ArrayList<Comment>) comments) {

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            final ViewHolder holder;
            if (convertView == null) {
                convertView = mActivity.getLayoutInflater().inflate(R.layout.comment_list_row, null);
                holder = new ViewHolder();
                holder.textViewUsername = (TextView) convertView.findViewById(R.id.userName);
                holder.textViewCommentDate = (TextView) convertView.findViewById(R.id.commentDate);
                holder.textViewCommentText = (TextView) convertView.findViewById(R.id.commentText);
                holder.imageViewUserIcon = (ImageView) convertView.findViewById(R.id.userIcon);
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }
            final Comment comment = getItem(position);
            holder.textViewUsername.setText(comment.getAuthorName());
            String pTime = mPrettyTime.format(comment.getDateCreate());
            /* keep Oliver happy */
            if ("es".equals(Locale.getDefault().getLanguage())) {
                pTime = capitaliseWord(pTime);
            }
            holder.textViewCommentDate.setText(pTime);
            holder.textViewCommentText.setText(Html.fromHtml(comment.getText()));
            String authorIcon = UrlUtilities.createBuddyIconUrl(comment.getIconFarm(), comment.getIconServer(), comment.getAuthor());
            Picasso.with(mActivity).load(authorIcon).into(holder.imageViewUserIcon);
            holder.imageViewUserIcon.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent profileViewer = new Intent(mActivity, ProfileViewerActivity.class);
                    profileViewer.putExtra(ProfileViewerActivity.KEY_PROFILE_ID, comment.getAuthor());
                    profileViewer.setAction(ProfileViewerActivity.ACTION_VIEW_USER_BY_ID);
                    startActivity(profileViewer);
                }
            });
            return convertView;
        }
    };
    mListView.setAdapter(mAdapter);
}
Also used : Comment(com.googlecode.flickrjandroid.photos.comments.Comment) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 40 with ViewGroup

use of android.view.ViewGroup in project Conductor by bluelinelabs.

the class SharedElementDelayingChangeHandler method getViewWithTransitionName.

@Nullable
View getViewWithTransitionName(@NonNull View view, @NonNull String transitionName) {
    if (transitionName.equals(view.getTransitionName())) {
        return view;
    }
    if (view instanceof ViewGroup) {
        ViewGroup viewGroup = (ViewGroup) view;
        int childCount = viewGroup.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View viewWithTransitionName = getViewWithTransitionName(viewGroup.getChildAt(i), transitionName);
            if (viewWithTransitionName != null) {
                return viewWithTransitionName;
            }
        }
    }
    return null;
}
Also used : ViewGroup(android.view.ViewGroup) View(android.view.View) Nullable(android.support.annotation.Nullable)

Aggregations

ViewGroup (android.view.ViewGroup)2327 View (android.view.View)1300 TextView (android.widget.TextView)452 ImageView (android.widget.ImageView)282 ArrayList (java.util.ArrayList)204 ViewParent (android.view.ViewParent)185 ListView (android.widget.ListView)159 LayoutInflater (android.view.LayoutInflater)127 FrameLayout (android.widget.FrameLayout)127 Paint (android.graphics.Paint)126 AdapterView (android.widget.AdapterView)118 LinearLayout (android.widget.LinearLayout)113 AbsListView (android.widget.AbsListView)106 RecyclerView (android.support.v7.widget.RecyclerView)100 Drawable (android.graphics.drawable.Drawable)95 Animator (android.animation.Animator)94 AnimatedView (carbon.animation.AnimatedView)88 ComponentView (carbon.component.ComponentView)88 RippleView (carbon.drawable.ripple.RippleView)88 ShadowView (carbon.shadow.ShadowView)88