List of usage examples for android.view View setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.android.browser.GearsBaseDialog.java
/** * Utility method to download an icon from a url and set * it to the GUI element R.id.origin_icon. * It is used both in the shortcut dialog and the * permission dialog.//ww w . java2s . co m * The actual download is done in the background via * IconDownload; once the icon is downlowded the UI is updated * via updateIcon(). * The icon size is included in the layout with the choosen * size, although not displayed, to limit text reflow once * the icon is received. */ void downloadIcon(String url) { if (url == null) { return; } View view = findViewById(R.id.origin_icon); if (view != null) { view.setMinimumWidth(mChoosenIconSize); view.setMinimumHeight(mChoosenIconSize); view.setVisibility(View.INVISIBLE); } Thread thread = new Thread(new IconDownload(url)); thread.start(); }
From source file:org.dvbviewer.controller.ui.fragments.StreamConfig.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_stream_config, container, false); qualitySpinner = (Spinner) v.findViewById(R.id.qualitySpinner); int qualityIndex = prefs.getInt(DVBViewerPreferences.KEY_STREAM_QUALITY, 7); qualitySpinner.setOnItemSelectedListener(this); qualitySpinner.setSelection(qualityIndex); aspectSpinner = (Spinner) v.findViewById(R.id.aspectSpinner); int aspectIndex = prefs.getInt(DVBViewerPreferences.KEY_STREAM_ASPECT_RATIO, 0); aspectSpinner.setSelection(aspectIndex); aspectSpinner.setOnItemSelectedListener(this); ffmpegSpinner = (Spinner) v.findViewById(R.id.ffmpegSpinner); int ffmpegIndex = prefs.getInt(DVBViewerPreferences.KEY_STREAM_FFMPEG_PRESET, 5); ffmpegSpinner.setSelection(ffmpegIndex); ffmpegSpinner.setOnItemSelectedListener(this); widthSpinner = (Spinner) v.findViewById(R.id.widthSpinner); int widthIndex = prefs.getInt(DVBViewerPreferences.KEY_STREAM_MAX_WIDTH, 0); widthSpinner.setSelection(widthIndex); widthSpinner.setOnItemSelectedListener(this); heightSpinner = (Spinner) v.findViewById(R.id.heightSpinner); int heightIndex = prefs.getInt(DVBViewerPreferences.KEY_STREAM_MAX_HEIGHT, 0); heightSpinner.setSelection(heightIndex); heightSpinner.setOnItemSelectedListener(this); startButton = (Button) v.findViewById(R.id.startTranscodedButton); startButton.setOnClickListener(this); startDirectStreamButton = (Button) v.findViewById(R.id.startDirectButton); startDirectStreamButton.setOnClickListener(this); startHours = (EditText) v.findViewById(R.id.stream_hours); startMinutes = (EditText) v.findViewById(R.id.stream_minutes); startSeconds = (EditText) v.findViewById(R.id.stream_seconds); View positionContainer = v.findViewById(R.id.streamPositionContainer); /**/*from ww w. j a va 2s.c o m*/ * Hide Position Row if streaming non seekable content */ if (!seekable) { positionContainer.setVisibility(View.GONE); } if (!TextUtils.isEmpty(preTime)) { startMinutes.setText(preTime); } qualitySpinner.requestFocus(); return v; }
From source file:com.achep.acdisplay.ui.widgets.notification.NotificationActions.java
protected void onActionClick(@NonNull View view, @NonNull Action action) { if (isRiiShowing()) { if (mView != view) { // Ignore this click. This may happen because of // the animation delays. return; }//from w w w .ja v a 2 s . c o m // Send the callback with performed remote input. assert mRemoteInput != null; assert mTextable != null; CharSequence text = mTextable.getText(); Check.getInstance().isFalse(TextUtils.isEmpty(text)); assert text != null; sendActionWithRemoteInput(view, action, mRemoteInput, text); hideRii(); } else if ((mRemoteInput = mRemoteInputsMap.get(action)) != null) { // Initialize and show the remote input graphic // user interface. mView = view; mTextable = onCreateTextable(mRemoteInput); mOnTextChangedListener.onTextChanged(mTextable.getText()); if (Device.hasKitKatApi() && isLaidOut()) { TransitionManager.beginDelayedTransition(this); } mLayoutParams = (LayoutParams) mView.getLayoutParams(); LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); mView.setLayoutParams(lp); // Hide all other actions for (int i = getChildCount() - 1; i >= 0; i--) { View v = getChildAt(i); if (v != mView) v.setVisibility(GONE); } // Add the textable view addView(mTextable.getView(), 0); mTextable.getView().requestFocus(); if (mCallback != null) mCallback.onRiiStateChanged(this, true); } else { sendAction(view, action); } }
From source file:HeaderGridView.java
/** added by Ahmed Basyouni * this method take supported fragment and fragment activity to add that * fragment as a banner to listView it create a layout at runtime then when * view is added to list we replace it with fragment otherwise it will crash * since view is not on screen to be replaced * * @param fragment/* w ww . j av a2 s .com*/ * @param activity */ public void addBannerFragment(final Fragment fragment, final FragmentActivity activity) { RelativeLayout layout = new RelativeLayout(activity); AbsListView.LayoutParams param = new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layout.setLayoutParams(param); // please don't ever remove that view otherwise application will crash and I mean it :D View view = new View(activity); view.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, 300)); view.setVisibility(View.INVISIBLE); layout.addView(view); layout.setId(CONTAINER_ID); addHeaderView(layout); this.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { HeaderGridView.this.removeOnLayoutChangeListener(this); FragmentManager manager = activity.getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(CONTAINER_ID, fragment).commit(); } }); }
From source file:com.ntsync.android.sync.activities.ShopActivity.java
public void handleReload(View view) { getSupportLoaderManager().restartLoader(LOADID_PRICES, null, this); View progressBar = findViewById(R.id.progressBar); progressBar.setVisibility(View.VISIBLE); View reloadBtn = findViewById(R.id.reloadBtn); reloadBtn.setVisibility(View.GONE); getListView().setEmptyView(progressBar); }
From source file:org.bwgz.quotation.activity.QuotationActivity.java
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); Log.d(TAG, String.format("onCreate - savedInstanceState: %s", bundle)); history = new History(); lazyLoadMessageHandler = new LazyLoadMessageHandler( Toast.makeText(this, R.string.loading_quote, (int) TimeUnit.SECONDS.toMillis(1))); setContentView(R.layout.quote_activity); long adFreePeriod = getRemaingAdFreePeriod(); Log.d(TAG, String.format("onCreate - adFreePeriod: %d", adFreePeriod)); if (adFreePeriod > 0) { View view = findViewById(R.id.adView); view.setVisibility(View.GONE); lazyAdViewTask = new LazyAdViewTask(view).execute(adFreePeriod); }/*from w w w .j a v a 2 s . c om*/ }
From source file:com.ntsync.android.sync.activities.ShopActivity.java
public void onLoadFinished(Loader<List<Price>> loader, List<Price> data) { adapter.setData(data);/*ww w . j a v a2 s.c o m*/ if (data != null && data.isEmpty()) { // Reload-Btn anzeigen when loading failed. View progressBar = findViewById(R.id.progressBar); progressBar.setVisibility(View.GONE); View reloadBtn = findViewById(R.id.reloadBtn); reloadBtn.setVisibility(View.VISIBLE); getListView().setEmptyView(reloadBtn); } if (data == null) { this.finish(); } }
From source file:com.markupartist.sthlmtraveling.RouteDetailActivity.java
private View createFooterView(final Trip2 trip) { mSubTripAdapter = new SubTripAdapter(this, trip.subTrips); int numSubTrips = trip.subTrips.size(); final SubTrip lastSubTrip = trip.subTrips.get(numSubTrips - 1); // todo: make sure this is safe. View convertView = getLayoutInflater().inflate(R.layout.trip_row_stop_layout, null); Button nameView = (Button) convertView.findViewById(R.id.trip_stop_title); nameView.setText(getLocationName(lastSubTrip.destination)); nameView.setOnClickListener(new View.OnClickListener() { @Override/* www . j av a 2 s . c om*/ public void onClick(View v) { Planner.Location location = lastSubTrip.destination; if (location.hasLocation()) { startActivity(createViewOnMapIntent(mTrip, mJourneyQuery, location)); } else { Toast.makeText(RouteDetailActivity.this, "Missing geo data", Toast.LENGTH_LONG).show(); } } }); View endSegment = convertView.findViewById(R.id.trip_line_segment_end); endSegment.setVisibility(View.VISIBLE); convertView.findViewById(R.id.trip_layout_intermediate_stop).setVisibility(View.GONE); // TextView arrivalTimeView = (TextView) convertView.findViewById(R.id.trip_arrival_time); // arrivalTimeView.setVisibility(View.GONE); TextView departureTimeView = (TextView) convertView.findViewById(R.id.trip_departure_time); departureTimeView.setText(lastSubTrip.arrivalTime); convertView.findViewById(R.id.trip_intermediate_stops_layout).setVisibility(View.GONE); return convertView; }
From source file:com.google.zxing.client.android.result.ResultHandler.java
/** * The Google Shopper button is special and is not handled by the abstract button methods above. * * @param listener The on click listener to install for this button. *//*from w ww .j av a 2s . c om*/ final void showGoogleShopperButton(View.OnClickListener listener) { View shopperButton = activity.findViewById(R.id.shopper_button); shopperButton.setVisibility(View.VISIBLE); shopperButton.setOnClickListener(listener); }
From source file:semanticweb.hws14.movapp.activities.MovieDetail.java
private void initDetailView() { btnSpoiler = (Button) findViewById(R.id.btnSpoiler); btnActorList = (Button) findViewById(R.id.btnToActorList); btnImdbPage = (Button) findViewById(R.id.btnLinkImdB); btnSpoiler = (Button) findViewById(R.id.btnSpoiler); btnRandomRelatedMovies = (Button) findViewById(R.id.btnRandomRelatedMovies); btnRelatedMovies = (Button) findViewById(R.id.btnRelatedMovies); btnSpoiler.setOnClickListener(new View.OnClickListener() { @Override/*from www . j a va2 s. c o m*/ public void onClick(View v) { View wikiAbs = findViewById(R.id.tvWikiAbstract); if (wikiAbs.getVisibility() == View.VISIBLE) { wikiAbs.setVisibility(View.GONE); } else { wikiAbs.setVisibility(View.VISIBLE); } } }); }