setBackgroundColor ( )源码实例Demo

android.widget.FrameLayout#setBackgroundColor ( )源码实例Demo

下面列出了android.widget.FrameLayout#setBackgroundColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AndroidChromium   文件: WebappActivity.java
private void initializeWebappData() {
    final int backgroundColor = ColorUtils.getOpaqueColor(mWebappInfo.backgroundColor(
            ApiCompatibilityUtils.getColor(getResources(), R.color.webapp_default_bg)));

    mSplashScreen = new FrameLayout(this);
    mSplashScreen.setBackgroundColor(backgroundColor);

    ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content);
    contentView.addView(mSplashScreen);

    mWebappUma.splashscreenVisible();
    mWebappUma.recordSplashscreenBackgroundColor(mWebappInfo.hasValidBackgroundColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);
    mWebappUma.recordSplashscreenThemeColor(mWebappInfo.hasValidThemeColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);

    initializeSplashScreenWidgets(backgroundColor);
}
 
源代码2 项目: weex   文件: WXRenderStatement.java
WXComponent createBodyOnDomThread(WXDomObject dom) {
  if (mWXSDKInstance == null) {
    return null;
  }
  WXDomObject domObject = new WXDomObject();
  domObject.type = WXBasicComponentType.DIV;
  domObject.ref = "god";
  mGodComponent = (WXVContainer) WXComponentFactory.newInstance(mWXSDKInstance, domObject, null);
  mGodComponent.createView(null, -1);
  if (mGodComponent == null) {
    if (WXEnvironment.isApkDebugable()) {
      WXLogUtils.e("rootView failed!");
    }
    //TODO error callback
    return null;
  }
  FrameLayout frameLayout = (FrameLayout) mGodComponent.getView();
  ViewGroup.LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  frameLayout.setLayoutParams(layoutParams);
  frameLayout.setBackgroundColor(Color.TRANSPARENT);

  WXComponent component = generateComponentTree(dom, mGodComponent);
  mGodComponent.addChild(component);
  mRegistry.put(component.getRef(), component);
  return component;
}
 
public static View getHeadView(Context context, boolean isVertical, int bgColor, String text) {
    FrameLayout headview = new FrameLayout(context);
    if (isVertical) {
        headview.setLayoutParams(new FamiliarRecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // vertical
    } else {
        headview.setLayoutParams(new FamiliarRecyclerView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); // horizontal
    }
    headview.setBackgroundColor(bgColor);
    TextView headviewContent = new TextView(context);
    FrameLayout.LayoutParams headviewContentParams;
    if (isVertical) {
        headviewContentParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dip2px(context, 150));
    } else {
        headviewContentParams = new FrameLayout.LayoutParams(dip2px(context, 150), ViewGroup.LayoutParams.WRAP_CONTENT);
    }
    headviewContentParams.gravity = Gravity.CENTER_HORIZONTAL| Gravity.CENTER_VERTICAL;
    headviewContent.setLayoutParams(headviewContentParams);
    headviewContent.setGravity(Gravity.CENTER);
    headviewContent.setText(text);
    headview.addView(headviewContent);

    return headview;
}
 
源代码4 项目: weex   文件: WXWebView.java
@Override
public View getView() {
    FrameLayout root = new FrameLayout(mContext);
    root.setBackgroundColor(Color.WHITE);

    mWebView = new WebView(mContext);//mContext.getApplicationContext();
    FrameLayout.LayoutParams wvLayoutParams =
            new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
                    FrameLayout.LayoutParams.MATCH_PARENT);
    wvLayoutParams.gravity = Gravity.CENTER;
    mWebView.setLayoutParams(wvLayoutParams);
    root.addView(mWebView);
    initWebView(mWebView);

    mProgressBar = new ProgressBar(mContext);
    showProgressBar(false);
    FrameLayout.LayoutParams pLayoutParams =
            new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
                    FrameLayout.LayoutParams.WRAP_CONTENT);
    mProgressBar.setLayoutParams(pLayoutParams);
    pLayoutParams.gravity = Gravity.CENTER;
    root.addView(mProgressBar);
    return root;
}
 
