List of usage examples for android.widget FrameLayout setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:com.example.android.aberdean.popularmoviesi.MovieDetails.java
/** * Allows the user to toggle between a light and a dark theme. * @param item the selected menu item// www . jav a 2s .co m * @return true or inherit from parent */ @Override public boolean onOptionsItemSelected(MenuItem item) { FrameLayout background = (FrameLayout) findViewById(R.id.background_color); switch (item.getItemId()) { case R.id.dark_scheme: background.setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackground)); mReleaseDate.setTextColor(ContextCompat.getColor(this, R.color.colorText)); mRating.setTextColor(ContextCompat.getColor(this, R.color.colorText)); mSynopsis.setTextColor(ContextCompat.getColor(this, R.color.colorText)); return true; case R.id.light_scheme: background.setBackgroundColor(ContextCompat.getColor(this, R.color.colorText)); mReleaseDate.setTextColor(ContextCompat.getColor(this, R.color.colorBackground)); mRating.setTextColor(ContextCompat.getColor(this, R.color.colorBackground)); mSynopsis.setTextColor(ContextCompat.getColor(this, R.color.colorBackground)); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.facebook.notifications.internal.activity.CardActivity.java
private void beginLoadingContent() { if (assetManager == null || contentManager == null) { Log.e(LOG_TAG, "Asset & content manager should be available!"); return;/*from w w w. ja v a 2s . c om*/ } if (configurationPayload == null) { Log.e(LOG_TAG, "No card payload is available!"); return; } ProgressBar loadingView = new ProgressBar(this); loadingView.setIndeterminate(true); int backgroundColor = ColorAssetHandler.fromRGBAHex(configurationPayload.optString("backdropColor")); FrameLayout loadingViewFrame = new FrameLayout(this); loadingViewFrame.setBackgroundColor(backgroundColor); LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER; loadingViewFrame.addView(loadingView, layoutParams); setContentView(loadingViewFrame); final Handler handler = new Handler(); if (configurationPayload == null) { return; } assetManager.cachePayload(configurationPayload, new AssetManager.CacheCompletionCallback() { @Override public void onCacheCompleted(@NonNull JSONObject payload) { final CardConfiguration configuration; try { configuration = new CardConfiguration(configurationPayload, assetManager, contentManager); } catch (JSONException ex) { Log.e(LOG_TAG, "Error while parsing JSON", ex); return; } handler.post(new Runnable() { @Override public void run() { displayConfiguration(configuration); } }); } }); }
From source file:de.enlightened.peris.Mail.java
@SuppressLint("NewApi") public void onCreate(final Bundle savedInstanceState) { final PerisApp application = (PerisApp) getApplication(); final String background = application.getSession().getServer().serverColor; ThemeSetter.setTheme(this, background); super.onCreate(savedInstanceState); ThemeSetter.setActionBar(this, background); setTitle("Inbox"); setContentView(R.layout.single_frame_activity); //Setup forum background final String forumWallpaper = application.getSession().getServer().serverWallpaper; final String forumBackground = application.getSession().getServer().serverBackground; final FrameLayout sfaHolder = (FrameLayout) findViewById(R.id.sfa_holder); final ImageView sfaWallpaper = (ImageView) findViewById(R.id.sfa_wallpaper); if (forumBackground != null && forumBackground.contains("#") && forumBackground.length() == 7) { sfaHolder.setBackgroundColor(Color.parseColor(forumBackground)); } else {/*from ww w. j ava 2s. c om*/ sfaHolder.setBackgroundColor(Color.parseColor(getString(R.string.default_background))); } if (forumWallpaper != null && forumWallpaper.contains("http")) { final String imageUrl = forumWallpaper; ImageLoader.getInstance().displayImage(imageUrl, sfaWallpaper); } else { sfaWallpaper.setVisibility(View.GONE); } final MailFragment mf = new MailFragment(); final FragmentManager fragmentManager = getSupportFragmentManager(); final FragmentTransaction ftZ = fragmentManager.beginTransaction(); ftZ.replace(R.id.single_frame_layout_frame, mf); ftZ.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ftZ.commit(); }
From source file:org.telegram.ui.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//from ww w. j av a 2 s . co m public void onItemClick(int id) { if (id == -1) { finishFragment(); } } }); listAdapter = new ListAdapter(context); fragmentView = new FrameLayout(context); FrameLayout frameLayout = (FrameLayout) fragmentView; frameLayout.setBackgroundColor(ContextCompat.getColor(context, R.color.settings_background)); RecyclerListView 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(new RecyclerListView.OnItemClickListener() { @Override public void onItemClick(final View view, int position) { if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) { final TLRPC.StickerSetCovered stickerSet = StickersQuery.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); installingStickerSets.put(stickerSet.set.id, stickerSet); } @Override public void onStickerSetUninstalled() { } }); showDialog(stickersAlert); } } }); return fragmentView; }
From source file:com.odoo.addons.customers.CustomerDetails.java
private void setColor(int color) { FrameLayout frameLayout = (FrameLayout) findViewById(R.id.parallax_view); frameLayout.setBackgroundColor(color); parallaxScrollView.setParallaxOverLayColor(color); parallaxScrollView.setBackgroundColor(color); mForm.setIconTintColor(color);/* ww w .ja v a2 s . co m*/ findViewById(R.id.parallax_view).setBackgroundColor(color); findViewById(R.id.parallax_view_edit).setBackgroundColor(color); findViewById(R.id.customerScrollViewEdit).setBackgroundColor(color); if (captureImage != null) { GradientDrawable shapeDrawable = (GradientDrawable) getResources() .getDrawable(R.drawable.circle_mask_primary); shapeDrawable.setColor(color); captureImage.setBackgroundDrawable(shapeDrawable); } }
From source file:org.telegram.ui.ArchivedStickersActivity.java
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); if (currentType == StickersQuery.TYPE_IMAGE) { actionBar.setTitle(LocaleController.getString("ArchivedStickers", R.string.ArchivedStickers)); } else {/* w w w . java 2 s.c o m*/ 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(ContextCompat.getColor(context, R.color.settings_background)); emptyView = new EmptyTextProgressView(context); if (currentType == StickersQuery.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(); } RecyclerListView 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(new RecyclerListView.OnItemClickListener() { @Override public void onItemClick(final View view, int position) { if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) { final TLRPC.StickerSetCovered stickerSet = sets.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(), ArchivedStickersActivity.this, inputStickerSet, null, null); stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() { @Override public void onStickerSetInstalled() { ArchivedStickerSetCell cell = (ArchivedStickerSetCell) view; cell.setChecked(true); } @Override public void onStickerSetUninstalled() { ArchivedStickerSetCell cell = (ArchivedStickerSetCell) view; cell.setChecked(false); } }); 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; }
From source file:sg.fxl.topekaport.QuizActivity.java
private void startQuizFromClickOn(final View clickedView) { initQuizFragment();//from w ww . ja va 2 s . c o m getSupportFragmentManager().beginTransaction() .replace(R.id.quiz_fragment_container, quizFragment, FRAGMENT_TAG).commit(); final FrameLayout container = (FrameLayout) findViewById(R.id.quiz_fragment_container); container.setBackgroundColor(ContextCompat.getColor(this, quiz.getTheme().getWindowBackgroundColor())); revealFragmentContainer(clickedView, container); // the toolbar should not have more elevation than the content while playing setToolbarElevation(false); }
From source file:com.google.samples.apps.topeka.activity.QuizActivity.java
private void startQuizFromClickOn(final View clickedView) { initQuizFragment();// w w w . j a v a 2 s . c o m 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); }
From source file:org.deviceconnect.android.uiapp.fragment.profile.NetworkServiceDiscoveryProfileFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { mLogger.entering(getClass().getName(), "onCreateView", new Object[] { inflater, container, savedInstanceState }); final Context context = getActivity(); FrameLayout lframe = new FrameLayout(context); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list);/*from w w w . j a v a2s .c o m*/ lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); lframe.setBackgroundColor(getResources().getColor(android.R.color.background_light)); mListView = (ListView) lframe.findViewById(android.R.id.list); mListView.setAdapter(new ArrayAdapter<SmartDevice>(getActivity(), android.R.layout.simple_list_item_1)); (new ServiceDiscoveryTask()).execute(); mLogger.exiting(getClass().getName(), "onCreateView", mListView); return lframe; }
From source file:com.google.samples.apps.topeka.view.quiz.QuizActivity.java
@Override public void renderQuizView(ThemeEntity theme, boolean withFabRevealAnimation) { final Theme androidTheme = Theme.values()[theme.ordinal()]; initQuizFragment(androidTheme);//from ww w. j a va 2s. c om 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, androidTheme.getWindowBackgroundColor())); revealFragmentContainer(findViewById(R.id.fab_quiz), container, androidTheme.getAccentColor()); // the toolbar should not have more elevation than the content while playing setToolbarElevation(false); }