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.actionbarsherlock.internal.ActionBarSherlockCompat.java
private void updateProgressBars(int value) { IcsProgressBar circularProgressBar = getCircularProgressBar(true); IcsProgressBar horizontalProgressBar = getHorizontalProgressBar(true); final int features = mFeatures;//getLocalFeatures(); if (value == Window.PROGRESS_VISIBILITY_ON) { if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) { int level = horizontalProgressBar.getProgress(); int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE : View.INVISIBLE; horizontalProgressBar.setVisibility(visibility); }/* w ww.j a v a2 s . c o m*/ if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) { circularProgressBar.setVisibility(View.VISIBLE); } } else if (value == Window.PROGRESS_VISIBILITY_OFF) { if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) { horizontalProgressBar.setVisibility(View.GONE); } if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) { circularProgressBar.setVisibility(View.GONE); } } else if (value == Window.PROGRESS_INDETERMINATE_ON) { horizontalProgressBar.setIndeterminate(true); } else if (value == Window.PROGRESS_INDETERMINATE_OFF) { horizontalProgressBar.setIndeterminate(false); } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) { // We want to set the progress value before testing for visibility // so that when the progress bar becomes visible again, it has the // correct level. horizontalProgressBar.setProgress(value - Window.PROGRESS_START); if (value < Window.PROGRESS_END) { showProgressBars(horizontalProgressBar, circularProgressBar); } else { hideProgressBars(horizontalProgressBar, circularProgressBar); } } else if (Window.PROGRESS_SECONDARY_START <= value && value <= Window.PROGRESS_SECONDARY_END) { horizontalProgressBar.setSecondaryProgress(value - Window.PROGRESS_SECONDARY_START); showProgressBars(horizontalProgressBar, circularProgressBar); } }
From source file:com.tandong.sa.aq.AbstractAQuery.java
/** * Set view visibility to View.INVISIBLE. * * @return self//w w w . j a v a 2s .c o m */ public T invisible() { if (view != null && view.getVisibility() != View.INVISIBLE) { view.setVisibility(View.INVISIBLE); } return self(); }
From source file:com.moonpi.tapunlock.MainActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { // Get pressed item information final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); // If Rename Tag pressed if (item.getTitle().equals(getResources().getString(R.string.rename_context_menu))) { // Create new EdiText and configure final EditText tagTitle = new EditText(this); tagTitle.setSingleLine(true);//from ww w . j a v a 2s. c o m tagTitle.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); // Set tagTitle maxLength int maxLength = 50; InputFilter[] array = new InputFilter[1]; array[0] = new InputFilter.LengthFilter(maxLength); tagTitle.setFilters(array); // Get tagName text into EditText try { assert info != null; tagTitle.setText(tags.getJSONObject(info.position).getString("tagName")); } catch (JSONException e) { e.printStackTrace(); } final LinearLayout l = new LinearLayout(this); l.setOrientation(LinearLayout.VERTICAL); l.addView(tagTitle); // Show rename dialog new AlertDialog.Builder(this).setTitle(R.string.rename_tag_dialog_title).setView(l) .setPositiveButton(R.string.rename_tag_dialog_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // 'Rename' pressed, change tagName and store try { JSONObject newTagName = tags.getJSONObject(info.position); newTagName.put("tagName", tagTitle.getText()); tags.put(info.position, newTagName); adapter.notifyDataSetChanged(); } catch (JSONException e) { e.printStackTrace(); } writeToJSON(); Toast toast = Toast.makeText(getApplicationContext(), R.string.toast_tag_renamed, Toast.LENGTH_SHORT); toast.show(); imm.hideSoftInputFromWindow(tagTitle.getWindowToken(), 0); } }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { imm.hideSoftInputFromWindow(tagTitle.getWindowToken(), 0); } }).show(); tagTitle.requestFocus(); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); return true; } // If Delete Tag pressed else if (item.getTitle().equals(getResources().getString(R.string.delete_context_menu))) { // Construct dialog message String dialogMessage = ""; assert info != null; try { dialogMessage = getResources().getString(R.string.delete_context_menu_dialog1) + " '" + tags.getJSONObject(info.position).getString("tagName") + "'?"; } catch (JSONException e) { e.printStackTrace(); dialogMessage = getResources().getString(R.string.delete_context_menu_dialog2); } // Show delete dialog new AlertDialog.Builder(this).setMessage(dialogMessage) .setPositiveButton(R.string.yes_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { JSONArray newArray = new JSONArray(); // Copy contents to new array, without the deleted item for (int i = 0; i < tags.length(); i++) { if (i != info.position) { try { newArray.put(tags.get(i)); } catch (JSONException e) { e.printStackTrace(); } } } // Equal original array to new array tags = newArray; // Write to file try { settings.put("tags", tags); root.put("settings", settings); } catch (JSONException e) { e.printStackTrace(); } writeToJSON(); adapter.adapterData = tags; adapter.notifyDataSetChanged(); updateListViewHeight(listView); // If no tags, show 'Press + to add Tags' textView if (tags.length() == 0) noTags.setVisibility(View.VISIBLE); else noTags.setVisibility(View.INVISIBLE); Toast toast = Toast.makeText(getApplicationContext(), R.string.toast_tag_deleted, Toast.LENGTH_SHORT); toast.show(); } }).setNegativeButton(R.string.no_button, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Do nothing, close dialog } }).show(); return true; } return super.onContextItemSelected(item); }
From source file:com.ieeton.user.activity.ChatActivity.java
/** * ?//from ww w . j a va 2 s. c o m * * @param view */ @Override public void onClick(View view) { int id = view.getId(); if (id == R.id.btn_send) {// ??(?) String s = mEditTextContent.getText().toString(); sendText(s); } else if (id == R.id.btn_take_picture) { selectPicFromCamera();// } else if (id == R.id.btn_picture) { selectPicFromLocal(); // } else if (id == R.id.btn_location) { // ? startActivityForResult(new Intent(this, BaiduMapActivity.class), REQUEST_CODE_MAP); } else if (id == R.id.iv_emoticons_normal) { // more.setVisibility(View.VISIBLE); iv_emoticons_normal.setVisibility(View.INVISIBLE); iv_emoticons_checked.setVisibility(View.VISIBLE); btnContainer.setVisibility(View.GONE); emojiIconContainer.setVisibility(View.VISIBLE); hideKeyboard(); } else if (id == R.id.iv_emoticons_checked) { // ?? iv_emoticons_normal.setVisibility(View.VISIBLE); iv_emoticons_checked.setVisibility(View.INVISIBLE); btnContainer.setVisibility(View.VISIBLE); emojiIconContainer.setVisibility(View.GONE); more.setVisibility(View.GONE); } else if (id == R.id.btn_video) { // ? Intent intent = new Intent(ChatActivity.this, ImageGridActivity.class); startActivityForResult(intent, REQUEST_CODE_SELECT_VIDEO); } else if (id == R.id.btn_file) { // selectFileFromLocal(); } else if (id == R.id.btn_voice_call) { // ? if (!EMChatManager.getInstance().isConnected()) Toast.makeText(this, "????", 0).show(); else startActivity(new Intent(ChatActivity.this, VoiceCallActivity.class) .putExtra("username", toChatUsername).putExtra("isComingCall", false)); } else if (id == R.id.iv_call) { if (toChatUsername.equals(NetEngine.getSecretaryID())) { //??400??? String number = NetEngine.getIvrNumber(); if (number != null && !"".equals(number)) { Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number)); startActivity(intent); } return; } if (mUser == null) { return; } if (mUser.getSwitchMobile() == 0 || TextUtils.isEmpty(mUser.getIvrMobile()) && TextUtils.isEmpty(mUser.getMobile())) { Utils.showToast(this, R.string.call_service_is_unavlable, Toast.LENGTH_SHORT); return; } String mobile = TextUtils.isEmpty(mUser.getIvrMobile()) ? mUser.getMobile() : mUser.getIvrMobile(); mCallDialog = Utils.showCallDialog(this, mobile); // String mobile = ""; // if (!TextUtils.isEmpty(mUser.getIvrMobile())){ // mobile = mUser.getIvrMobile(); // }else if (!TextUtils.isEmpty(mUser.getMobile())){ // mobile = mUser.getMobile(); // } // if (!TextUtils.isEmpty(mobile)){ // Intent intent=new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+mobile)); // startActivity(intent); // }else{ // Utils.showToast(this, R.string.call_service_is_unavlable, Toast.LENGTH_SHORT); // } } else if (view == mBackBtn) { finish(); } }
From source file:com.saulcintero.moveon.fragments.History.java
private void refreshRoutes() { boolean isMetric = FunctionUtils.checkIfUnitsAreMetric(mContext); if (!DataFunctionUtils.checkInformationInDB(mContext)) hello_text.setVisibility(View.INVISIBLE); else/*from ww w . j a v a 2 s. c o m*/ hello_text.setVisibility(View.VISIBLE); List<HashMap<String, String>> mList = new ArrayList<HashMap<String, String>>(); idList = new ArrayList<Integer>(); nameList = new ArrayList<String>(); headerList = new ArrayList<String>(); yearList = new ArrayList<String>(); sectionList = new ArrayList<Integer>(); headers_session_counter = new ArrayList<Integer>(); adapterList = new ArrayList<CustomArrayAdapter>(); accum_time = 0; accum_distance = 0; accum_calories = 0; pos = 0; sessions = 0; DBManager = new DataManager(mContext); DBManager.Open(); FilterTypes whichFilter = FilterTypes.values()[typeOfFilter]; switch (whichFilter) { case ALL_DESC: cursor = DBManager.getAll_DESC("routes"); break; case BY_ACTIVITY: cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_activity), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE category_id = '" + activities_id + "' ORDER BY iso_date DESC"); break; case BY_DATE_THIS_YEAR: cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_date), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE substr(date,7) = '" + Calendar.getInstance().get(Calendar.YEAR) + "' ORDER BY iso_date DESC"); break; case BY_DATE_THIS_MONTH: getMonth(); cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_date), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE substr(date,4,2) = '" + mMonth1 + "' " + "AND substr(date,7) = '" + Calendar.getInstance().get(Calendar.YEAR) + "' ORDER BY iso_date DESC"); break; case BY_DATE_THIS_WEEK: getWeek(); cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_date), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE substr(date,7)||substr(date,4,2)||substr(date,1,2) " + "BETWEEN '" + mYear1 + mMonth1 + mDay1 + "' AND '" + mYear2 + mMonth2 + mDay2 + "' ORDER BY iso_date DESC"); break; case BY_DATE_CUSTOM_DATE: extractPartsOfDate(); cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_date), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE substr(date,7)||substr(date,4,2)||substr(date,1,2) " + "BETWEEN '" + mYear1 + mMonth1 + mDay1 + "' AND '" + mYear2 + mMonth2 + mDay2 + "' " + "ORDER BY iso_date DESC"); break; case BY_ACTIVITY_AND_DATE_THIS_YEAR: cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_activity_and_date), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE category_id = '" + activities_id + "' " + "AND substr(date,7) = '" + Calendar.getInstance().get(Calendar.YEAR) + "' ORDER BY iso_date DESC"); break; case BY_ACTIVITY_AND_DATE_THIS_MONTH: getMonth(); cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_activity_and_date), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE category_id = '" + activities_id + "' " + "AND substr(date,4,2) = '" + mMonth1 + "' " + "AND substr(date,7) = '" + Calendar.getInstance().get(Calendar.YEAR) + "' ORDER BY iso_date DESC"); break; case BY_ACTIVITY_AND_DATE_THIS_WEEK: getWeek(); cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_activity_and_date), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE category_id = '" + activities_id + "' " + "AND substr(date,7)||substr(date,4,2)||substr(date,1,2) " + "BETWEEN '" + mYear1 + mMonth1 + mDay1 + "' AND '" + mYear2 + mMonth2 + mDay2 + "' ORDER BY iso_date DESC"); break; case BY_ACTIVITY_AND_DATE_CUSTOM_DATE: extractPartsOfDate(); cursor = DBManager.CustomQuery(getString(R.string.db_query_select_records_by_activity_and_date), "SELECT *, ((substr(date,7,4)||substr(date,4,2)||substr(date,1,2))) AS iso_date FROM routes WHERE category_id = '" + activities_id + "' " + "AND substr(date,7)||substr(date,4,2)||substr(date,1,2) " + "BETWEEN '" + mYear1 + mMonth1 + mDay1 + "' AND '" + mYear2 + mMonth2 + mDay2 + "' ORDER BY iso_date DESC"); break; } cursor.moveToFirst(); if (cursor.getCount() > 0) { sessions = cursor.getCount(); history_icon = new ArrayList<String>(); history_data1 = new ArrayList<String>(); history_data2 = new ArrayList<String>(); history_data3 = new ArrayList<String>(); history_data4 = new ArrayList<String>(); history_data5 = new ArrayList<String>(); history_data6 = new ArrayList<String>(); headers_register = new ArrayList<Integer>(); adapter = new SeparatedListAdapter(mContext); Locale currenLocale = res.getConfiguration().locale; // create headers Strings boolean isFirstEntry = true; while (!cursor.isAfterLast()) { String mDate = cursor.getString(cursor.getColumnIndex("date")); String[] splitDate = mDate.split("/"); String currentMonth = FunctionUtils.getNameOfMonth(Integer.parseInt(splitDate[1]), currenLocale); if (isFirstEntry) { lastMonth = currentMonth; isFirstEntry = false; } if (currentMonth != lastMonth) { headers_session_counter.add(session_counter); session_counter = 1; lastMonth = currentMonth; } else { session_counter += 1; } pos += 1; if (pos == cursor.getCount()) headers_session_counter.add(session_counter); cursor.moveToNext(); } cursor.moveToFirst(); pos = 0; session_counter = 0; headers_pos = 0; lastMonth = ""; while (!cursor.isAfterLast()) { HashMap<String, String> hm = new HashMap<String, String>(); id = cursor.getInt(cursor.getColumnIndex("_id")); time = Long.parseLong(String.valueOf(cursor.getInt(cursor.getColumnIndex("time")))); distance = cursor.getFloat(cursor.getColumnIndex("distance")); calories = cursor.getInt(cursor.getColumnIndex("kcal")); avg_hr = cursor.getInt(cursor.getColumnIndex("avg_hr")); name = cursor.getString(cursor.getColumnIndex("name")); accum_time = accum_time + time; accum_distance = accum_distance + distance; accum_calories = accum_calories + calories; String mDate = cursor.getString(cursor.getColumnIndex("date")); String[] splitDate = mDate.split("/"); String currentMonth = FunctionUtils.getNameOfMonth(Integer.parseInt(splitDate[1]), currenLocale); String currentYear = FunctionUtils.getYear(mDate); if (headerList.size() == 0) { headerList.add(currentMonth); yearList.add(currentYear); lastMonth = currentMonth; sectionList.add(1); sectionList.add(0); } if (currentMonth != lastMonth) { sectionList.add(1); sectionList.add(0); headers_register.add(pos); headers = new String[headerList.size()]; years = new String[headerList.size()]; for (int m = 0; m <= (headerList.size() - 1); m++) { headers[m] = headerList.get(m).toString(); years[m] = yearList.get(m).toString(); } CustomArrayAdapter listadapter_history_rows = null; listadapter_history_rows = new CustomArrayAdapter(mContext, R.layout.history_list_row, history_icon, history_data1, history_data2, history_data3, history_data4, history_data5, history_data6); adapter.addSection(headers[headers_pos].substring(0, 1).toUpperCase(Locale.getDefault()) + headers[headers_pos].substring(1) + " " + years[headers_pos] + " ( " + headers_session_counter.get(headers_pos) + " " + getString(R.string.practices) + " )", listadapter_history_rows); adapterList.add(listadapter_history_rows); headerList.add(currentMonth); yearList.add(currentYear); lastMonth = currentMonth; headers_pos += 1; history_icon = new ArrayList<String>(); history_data1 = new ArrayList<String>(); history_data2 = new ArrayList<String>(); history_data3 = new ArrayList<String>(); history_data4 = new ArrayList<String>(); history_data5 = new ArrayList<String>(); history_data6 = new ArrayList<String>(); } else { sectionList.add(0); } hm.put("history_list_icon", Integer.toString(res.getIdentifier("com.saulcintero.moveon:drawable/activity" + (cursor.getInt(cursor.getColumnIndex("category_id")) + 1), null, null))); history_icon.add(Integer.toString(cursor.getInt(cursor.getColumnIndex("category_id")))); hm.put("history_data1", name); history_data1.add(name); if (time < 3600) mTime = FunctionUtils.shortFormatTime(time); else mTime = FunctionUtils.longFormatTime(time); hm.put("history_data2", String .valueOf((isMetric ? distance + " " + getString(R.string.long_unit1_detail_1) + " " : FunctionUtils.getMilesFromKilometersWithTwoDecimals(distance) + " " + getString(R.string.long_unit2_detail_1) + " ")) + getString(R.string.in) + " " + mTime); history_data2.add(String .valueOf((isMetric ? distance + " " + getString(R.string.long_unit1_detail_1) + " " : FunctionUtils.getMilesFromKilometersWithTwoDecimals(distance) + " " + getString(R.string.long_unit2_detail_1) + " ")) + getString(R.string.in) + " " + mTime); hm.put("history_data3", String.valueOf(calories + " " + getString(R.string.tell_calories_setting_details))); history_data3 .add(String.valueOf(calories + " " + getString(R.string.tell_calories_setting_details))); hm.put("history_data4", String.valueOf(avg_hr + " " + getString(R.string.beats_per_minute))); history_data4.add(String.valueOf(avg_hr + " " + getString(R.string.beats_per_minute))); hm.put("history_data5", countPictures(id)); history_data5.add(countPictures(id)); hm.put("history_data6", cursor.getString(cursor.getColumnIndex("date")) + ", " + (cursor.getString(cursor.getColumnIndex("hour")).substring(0, 5))); history_data6.add(cursor.getString(cursor.getColumnIndex("date")) + ", " + (cursor.getString(cursor.getColumnIndex("hour")).substring(0, 5))); mList.add(hm); idList.add(id); nameList.add(cursor.getString(cursor.getColumnIndex("name"))); if ((pos + 1) == cursor.getCount()) { if (currentMonth != lastMonth) { headerList.add(currentMonth); yearList.add(currentYear); } lastMonth = currentMonth; headers = new String[headerList.size()]; years = new String[headerList.size()]; for (int m = 0; m <= (headerList.size() - 1); m++) { headers[m] = headerList.get(m).toString(); years[m] = yearList.get(m).toString(); } CustomArrayAdapter listadapter_history_rows = null; listadapter_history_rows = new CustomArrayAdapter(mContext, R.layout.history_list_row, history_icon, history_data1, history_data2, history_data3, history_data4, history_data5, history_data6); adapter.addSection( headers[headers_pos].substring(0, 1).toUpperCase(Locale.getDefault()) + headers[headers_pos].substring(1) + " " + years[headers_pos] + " ( " + headers_session_counter.get(headers_pos) + " prctica(s) )", listadapter_history_rows); adapterList.add(listadapter_history_rows); headers_pos += 1; } pos += 1; cursor.moveToNext(); } } else { adapter = null; } cursor.close(); DBManager.Close(); currentPosition = historyListView.getFirstVisiblePosition(); view = historyListView.getChildAt(0); top = (view == null) ? 0 : view.getTop(); int sum = 0; for (int p = 0; p < sectionList.size(); p++) { if (currentPosition > p) sum = sum + Integer.parseInt(sectionList.get(p).toString()); } historyListView.setAdapter(adapter); if (currentPosition > 0) historyListView.setSelectionFromTop(((currentPosition - 1) + sum), top); sessions_text.setText(String.valueOf(sessions)); distance_text.setText(String.valueOf((isMetric ? FunctionUtils.customizedRound(accum_distance, 2) : FunctionUtils.customizedRound(((accum_distance * 1000f) / 1609f), 2)))); distance_unit_text .setText(isMetric ? getString(R.string.long_unit1_detail_1).toUpperCase(Locale.getDefault()) : getString(R.string.long_unit2_detail_1).toUpperCase(Locale.getDefault())); time_text.setText(FunctionUtils.longFormatTime(accum_time)); calories_text.setText(String.valueOf(accum_calories)); }
From source file:radu.pidroid.Controller.java
public void setControls(int id) { switch (id) { case TOUCH_CONTROLS: touchControlsLayout.setVisibility(View.VISIBLE); smallCameraJoystickView.setVisibility(View.VISIBLE); sliderControlsLayout.setVisibility(View.INVISIBLE); joystickControlsLayout.setVisibility(View.INVISIBLE); tiltControlsOn = true;/* w w w . j ava 2 s . c om*/ videoFeedMjpegView.setCameraStabilisation(cameraStabilisationOn = true); break; case SLIDER_CONTROLS: sliderControlsLayout.setVisibility(View.VISIBLE); smallCameraJoystickView.setVisibility(View.VISIBLE); touchControlsLayout.setVisibility(View.INVISIBLE); joystickControlsLayout.setVisibility(View.INVISIBLE); tiltControlsOn = true; videoFeedMjpegView.setCameraStabilisation(cameraStabilisationOn = true); break; case JOYSTICK_CONTROLS: joystickControlsLayout.setVisibility(View.VISIBLE); touchControlsLayout.setVisibility(View.INVISIBLE); sliderControlsLayout.setVisibility(View.INVISIBLE); smallCameraJoystickView.setVisibility(View.INVISIBLE); tiltControlsOn = false; videoFeedMjpegView.setCameraStabilisation(cameraStabilisationOn = false); break; default: Log.e("setControls(): ", "default triggered with controlsID = " + controlsID); return; } // switch controlsID = id; }
From source file:com.benefit.buy.library.http.query.AbstractAQuery.java
/** * Set view visibility to View.INVISIBLE. * @return self// w ww .j a va2 s . c o m */ public T invisible() { /* * if(view != null && view.getVisibility() != View.INVISIBLE){ view.setVisibility(View.INVISIBLE); } return * self(); */ return visibility(View.INVISIBLE); }
From source file:com.nappking.movietimesup.GameFragment.java
private void fetchFriendBitmapAndFireImages(final UserImageView userImageView, final String friendToSmashID, final boolean extraImage) { AsyncTask.execute(new Runnable() { public void run() { URL bitmapURL;//from w w w . j a v a2s. co m try { bitmapURL = new URL("http://graph.facebook.com/" + friendToSmashID + "/picture?width=" + iconWidth + "&height=" + iconWidth); friendToSmashBitmap = BitmapFactory.decodeStream(bitmapURL.openConnection().getInputStream()); } catch (Exception e) { // Unknown error Log.e(FriendSmashApplication.TAG, e.toString()); } uiHandler.post(new Runnable() { @Override public void run() { // Hide the spinner after retrieving progressContainer.setVisibility(View.INVISIBLE); if (friendToSmashBitmap != null) { setFriendImageAndFire(userImageView, friendToSmashBitmap, extraImage); // Also set the lastFriendSmashedID in the application ((FriendSmashApplication) getActivity().getApplication()) .setLastFriendSmashedID(friendToSmashID); } else { closeAndShowError(getResources().getString(R.string.error_fetching_friend_bitmap)); } } }); } }); }
From source file:com.ichi2.anki2.StudyOptionsFragment.java
private void initAllContentViews(LayoutInflater inflater) { mStudyOptionsView = inflater.inflate(R.layout.studyoptions, null); Themes.setContentStyle(mStudyOptionsView, Themes.CALLER_STUDYOPTIONS); mTextDeckName = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_deck_name); mTextDeckDescription = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_deck_description); mButtonStart = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_start); // mButtonUp = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_limitup); // mButtonDown = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_limitdown); // mToggleLimitToggle = (ToggleButton) mStudyOptionsView.findViewById(R.id.studyoptions_limittoggle); // mToggleNight = (ToggleButton) mStudyOptionsView // .findViewById(R.id.studyoptions_night); // mToggle.setChecked(mInvertedColors); if (AnkiDroidApp.colIsOpen() && AnkiDroidApp.getCol().getDecks().isDyn(AnkiDroidApp.getCol().getDecks().selected())) { Button rebBut = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_rebuild_cram); rebBut.setOnClickListener(mButtonClickListener); Button emptyBut = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_empty_cram); emptyBut.setOnClickListener(mButtonClickListener); ((LinearLayout) mStudyOptionsView.findViewById(R.id.studyoptions_cram_buttons)) .setVisibility(View.VISIBLE); }//from w ww. ja va 2s .co m if (mFragmented) { Button but = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_options); but.setOnClickListener(mButtonClickListener); mFragmentedCram = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_new_filtercram); if (AnkiDroidApp.colIsOpen() && AnkiDroidApp.getCol().getDecks().isDyn(AnkiDroidApp.getCol().getDecks().selected())) { mFragmentedCram.setEnabled(false); mFragmentedCram.setVisibility(View.GONE); } else { // If we are in fragmented mode, then the cram option in menu applies to all decks, so we need an extra // button in StudyOptions side of screen to create dynamic deck filtered on this deck mFragmentedCram.setEnabled(true); mFragmentedCram.setVisibility(View.VISIBLE); } mFragmentedCram.setOnClickListener(mButtonClickListener); } else { mAddNote = (ImageButton) mStudyOptionsView.findViewById(R.id.studyoptions_add); if (AnkiDroidApp.colIsOpen()) { Collection col = AnkiDroidApp.getCol(); if (col.getDecks().isDyn(col.getDecks().selected())) { mAddNote.setEnabled(false); } } mCardBrowser = (ImageButton) mStudyOptionsView.findViewById(R.id.studyoptions_card_browser); mStatisticsButton = (ImageButton) mStudyOptionsView.findViewById(R.id.studyoptions_statistics); mDeckOptions = (ImageButton) mStudyOptionsView.findViewById(R.id.studyoptions_options); mAddNote.setOnClickListener(mButtonClickListener); mCardBrowser.setOnClickListener(mButtonClickListener); mStatisticsButton.setOnClickListener(mButtonClickListener); mDeckOptions.setOnClickListener(mButtonClickListener); } mGlobalBar = (View) mStudyOptionsView.findViewById(R.id.studyoptions_global_bar); mGlobalMatBar = (View) mStudyOptionsView.findViewById(R.id.studyoptions_global_mat_bar); mBarsMax = (View) mStudyOptionsView.findViewById(R.id.studyoptions_progressbar_content); mTextTodayNew = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_new); mTextTodayLrn = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_lrn); mTextTodayRev = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_rev); mTextNewTotal = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_total_new); mTextTotal = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_total); mTextETA = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_eta); mSmallChart = (LinearLayout) mStudyOptionsView.findViewById(R.id.studyoptions_mall_chart); mGlobalMatBar.setVisibility(View.INVISIBLE); mGlobalBar.setVisibility(View.INVISIBLE); mDeckCounts = (LinearLayout) mStudyOptionsView.findViewById(R.id.studyoptions_deckcounts); mDeckChart = (LinearLayout) mStudyOptionsView.findViewById(R.id.studyoptions_chart); mButtonStart.setOnClickListener(mButtonClickListener); // mButtonUp.setOnClickListener(mButtonClickListener); // mButtonDown.setOnClickListener(mButtonClickListener); // mToggleLimitToggle.setOnClickListener(mButtonClickListener); // mToggleCram.setOnClickListener(mButtonClickListener); // mToggleNight.setOnClickListener(mButtonClickListener); // The view that shows the congratulations view. mCongratsView = inflater.inflate(R.layout.studyoptions_congrats, null); // The view that shows the learn more options mCustomStudyDetailsView = inflater.inflate(R.layout.styled_custom_study_details_dialog, null); mCustomStudyTextView1 = (TextView) mCustomStudyDetailsView.findViewById(R.id.custom_study_details_text1); mCustomStudyTextView2 = (TextView) mCustomStudyDetailsView.findViewById(R.id.custom_study_details_text2); mCustomStudyEditText = (EditText) mCustomStudyDetailsView.findViewById(R.id.custom_study_details_edittext2); Themes.setWallpaper(mCongratsView); mTextCongratsMessage = (TextView) mCongratsView.findViewById(R.id.studyoptions_congrats_message); Themes.setTextViewStyle(mTextCongratsMessage); mTextCongratsMessage.setOnClickListener(mButtonClickListener); mButtonCongratsUndo = (Button) mCongratsView.findViewById(R.id.studyoptions_congrats_undo); mButtonCongratsCustomStudy = (Button) mCongratsView.findViewById(R.id.studyoptions_congrats_customstudy); mButtonCongratsOpenOtherDeck = (Button) mCongratsView .findViewById(R.id.studyoptions_congrats_open_other_deck); if (mFragmented) { mButtonCongratsOpenOtherDeck.setVisibility(View.GONE); } mButtonCongratsFinish = (Button) mCongratsView.findViewById(R.id.studyoptions_congrats_finish); mButtonCongratsUndo.setOnClickListener(mButtonClickListener); mButtonCongratsCustomStudy.setOnClickListener(mButtonClickListener); mButtonCongratsOpenOtherDeck.setOnClickListener(mButtonClickListener); mButtonCongratsFinish.setOnClickListener(mButtonClickListener); }
From source file:edu.mum.ml.group7.guessasketch.android.EasyPaint.java
/** * This takes the screenshot of the whole screen. Is this a good thing? *//* w w w .j av a 2s .c o m*/ private File sendScreenshot(boolean showToast, ApiCallType callType, String label) { saveButton.setVisibility(View.INVISIBLE); loader.setVisibility(View.VISIBLE); View v = findViewById(R.id.CanvasId); v.setDrawingCacheEnabled(true); Bitmap cachedBitmap = v.getDrawingCache(); Bitmap copyBitmap = toGrayscale(cachedBitmap.copy(Bitmap.Config.RGB_565, true)); v.destroyDrawingCache(); FileOutputStream output = null; File file = null; try { File path = Places.getScreenshotFolder(); Calendar cal = Calendar.getInstance(); file = new File(path, cal.get(Calendar.YEAR) + "_" + (1 + cal.get(Calendar.MONTH)) + "_" + cal.get(Calendar.DAY_OF_MONTH) + "_" + cal.get(Calendar.HOUR_OF_DAY) + "_" + cal.get(Calendar.MINUTE) + "_" + cal.get(Calendar.SECOND) + ".jpg"); output = new FileOutputStream(file); copyBitmap.compress(CompressFormat.JPEG, 60, output); sendPost(file, callType, label); } catch (FileNotFoundException e) { file = null; e.printStackTrace(); } finally { if (output != null) { try { output.close(); } catch (IOException e) { e.printStackTrace(); } } } if (file != null) { if (showToast) Toast.makeText(getApplicationContext(), String .format(getResources().getString(R.string.saved_your_location_to), file.getAbsolutePath()), Toast.LENGTH_LONG).show(); /* // sending a broadcast to the media scanner so it will scan the new // screenshot. Intent requestScan = new Intent( Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); requestScan.setData(Uri.fromFile(file)); sendBroadcast(requestScan); */ return file; } else { return null; } }