List of usage examples for android.view View INVISIBLE
int INVISIBLE
To view the source code for android.view View INVISIBLE.
Click Source Link
From source file:com.test.shopping.view.ProductDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /*/*from ww w .jav a 2s. co m*/ * Inflate the layout based on the current product details. * Fetch the product associated with the current position in product id list */ ProductDataModel product = CacheUtil.getInstance(getActivity()).getProduct(mPosition); ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.product_detail, container, false); TextView productName = (TextView) rootView.findViewById(R.id.product_name); productName.setText(StringEscapeUtils.unescapeJava(product.getProductName())); String longDes = product.getLongDescription(); TextView longDescLabel = (TextView) rootView.findViewById(R.id.long_description_label); TextView longDesc = (TextView) rootView.findViewById(R.id.long_description); if (longDes != null && longDes.length() > 0) { longDesc.setText(Jsoup.clean(longDes, Whitelist.simpleText())); longDesc.setVisibility(View.VISIBLE); longDescLabel.setVisibility(View.VISIBLE); } else { longDesc.setVisibility(View.INVISIBLE); longDescLabel.setVisibility(View.INVISIBLE); } TextView price = (TextView) rootView.findViewById(R.id.price); price.setText(product.getPrice()); ImageView imageView = (ImageView) rootView.findViewById(R.id.image); ImageLoader loader = ConnectionUtil.getInstance(sContext).getImageLoader(); loader.get(product.getProductImage(), ImageLoader.getImageListener(imageView, R.mipmap.ic_launcher, R.mipmap.ic_launcher)); TextView ratingCountView = (TextView) rootView.findViewById(R.id.rating_count); ratingCountView.setText("(" + String.valueOf(product.getReviewCount() + ")")); RatingBar bar = (RatingBar) rootView.findViewById(R.id.ratingBar); bar.setRating((int) product.getReviewRating()); bar.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); TextView inStock = (TextView) rootView.findViewById(R.id.inStock); if (product.isInStock()) { inStock.setTextColor(getResources().getColor(android.R.color.holo_green_dark)); inStock.setText(R.string.in_stock_label); } else { inStock.setTextColor(getResources().getColor(android.R.color.holo_red_dark)); inStock.setText(R.string.out_of_stock_label); } return rootView; }
From source file:com.citrus.sdk.fragments.SavedOptions.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { returnView = inflater.inflate(R.layout.activity_saved_options, container, false); listener = new JSONTaskComplete() { @Override/*from w w w. j a va2s . c o m*/ public void onTaskExecuted(JSONObject[] returnObject, String message) { progressBar.setVisibility(View.INVISIBLE); if (TextUtils.equals(message, "success")) { initViews(); try { storePayOptions(returnObject[1]); showPayOptions(); } catch (Exception e) { return; } } else { Logout.logoutUser(getActivity()); showSignInFlow("User not signed in"); } } }; signInListener = new JSONTaskComplete() { @Override public void onTaskExecuted(JSONObject[] paymentObject, String message) { progressBar.setVisibility(View.INVISIBLE); if (TextUtils.equals(message, "signedIn")) { showSavedOptions(); } else { showSignInFlow("User not signed in"); } } }; showSavedOptions(); return returnView; }
From source file:com.insthub.O2OMobile.Activity.C4_EditIntroActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.c4_edit_intro); mTitle = (TextView) findViewById(R.id.top_view_title); mTitle.setText(getString(R.string.edit_brief)); mBack = (ImageView) findViewById(R.id.top_view_back); mBrief = (EditText) findViewById(R.id.et_brief); mTextNum = (TextView) findViewById(R.id.text_num); mSave = (Button) findViewById(R.id.btn_save); mTopViewRightImage = (ImageView) findViewById(R.id.top_view_right_image); mTopViewRightImage.setVisibility(View.INVISIBLE); mShared = getSharedPreferences(O2OMobileAppConst.USERINFO, 0); String userStr = mShared.getString("user", ""); try {/*from w ww .j av a 2 s . c o m*/ if (userStr != null) { JSONObject userJson = new JSONObject(userStr); USER user = new USER(); user.fromJson(userJson); mBrief.setText(user.brief); mTextNum.setText(mTotalSize - mBrief.getText().length() + ""); mBrief.setSelection(user.brief.length()); } } catch (JSONException e) { e.printStackTrace(); } mUserModel = new UserModel(this); mUserModel.addResponseListener(this); mSave = (Button) findViewById(R.id.btn_save); mBack.setOnClickListener(this); mSave.setOnClickListener(this); //?? mBrief.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { mTextNum.setText(mTotalSize - mBrief.getText().length() + ""); } }); }
From source file:com.insthub.O2OMobile.Activity.C12_EditSignatureActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.c12_edit_signature); mTitle = (TextView) findViewById(R.id.top_view_title); mTitle.setText(getString(R.string.edit_signature)); mBack = (ImageView) findViewById(R.id.top_view_back); mSignture = (EditText) findViewById(R.id.et_signature); mTextNum = (TextView) findViewById(R.id.text_num); mSave = (Button) findViewById(R.id.btn_save); mTopViewRightImage = (ImageView) findViewById(R.id.top_view_right_image); mTopViewRightImage.setVisibility(View.INVISIBLE); mShared = getSharedPreferences(O2OMobileAppConst.USERINFO, 0); String userStr = mShared.getString("user", ""); try {/*from w w w. j a v a 2 s . c o m*/ if (userStr != null) { JSONObject userJson = new JSONObject(userStr); USER user = new USER(); user.fromJson(userJson); mSignture.setText(user.signature); mTextNum.setText(mTotalSize - mSignture.getText().length() + ""); mSignture.setSelection(user.signature.length()); } } catch (JSONException e) { e.printStackTrace(); } mUserModel = new UserModel(this); mUserModel.addResponseListener(this); mSave = (Button) findViewById(R.id.btn_save); mBack.setOnClickListener(this); mSave.setOnClickListener(this); //?? mSignture.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { mTextNum.setText(mTotalSize - mSignture.getText().length() + ""); } }); }
From source file:edu.stanford.mobisocial.dungbeetle.facebook.FacebookInterfaceActivity.java
/** Called when the activity is first created. */ @Override// w w w . jav a 2 s .c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (APP_ID == null) { Util.showAlert(this, "Warning", "Facebook Applicaton ID must be " + "specified before running this example: see FacebookInterfaceActivity.java"); } setContentView(R.layout.facebook); mLoginButton = (LoginButton) findViewById(R.id.login); mText = (TextView) FacebookInterfaceActivity.this.findViewById(R.id.txt); mRequestButton = (Button) findViewById(R.id.requestButton); mPostButton = (Button) findViewById(R.id.postButton); mDeleteButton = (Button) findViewById(R.id.deletePostButton); mUploadButton = (Button) findViewById(R.id.uploadButton); mFacebook = new Facebook(APP_ID); mAsyncRunner = new AsyncFacebookRunner(mFacebook); SessionStore.restore(mFacebook, this); SessionEvents.addAuthListener(new SampleAuthListener()); SessionEvents.addLogoutListener(new SampleLogoutListener()); mLoginButton.init(this, mFacebook); mRequestButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { mAsyncRunner.request("me", new SampleRequestListener()); } }); mRequestButton.setVisibility(mFacebook.isSessionValid() ? View.VISIBLE : View.INVISIBLE); mUploadButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Bundle params = new Bundle(); params.putString("method", "photos.upload"); URL uploadFileUrl = null; try { uploadFileUrl = new URL("http://www.facebook.com/images/devsite/iphone_connect_btn.jpg"); } catch (MalformedURLException e) { e.printStackTrace(); } try { HttpURLConnection conn = (HttpURLConnection) uploadFileUrl.openConnection(); conn.setDoInput(true); conn.connect(); int length = conn.getContentLength(); byte[] imgData = new byte[length]; InputStream is = conn.getInputStream(); is.read(imgData); params.putByteArray("picture", imgData); } catch (IOException e) { e.printStackTrace(); } mAsyncRunner.request(null, params, "POST", new SampleUploadListener(), null); } }); mUploadButton.setVisibility(mFacebook.isSessionValid() ? View.VISIBLE : View.INVISIBLE); mPostButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { mFacebook.dialog(FacebookInterfaceActivity.this, "feed", new SampleDialogListener()); } }); mPostButton.setVisibility(mFacebook.isSessionValid() ? View.VISIBLE : View.INVISIBLE); }
From source file:fr.bde_eseo.eseomega.lacommande.tabs.TabCartView.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.tab_cartview_2, container, false); // UI objets/*from w ww. j av a 2s .c om*/ floatingShop = (FloatingActionButton) v.findViewById(R.id.fabCommand); tvPrice = (TextView) v.findViewById(R.id.tvCartPrice); tv1 = (TextView) v.findViewById(R.id.tvListNothing); tv2 = (TextView) v.findViewById(R.id.tvListNothing2); img = (ImageView) v.findViewById(R.id.imgNoCart); tv1.setVisibility(View.VISIBLE); tv2.setVisibility(View.VISIBLE); img.setVisibility(View.VISIBLE); viewOrder = v.findViewById(R.id.viewCircle); viewOrder.setVisibility(View.INVISIBLE); progressBarOrder = (ProgressBar) v.findViewById(R.id.progressLoading); progressBarOrder.setVisibility(View.INVISIBLE); progressBarOrder.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.md_white_1000), PorterDuff.Mode.SRC_IN); // Database model and view mAdapter = new MyCartAdapter(getActivity()); recList = (RecyclerView) v.findViewById(R.id.recyList); recList.setAdapter(mAdapter); recList.setHasFixedSize(false); LinearLayoutManager llm = new LinearLayoutManager(getActivity()); llm.setOrientation(LinearLayoutManager.VERTICAL); recList.setLayoutManager(llm); // event bus //EventBus.getDefault().register(this); // remove on clic ? recList.addOnItemTouchListener( new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() { @Override public void onItemClick(View view, final int position) { new MaterialDialog.Builder(getActivity()) .title(DataManager.getInstance().getCartArray().get(position).getName()) .content("Quelle action effectuer ?").positiveText("Supprimer") .negativeText("Annuler").callback(new MaterialDialog.ButtonCallback() { @Override public void onNegative(MaterialDialog dialog) { super.onNegative(dialog); } @Override public void onPositive(MaterialDialog dialog) { super.onPositive(dialog); DataManager.getInstance().getCartArray().remove(position); refreshCart(); OrderTabsFragment mFragment = (OrderTabsFragment) getActivity() .getSupportFragmentManager() .findFragmentByTag(Constants.TAG_FRAGMENT_ORDER_TABS); mFragment.refreshCart(); Toast.makeText(getActivity(), "lment retir du panier", Toast.LENGTH_SHORT).show(); } }).show(); } })); // GO GO GO Post the order data to server ! floatingShop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int size = DataManager.getInstance().getCartArray().size(); int nbMenu = 0; for (int i = 0; i < size; i++) if (DataManager.getInstance().getCartArray().get(i).getObjectType() .equals(LacmdMenu.ID_CAT_MENU)) nbMenu++; if (size > 0 && size <= 10 && nbMenu <= 2) { MaterialDialog md = new MaterialDialog.Builder(getActivity()) .customView(R.layout.dialog_add_instructions, false).title("Ajouter un commentaire ?") .positiveText("Finaliser la commande").negativeText("Annuler").cancelable(false) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { super.onPositive(dialog); DataManager.getInstance().setInstructions( // Convert InputText into formatted string without Emojis / Unicode characters etInstr.getText().toString().trim()); new MaterialDialog.Builder(getActivity()).title("Valider la commande ?") .content( "En validant, vous vous engagez payer et rcuprer votre repas au comptoir de la cafet aujourd'hui aux horaires d'ouverture." + "\n\nSi ce n'est pas le cas, il vous sera impossible de passer une nouvelle commande ds demain.") .positiveText("Je confirme, j'ai faim !").negativeText("Annuler") .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { super.onPositive(dialog); AsyncPostCart asyncPostCart = new AsyncPostCart(); asyncPostCart.execute(); } @Override public void onNegative(MaterialDialog dialog) { super.onNegative(dialog); } }).show(); } @Override public void onNegative(MaterialDialog dialog) { super.onNegative(dialog); } }).build(); etInstr = ((EditText) (md.getView().findViewById(R.id.etInstructions))); md.show(); } else if (size == 0) { new MaterialDialog.Builder(getActivity()).title("Panier vide") .content("Une commande doit comporter au moins un lment !").negativeText("En effet") .show(); } else if (size == 10) { new MaterialDialog.Builder(getActivity()).title("Panier rempli") .content("Une commande est limit 10 lments !") .negativeText("Je vais en retirer").show(); } else if (nbMenu > 2) { new MaterialDialog.Builder(getActivity()).title("Trop gourmand") .content("Une commande est limit 2 menus !").negativeText("Dommage").show(); } } }); return v; }
From source file:com.facebook.android.friendsmash.ScoreboardFragment.java
@TargetApi(13) @Override/*from w w w.j a va 2s .c om*/ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_scoreboard, parent, false); scoreboardContainer = (LinearLayout) v.findViewById(R.id.scoreboardContainer); progressContainer = (FrameLayout) v.findViewById(R.id.progressContainer); // Set the progressContainer as invisible by default progressContainer.setVisibility(View.INVISIBLE); // Note: Scoreboard is populated during onResume below return v; }
From source file:cc.softwarefactory.lokki.android.utilities.DialogUtils.java
public static void addPlace(final Context context, final LatLng latLng, final int radius) { final EditText input = new EditText(context); // Set an EditText view to get user input input.setSingleLine(true);/*from w ww . j av a 2s. co m*/ final AlertDialog addPlaceDialog = new AlertDialog.Builder(context) .setTitle(context.getResources().getString(R.string.write_place_name)).setView(input) .setPositiveButton(R.string.ok, null).setNegativeButton(R.string.cancel, null).create(); addPlaceDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { ((FragmentActivity) context).findViewById(R.id.add_place_overlay).setVisibility(View.INVISIBLE); // todo maybe re enabled this... it will however also fire on empty input } }); addPlaceDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { addPlaceDialog.getButton(AlertDialog.BUTTON_POSITIVE) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Editable value = input.getText(); if (value == null || value.toString().isEmpty()) { input.setError(context.getResources().getString(R.string.required)); return; } try { ServerApi.addPlace(context, value.toString(), latLng, radius); } catch (JSONException e) { e.printStackTrace(); } addPlaceDialog.dismiss(); } }); } }); addPlaceDialog.show(); }
From source file:com.github.rutvijkumar.twittfuse.TwitterUtil.java
public void markFavorite(final Tweet tweet, final ImageButton favAction, final TextView countView, final boolean hideZero) { if (!Util.isNetworkAvailable(activity)) { Util.showNetworkUnavailable(activity); }//from ww w . ja v a 2 s . c om client.markTweetFavorite(tweet.isFavorited(), String.valueOf(tweet.getUid()), new JsonHttpResponseHandler() { // @Override // public void onSuccess(int statusCode, Header[] headers, // JSONObject response) { // onSuccess(response); // } // @Override // public void onFailure(int statusCode, Header[] headers, // Throwable throwable, JSONObject errorResponse) { // onFailure(throwable, errorResponse); // } @Override public void onSuccess(JSONObject body) { boolean isFav = tweet.isFavorited(); long newFavCount = tweet.getFavouritesCount(); if (isFav) { newFavCount++; } else { newFavCount--; } if (hideZero) { if (newFavCount == 0) { countView.setVisibility(View.INVISIBLE); } else { countView.setVisibility(View.VISIBLE); } } tweet.setFavouritesCount(newFavCount); tweet.save(); countView.setText(String.valueOf(newFavCount)); setFavView(tweet.isFavorited(), favAction); } public void onFailure(Throwable e, JSONObject error) { Log.d("DEBUG", error.toString()); Log.e("ERROR", "Exception while marking fav", e); } }); }
From source file:com.jittr.android.facebook.Example.java
/** Called when the activity is first created. */ @Override// w ww.j a v a 2 s.c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (APP_ID == null) { Util.showAlert(this, "Warning", "Facebook Applicaton ID must be " + "specified before running this example: see Example.java"); } // mFacebook. setContentView(R.layout.mainfacebook); mLoginButton = (LoginButton) findViewById(R.id.login); mText = (TextView) Example.this.findViewById(R.id.txt); mRequestButton = (Button) findViewById(R.id.requestButton); mPostButton = (Button) findViewById(R.id.postButton); mDeleteButton = (Button) findViewById(R.id.deletePostButton); mUploadButton = (Button) findViewById(R.id.uploadButton); mFacebook = new Facebook(); mAsyncRunner = new AsyncFacebookRunner(mFacebook); SessionStore.restore(mFacebook, this); SessionEvents.addAuthListener(new SampleAuthListener()); SessionEvents.addLogoutListener(new SampleLogoutListener()); mLoginButton.init(mFacebook, PERMISSIONS); mRequestButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { mAsyncRunner.request("me", new SampleRequestListener()); } }); mRequestButton.setVisibility(mFacebook.isSessionValid() ? View.VISIBLE : View.INVISIBLE); mUploadButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Bundle params = new Bundle(); params.putString("method", "photos.upload"); URL uploadFileUrl = null; try { uploadFileUrl = new URL("http://www.facebook.com/images/devsite/iphone_connect_btn.jpg"); } catch (MalformedURLException e) { e.printStackTrace(); } try { HttpURLConnection conn = (HttpURLConnection) uploadFileUrl.openConnection(); conn.setDoInput(true); conn.connect(); int length = conn.getContentLength(); byte[] imgData = new byte[length]; InputStream is = conn.getInputStream(); is.read(imgData); params.putByteArray("picture", imgData); } catch (IOException e) { e.printStackTrace(); } mAsyncRunner.request(null, params, "POST", new SampleUploadListener()); } }); mUploadButton.setVisibility(mFacebook.isSessionValid() ? View.VISIBLE : View.INVISIBLE); mPostButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { mFacebook.dialog(Example.this, "stream.publish", new SampleDialogListener()); } }); mPostButton.setVisibility(mFacebook.isSessionValid() ? View.VISIBLE : View.INVISIBLE); }