List of usage examples for android.view View setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.raspi.chatapp.ui.chatting.SendImageFragment.java
/** * this function will initialize the ui showing the current image and reload * everything to make sure it is shown correctly *//*w w w . j a v a2s . c o m*/ private void initUI() { // set the actionBar title and subtitle if (actionBar != null) { actionBar.setTitle(R.string.send_image); actionBar.setSubtitle(name); // actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor // (R.color.action_bar_transparent))); // // set the statusBar color // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) // getActivity().getWindow().setStatusBarColor(getResources().getColor(R // .color.action_bar_transparent)); } // instantiate the ViewPager viewPager = (ViewPager) getActivity().findViewById(R.id.send_image_view_pager); viewPager.setAdapter(new MyPagerAdapter()); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { changePage(position, false, false); } @Override public void onPageScrollStateChanged(int state) { } }); //Cancel button pressed getView().findViewById(R.id.send_image_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // just return to the chatFragment mListener.onReturnClick(); } }); //Send button pressed getView().findViewById(R.id.send_image_send).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // create the progressDialog that is to be shown while saving // the image ProgressDialog progressDialog = new ProgressDialog(getContext()); if (images.size() > 1) progressDialog.setTitle( String.format(getResources().getString(R.string.sending_images), images.size())); else progressDialog.setTitle(R.string.sending_image); // run the sendImage in a new thread because I am saving the // image and this should be done in a new thread new Thread(new SendImagesRunnable(new Handler(), getContext(), progressDialog)).start(); } }); // generate the overview only if there are at least 2 images if (images.size() > 1) { // the layoutParams for the imageView which has the following attributes: // width = height = 65dp // margin = 5dp getActivity().findViewById(R.id.send_image_overview).setVisibility(View.VISIBLE); int a = Constants.dipToPixel(getContext(), 65); RelativeLayout.LayoutParams imageViewParams = new RelativeLayout.LayoutParams(a, a); int b = Constants.dipToPixel(getContext(), 5); imageViewParams.setMargins(b, b, b, b); // the layoutParams for the backgroundView which has the following // attributes: // width = height = 71dp // margin = 2dp int c = Constants.dipToPixel(getContext(), 71); RelativeLayout.LayoutParams backgroundParams = new RelativeLayout.LayoutParams(c, c); int d = Constants.dipToPixel(getContext(), 2); backgroundParams.setMargins(d, d, d, d); // the layoutParams for the relativeLayout containing the image and // the background which has the following attributes: // width = height = wrap_content LinearLayout.LayoutParams relativeLayoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout linearLayout = (LinearLayout) getActivity().findViewById(R.id.send_image_overview_content); linearLayout.removeAllViewsInLayout(); int i = 0; for (Message msg : images) { // set up the imageView ImageView imageView = new ImageView(getContext()); imageView.setLayoutParams(imageViewParams); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); // load the bitmap async AsyncDrawable.BitmapWorkerTask bitmapWorker = new AsyncDrawable.BitmapWorkerTask(imageView, a, a, true); imageView.setImageDrawable(new AsyncDrawable(getResources(), null, bitmapWorker)); imageView.setOnClickListener(new overviewSelectListener(i++)); bitmapWorker.execute(FileUtils.getFile(getContext(), msg.getImageUri())); // set up the background View background = new View(getContext()); background.setLayoutParams(backgroundParams); background.setBackgroundColor(getActivity().getResources().getColor(R.color.colorPrimaryDark)); // make it invisible in the beginning background.setVisibility(View.GONE); // create the relativeLayout containing them RelativeLayout relativeLayout = new RelativeLayout(getContext()); relativeLayout.setLayoutParams(relativeLayoutParams); relativeLayout.addView(background); relativeLayout.addView(imageView); // combination of Message and overviewViews msg.setLayout(relativeLayout); msg.setBackground(background); linearLayout.addView(relativeLayout); } } else getActivity().findViewById(R.id.send_image_overview).setVisibility(View.GONE); changePage(current, true, true); showSystemUI(); }
From source file:com.matthewmitchell.peercoin_android_wallet.ui.WalletActivity.java
private void prepareRestoreWalletDialog(final Dialog dialog) { final AlertDialog alertDialog = (AlertDialog) dialog; final List<File> files = new LinkedList<File>(); // external storage if (Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.exists() && Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.isDirectory()) for (final File file : Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.listFiles()) { if (!file.getName().contains("evergreencoin")) continue; if (WalletUtils.BACKUP_FILE_FILTER.accept(file) || WalletUtils.KEYS_FILE_FILTER.accept(file) || Crypto.OPENSSL_FILE_FILTER.accept(file)) files.add(file);// ww w .ja v a 2 s . com } // internal storage for (final String filename : fileList()) if (filename.startsWith(Constants.Files.WALLET_KEY_BACKUP_PROTOBUF + '.')) files.add(new File(getFilesDir(), filename)); // sort Collections.sort(files, new Comparator<File>() { @Override public int compare(final File lhs, final File rhs) { return lhs.getName().compareToIgnoreCase(rhs.getName()); } }); final View replaceWarningView = alertDialog .findViewById(R.id.restore_wallet_from_storage_dialog_replace_warning); final boolean hasCoins = application.getWallet().getBalance(BalanceType.ESTIMATED).signum() > 0; replaceWarningView.setVisibility(hasCoins ? View.VISIBLE : View.GONE); final Spinner fileView = (Spinner) alertDialog.findViewById(R.id.import_keys_from_storage_file); final FileAdapter adapter = (FileAdapter) fileView.getAdapter(); adapter.setFiles(files); fileView.setEnabled(!adapter.isEmpty()); final EditText passwordView = (EditText) alertDialog.findViewById(R.id.import_keys_from_storage_password); passwordView.setText(null); final ImportDialogButtonEnablerListener dialogButtonEnabler = new ImportDialogButtonEnablerListener( passwordView, alertDialog) { @Override protected boolean hasFile() { return fileView.getSelectedItem() != null; } @Override protected boolean needsPassword() { final File selectedFile = (File) fileView.getSelectedItem(); return selectedFile != null ? Crypto.OPENSSL_FILE_FILTER.accept(selectedFile) : false; } }; passwordView.addTextChangedListener(dialogButtonEnabler); fileView.setOnItemSelectedListener(dialogButtonEnabler); final CheckBox showView = (CheckBox) alertDialog.findViewById(R.id.import_keys_from_storage_show); showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView)); }
From source file:cw.kop.autobackground.sources.SourceListFragment.java
@Override public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { View expandedView = view.findViewById(R.id.source_expand_container); if (expandedView.isShown()) { expandedView.setVisibility(View.GONE); } else {//from w w w. ja v a 2 s .c om expandedView.setVisibility(View.VISIBLE); sourceList.smoothScrollToPositionFromTop(position, (int) (sourceList.getHeight() / 2 - view.getHeight() / 2 - addButtonBackground.getHeight() * 1.5), SCROLL_ANIMATION_TIME); } }
From source file:ca.mymenuapp.ui.widgets.SlidingUpPanelLayout.java
public void showPane() { if (getChildCount() < 2) { return;// w w w.j av a2s .c o m } View slidingPane = getChildAt(1); slidingPane.setVisibility(View.VISIBLE); requestLayout(); }
From source file:org.telegram.ui.LaunchActivity.java
public void fixBackButton() { if (android.os.Build.VERSION.SDK_INT == 19) { //workaround for back button dissapear try {// ww w .java 2 s . co m Class firstClass = getSupportActionBar().getClass(); Class aClass = firstClass.getSuperclass(); if (aClass == android.support.v7.app.ActionBar.class) { } else { Field field = aClass.getDeclaredField("mActionBar"); field.setAccessible(true); android.app.ActionBar bar = (android.app.ActionBar) field.get(getSupportActionBar()); field = bar.getClass().getDeclaredField("mActionView"); field.setAccessible(true); View v = (View) field.get(bar); aClass = v.getClass(); field = aClass.getDeclaredField("mHomeLayout"); field.setAccessible(true); v = (View) field.get(v); v.setVisibility(View.VISIBLE); } } catch (Exception e) { e.printStackTrace(); } } }
From source file:cc.flydev.launcher.Folder.java
public void hideItem(ShortcutInfo info) { View v = getViewForInfo(info); v.setVisibility(INVISIBLE); }
From source file:cc.flydev.launcher.Folder.java
public void showItem(ShortcutInfo info) { View v = getViewForInfo(info); v.setVisibility(VISIBLE); }
From source file:android.support.v7.widget.BaseRecyclerViewInstrumentationTest.java
public void setVisibility(final View view, final int visibility) throws Throwable { runTestOnUiThread(new Runnable() { @Override// w w w. ja va 2s . co m public void run() { view.setVisibility(visibility); } }); }
From source file:com.albedinsky.android.ui.widget.SearchView.java
/** * Changes visibility of the given <var>view</var> to {@link #VISIBLE} or {@link #GONE} based on * the specified <var>visible</var> boolean flag. * * @param view The view of which visibility to change. * @param visible {@code True} to make the view visible, {@code false} to make it gone. *//*from ww w . java2 s. c om*/ private void changeViewVisibility(final View view, boolean visible) { view.setVisibility(visible ? VISIBLE : GONE); }
From source file:cm.aptoide.pt.ManageRepos.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_repos); View searchView = findViewById(R.id.search_button); searchView.setVisibility(View.GONE); loading = findViewById(R.id.loading); empty = findViewById(android.R.id.empty); empty.setVisibility(View.INVISIBLE); this.ctx = this; this.reposInserting = new HashMap<Integer, ViewDisplayRepo>(); this.reposManager = new ReposManager(); if (!serviceDataIsBound) { bindService(new Intent(this, AptoideServiceData.class), serviceDataConnection, Context.BIND_AUTO_CREATE); }// w ww. j a v a 2s .c o m registerForContextMenu(this.getListView()); }