List of usage examples for android.widget RelativeLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.mobicage.rogerthat.ServiceBoundActivity.java
public void setNavigationBarVisible(boolean isVisible) { final RelativeLayout navBar = (RelativeLayout) findViewById(R.id.nav_bar); if (navBar == null) { L.d("navBar not found in current activity"); return;/*from w w w . j a v a 2 s . com*/ } navBar.setVisibility(isVisible ? View.VISIBLE : View.GONE); }
From source file:com.webianks.library.ShowHideAnimation.java
public void animateOut(final RelativeLayout view) { Animation anim = AnimationUtils.loadAnimation(view.getContext(), R.anim.pop_out); anim.setInterpolator(INTERPOLATOR_OUT); anim.setDuration(250L);//from w w w.ja v a2 s. co m anim.setAnimationListener(new Animation.AnimationListener() { public void onAnimationStart(Animation animation) { //ScrollAwareFABBehavior.this.mIsAnimatingOut = true; } public void onAnimationEnd(Animation animation) { //ScrollAwareFABBehavior.this.mIsAnimatingOut = false; view.setVisibility(View.GONE); } @Override public void onAnimationRepeat(final Animation animation) { } }); view.startAnimation(anim); }
From source file:com.almalence.opencam.ui.AlmalenceStore.java
public void showStore() { LayoutInflater inflater = LayoutInflater.from(MainScreen.getInstance()); List<RelativeLayout> pages = new ArrayList<RelativeLayout>(); // <!-- -+- final boolean unlocked = false; //-+- -->//from w ww .ja v a 2 s.c o m /* <!-- +++ final boolean unlocked = true; +++ --> */ // page 1 RelativeLayout page = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_pager_fragment, null); initStoreList(); RelativeLayout store = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_store, null); final ImageView imgStoreNext = (ImageView) store.findViewById(R.id.storeWhatsNew); GridView gridview = (GridView) store.findViewById(R.id.storeGrid); gridview.setAdapter(storeAdapter); if (!unlocked) { page.addView(store); pages.add(page); } // page 2 page = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_pager_fragment, null); RelativeLayout features = (RelativeLayout) inflater.inflate(R.layout.gui_almalence_features, null); final ImageView imgFeaturesPrev = (ImageView) features.findViewById(R.id.storeWhatsNew); imgFeaturesPrev.setVisibility(View.INVISIBLE); WebView wv = (WebView) features.findViewById(R.id.text_features); wv.loadUrl("file:///android_asset/www/features.html"); page.addView(features); pages.add(page); SamplePagerAdapter pagerAdapter = new SamplePagerAdapter(pages); final ViewPager viewPager = new ViewPager(MainScreen.getInstance()); viewPager.setAdapter(pagerAdapter); if (!unlocked) viewPager.setCurrentItem(0); else viewPager.setCurrentItem(1); viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { switch (position) { case 0: // 0 imgStoreNext.setVisibility(View.VISIBLE); // 1 imgFeaturesPrev.setVisibility(View.INVISIBLE); break; case 1: // 0 imgStoreNext.setVisibility(View.INVISIBLE); // 1 if (!unlocked) imgFeaturesPrev.setVisibility(View.VISIBLE); else imgFeaturesPrev.setVisibility(View.INVISIBLE); break; default: break; } } }); imgStoreNext.setOnClickListener(new OnClickListener() { public void onClick(View v) { viewPager.setCurrentItem(1); } }); imgFeaturesPrev.setOnClickListener(new OnClickListener() { public void onClick(View v) { viewPager.setCurrentItem(0); } }); guiView.findViewById(R.id.buttonGallery).setEnabled(false); guiView.findViewById(R.id.buttonShutter).setEnabled(false); guiView.findViewById(R.id.buttonSelectMode).setEnabled(false); PluginManager.getInstance().sendMessage(ApplicationInterface.MSG_BROADCAST, ApplicationInterface.MSG_CONTROL_LOCKED); MainScreen.getGUIManager().lockControls = true; // <!-- -+- if (MainScreen.getInstance().showPromoRedeemed) { Toast.makeText(MainScreen.getInstance(), "The promo code has been successfully redeemed. All PRO-Features are unlocked", Toast.LENGTH_LONG).show(); MainScreen.getInstance().showPromoRedeemed = false; } if (MainScreen.getInstance().showPromoRedeemedJulius) { Toast.makeText(MainScreen.getInstance(), MainScreen.getInstance().getResources().getString(R.string.promoRedeemedJulius), Toast.LENGTH_LONG).show(); MainScreen.getInstance().showPromoRedeemedJulius = false; } //-+- --> final RelativeLayout pagerLayout = ((RelativeLayout) guiView.findViewById(R.id.viewPagerLayout)); pagerLayout.addView(viewPager); final RelativeLayout pagerLayoutMain = ((RelativeLayout) guiView.findViewById(R.id.viewPagerLayoutMain)); pagerLayoutMain.setVisibility(View.VISIBLE); pagerLayoutMain.bringToFront(); // We need this timer, to show store on top, after we return from google // play. // In MainScreen there is timer, which brings main buttons on top, // after MainScreen activity resumed. // So this timer "blocks" timer from MainScreen if we want to show // store. new CountDownTimer(600, 10) { public void onTick(long millisUntilFinished) { pagerLayoutMain.bringToFront(); } public void onFinish() { pagerLayoutMain.bringToFront(); } }.start(); }
From source file:com.lloydtorres.stately.telegrams.TelegramsAdapter.java
/** * Changes the telegram alert to a certain style depending on its type. * @param type Telegram type//from ww w . j a v a 2s . c o m * @param holder * @param icon * @param text */ public void setAlertState(int type, boolean isPreview, RelativeLayout holder, ImageView icon, TextView text) { if (type != Telegram.TELEGRAM_GENERIC) { holder.setVisibility(View.VISIBLE); int iconRes = isPreview ? R.drawable.ic_alert_recruitment : R.drawable.ic_alert_recruitment_white; int alertColor = R.color.colorChart1; int alertContent = R.string.telegrams_alert_recruitment; switch (type) { case Telegram.TELEGRAM_REGION: iconRes = isPreview ? R.drawable.ic_region_green : R.drawable.ic_region_white; alertColor = R.color.colorChart3; alertContent = R.string.telegrams_alert_region; break; case Telegram.TELEGRAM_WELCOME: iconRes = isPreview ? R.drawable.ic_region_green : R.drawable.ic_region_white; alertColor = R.color.colorChart3; alertContent = R.string.telegram_alert_welcome; break; case Telegram.TELEGRAM_MODERATOR: iconRes = isPreview ? R.drawable.ic_alert_moderator : R.drawable.ic_alert_moderator_white; alertColor = R.color.colorChart3; alertContent = R.string.telegrams_alert_mod; break; } icon.setImageResource(iconRes); text.setText(context.getString(alertContent)); if (isPreview) { text.setTextColor(ContextCompat.getColor(context, alertColor)); } else { holder.setBackgroundColor(ContextCompat.getColor(context, alertColor)); } } else { holder.setVisibility(View.GONE); } }
From source file:org.irmacard.cardemu.selfenrol.EnrollSelectActivity.java
/** * Called when the user presses the continue button *//*from w w w .j av a2 s.c o m*/ protected void advanceScreen() { switch (screen) { case SCREEN_START: setContentView(R.layout.enroll_activity_bac); screen = SCREEN_BAC; updateProgressCounter(screen - 1); Spinner spinner = (Spinner) findViewById(R.id.bac_selector); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.document_list, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Log.v(TAG, (String) parent.getItemAtPosition(position)); RelativeLayout drivers_license = (RelativeLayout) findViewById(R.id.drivers_license_data); RelativeLayout passport = (RelativeLayout) findViewById(R.id.passport_data); if (position == 0) { drivers_license.setVisibility(View.GONE); passport.setVisibility(View.VISIBLE); next_activity = PASSPORT_ACTIVITY; } else if (position == 1) { drivers_license.setVisibility(View.VISIBLE); passport.setVisibility(View.GONE); next_activity = DL_ACTIVITY; } else { throw new IllegalArgumentException("Pulldown list provided unspecified argument"); } if (bacFieldWatcher != null) bacFieldWatcher.onTextChanged("", 0, 0, 0); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); spinner.setSelection(settings.getInt("enroll_document", PASSPORT_ACTIVITY)); populateBacAndBapFields(); EditText docnrEditText; EditText dobEditText; EditText doeEditText; long bacDob; long bacDoe; enableContinueButton(); setBacFieldWatcher(); break; case SCREEN_BAC: if (next_activity == PASSPORT_ACTIVITY) { // Store the entered document number and dates in the settings. docnrEditText = (EditText) findViewById(R.id.doc_nr_edittext); dobEditText = (EditText) findViewById(R.id.dob_edittext); doeEditText = (EditText) findViewById(R.id.doe_edittext); if (docnrEditText != null && dobEditText != null && doeEditText != null) { bacDob = 0; bacDoe = 0; try { String dobString = dobEditText.getText().toString(); String doeString = doeEditText.getText().toString(); if (dobString.length() != 0) bacDob = hrDateFormat.parse(dobString).getTime(); if (doeString.length() != 0) bacDoe = hrDateFormat.parse(doeString).getTime(); } catch (ParseException e) { // Should not happen: the DOB and DOE EditTexts are set only by the DatePicker's, // OnDateSetListener, which should always set a properly formatted string. e.printStackTrace(); } if (bacDoe < System.currentTimeMillis()) { showErrorScreen(getString(R.string.error_enroll_passport_expired), getString(R.string.abort), 0, getString(R.string.retry), SCREEN_BAC); return; } settings.edit().putInt("enroll_document", next_activity).putLong("enroll_bac_dob", bacDob) .putLong("enroll_bac_doe", bacDoe) .putString("enroll_bac_docnr", docnrEditText.getText().toString()).apply(); } Intent i = new Intent(this, PassportEnrollActivity.class); startActivityForResult(i, PassportEnrollActivity.PassportEnrollActivityCode); } else if (next_activity == DL_ACTIVITY) { //safe the mrz text field for later. EditText mrzText = (EditText) findViewById(R.id.mrz); if (mrzText != null) { settings.edit().putInt("enroll_document", next_activity) .putString("mrz", mrzText.getText().toString()).apply(); } //TODO handle DL GUI Intent i = new Intent(this, DriversLicenseEnrollActivity.class); startActivityForResult(i, DriversLicenseEnrollActivity.DriversLicenseEnrollActivityCode); } else { throw new IllegalStateException("Enroll Activity advancing an unknown screen: " + screen); } break; case SCREEN_ISSUE: case SCREEN_ERROR: screen = SCREEN_START; finish(); break; default: Log.e(TAG, "Error, screen switch fall through: " + screen); break; } }
From source file:dynamite.zafroshops.app.fragment.NearestZopsFragment.java
private void resetVisibility(ListView zops, LinearLayout noZops, RelativeLayout loader, boolean showLoader) { Activity activity = getActivity();//ww w .ja v a 2 s. c o m if (nearestZops.size() == 0) { noZops.setVisibility(View.VISIBLE); zops.setVisibility(View.INVISIBLE); } else { noZops.setVisibility(View.INVISIBLE); zops.setVisibility(View.VISIBLE); } if (showLoader) { zops.setVisibility(View.INVISIBLE); noZops.setVisibility(View.INVISIBLE); loader.setVisibility(View.VISIBLE); } else { loader.setVisibility(View.INVISIBLE); } }
From source file:org.secuso.privacyfriendlypasswordgenerator.dialogs.UpdateMetadataDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); rootView = inflater.inflate(R.layout.dialog_update_metadata, null); versionVisible = false;//from w w w. j a v a2s . c om Bundle bundle = getArguments(); position = bundle.getInt("position"); hash_algorithm = bundle.getString("hash_algorithm"); bindToDevice_enabled = bundle.getBoolean("bindToDevice_enabled"); database = MetaDataSQLiteHelper.getInstance(getActivity()); metaData = database.getMetaData(position); oldMetaData = database.getMetaData(position); number_iterations = bundle.getInt("number_iterations"); builder.setView(rootView); setUpData(); builder.setIcon(R.mipmap.ic_drawer); builder.setTitle(getActivity().getString(R.string.add_new_metadata_heading)); builder.setPositiveButton(getActivity().getString(R.string.save), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { updateMetadata(oldMetaData.getITERATION()); } }); builder.setNegativeButton(getActivity().getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { cancelUpdate(); } }); Button versionButton = (Button) rootView.findViewById(R.id.versionButton); versionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RelativeLayout versionDataLayout = (RelativeLayout) rootView.findViewById(R.id.updateVersionLayout); TextView versionTextView = (TextView) rootView.findViewById(R.id.versionButton); TextView textViewIteration = (TextView) rootView.findViewById(R.id.textViewIteration); if (!versionVisible) { versionDataLayout.setVisibility(View.VISIBLE); textViewIteration.setVisibility(View.VISIBLE); versionTextView.setText(getString(R.string.change_version_opened)); versionTextView.setTextColor(Color.BLACK); versionVisible = true; } else { versionDataLayout.setVisibility(View.GONE); textViewIteration.setVisibility(View.GONE); versionTextView.setText(getString(R.string.change_version_closed)); versionTextView.setTextColor(Color.parseColor("#d3d3d3")); versionVisible = false; } } }); ImageButton versionInfoImageButton = (ImageButton) rootView.findViewById(R.id.versionInfoImageButton); versionInfoImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder infoBbuilder = new AlertDialog.Builder(getActivity()); infoBbuilder.setTitle(getString(R.string.dialog_version_title)); infoBbuilder.setMessage(R.string.dialog_version); infoBbuilder.show(); } }); return builder.create(); }
From source file:dynamite.zafroshops.app.fragment.AddZopFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_add_zop, container, false); Spinner zopTypeSpinner = (Spinner) rootView.findViewById(R.id.newZopType); Spinner zopCountrySpinner = (Spinner) rootView.findViewById(R.id.newZopCountry); RelativeLayout loader = (RelativeLayout) rootView.findViewById(R.id.relativeLayoutLoader); LinearLayout zop = (LinearLayout) rootView.findViewById(R.id.itemZopAdd); TextView text = (TextView) rootView.findViewById(R.id.loading_message); final TextView phoneCode = (TextView) rootView.findViewById(R.id.newZopPhoneCode); loader.setVisibility(View.INVISIBLE); zop.setVisibility(View.VISIBLE); text.setText(getString(R.string.sending_data)); zopTypeSpinner.setAdapter(zopTypeAdapter); zopCountrySpinner.setAdapter(zopCountryAdapter); zopTypeSpinner.setSelection(zopTypeAdapter.getPosition(ZopType.Shop)); ((Button) rootView.findViewById(R.id.newZopOpeningsButton)) .setText(getString(R.string.openings_edit) + " 0/7"); ((Button) rootView.findViewById(R.id.newZopServicesButton)) .setText(getString(R.string.services_editing) + " 0/" + ZopServiceType.values().length); zopCountrySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override/* w ww . j av a 2s . c o m*/ public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) { MobileCountry country = (MobileCountry) parent.getItemAtPosition(position); phoneCode.setText(country.PhoneCode); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); clearForm(rootView); return rootView; }
From source file:de.incoherent.suseconferenceclient.activities.HomeActivity.java
private void setView(boolean loadSocial) { Log.d("SUSEConferences", "setView"); if (mDialog != null) mDialog.dismiss();//from w ww . j av a 2s .com showChangeLog(); Database db = SUSEConferences.getDatabase(); mConference = db.getConference(mConferenceId); mVenueId = db.getConferenceVenue(mConferenceId); getSupportActionBar().setTitle(mConference.getName()); Log.d("SUSEConferences", "Conference ID is " + mConferenceId); mPhonePager = (ViewPager) findViewById(R.id.phonePager); if (mPhonePager != null) { // Phone layout ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); Bundle args = new Bundle(); args.putLong("conferenceId", this.mConferenceId); args.putString("socialTag", mConference.getSocialTag()); args.putString("conferenceName", mConference.getName()); // If the user has switched the conference after another conference // was loaded, we'll just reset everything if (mTabsAdapter == null) { mTabsAdapter = new TabAdapter(this, mPhonePager); Tab myScheduleTab = bar.newTab(); myScheduleTab.setText(getString(R.string.mySchedule)); myScheduleTab.setTag(MY_SCHEDULE_TAG); mTabsAdapter.addTab(myScheduleTab, MyScheduleFragment.class, args); Tab scheduleTab = bar.newTab(); scheduleTab.setText(getString(R.string.fullSchedule)); scheduleTab.setTag(SCHEDULE_TAG); mTabsAdapter.addTab(scheduleTab, ScheduleFragment.class, args); if (hasInternet()) { mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.newsFeed)), NewsFeedFragment.class, args); //mTabsAdapter.addTab( // bar.newTab().setText(getString(R.string.rssFeed)), // RssFeedFragment.class,args); } } } else { // Tablet layout FragmentManager fm = getSupportFragmentManager(); Bundle args = new Bundle(); args.putLong("conferenceId", this.mConferenceId); args.putString("socialTag", mConference.getSocialTag()); args.putString("conferenceName", mConference.getName()); MyScheduleFragment mySched = new MyScheduleFragment(); mySched.setArguments(args); fm.beginTransaction().add(R.id.myScheduleFragmentLayout, mySched, MY_SCHEDULE_TAG).commit(); ScheduleFragment sched = new ScheduleFragment(); sched.setArguments(args); fm.beginTransaction().add(R.id.scheduleFragmentLayout, sched, SCHEDULE_TAG).commit(); if (hasInternet() && loadSocial) { NewsFeedFragment newsFeed = new NewsFeedFragment(); newsFeed.setArguments(args); fm.beginTransaction().add(R.id.socialLayout, newsFeed, NEWSFEED_TAG).commit(); } if (!hasInternet()) { RelativeLayout horizontal = (RelativeLayout) findViewById(R.id.newsFeedHorizontalLayout); if (horizontal != null) horizontal.setVisibility(View.GONE); FrameLayout socialLayout = (FrameLayout) findViewById(R.id.socialLayout); socialLayout.setVisibility(View.GONE); TextView labelView = (TextView) findViewById(R.id.newsFeedTextView); labelView.setVisibility(View.GONE); } } }
From source file:com.mobicage.rogerthat.plugins.friends.RecommendServiceActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recommend_service); mViewFlipper = (ViewFlipper) findViewById(R.id.view_flipper); if (!AppConstants.FRIENDS_ENABLED) { LinearLayout rtf = (LinearLayout) findViewById(R.id.recommend_to_friends); mViewFlipper.removeView(rtf);/*w w w .j av a 2 s .co m*/ RelativeLayout rl = (RelativeLayout) findViewById(R.id.rogerthat_layout); rl.setVisibility(View.GONE); View ci = findViewById(R.id.contacts_indicator); ci.setVisibility(View.VISIBLE); } if (AppConstants.FACEBOOK_APP_ID == null) { LinearLayout rof = (LinearLayout) findViewById(R.id.recommend_on_fb); mViewFlipper.removeView(rof); RelativeLayout fl = (RelativeLayout) findViewById(R.id.facebook_layout); fl.setVisibility(View.GONE); } Swiper leftSwiper = new Swiper() { @Override public Intent onSwipe() { int i = mViewFlipper.getDisplayedChild() + 1; if (i < mViewFlipper.getChildCount()) { displayTab(i); } return null; } }; Swiper rightSwiper = new Swiper() { @Override public Intent onSwipe() { int i = mViewFlipper.getDisplayedChild(); if (i > 0) { displayTab(i - 1); } return null; } }; mGestureScanner = new GestureDetector(new Slider(this, this, leftSwiper, rightSwiper)); Intent intent = getIntent(); mServiceEmail = intent.getStringExtra(SERVICE_EMAIL); mShareDescription = intent.getStringExtra(SHARE_DESCRIPTION); mShareCaption = intent.getStringExtra(SHARE_CAPTION); Uri shareLinkUrl = Uri.parse(intent.getStringExtra(SHARE_LINK_URL)); Builder b = shareLinkUrl.buildUpon(); b.appendQueryParameter("from", "phone"); b.appendQueryParameter("target", "fbwall"); b.build(); mShareLinkUrl = b.toString(); mShareImageUrl = intent.getStringExtra(SHARE_IMAGE_URL); mUiHelper = new UiLifecycleHelper(this, null); mUiHelper.onCreate(savedInstanceState); }