@Override
 public void onCreate(Bundle icicle) {
   super.onCreate(icicle);

   Window window = getWindow();
   window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   viewLayout = new LinearLayout(this);
   viewLayout.setOrientation(LinearLayout.HORIZONTAL);
   frameLayout = new FrameLayout(this);
   frameLayout.addView(viewLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
   frameLayout.setBackgroundColor(0xFFFFFFFF); // COLOR_WHITE XXX

   setContentView(frameLayout);
   frameLayout.requestLayout();

   hasSurface = false;
 }
 
源代码6 项目: RemoteControlView   文件: RemoteControlView.java
private void init(Context context) {
    setWillNotDraw(false);
    mPhonePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBackPath = new Path();
    // 不使用硬件加速,否则虚线显示不出
    setLayerType(LAYER_TYPE_SOFTWARE, null);
    // 拖拽有效区域
    frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundColor(Color.parseColor(CONTENT_COLOR));
    frameLayout.setOnDragListener(this);
    addView(frameLayout);
    // 提示文字
    mTextView = new TextView(context);
    mTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    mTextView.setTextColor(Color.WHITE);
    mTextView.setText("长按并拖拽下方按钮到这里");
    LayoutParams fl = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    fl.gravity = Gravity.CENTER;
    mTextView.setLayoutParams(fl);
    mTextView.measure(0, 0);
    addView(mTextView);
}
 
源代码7 项目: ucar-weex-core   文件: BasicListComponent.java
private ListBaseViewHolder createVHForRefreshComponent(int viewType) {
  FrameLayout view = new FrameLayout(getContext());
  view.setBackgroundColor(Color.WHITE);
  view.setLayoutParams(new FrameLayout.LayoutParams(1, 1));
  view.setVisibility(View.GONE);
  return new ListBaseViewHolder(view, viewType);
}
 
源代码8 项目: android-topeka   文件: QuizActivity.java
private void startQuizFromClickOn(final View clickedView) {
    initQuizFragment();
    getFragmentManager()
            .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);
}
 
源代码9 项目: Mrthumb   文件: NiceVideoPlayer.java
private void init() {
    mContainer = new FrameLayout(mContext);
    mContainer.setBackgroundColor(Color.BLACK);
    LayoutParams params = new LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    this.addView(mContainer, params);
}
 
源代码10 项目: GSYVideoPlayer   文件: SmallVideoHelper.java
/**
 * 如果是5.0的动画开始位置
 */
private void resolveMaterialAnimation() {
    listItemRect = new int[2];
    listItemSize = new int[2];
    saveLocationStatus(context, gsyVideoOptionBuilder.isHideActionBar(), gsyVideoOptionBuilder.isHideStatusBar());
    FrameLayout.LayoutParams lpParent = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    FrameLayout frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundColor(Color.BLACK);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(listItemSize[0], listItemSize[1]);
    lp.setMargins(listItemRect[0], listItemRect[1], 0, 0);
    frameLayout.addView(gsyVideoPlayer, lp);
    if (fullViewContainer != null) {
        fullViewContainer.addView(frameLayout, lpParent);
    } else {
        windowViewContainer.addView(frameLayout, lpParent);
    }
    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            //开始动画
            if (fullViewContainer != null) {
                TransitionManager.beginDelayedTransition(fullViewContainer);
            } else {
                TransitionManager.beginDelayedTransition(windowViewContainer);
            }
            resolveMaterialFullVideoShow(gsyVideoPlayer);
            resolveChangeFirstLogic(600);
        }
    }, 300);
}
 
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    View inAppView = inflater.inflate(R.layout.inapp_cover_image, container, false);

    FrameLayout fl  = inAppView.findViewById(R.id.inapp_cover_image_frame_layout);
    fl.setBackgroundColor(Color.parseColor(inAppNotification.getBackgroundColor()));

    RelativeLayout relativeLayout = fl.findViewById(R.id.cover_image_relative_layout);
    ImageView imageView = relativeLayout.findViewById(R.id.cover_image);

    if(inAppNotification.getInAppMediaForOrientation(currentOrientation) != null) {
        if (inAppNotification.getImage(inAppNotification.getInAppMediaForOrientation(currentOrientation)) != null) {
            imageView.setImageBitmap(inAppNotification.getImage(inAppNotification.getInAppMediaForOrientation(currentOrientation)));
            imageView.setTag(0);
            imageView.setOnClickListener(new CTInAppNativeButtonClickListener());
        }
    }

    @SuppressLint("ResourceType")
    CloseImageView closeImageView = fl.findViewById(199272);

    closeImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            didDismiss(null);
            getActivity().finish();
        }
    });

    if(!inAppNotification.isHideCloseButton()) {
        closeImageView.setVisibility(View.GONE);
    }
    else {
        closeImageView.setVisibility(View.VISIBLE);
    }

    return inAppView;
}
 
