List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:de.tobiasbielefeld.solitaire.dialogs.DialogWon.java
@Override @NonNull/*from w ww. j av a 2s . c om*/ public Dialog onCreateDialog(Bundle savedState) { final GameManager gameManager = (GameManager) getActivity(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.dialog_won, null); builder.setCustomTitle(view).setItems(R.array.won_menu, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // "which" argument contains index of selected item switch (which) { case 0: gameLogic.newGame(); break; case 1: gameLogic.redeal(); break; case 2: if (gameManager.hasLoaded) { timer.save(); gameLogic.setWonAndReloaded(); gameLogic.save(); } gameManager.finish(); break; } } }).setNegativeButton(R.string.game_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //just cancel } }); LinearLayout layoutScores = (LinearLayout) view.findViewById(R.id.dialog_won_layout_scores); //only show the calculation of the score if bonus is enabled if (currentGame.isBonusEnabled()) { layoutScores.setVisibility(View.VISIBLE); TextView text1 = (TextView) view.findViewById(R.id.dialog_won_text1); TextView text2 = (TextView) view.findViewById(R.id.dialog_won_text2); TextView text3 = (TextView) view.findViewById(R.id.dialog_won_text3); score = (savedState != null && savedState.containsKey(KEY_SCORE)) ? savedState.getLong(KEY_SCORE) : scores.getPreBonus(); bonus = (savedState != null && savedState.containsKey(KEY_BONUS)) ? savedState.getLong(KEY_BONUS) : scores.getBonus(); total = (savedState != null && savedState.containsKey(KEY_TOTAL)) ? savedState.getLong(KEY_TOTAL) : scores.getScore(); text1.setText( String.format(Locale.getDefault(), getContext().getString(R.string.dialog_win_score), score)); text2.setText( String.format(Locale.getDefault(), getContext().getString(R.string.dialog_win_bonus), bonus)); text3.setText( String.format(Locale.getDefault(), getContext().getString(R.string.dialog_win_total), total)); } else { layoutScores.setVisibility(View.GONE); } return applyFlags(builder.create()); }
From source file:de.androvdr.fragments.ChannelsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (!Preferences.showCurrentChannel) { LinearLayout lay = (LinearLayout) mActivity.findViewById(R.id.channels_currentchannel); lay.setVisibility(View.GONE); }/*from www . ja va2 s .co m*/ mListView = (ListView) mActivity.findViewById(android.R.id.list); /* * setTheme doesn't change background color :( */ if (Preferences.blackOnWhite) mListView.setBackgroundColor(Color.WHITE); mSearchTime = mActivity.getIntent().getLongExtra(SEARCHTIME, 0); mController = new ChannelController(mActivity, mHandler, mListView, mSearchTime); mController.setOnChannelSelectedListener(this); getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); if (mActivity.isDualPane()) { getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); mUpdateSelectedItemThread = new UpdateSelectedItemThread() { @Override public int getPosition() { int position = mCurrentItemIndex; if (position == -1 && getListView().getCount() > 0) position = 0; return position; } }; } }
From source file:dynamite.zafroshops.app.fragment.NearestZopsFragment.java
private void resetVisibility(ListView zops, LinearLayout noZops, RelativeLayout loader, boolean showLoader) { Activity activity = getActivity();/*from w w w. j av a 2s . c o m*/ if (nearestZops.size() == 0) { noZops.setVisibility(View.VISIBLE); zops.setVisibility(View.INVISIBLE); } else { noZops.setVisibility(View.INVISIBLE); zops.setVisibility(View.VISIBLE); } if (showLoader) { zops.setVisibility(View.INVISIBLE); noZops.setVisibility(View.INVISIBLE); loader.setVisibility(View.VISIBLE); } else { loader.setVisibility(View.INVISIBLE); } }
From source file:com.krayzk9s.imgurholo.ui.CommentsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.account_layout, container, false); LinearLayout headerLayout = (LinearLayout) view.findViewById(R.id.header); headerLayout.setVisibility(View.GONE); errorText = (TextView) view.findViewById(R.id.error); mDrawerList = (ListView) view.findViewById(R.id.account_list); ImgurHoloActivity activity = (ImgurHoloActivity) getActivity(); SharedPreferences settings = activity.getApiCall().settings; if (settings.getString("theme", MainActivity.HOLO_LIGHT).equals(MainActivity.HOLO_LIGHT)) commentsAdapter = new MessageAdapter(activity, R.layout.comment_layout); else/* w w w . ja va 2s . co m*/ commentsAdapter = new MessageAdapter(activity, R.layout.comment_layout_dark); String[] mMenuList = getResources().getStringArray(R.array.emptyList); ArrayAdapter<String> tempAdapter; if (settings.getString("theme", MainActivity.HOLO_LIGHT).equals(MainActivity.HOLO_LIGHT)) tempAdapter = new ArrayAdapter<String>(activity, R.layout.comment_layout, mMenuList); else tempAdapter = new ArrayAdapter<String>(activity, R.layout.comment_layout_dark, mMenuList); mDrawerList.setAdapter(tempAdapter); if (savedInstanceState == null) { getComments(); } else { commentDataArray = savedInstanceState.getParcelableArrayList("content"); commentsAdapter.addAll(commentDataArray); mDrawerList.setAdapter(commentsAdapter); commentsAdapter.notifyDataSetChanged(); } return view; }
From source file:com.hanyao.passwordmanager.activity.MainActivity.java
@Override protected void onStart() { super.onStart(); LinearLayout textView = (LinearLayout) findViewById(R.id.no_password_tip); textView.setVisibility(View.GONE); ListView listView = (ListView) findViewById(R.id.main_list_view); final PasswordPresenter passwordPresenter = new PasswordPresenter(); Map<String[], Password> map = passwordPresenter.getPassword(); if (map == null) { textView.setVisibility(View.VISIBLE); listView.setVisibility(View.GONE); return;//ww w. ja va2s .co m } listView.setVisibility(View.VISIBLE); final List<PasswordList> passwordListList = new ArrayList<>(); for (Map.Entry<String[], Password> entry : map.entrySet()) { PasswordList passwordList = new PasswordList(entry.getKey()[0], entry.getKey()[1]); passwordList.setPasswordString(entry.getKey()[2]); passwordList.setPassword(entry.getValue()); passwordListList.add(passwordList); } Collections.sort(passwordListList); PasswordListAdapter passwordListAdapter = new PasswordListAdapter(MainActivity.this, R.layout.new_password_list_layout, passwordListList); listView.setAdapter(passwordListAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PasswordList passwordList = passwordListList.get(position); Intent intent = new Intent(MainActivity.this, DisplayPasswordActivity.class); intent.putExtra("password", passwordList.getPassword()); passwordPresenter.addSee(passwordList.getPassword()); startActivity(intent); } }); }
From source file:com.android.calculator2.Fragment.java
@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);//w w w.j av a2 s . c om 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_VIEW_CONTAINER_ID); View cv = inflateView(savedInstanceState); cv.setId(android.R.id.content); lframe.addView(cv, 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:de.enlightened.peris.ColorPickerDialogFragment.java
private void setupColorPicker(final View v) { final Bundle bundle = getArguments(); if (bundle != null) { if (bundle.containsKey("show_opacity")) { this.showOpacity = bundle.getBoolean("show_opacity"); }/*from w w w . j a va 2 s. c o m*/ } this.colorPickerColorsLayout = (LinearLayout) v.findViewById(R.id.color_picker_colors_layout); final LinearLayout opacityLayout = (LinearLayout) v.findViewById(R.id.color_picker_opacity_layout); if (this.showOpacity) { opacityLayout.setVisibility(View.VISIBLE); final SeekBar colorOpacitySeeker = (SeekBar) v.findViewById(R.id.color_opacity_seeker); colorOpacitySeeker.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override @SuppressWarnings("checkstyle:requirethis") public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) { // TODO Auto-generated method stub opacity = progress; final float opacityPercent = progress / (float) MAX_OPACITY; //Log.d(TAG ,progress + "/255 = " + opacityPercent); colorPickerColorsLayout.setAlpha(opacityPercent); } @Override public void onStartTrackingTouch(final SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStopTrackingTouch(final SeekBar seekBar) { // TODO Auto-generated method stub } }); } else { opacityLayout.setVisibility(View.GONE); } final LinearLayout llPicker = (LinearLayout) v.findViewById(R.id.profileColorPicker); llPicker.setVisibility(View.VISIBLE); v.findViewById(R.id.pickColor1).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor2).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor3).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor4).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor5).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor6).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor7).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor8).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor9).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor10).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor11).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor12).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor13).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor14).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor15).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor16).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor17).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor18).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor19).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor20).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor21).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor22).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor23).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor24).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor25).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor26).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor27).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor28).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor29).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor30).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor31).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor32).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor33).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor34).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor35).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor36).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor37).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor38).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor39).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor40).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor41).setOnClickListener(this.colorSetter); v.findViewById(R.id.pickColor42).setOnClickListener(this.colorSetter); }
From source file:org.proninyaroslav.libretorrent.fragments.AddTorrentInfoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_add_torrent_info, container, false); torrentNameField = (EditText) v.findViewById(R.id.torrent_name); layoutTorrentName = (TextInputLayout) v.findViewById(R.id.layout_torrent_name); sha1HashView = (TextView) v.findViewById(R.id.torrent_hash_sum); commentView = (TextView) v.findViewById(R.id.torrent_comment); createdByView = (TextView) v.findViewById(R.id.torrent_created_in_program); torrentSizeView = (TextView) v.findViewById(R.id.torrent_size); fileCountView = (TextView) v.findViewById(R.id.torrent_file_count); creationDateView = (TextView) v.findViewById(R.id.torrent_create_date); pathToUploadView = (TextView) v.findViewById(R.id.upload_torrent_into); folderChooserButton = (ImageButton) v.findViewById(R.id.folder_chooser_button); sequentialDownload = (CheckBox) v.findViewById(R.id.sequential_download); startTorrent = (CheckBox) v.findViewById(R.id.start_torrent); freeSpace = (TextView) v.findViewById(R.id.free_space); TorrentMetaInfo info = getArguments().getParcelable(TAG_INFO); if (info != null) { torrentNameField.setText(info.getTorrentName()); sha1HashView.setText(info.getSha1Hash()); if (TextUtils.isEmpty(info.getComment())) { commentView.setVisibility(View.GONE); LinearLayout commentViewLayout = (LinearLayout) v.findViewById(R.id.layout_torrent_comment); commentViewLayout.setVisibility(View.GONE); TextView commentViewHeader = (TextView) v.findViewById(R.id.header_torrent_comment); commentViewHeader.setVisibility(View.GONE); } else {//from w w w .j a va 2s . c om commentView.setText(info.getComment()); } if (TextUtils.isEmpty(info.getCreatedBy())) { createdByView.setVisibility(View.GONE); LinearLayout createdByViewLayout = (LinearLayout) v .findViewById(R.id.layout_torrent_created_in_program); createdByViewLayout.setVisibility(View.GONE); TextView createdByViewHeader = (TextView) v.findViewById(R.id.header_torrent_created_in_program); createdByViewHeader.setVisibility(View.GONE); } else { createdByView.setText(info.getCreatedBy()); } torrentSizeView.setText(Formatter.formatFileSize(activity, info.getTorrentSize())); creationDateView .setText(SimpleDateFormat.getDateTimeInstance().format(new Date(info.getCreationDate()))); fileCountView.setText(Integer.toString(info.getFileCount())); pathToUploadView.setText(downloadDir); freeSpace.setText(String.format(getString(R.string.free_space), Formatter .formatFileSize(activity.getApplicationContext(), FileIOUtils.getFreeSpace(downloadDir)))); } startTorrent.setChecked(true); return v; }
From source file:com.bytestemplar.tonedef.touchpad.TouchPadActivity.java
protected void setup(boolean disable_dialstring, boolean disable_menu) throws Exception { _disable_menu = disable_menu;//w w w . j av a 2 s . c o m // only load preferences if we've been supplied their id if ((_pref_mark != null) && (_pref_delay != null) && (_pref_space != null)) { _delay_mark = Integer.parseInt(_preferences.getString(_pref_mark, "250")); _delay_space = Integer.parseInt(_preferences.getString(_pref_space, "100")); _del_delay = Integer.parseInt(_preferences.getString(_pref_delay, "1000")); } // ensure we have a _tonebank if (_tonebank == null) { throw new Exception("No tone bank defined (use setToneBank)"); } // ensure we have a layout to inflate if (_touchpad_layout == 0) { throw new Exception("No container layout ID specified (use setTouchPadLayoutId)"); } // inflate layout LinearLayout content_container = (LinearLayout) findViewById(R.id.touchpad_content); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(_touchpad_layout, content_container, true); // let descendant define _buttons defineToneButtons(_buttons); if (_buttons.buttons.size() == 0) { throw new Exception("At least one button must be defined via defineToneButtons"); } assertInvertState(true); if (disable_dialstring) { LinearLayout ll = (LinearLayout) findViewById(R.id.touchpad_dialingstring); ll.setVisibility(View.GONE); } UICustom.getInstance().updateActivity(this); }
From source file:nl.hnogames.domoticz.app.DomoticzFragment.java
private void showDebugLayout() { try {// w ww . j a va2 s .c o m if (root != null) { LinearLayout debugLayout = (LinearLayout) root.findViewById(R.id.debugLayout); if (debugLayout != null) { debugLayout.setVisibility(View.VISIBLE); debugText = (TextView) root.findViewById(R.id.debugText); if (debugText != null) { debugText.setMovementMethod(new ScrollingMovementMethod()); debugText.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { mDomoticz.debugTextToClipboard(debugText); return false; } }); } } } } catch (Exception ex) { } }