List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:org.ciasaboark.tacere.activity.fragment.EventsFragment.java
private void drawServiceWarningBoxIfNeeded() { LinearLayout warningBox = (LinearLayout) rootView.findViewById(R.id.main_service_warning); if (!prefs.isServiceActivated()) { warningBox.setVisibility(View.VISIBLE); } else {//from w ww . j ava2 s .co m warningBox.setVisibility(View.GONE); } }
From source file:com.github.suzukaze.yarulistfortodoly.fragment.ToDoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.todo, container, false); ButterKnife.bind(this, view); final MainActivity mainActivity = (MainActivity) getActivity(); todoViewModel = new TodoViewModel(accountManager, dataManager, historyManager); todoViewModel.setOnSyncFinishListener(this); Toolbar toolbar = mainActivity.getToolbar(); toolbar.setTitle(getResources().getString(R.string.yarulist)); mainActivity.showToolbar();//from w w w . j av a 2 s. c om if (dataManager.getProjects().size() > 0) { currentProject = dataManager.getProjects().get(0); } syncLayout = mainActivity.getSyncLayout(); final LinearLayout finalSyncLayout = syncLayout; finalSyncLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (underCommunication) return; finalSyncLayout.setVisibility(View.INVISIBLE); todoViewModel.sync(); } }); final ToDoFragment toDoFragment = this; LinearLayout addProject = mainActivity.getAddProjectLayout(); addProject.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ProjectViewModel projectViewModel = new ProjectViewModel(dataManager, historyManager); projectViewModel.setProjectId(Project.PROJECT_ID_NONE); projectView.init(projectViewModel, mainActivity.getInputMethodManager(), toDoFragment, mainActivity, currentProject, ProjectMode.ADD_PROJECT, accountManager, compositeSubscription); projectView.show(); } }); LinearLayout editProjectLayout = mainActivity.getEditProjectLayout(); editProjectLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ProjectViewModel projectViewModel = new ProjectViewModel(dataManager, historyManager); projectViewModel.setProjectId(currentProject.getId()); projectView.init(projectViewModel, mainActivity.getInputMethodManager(), toDoFragment, mainActivity, currentProject, ProjectMode.UPDATE_PROJECT, accountManager, compositeSubscription); projectView.show(); } }); mainActivity.setEditItemView(editItemView); mainActivity.setProjectView(null); Resources r = getResources(); tabs.setTextColor(r.getColor(R.color.white)); tabs.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TABS_TEXT_SIZE); tabs.setTabIndicatorColor(r.getColor(R.color.white)); dataManager = mainActivity.getDataManager(); dataManager.clear(); dataManager.load(); if (sync) { todoViewModel.sync(); } else { changeTabs(); } return view; }
From source file:de.enlightened.peris.ForumSettingsFragment.java
private void setupSignatureButton(final SharedPreferences appPreferences) { //Signature button final LinearLayout forumSettingTagline = (LinearLayout) getActivity() .findViewById(R.id.forum_setting_tagline); if (this.application.getSession().getServer().serverUserName.contentEquals("0")) { forumSettingTagline.setVisibility(View.GONE); } else {//from w w w . j av a 2 s. co m final LinearLayout forumSettingTaglineBodyBuilder = (LinearLayout) getActivity() .findViewById(R.id.forum_setting_tagline_body_builder); final boolean useShading = appPreferences.getBoolean("use_shading", false); final boolean useOpenSans = appPreferences.getBoolean("use_opensans", false); final int fontSize = appPreferences.getInt("font_size", 16); final Typeface opensans = Typeface.createFromAsset(getActivity().getAssets(), "fonts/opensans.ttf"); BBCodeParser.parseCode(getActivity(), forumSettingTaglineBodyBuilder, this.application.getSession().getServer().serverTagline, opensans, useOpenSans, useShading, null, fontSize, false, "#333333", this.application); forumSettingTagline.setOnClickListener(new View.OnClickListener() { @Override @SuppressWarnings("checkstyle:requirethis") public void onClick(final View v) { final Intent myIntent = new Intent(getActivity(), NewPost.class); final Bundle bundle = new Bundle(); bundle.putString("postid", "0"); bundle.putString("parent", "0"); bundle.putString("category", "0"); bundle.putString("subforum_id", (String) "0"); bundle.putString("original_text", (String) ""); bundle.putString("boxTitle", (String) "Signature Editor"); bundle.putString("picture", (String) "0"); bundle.putString("color", (String) application.getSession().getServer().serverColor); bundle.putString("subject", (String) ""); bundle.putString("post_type", NewPost.Type.Tagline.name()); myIntent.putExtras(bundle); startActivity(myIntent); } }); } }
From source file:com.readboy.mathproblem.app.ExpandableListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a ListView whose id * is {@link android.R.id#list android.R.id.list} and can optionally * have a sibling view id {@link android.R.id#empty android.R.id.empty} * that is to be shown when the list is empty. * * <p>If you are overriding this method with your own custom content, * consider including the standard layout {@link android.R.layout#list_content} * in your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only * way to have the built-in indeterminant progress state be shown. *///from w w w . jav a 2s.com @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ /*ExpandableListView expandableListView = (ExpandableListView) View.inflate( getActivity(), R.layout.expandable_gradelist, lframe);*/ // ------------------------------------------------------------------ ExpandableListView lv = new ExpandableListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ /* ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));*/ // ------------------------------------------------------------------ root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); return root; }
From source file:com.google.android.apps.mytracks.io.sendtogoogle.UploadResultActivity.java
@Override protected Dialog onCreateDialog(int id) { if (id != DIALOG_RESULT_ID) { return null; }/* w ww .j a va2 s . c om*/ view = getLayoutInflater().inflate(R.layout.upload_result, null); LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result); ImageView mapsResultIcon = (ImageView) view.findViewById(R.id.upload_result_maps_result_icon); TextView successFooter = (TextView) view.findViewById(R.id.upload_result_success_footer); TextView errorFooter = (TextView) view.findViewById(R.id.upload_result_error_footer); boolean hasError = false; if (!sendRequest.isSendNogago()) { mapsResult.setVisibility(View.GONE); } else { if (!sendRequest.isNogagoSuccess()) { mapsResultIcon.setImageResource(R.drawable.failure); mapsResultIcon.setContentDescription(getString(R.string.generic_error_title)); hasError = true; } } if (hasError) { successFooter.setVisibility(View.GONE); } else { errorFooter.setVisibility(View.GONE); } AlertDialog.Builder builder = new AlertDialog.Builder(this).setCancelable(true) .setIcon(hasError ? android.R.drawable.ic_dialog_alert : android.R.drawable.ic_dialog_info) .setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { finish(); } }).setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); } }).setNeutralButton(R.string.dlg_btn_settings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finish(); Intent settings = new Intent(UploadResultActivity.this, SettingsActivity.class); startActivity(settings); } }).setTitle(hasError ? R.string.generic_error_title : R.string.generic_success_title).setView(view); // Add a Share URL button if shareUrl exists if (shareUrl != null) { builder.setNegativeButton(R.string.share_track_share_url, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ChooseActivityDialogFragment.newInstance(sendRequest.getTrackId(), shareUrl).show( getSupportFragmentManager(), ChooseActivityDialogFragment.CHOOSE_ACTIVITY_DIALOG_TAG); } }); } resultDialog = builder.create(); return resultDialog; }
From source file:de.enlightened.peris.SettingsFragment.java
private void setupUserCard() { if (this.getActivity() == null) { return;/*from w ww .j av a 2 s .c o m*/ } final LinearLayout userLayout = (LinearLayout) getActivity().findViewById(R.id.settings_user_box); if (this.application.getSession().getServer().serverUserId == null) { userLayout.setVisibility(View.GONE); } else { final ImageView ivAvatar = (ImageView) getActivity().findViewById(R.id.settings_user_avatar); final TextView tvUsername = (TextView) getActivity().findViewById(R.id.settings_user_name); final ImageView ivLogout = (ImageView) getActivity().findViewById(R.id.settings_user_logout); tvUsername.setText(this.application.getSession().getServer().serverUserName); if (this.application.getSession().getServer().serverAvatar.contains("http")) { ImageLoader.getInstance().displayImage(this.application.getSession().getServer().serverAvatar, ivAvatar); } else { ivAvatar.setImageResource(R.drawable.no_avatar); } ivLogout.setOnClickListener(new View.OnClickListener() { @Override @SuppressWarnings("checkstyle:requirethis") public void onClick(final View v) { logOut(); } }); userLayout.setOnClickListener(new View.OnClickListener() { @Override @SuppressWarnings("checkstyle:requirethis") public void onClick(final View v) { loadMyWall(); } }); } }
From source file:com.mobicage.rogerthat.NewsActivity.java
private void setupConnectedToInternet() { final LinearLayout ll = (LinearLayout) findViewById(R.id.internet_status_container); if (mIsConnectedToInternet) { ll.setVisibility(View.GONE); swipeContainer.setEnabled(true); swipeContainer.setRefreshing(true); } else {/*from w w w . ja v a2 s . c o m*/ ll.setVisibility(View.VISIBLE); swipeContainer.setEnabled(false); swipeContainer.setRefreshing(false); } }
From source file:dynamite.zafroshops.app.fragment.AddZopFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_add_zop, container, false); Spinner zopTypeSpinner = (Spinner) rootView.findViewById(R.id.newZopType); Spinner zopCountrySpinner = (Spinner) rootView.findViewById(R.id.newZopCountry); RelativeLayout loader = (RelativeLayout) rootView.findViewById(R.id.relativeLayoutLoader); LinearLayout zop = (LinearLayout) rootView.findViewById(R.id.itemZopAdd); TextView text = (TextView) rootView.findViewById(R.id.loading_message); final TextView phoneCode = (TextView) rootView.findViewById(R.id.newZopPhoneCode); loader.setVisibility(View.INVISIBLE); zop.setVisibility(View.VISIBLE); text.setText(getString(R.string.sending_data)); zopTypeSpinner.setAdapter(zopTypeAdapter); zopCountrySpinner.setAdapter(zopCountryAdapter); zopTypeSpinner.setSelection(zopTypeAdapter.getPosition(ZopType.Shop)); ((Button) rootView.findViewById(R.id.newZopOpeningsButton)) .setText(getString(R.string.openings_edit) + " 0/7"); ((Button) rootView.findViewById(R.id.newZopServicesButton)) .setText(getString(R.string.services_editing) + " 0/" + ZopServiceType.values().length); zopCountrySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override// ww w. j a va 2 s.co m public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) { MobileCountry country = (MobileCountry) parent.getItemAtPosition(position); phoneCode.setText(country.PhoneCode); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); clearForm(rootView); return rootView; }
From source file:de.enlightened.peris.ProfileFragment.java
private void setupElements() { this.tvCreated = (TextView) this.activity.findViewById(R.id.profileCreated); this.tvPostCount = (TextView) this.activity.findViewById(R.id.profilePostCount); this.tvActivity = (TextView) this.activity.findViewById(R.id.profileLastActivity); this.tvTagline = (TextView) this.activity.findViewById(R.id.profileTagline); this.tvAbout = (TextView) this.activity.findViewById(R.id.profileAbout); this.ivProfilePic = (ImageView) this.activity.findViewById(R.id.profilePicture); final String userid = this.application.getSession().getServer().serverUserId; final LinearLayout avatarButtons = (LinearLayout) this.activity .findViewById(R.id.profile_avatar_editor_buttons); if (this.userId == null) { avatarButtons.setVisibility(View.GONE); } else if (!this.userId.equals(userid)) { avatarButtons.setVisibility(View.GONE); }// w w w.j a va 2 s. c o m final Button btnPicFromCamera = (Button) this.activity.findViewById(R.id.profile_upload_avatar_camera); final Button btnPicFromGallery = (Button) this.activity.findViewById(R.id.profile_upload_avatar_gallery); if (!this.canHandleCameraIntent()) { btnPicFromCamera.setVisibility(View.GONE); } btnPicFromGallery.setOnClickListener(new View.OnClickListener() { public void onClick(final View v) { final Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), GALLERY_PIC_REQUEST); } }); btnPicFromCamera.setOnClickListener(new View.OnClickListener() { public void onClick(final View v) { final Intent imageIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); final File imagesFolder = new File(Environment.getExternalStorageDirectory(), "temp"); imagesFolder.mkdirs(); final File image = new File(imagesFolder, "temp.jpg"); final Uri uriSavedImage = Uri.fromFile(image); imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage); startActivityForResult(imageIntent, CAMERA_PIC_REQUEST); } }); }
From source file:org.sufficientlysecure.keychain.ui.dialog.EditSubkeyExpiryDialogFragment.java
/** * Creates dialog//from w w w. j a v a 2 s .c om */ @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Activity activity = getActivity(); mMessenger = getArguments().getParcelable(ARG_MESSENGER); long creation = getArguments().getLong(ARG_CREATION); long expiry = getArguments().getLong(ARG_EXPIRY); final Calendar creationCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); creationCal.setTimeInMillis(creation * 1000); Calendar expiryCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); expiryCal.setTimeInMillis(expiry * 1000); // date picker works with default time zone, we need to convert from UTC to default timezone creationCal.setTimeZone(TimeZone.getDefault()); expiryCal.setTimeZone(TimeZone.getDefault()); // Explicitly not using DatePickerDialog here! // DatePickerDialog is difficult to customize and has many problems (see old git versions) CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity); alert.setTitle(R.string.expiry_date_dialog_title); LayoutInflater inflater = activity.getLayoutInflater(); View view = inflater.inflate(R.layout.edit_subkey_expiry_dialog, null); alert.setView(view); final CheckBox noExpiry = (CheckBox) view.findViewById(R.id.edit_subkey_expiry_no_expiry); final DatePicker datePicker = (DatePicker) view.findViewById(R.id.edit_subkey_expiry_date_picker); final TextView currentExpiry = (TextView) view.findViewById(R.id.edit_subkey_expiry_current_expiry); final LinearLayout expiryLayout = (LinearLayout) view.findViewById(R.id.edit_subkey_expiry_layout); noExpiry.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { expiryLayout.setVisibility(View.GONE); } else { expiryLayout.setVisibility(View.VISIBLE); } } }); if (expiry == 0L) { noExpiry.setChecked(true); expiryLayout.setVisibility(View.GONE); currentExpiry.setText(R.string.btn_no_date); } else { noExpiry.setChecked(false); expiryLayout.setVisibility(View.VISIBLE); currentExpiry.setText(DateFormat.getDateFormat(getActivity()).format(expiryCal.getTime())); } // date picker works based on default time zone Calendar todayCal = Calendar.getInstance(TimeZone.getDefault()); if (creationCal.after(todayCal)) { // NOTE: This is just for the rare cases where creation is _after_ today // Min Date: Creation date + 1 day Calendar creationCalPlusOne = (Calendar) creationCal.clone(); creationCalPlusOne.add(Calendar.DAY_OF_YEAR, 1); datePicker.setMinDate(creationCalPlusOne.getTime().getTime()); datePicker.init(creationCalPlusOne.get(Calendar.YEAR), creationCalPlusOne.get(Calendar.MONTH), creationCalPlusOne.get(Calendar.DAY_OF_MONTH), null); } else { // Min Date: today + 1 day // at least one day after creation (today) todayCal.add(Calendar.DAY_OF_YEAR, 1); datePicker.setMinDate(todayCal.getTime().getTime()); datePicker.init(todayCal.get(Calendar.YEAR), todayCal.get(Calendar.MONTH), todayCal.get(Calendar.DAY_OF_MONTH), null); } alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dismiss(); long expiry; if (noExpiry.isChecked()) { expiry = 0L; } else { Calendar selectedCal = Calendar.getInstance(TimeZone.getDefault()); //noinspection ResourceType selectedCal.set(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth()); // date picker uses default time zone, we need to convert to UTC selectedCal.setTimeZone(TimeZone.getTimeZone("UTC")); long numDays = (selectedCal.getTimeInMillis() / 86400000) - (creationCal.getTimeInMillis() / 86400000); if (numDays <= 0) { Activity activity = getActivity(); if (activity != null) { Notify.create(activity, R.string.error_expiry_past, Style.ERROR).show(); } return; } expiry = selectedCal.getTime().getTime() / 1000; } Bundle data = new Bundle(); data.putSerializable(MESSAGE_DATA_EXPIRY, expiry); sendMessageToHandler(MESSAGE_NEW_EXPIRY, data); } }); alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dismiss(); } }); return alert.show(); }