private void initTopView() {
    mTopLayout = new FrameLayout(mContext);
    LayoutParams params = new LayoutParams(mWidth, mTopLayoutHeight);
    params.gravity = Gravity.TOP;
    mTopLayout.setLayoutParams(params);
    mTopLayout.setBackgroundColor(Color.parseColor("#2896F0"));

    mTopLayout.addView(createBackView());
    mTopLayout.addView(createTitleView());

    initCancelView();
    mTopLayout.addView(mCancelView);
    addView(mTopLayout);
}
 
源代码13 项目: MyBookshelf   文件: MoDialogHUD.java
private void initViews() {
    decorView = ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = new FrameLayout(context);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    );
    rootView.setLayoutParams(layoutParams);
    rootView.setClickable(true);
    rootView.setBackgroundColor(context.getResources().getColor(R.color.btn_bg_press_tp));

    mSharedView = new MoDialogView(context);

}
 
源代码14 项目: weex   文件: WXListComponent.java
@NonNull
private ListBaseViewHolder createVHForWXLoading(WXComponent component, int viewType) {
    FrameLayout view = new FrameLayout(mContext);
    view.setBackgroundColor(Color.TRANSPARENT);
    view.setLayoutParams(new FrameLayout.LayoutParams(1, 1));
    return new ListBaseViewHolder(view, viewType);
}
 
