List of usage examples for android.view View VISIBLE
int VISIBLE
To view the source code for android.view View VISIBLE.
Click Source Link
From source file:com.vrem.wifianalyzer.wifi.AccessPointDetail.java
private void setViewCompact(@NonNull Context context, @NonNull View view, @NonNull WiFiDetail wiFiDetail, boolean isChild) { ((TextView) view.findViewById(R.id.ssid)).setText(wiFiDetail.getTitle()); WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage.setColorFilter(ContextCompat.getColor(context, R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(R.id.level); textLevel.setText(String.format(Locale.ENGLISH, "%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(ContextCompat.getColor(context, strength.colorResource())); //SET CHANNEL ((TextView) view.findViewById(R.id.channel)).setText(wiFiSignal.getChannelDisplay()); ((TextView) view.findViewById(R.id.primaryFrequency)).setText(String.format(Locale.ENGLISH, "%d%s", wiFiSignal.getPrimaryFrequency(), WiFiSignal.FREQUENCY_UNITS)); ((TextView) view.findViewById(R.id.distance)) .setText(String.format(Locale.ENGLISH, "%5.1fm", wiFiSignal.getDistance())); if (isChild) { view.findViewById(R.id.tab).setVisibility(View.VISIBLE); } else {//from ww w. java 2 s . c o m view.findViewById(R.id.tab).setVisibility(View.GONE); } }
From source file:name.gumartinm.weather.information.fragment.current.CurrentFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { // Restore UI state final Current current = (Current) savedInstanceState.getSerializable("Current"); if (current != null) { final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext()); store.saveCurrent(current);//from w w w. j av a2s. co m } } this.setHasOptionsMenu(false); this.getActivity().findViewById(R.id.weather_current_data_container).setVisibility(View.GONE); this.getActivity().findViewById(R.id.weather_current_progressbar).setVisibility(View.VISIBLE); this.getActivity().findViewById(R.id.weather_current_error_message).setVisibility(View.GONE); }
From source file:com.gammalabs.wifianalyzer.wifi.AccessPointDetail.java
private void setViewCompact(@NonNull Context context, @NonNull View view, @NonNull WiFiDetail wiFiDetail, boolean isChild) { ((TextView) view.findViewById(R.id.ssid)).setText(wiFiDetail.getTitle()); WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal(); Strength strength = wiFiSignal.getStrength(); Security security = wiFiDetail.getSecurity(); ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage); securityImage.setImageResource(security.imageResource()); securityImage.setColorFilter(ContextCompat.getColor(context, R.color.icons_color)); TextView textLevel = (TextView) view.findViewById(R.id.level); textLevel.setText(String.format(Locale.ENGLISH, "%ddBm", wiFiSignal.getLevel())); textLevel.setTextColor(ContextCompat.getColor(context, strength.colorResource())); ((TextView) view.findViewById(R.id.channel)).setText(wiFiSignal.getChannelDisplay()); ((TextView) view.findViewById(R.id.primaryFrequency)).setText(String.format(Locale.ENGLISH, "%d%s", wiFiSignal.getPrimaryFrequency(), WiFiSignal.FREQUENCY_UNITS)); ((TextView) view.findViewById(R.id.distance)) .setText(String.format(Locale.ENGLISH, "%5.1fm", wiFiSignal.getDistance())); if (isChild) { view.findViewById(R.id.tab).setVisibility(View.VISIBLE); } else {//from w w w .j av a 2 s . co m view.findViewById(R.id.tab).setVisibility(View.GONE); } }
From source file:com.handmark.pulltorefresh.library.PullToRefreshListView.java
@Override protected void onRefreshing(final boolean doScroll) { /**//from w w w. j a va 2s.co m * If we're not showing the Refreshing view, or the list is empty, the * the header/footer views won't show so we use the normal method. */ ListAdapter adapter = mRefreshableView.getAdapter(); if (!mListViewExtrasEnabled || !getShowViewWhileRefreshing() || null == adapter || adapter.isEmpty()) { super.onRefreshing(doScroll); return; } super.onRefreshing(false); final LoadingLayout origLoadingView, listViewLoadingView, oppositeListViewLoadingView; final int selection, scrollToY; switch (getCurrentMode()) { case MANUAL_REFRESH_ONLY: case PULL_FROM_END: origLoadingView = getFooterLayout(); listViewLoadingView = mFooterLoadingView; oppositeListViewLoadingView = mHeaderLoadingView; selection = mRefreshableView.getCount() - 1; scrollToY = getScrollY() - getFooterSize(); break; case PULL_FROM_START: default: origLoadingView = getHeaderLayout(); listViewLoadingView = mHeaderLoadingView; oppositeListViewLoadingView = mFooterLoadingView; selection = 0; scrollToY = getScrollY() + getHeaderSize(); break; } // Hide our original Loading View origLoadingView.reset(); origLoadingView.hideAllViews(); // Make sure the opposite end is hidden too oppositeListViewLoadingView.setVisibility(View.GONE); // Show the ListView Loading View and set it to refresh. listViewLoadingView.setVisibility(View.VISIBLE); listViewLoadingView.refreshing(); if (doScroll) { // We need to disable the automatic visibility changes for now disableLoadingLayoutVisibilityChanges(); // We scroll slightly so that the ListView's header/footer is at the // same Y position as our normal header/footer setHeaderScroll(scrollToY); // Make sure the ListView is scrolled to show the loading // header/footer mRefreshableView.setSelection(selection); // Smooth scroll as normal smoothScrollTo(0); } }
From source file:me.piebridge.prevent.ui.UserGuideActivity.java
@Override public void onCreate(Bundle savedInstanceState) { ThemeUtils.setTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.about);//from w w w .j ava 2 s .c o m ThemeUtils.fixSmartBar(this); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { getActionBar().setDisplayHomeAsUpEnabled(true); } WebView webView = (WebView) findViewById(R.id.webview); webView.setVerticalScrollBarEnabled(false); webView.setHorizontalScrollBarEnabled(false); if ("zh".equals(Locale.getDefault().getLanguage())) { webView.loadUrl("file:///android_asset/about.zh.html"); } else { webView.loadUrl("file:///android_asset/about.en.html"); } setView(R.id.alipay, "com.eg.android.AlipayGphone"); if (hasPermission()) { setView(R.id.wechat, "com.tencent.mm"); } else { findViewById(R.id.wechat).setVisibility(View.GONE); } if (!setView(R.id.paypal, "com.paypal.android.p2pmobile")) { TextView paypal = (TextView) findViewById(R.id.paypal); paypal.setClickable(true); paypal.setOnClickListener(this); paypal.setCompoundDrawablesWithIntrinsicBounds(null, cropDrawable(paypal.getCompoundDrawables()[1]), null, null); } if (setView(R.id.play, "com.android.vending")) { findViewById(R.id.play).setVisibility(View.GONE); checkDonate(); } donateView = findViewById(R.id.donate); if (BuildConfig.DONATE && TextUtils.isEmpty(LicenseUtils.getLicense(this))) { donateView.setVisibility(View.VISIBLE); } else { donateView.setVisibility(View.GONE); } retrieveInfo(); }
From source file:com.metaphyze.hackernewsfrontpage.HackerNewsFrontPageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hacker_news_front_page); bookFileName = getFilesDir() + File.separator + "bookmarked_posts.js"; drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.drawer); location = (TextView) findViewById(R.id.location); webView = (WebView) findViewById(R.id.content_frame); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setAppCacheEnabled(true); loadingView = findViewById(R.id.loading); ProgressBar progressBar = ((ProgressBar) findViewById(R.id.progress_bar)); progressBar.setIndeterminate(true);/*from ww w. ja va2s.c o m*/ drawerList.setAdapter(new HackerNewsAdapter(HackerNewsFrontPageActivity.this, R.layout.post_item, new ArrayList<HackerNewsPost>(), true)); getActionBar().setTitle("Hacker News Front Page (Loading Live Stream...)"); drawerList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { HackerNewsPost post = (HackerNewsPost) parent.getItemAtPosition(position); webView.loadUrl(post.getUrl()); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); loadingView.setVisibility(View.VISIBLE); location.setText("LOADING......" + url); } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); loadingView.setVisibility(View.INVISIBLE); location.setText(url); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { loadingView.setVisibility(View.INVISIBLE); location.setText("ERROR LOADING PAGE"); view.loadUrl("file:///android_asset/failed_to_load_page.html"); } }); drawerLayout.closeDrawer(drawerList); } }); drawerList.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { final HackerNewsPost clonedPost = ((HackerNewsPost) parent.getItemAtPosition(position)).clone(); clonedPost.setPostedAgo(new Date().toString()); AlertDialog.Builder builder = new AlertDialog.Builder(HackerNewsFrontPageActivity.this); if (((HackerNewsAdapter) parent.getAdapter()).isLive()) { builder.setTitle("Bookmark?"); builder.setMessage("Do you want to bookmark the post\n" + clonedPost.getTitle()); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { HackerNewsFrontPageContents contents = readContentsFromBookmarksFile(); if (contents == null) { showError("ERROR", "Failed to read bookmark file"); dialog.dismiss(); return; } if (!contents.addPost(clonedPost)) { showError("Already Exists", "Not added becasue bookmark already exists"); dialog.dismiss(); return; } if (!saveContentsToBookmarksFile(contents)) { showError("ERROR", "Failed to save bookmark"); dialog.dismiss(); } } catch (Exception ex) { ex.printStackTrace(); showError("ERROR", "Internal error: " + ex); } } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); } else { builder.setTitle("Delete?"); builder.setMessage("Do you want to delete the bookmarked post:\n" + clonedPost.getTitle()); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { HackerNewsFrontPageContents contents = readContentsFromBookmarksFile(); if (contents == null) { showError("ERROR", "Unable to find or generate bookmarks file"); dialog.dismiss(); return; } if (!contents.removePost(clonedPost)) { showError("Not Removed", "Does not exist? How's that possible?"); dialog.dismiss(); return; } if (saveContentsToBookmarksFile(contents)) { if (contents.getItems().size() > 0) { drawerList .setAdapter(new HackerNewsAdapter(HackerNewsFrontPageActivity.this, R.layout.post_item, contents.getItems(), false)); } else { showError("No more bookmarks", "Reverting to live stream"); loadLiveStream(); } } else { showError("ERROR", "Failed to save bookmark deletion"); } dialog.dismiss(); } catch (Exception ex) { ex.printStackTrace(); showError("ERROR", "Internal Error: " + ex); } } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); } builder.setCancelable(true); builder.create().show(); return false; } }); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.drawer_icon, 0, 0); drawerLayout.setDrawerListener(drawerToggle); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // actionBar.setHomeButtonEnabled(true); requestQueue = Volley.newRequestQueue(this); loadLiveStream(); }
From source file:com.actionbarsherlock.internal.view.menu.ListMenuItemView.java
public void initialize(MenuItemImpl itemData, int menuType) { mItemData = itemData;/*from w w w.j a v a2 s . co m*/ //UNUSED mMenuType = menuType; setVisibility(itemData.isVisible() ? View.VISIBLE : View.GONE); setTitle(itemData.getTitleForItemView(this)); setCheckable(itemData.isCheckable()); setShortcut(itemData.shouldShowShortcut(), itemData.getShortcut()); setIcon(itemData.getIcon()); setEnabled(itemData.isEnabled()); }
From source file:com.df.push.DemoActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);// w w w. j a v a 2 s.c o m mDisplay = (TextView) findViewById(R.id.display); context = getApplicationContext(); progressDialog = new ProgressDialog(DemoActivity.this); progressDialog.setMessage("Please wait..."); // Check device for Play Services APK. If check succeeds, proceed with GCM registration. if (checkPlayServices()) { // display loading bar and fetch topics for future use getTopics(); } else { Log.i(TAG, "No valid Google Play Services APK found."); } readSubscriptions(); // if subscribed previously final SharedPreferences prefs = getGcmPreferences(context); if (prefs.getString(PROPERTY_REG_URL, null) == null) { // device token is not updated on server, disable subscribe and unsubscribe buttons findViewById(R.id.subscribe).setVisibility(View.GONE); findViewById(R.id.unsubscribe).setVisibility(View.GONE); } else { findViewById(R.id.subscribe).setVisibility(View.VISIBLE); findViewById(R.id.unsubscribe).setVisibility(View.VISIBLE); } }
From source file:com.markupartist.sthlmtraveling.RouteDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.route_details_list); registerScreen("Route details"); Bundle extras = getIntent().getExtras(); mTrip = (Trip2) getLastNonConfigurationInstance(); if (mTrip == null) { mTrip = extras.getParcelable(EXTRA_JOURNEY_TRIP); }/*w w w.j a v a 2 s. com*/ mJourneyQuery = extras.getParcelable(EXTRA_JOURNEY_QUERY); mActionBar = initActionBar(); updateStartAndEndPointViews(mJourneyQuery); View headerView = getLayoutInflater().inflate(R.layout.route_header_details, null); TextView timeView = (TextView) headerView.findViewById(R.id.route_date_time); timeView.setText(getString(R.string.time_to, mTrip.getDurationText(), mTrip.destination.getCleanName())); if (mTrip.canBuySmsTicket()) { View buySmsTicketView = headerView.findViewById(R.id.route_buy_ticket); buySmsTicketView.setVisibility(View.VISIBLE); buySmsTicketView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Analytics.getInstance(RouteDetailActivity.this).event("Ticket", "Click on zone"); showDialog(DIALOG_BUY_SMS_TICKET); } }); TextView zoneView = (TextView) headerView.findViewById(R.id.route_zones); zoneView.setText(mTrip.tariffZones); } getListView().addHeaderView(headerView, null, false); onRouteDetailsResult(mTrip); }