List of usage examples for android.view View setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.alexandrepiveteau.library.tutorial.TutorialActivity.java
private void animateViewFadeOut(final View view) { view.animate().alpha(0f).setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setListener(new AnimatorListenerAdapter() { @Override//www. j a v a 2 s. c o m public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.GONE); } }).start(); }
From source file:com.alexandrepiveteau.library.tutorial.TutorialActivity.java
private void animateViewFadeIn(final View view) { view.animate().alpha(1f).setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setListener(new AnimatorListenerAdapter() { @Override//from w w w . jav a 2 s.com public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); } }).start(); }
From source file:de.geeksfactory.opacclient.frontend.AccountEditActivity.java
public void setProgress(boolean show, boolean animate) { ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar); View content = findViewById(R.id.svAccount); if (show) {//from w w w .j ava 2 s . c o m if (animate) { progress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); content.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); } else { progress.clearAnimation(); content.clearAnimation(); } progress.setVisibility(View.VISIBLE); content.setVisibility(View.GONE); } else { if (animate) { progress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); content.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); } else { progress.clearAnimation(); content.clearAnimation(); } progress.setVisibility(View.GONE); content.setVisibility(View.VISIBLE); } }
From source file:com.akop.bach.fragment.xboxlive.AchievementsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) return null; View layout = inflater.inflate(R.layout.xbl_fragment_achievement_list, container, false); mShowGameTotals = false;/*from ww w . ja v a2 s.c o m*/ View gameDetails = layout.findViewById(R.id.game_details); if (gameDetails != null) { mShowGameTotals = getArguments().getBoolean("showGameTotals"); gameDetails.setVisibility(mShowGameTotals ? View.VISIBLE : View.GONE); gameDetails.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String url = Games.getGameUrl(getActivity(), mTitleId); if (url != null) GameOverview.actionShow(getActivity(), mAccount, url); } }); if (mShowGameTotals) { XboxLiveGameListItem view = (XboxLiveGameListItem) gameDetails.findViewById(R.id.gameListItem); view.mClickListener = this; } } mAdapter = new MyCursorAdapter(getActivity(), null); mMessage = (TextView) layout.findViewById(R.id.message); mMessage.setText(R.string.no_game_selected); mProgress = layout.findViewById(R.id.loading); mProgress.setVisibility(View.GONE); mListView = (ListView) layout.findViewById(R.id.list); mListView.setOnItemClickListener(this); mListView.setAdapter(mAdapter); mListView.setEmptyView(mMessage); registerForContextMenu(mListView); return layout; }
From source file:org.sirimangalo.meditationplus.AdapterCommit.java
@Override public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.list_item_commit, parent, false); final View shell = rowView.findViewById(R.id.detail_shell); rowView.setOnClickListener(new View.OnClickListener() { @Override/*from ww w . j av a2 s.c o m*/ public void onClick(View view) { boolean visible = shell.getVisibility() == View.VISIBLE; shell.setVisibility(visible ? View.GONE : View.VISIBLE); context.setCommitVisible(position, !visible); } }); final JSONObject p = values.get(position); TextView title = (TextView) rowView.findViewById(R.id.title); TextView descV = (TextView) rowView.findViewById(R.id.desc); TextView defV = (TextView) rowView.findViewById(R.id.def); TextView usersV = (TextView) rowView.findViewById(R.id.users); TextView youV = (TextView) rowView.findViewById(R.id.you); try { if (p.getBoolean("open")) shell.setVisibility(View.VISIBLE); title.setText(p.getString("title")); descV.setText(p.getString("description")); String length = p.getString("length"); String time = p.getString("time"); final String cid = p.getString("cid"); String def = ""; boolean repeat = false; if (length.indexOf(":") > 0) { repeat = true; String[] lengtha = length.split(":"); def += lengtha[0] + " minutes walking and " + lengtha[1] + " minutes sitting"; } else def += length + " minutes total meditation"; String period = p.getString("period"); String day = p.getString("day"); if (period.equals("daily")) { if (repeat) def += " every day"; else def += " per day"; } else if (period.equals("weekly")) { if (repeat) def += " every " + dow[Integer.parseInt(day)]; else def += " per week"; } else if (period.equals("monthly")) { if (repeat) def += " on the " + day + (day.substring(day.length() - 1).equals("1") ? "st" : (day.substring(day.length() - 1).equals("2") ? "nd" : (day.substring(day.length() - 1).equals("3") ? "rd" : "th"))) + " day of the month"; else def += " per month"; } else if (period.equals("yearly")) { if (repeat) def += " on the " + day + (day.substring(day.length() - 1).equals("1") ? "st" : (day.substring(day.length() - 1).equals("2") ? "nd" : (day.substring(day.length() - 1).equals("3") ? "rd" : "th"))) + " day of the year"; else def += " per year"; } if (!time.equals("any")) { Calendar utc = Calendar.getInstance(TimeZone.getTimeZone("UTC")); utc.set(Calendar.HOUR_OF_DAY, Integer.parseInt(time.split(":")[0])); utc.set(Calendar.MINUTE, Integer.parseInt(time.split(":")[1])); Calendar here = Calendar.getInstance(); here.setTimeInMillis(utc.getTimeInMillis()); int hours = here.get(Calendar.HOUR_OF_DAY); int minutes = here.get(Calendar.MINUTE); def += " at " + (time.length() == 4 ? "0" : "") + time.replace(":", "") + "h UTC <i>(" + (hours > 12 ? hours - 12 : hours) + ":" + ((minutes < 10 ? "0" : "") + minutes) + " " + (hours > 11 && hours < 24 ? "PM" : "AM") + " your time)</i>"; } defV.setText(Html.fromHtml(def)); JSONObject usersJ = p.getJSONObject("users"); ArrayList<String> committedArray = new ArrayList<String>(); // collect into array for (int i = 0; i < usersJ.names().length(); i++) { try { String j = usersJ.names().getString(i); String k = j; // if(j.equals(p.getString("creator"))) // k = "["+j+"]"; committedArray.add(k); } catch (JSONException e) { e.printStackTrace(); } } String text = context.getString(R.string.committed) + " "; // add spans int committed = -1; int pos = text.length(); // start after "Committed: " text += TextUtils.join(", ", committedArray); Spannable span = new SpannableString(text); span.setSpan(new StyleSpan(Typeface.BOLD), 0, pos, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // bold the "Online: " for (int i = 0; i < committedArray.size(); i++) { try { final String oneCom = committedArray.get(i); String userCom = usersJ.getString(oneCom); //String userCom = usersJ.getString(oneCom.replace("[", "").replace("]", "")); //if(oneCom.replace("[","").replace("]","").equals(loggedUser)) if (oneCom.equals(loggedUser)) committed = Integer.parseInt(userCom); int end = pos + oneCom.length(); ClickableSpan clickable = new ClickableSpan() { @Override public void onClick(View widget) { context.showProfile(oneCom); } }; span.setSpan(clickable, pos, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); span.setSpan(new UnderlineSpan() { public void updateDrawState(TextPaint tp) { tp.setUnderlineText(false); } }, pos, end, 0); String color = Utils.makeRedGreen(Integer.parseInt(userCom), true); span.setSpan(new ForegroundColorSpan(Color.parseColor("#FF" + color)), pos, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); pos += oneCom.length() + 2; } catch (JSONException e) { e.printStackTrace(); } } usersV.setText(span); usersV.setMovementMethod(new LinkMovementMethod()); if (loggedUser != null && loggedUser.length() > 0) { LinearLayout bl = (LinearLayout) rowView.findViewById(R.id.commit_buttons); if (!usersJ.has(loggedUser)) { Button commitB = new Button(context); commitB.setId(R.id.commit_button); commitB.setText(R.string.commit); commitB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>(); nvp.add(new BasicNameValuePair("full_update", "true")); context.doSubmit("commitform_" + cid, nvp, true); } }); bl.addView(commitB); } else { Button commitB = new Button(context); commitB.setId(R.id.uncommit_button); commitB.setText(R.string.uncommit); commitB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>(); nvp.add(new BasicNameValuePair("full_update", "true")); context.doSubmit("uncommitform_" + cid, nvp, true); } }); bl.addView(commitB); } if (loggedUser.equals(p.getString("creator")) || context.isAdmin) { Button commitB2 = new Button(context); commitB2.setId(R.id.edit_commit_button); commitB2.setText(R.string.edit); commitB2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(context, ActivityCommit.class); i.putExtra("commitment", p.toString()); context.startActivity(i); } }); bl.addView(commitB2); Button commitB3 = new Button(context); commitB3.setId(R.id.uncommit_button); commitB3.setText(R.string.delete); commitB3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>(); nvp.add(new BasicNameValuePair("full_update", "true")); context.doSubmit("delcommitform_" + cid, nvp, true); } }); bl.addView(commitB3); } } if (committed > -1) { int color = Color.parseColor("#FF" + Utils.makeRedGreen(committed, false)); rowView.setBackgroundColor(color); } if (committed != -1) { youV.setText(String.format(context.getString(R.string.you_commit_x), committed)); youV.setVisibility(View.VISIBLE); } } catch (Exception e) { e.printStackTrace(); } return rowView; }
From source file:com.alexandrepiveteau.library.tutorial.TutorialActivity.java
private void animateViewScaleOut(final View view) { view.animate().scaleX(0).scaleY(0)// w w w . j a va2 s . co m .setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.GONE); } }).start(); }
From source file:com.alexandrepiveteau.library.tutorial.TutorialActivity.java
private void animateViewScaleIn(final View view) { view.animate().scaleX(1).scaleY(1)/*from w w w .j a va 2 s .c om*/ .setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); } }).start(); }
From source file:co.carlosandresjimenez.android.gotit.BaseActivity.java
public void createSnackBar(int messageResId) { Snackbar.make(findViewById(R.id.main_layout), messageResId, Snackbar.LENGTH_INDEFINITE) .setAction(android.R.string.ok, new View.OnClickListener() { @Override//w w w . jav a2s .c o m public void onClick(View v) { // Request the permission again. v.setVisibility(View.GONE); } }).show(); }
From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java
public void hideLoadingScreen() { View progressBar = (View) findViewById(R.id.progressBar); View loadingTV = (View) findViewById(R.id.loading_tv); progressBar.setVisibility(View.GONE); loadingTV.setVisibility(View.GONE); }
From source file:fr.shywim.antoinedaniel.ui.MainActivity.java
private void removeAdMobLayout() { View adLayout = findViewById(R.id.adLayout); if (adLayout != null) { adLayout.setVisibility(View.GONE); }/*from ww w. j a v a 2s.c o m*/ destroyAdMob(); }