源代码15 项目: KrGallery   文件: PhotoAlbumPickerActivity.java
@SuppressWarnings("unchecked")
@Override
public View createView(Context context) {
    actionBar.setBackgroundColor(Theme.ACTION_BAR_MEDIA_PICKER_COLOR);
    actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR);
    // actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setBackText(context.getString(R.string.Cancel));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == 1) {
                if (delegate != null) {
                    finishFragment(false);
                    delegate.startPhotoSelectActivity();
                }
            } else if (id == item_photos) {
                refreshShowPic();//刷新照片目录
            } else if (id == item_video) {
                refreshShowVedio();//刷新录像目录
            }
        }
    });


    fragmentView = new FrameLayout(context);

    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(DarkTheme ? 0xff000000 : 0xffffffff);
    //==============videos pick====================
    int res = !singlePhoto && filterMimeTypes.length > 0 ? R.string.PickerVideo : R.string.Album;
    actionBar.setTitle(context.getString(res));
    selectedMode = filterMimeTypes.length > 0 ? 1 : selectedMode;
    listView = new ListView(context);
    listView.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4),
            AndroidUtilities.dp(4));
    listView.setClipToPadding(false);
    listView.setHorizontalScrollBarEnabled(false);
    listView.setVerticalScrollBarEnabled(false);
    listView.setSelector(new ColorDrawable(0));
    listView.setDividerHeight(0);
    listView.setDivider(null);
    listView.setDrawingCacheEnabled(false);
    listView.setScrollingCacheEnabled(false);
    frameLayout.addView(listView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView
            .getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    // layoutParams.bottomMargin = AndroidUtilities.dp(48);
    listView.setLayoutParams(layoutParams);
    listView.setAdapter(listAdapter = new ListAdapter(context));
    AndroidUtilities.setListViewEdgeEffectColor(listView, 0xff333333);

    emptyView = new TextView(context);
    emptyView.setTextColor(0xff808080);
    emptyView.setTextSize(20);
    emptyView.setGravity(Gravity.CENTER);
    emptyView.setVisibility(View.GONE);
    emptyView.setText(R.string.NoPhotos);
    frameLayout.addView(emptyView);
    layoutParams = (FrameLayout.LayoutParams) emptyView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.bottomMargin = AndroidUtilities.dp(48);
    emptyView.setLayoutParams(layoutParams);
    emptyView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

    progressView = new FrameLayout(context);
    progressView.setVisibility(View.GONE);
    frameLayout.addView(progressView);
    layoutParams = (FrameLayout.LayoutParams) progressView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.bottomMargin = AndroidUtilities.dp(48);
    progressView.setLayoutParams(layoutParams);

    ProgressBar progressBar = new ProgressBar(context);
    progressView.addView(progressBar);
    layoutParams = (FrameLayout.LayoutParams) progressView.getLayoutParams();
    layoutParams.width = LayoutHelper.WRAP_CONTENT;
    layoutParams.height = LayoutHelper.WRAP_CONTENT;
    layoutParams.gravity = Gravity.CENTER;
    progressView.setLayoutParams(layoutParams);


    if (loading && (albumsSorted == null || albumsSorted != null && albumsSorted.isEmpty())) {
        progressView.setVisibility(View.VISIBLE);
        listView.setEmptyView(null);
    } else {
        progressView.setVisibility(View.GONE);
        listView.setEmptyView(emptyView);
    }
    return fragmentView;
}
 
源代码16 项目: emerald   文件: MainLayout.java
public static RelativeLayout get(Context context, SharedPreferences options) {
	RelativeLayout mainLayout = new RelativeLayout(context);
	LayoutInflater layoutInflater = (LayoutInflater) 
		context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

	addDockBar(mainLayout, layoutInflater, options);

	boolean kitkatNoImmersiveMode = (Build.VERSION.SDK_INT == 19 && !options.getBoolean(Keys.FULLSCREEN, false));
	FrameLayout mainBar = (FrameLayout) layoutInflater.inflate(R.layout.main_bar, mainLayout, false);
	RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(mainBar.getLayoutParams());
	
	GridView grid = (GridView) layoutInflater.inflate(R.layout.apps_grid, mainLayout, false);
	initAppsGrid(grid, options);
	
	if (options.getBoolean(Keys.BOTTOM_MAIN_BAR, true)) {
		layoutParams.addRule(RelativeLayout.ABOVE, R.id.dock_bar);
		mainBar.setLayoutParams(layoutParams);
		mainLayout.addView(mainBar);
		
		if (kitkatNoImmersiveMode) {
			mainLayout.addView(getFakeStatusBar(mainLayout, layoutInflater, options));
		}
		layoutParams = new RelativeLayout.LayoutParams(grid.getLayoutParams());
		if (kitkatNoImmersiveMode) {
			layoutParams.addRule(RelativeLayout.BELOW, R.id.kitkat_status_bar);
		} else {
			layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
		}
		layoutParams.addRule(RelativeLayout.ABOVE, R.id.main_bar);
		grid.setLayoutParams(layoutParams);
		mainLayout.addView(grid);
	} else {
		if (!kitkatNoImmersiveMode) {
			layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
		} else {
			mainLayout.addView(getFakeStatusBar(mainLayout, layoutInflater, options));
			layoutParams.addRule(RelativeLayout.BELOW, R.id.kitkat_status_bar);
		}
		
		mainBar.setLayoutParams(layoutParams);
		mainLayout.addView(mainBar);
		
		layoutParams = new RelativeLayout.LayoutParams(grid.getLayoutParams());
		layoutParams.addRule(RelativeLayout.ABOVE, R.id.dock_bar);
		layoutParams.addRule(RelativeLayout.BELOW, R.id.main_bar);
		grid.setLayoutParams(layoutParams);
		mainLayout.addView(grid);
	}
	if (options.getBoolean(Keys.HIDE_MAIN_BAR, false)) {
		mainBar.setVisibility(View.GONE);
	}
	mainBar.setBackgroundColor(options.getInt(Keys.BAR_BACKGROUND, 0x22000000));
	
	return mainLayout;
}
 
