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();
}
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;
}
}
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);
}
});
}
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);
}
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;
}
Aggregations