源代码17 项目: TelePlus-Android   文件: DataUsageActivity.java
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    if (currentType == 0) {
        actionBar.setTitle(LocaleController.getString("MobileUsage", R.string.MobileUsage));
    } else if (currentType == 1) {
        actionBar.setTitle(LocaleController.getString("WiFiUsage", R.string.WiFiUsage));
    } else if (currentType == 2) {
        actionBar.setTitle(LocaleController.getString("RoamingUsage", R.string.RoamingUsage));
    }
    if (AndroidUtilities.isTablet()) {
        actionBar.setOccupyStatusBar(false);
    }
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
    FrameLayout frameLayout = (FrameLayout) fragmentView;

    listView = new RecyclerListView(context);
    listView.setVerticalScrollBarEnabled(false);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, final int position) {
            if (getParentActivity() == null) {
                return;
            }
            if (position == resetRow) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setMessage(LocaleController.getString("ResetStatisticsAlert", R.string.ResetStatisticsAlert));
                builder.setPositiveButton(LocaleController.getString("Reset", R.string.Reset), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        StatsController.getInstance(currentAccount).resetStats(currentType);
                        listAdapter.notifyDataSetChanged();
                    }
                });
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder.create());
            }
        }
    });

    frameLayout.addView(actionBar);

    return fragmentView;
}
 
源代码18 项目: TiCrouton   文件: Crouton.java
private FrameLayout initializeCroutonViewGroup(Resources resources) {
  FrameLayout croutonView = new FrameLayout(this.activity);

  if (null != onClickListener) {
    croutonView.setOnClickListener(onClickListener);
  }

  final int height;
  if (this.style.heightDimensionResId > 0) {
    height = resources.getDimensionPixelSize(this.style.heightDimensionResId);
  } else {
    height = this.style.heightInPixels;
  }

  final int width;
  if (this.style.widthDimensionResId > 0) {
    width = resources.getDimensionPixelSize(this.style.widthDimensionResId);
  } else {
    width = this.style.widthInPixels;
  }

  croutonView.setLayoutParams(
      new FrameLayout.LayoutParams(width != 0 ? width : FrameLayout.LayoutParams.MATCH_PARENT, height));

  // set background
  if (this.style.backgroundColorValue != Style.NOT_SET) {
    croutonView.setBackgroundColor(this.style.backgroundColorValue);
  } else {
    croutonView.setBackgroundColor(resources.getColor(this.style.backgroundColorResourceId));
  }

  // set the background drawable if set. This will override the background
  // color.
  if (this.style.backgroundDrawableResourceId != 0) {
    Bitmap background = BitmapFactory.decodeResource(resources, this.style.backgroundDrawableResourceId);
    BitmapDrawable drawable = new BitmapDrawable(resources, background);
    if (this.style.isTileEnabled) {
      drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
    }
    croutonView.setBackgroundDrawable(drawable);
  }
  return croutonView;
}
 
源代码19 项目: Telegram   文件: ArchivedStickersActivity.java
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    if (currentType == MediaDataController.TYPE_IMAGE) {
        actionBar.setTitle(LocaleController.getString("ArchivedStickers", R.string.ArchivedStickers));
    } else {
        actionBar.setTitle(LocaleController.getString("ArchivedMasks", R.string.ArchivedMasks));
    }
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));

    emptyView = new EmptyTextProgressView(context);
    if (currentType == MediaDataController.TYPE_IMAGE) {
        emptyView.setText(LocaleController.getString("ArchivedStickersEmpty", R.string.ArchivedStickersEmpty));
    } else {
        emptyView.setText(LocaleController.getString("ArchivedMasksEmpty", R.string.ArchivedMasksEmpty));
    }
    frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    if (loadingStickers) {
        emptyView.showProgress();
    } else {
        emptyView.showTextView();
    }

    listView = new RecyclerListView(context);
    listView.setFocusable(true);
    listView.setEmptyView(emptyView);
    listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));

    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener((view, position) -> {
        if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
            final TLRPC.StickerSetCovered stickerSet = sets.get(position - stickersStartRow);
            TLRPC.InputStickerSet inputStickerSet;
            if (stickerSet.set.id != 0) {
                inputStickerSet = new TLRPC.TL_inputStickerSetID();
                inputStickerSet.id = stickerSet.set.id;
            } else {
                inputStickerSet = new TLRPC.TL_inputStickerSetShortName();
                inputStickerSet.short_name = stickerSet.set.short_name;
            }
            inputStickerSet.access_hash = stickerSet.set.access_hash;
            final StickersAlert stickersAlert = new StickersAlert(getParentActivity(), ArchivedStickersActivity.this, inputStickerSet, null, null);
            stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() {
                @Override
                public void onStickerSetInstalled() {
                    ((ArchivedStickerSetCell) view).setDrawProgress(true, true);
                    installingStickerSets.put(stickerSet.set.id, stickerSet);
                }

                @Override
                public void onStickerSetUninstalled() {
                }
            });
            showDialog(stickersAlert);
        }
    });
    listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            if (!loadingStickers && !endReached && layoutManager.findLastVisibleItemPosition() > stickersLoadingRow - 2) {
                getStickers();
            }
        }
    });

    return fragmentView;
}
 
源代码20 项目: Telegram   文件: FeaturedStickersActivity.java
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("FeaturedStickers", R.string.FeaturedStickers));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));

    listView = new RecyclerListView(context);
    listView.setItemAnimator(null);
    listView.setLayoutAnimation(null);
    listView.setFocusable(true);
    listView.setTag(14);
    layoutManager = new LinearLayoutManager(context) {
        @Override
        public boolean supportsPredictiveItemAnimations() {
            return false;
        }
    };
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    listView.setLayoutManager(layoutManager);

    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener((view, position) -> {
        if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
            final TLRPC.StickerSetCovered stickerSet = MediaDataController.getInstance(currentAccount).getFeaturedStickerSets().get(position);
            TLRPC.InputStickerSet inputStickerSet;
            if (stickerSet.set.id != 0) {
                inputStickerSet = new TLRPC.TL_inputStickerSetID();
                inputStickerSet.id = stickerSet.set.id;
            } else {
                inputStickerSet = new TLRPC.TL_inputStickerSetShortName();
                inputStickerSet.short_name = stickerSet.set.short_name;
            }
            inputStickerSet.access_hash = stickerSet.set.access_hash;
            StickersAlert stickersAlert = new StickersAlert(getParentActivity(), FeaturedStickersActivity.this, inputStickerSet, null, null);
            stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() {
                @Override
                public void onStickerSetInstalled() {
                    FeaturedStickerSetCell cell = (FeaturedStickerSetCell) view;
                    cell.setDrawProgress(true, true);
                    installingStickerSets.put(stickerSet.set.id, stickerSet);
                }

                @Override
                public void onStickerSetUninstalled() {

                }
            });
            showDialog(stickersAlert);
        }
    });
    return fragmentView;
}