List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.xalops.spotifystreamer.fragments.SearchListFragment.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.j a va2 s . c om*/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); //QUICK Inflate from XML file //inflater.inflate(R.layout.search_list_detail, root); // ------------------------------------------------------------------ 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.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ RelativeLayout rlayout = new RelativeLayout(context); EditText et = new EditText(getActivity()); et.setId(INTERNAL_SEARCH_FIELD_ID); et.setSingleLine(true); et.setInputType(InputType.TYPE_CLASS_TEXT); et.setImeOptions(EditorInfo.IME_ACTION_DONE); RelativeLayout.LayoutParams etRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); RelativeLayout.LayoutParams lframeRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); lframeRLayoutParams.addRule(RelativeLayout.BELOW, INTERNAL_SEARCH_FIELD_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); rlayout.addView(et, etRLayoutParams); rlayout.addView(lframe, lframeRLayoutParams); root.addView(rlayout, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:de.devmil.common.ui.color.HistorySelectorView.java
private void makeColorList() { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout colorlist = (LinearLayout) findViewById(R.id.colorlist); if (colors == null || colors.length() <= 0) { View nocolors = findViewById(R.id.nocolors); nocolors.setVisibility(View.VISIBLE); colorlist.setVisibility(View.GONE); findViewById(R.id.colorlistscroll).setVisibility(View.GONE); //have to remove it's parent container too return;//from w w w .j av a2 s . c o m } try { for (int i = colors.length() - 1; i >= 0; i--) { final int color = colors.getInt(i); ViewGroup boxgroup = (ViewGroup) inflater.inflate(R.layout.color_historyview_item, colorlist, false); TextView box = (TextView) boxgroup.findViewById(R.id.colorbox); box.setBackgroundColor(color); //box.setText("#"+Integer.toHexString(color)); colorlist.addView(boxgroup); box.setOnClickListener(new OnClickListener() { public void onClick(View v) { setColor(color); onColorChanged(); } }); } } catch (Exception e) { e.printStackTrace(); } }
From source file:nl.hnogames.domoticz.app.DomoticzCardFragment.java
private void showDebugLayout() { try {/* w w w . j a va 2 s.c om*/ 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); } } } catch (Exception ex) { } }
From source file:de.vanita5.twittnuker.fragment.support.BasePullToRefreshListFragment.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./*from w w w . j a va 2 s . c o m*/ * <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. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final 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.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final RefreshNowListView lv = new RefreshNowListView(getActivity()); lv.setId(android.R.id.list); lv.setOverScrollMode(View.OVER_SCROLL_NEVER); lv.setDrawSelectorOnTop(false); lv.setOnRefreshListener(this); lv.setConfig(ThemeUtils.buildRefreshNowConfig(context)); lv.setOnTouchListener(this); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final RefreshNowProgressIndicator indicator = new RefreshNowProgressIndicator(context); indicator.setConfig(ThemeUtils.buildRefreshIndicatorConfig(context)); final int indicatorHeight = Math.round(3 * getResources().getDisplayMetrics().density); lframe.addView(indicator, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, indicatorHeight, Gravity.TOP)); lv.setRefreshIndicatorView(indicator); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:org.odk.collect.android.activities.SplashScreenActivity.java
private void startSplashScreen(String path) { // add items to the splash screen here. makes things less distracting. ImageView iv = (ImageView) findViewById(R.id.splash); LinearLayout ll = (LinearLayout) findViewById(R.id.splash_default); File f = new File(path); if (f.exists()) { iv.setImageBitmap(decodeFile(f)); ll.setVisibility(View.GONE); iv.setVisibility(View.VISIBLE); }//from w ww . j a v a 2s.com // create a thread that counts up to the timeout Thread t = new Thread() { int count = 0; @Override public void run() { try { super.run(); while (count < mSplashTimeout) { sleep(100); count += 100; } } catch (Exception e) { e.printStackTrace(); } finally { endSplashScreen(); } } }; t.start(); }
From source file:org.proninyaroslav.libretorrent.fragments.DetailTorrentInfoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_detail_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); freeSpace = (TextView) v.findViewById(R.id.free_space); sequentialDownload.setOnClickListener(new View.OnClickListener() { @Override// www.ja v a2 s.co m public void onClick(View view) { if (callback != null) { callback.onTorrentInfoChanged(); } } }); Torrent torrent = getArguments().getParcelable(TAG_TORRENT); TorrentMetaInfo info = getArguments().getParcelable(TAG_INFO); if (info != null && torrent != null) { torrentNameField.setText(torrent.getName()); 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 { 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(torrent.getDownloadPath()); sequentialDownload.setChecked(torrent.isSequentialDownload()); freeSpace.setText(String.format(getString(R.string.free_space), Formatter.formatFileSize( activity.getApplicationContext(), FileIOUtils.getFreeSpace(torrent.getDownloadPath())))); } return v; }
From source file:org.ciasaboark.tacere.activity.fragment.SelectCalendarsFragment.java
private void hideError() { LinearLayout error = (LinearLayout) rootView.findViewById(R.id.error_box); error.setVisibility(View.GONE); }
From source file:org.ciasaboark.tacere.activity.fragment.MainSettingsFragment.java
private void drawAdvancedSettingsWidget() { LinearLayout advancedSettingsContainer = (LinearLayout) rootView .findViewById(R.id.settings_advanced_settings_container); if (showAdvancedSettingsLink) { advancedSettingsContainer.setVisibility(View.VISIBLE); LinearLayout advancedSettingsBox = (LinearLayout) rootView .findViewById(R.id.settings_advanced_settings_box); advancedSettingsBox.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . jav a2 s . c om*/ public void onClick(View v) { startActivity(new Intent(context, AdvancedSettingsActivity.class)); } }); } else { advancedSettingsContainer.setVisibility(View.GONE); } }
From source file:org.ciasaboark.tacere.activity.fragment.SelectCalendarsFragment.java
private void drawError() { hideDialogBody();/*from w ww .ja va2 s .com*/ LinearLayout error = (LinearLayout) rootView.findViewById(R.id.error_box); error.setVisibility(View.VISIBLE); }
From source file:com.kccomy.orgar.ui.note.NoteFragment.java
@Override public void onNodeLongClick(View view, final TreeNode treeNode, final int position) { LinearLayout menuLayout = (LinearLayout) view.findViewById(R.id.item_org_tree_llayout_menu); menuLayout.setVisibility(View.VISIBLE); ImageButton imgBtnEdit = (ImageButton) menuLayout.findViewById(R.id.item_org_tree_menu_ibtn_edit); imgBtnEdit.setOnClickListener(new View.OnClickListener() { @Override// w ww.ja v a 2s .com public void onClick(View view) { presenter.edit(treeNode); } }); ImageButton imageBtnAddNode = (ImageButton) menuLayout.findViewById(R.id.item_org_tree_menu_ibtn_add_node); imageBtnAddNode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { presenter.addNode(treeNode); } }); ImageButton imageButtonAddSub = (ImageButton) menuLayout .findViewById(R.id.item_org_tree_menu_ibtn_add_subnode); imageButtonAddSub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { presenter.addSubNode(treeNode); } }); ImageButton imageBtnDelete = (ImageButton) menuLayout.findViewById(R.id.item_org_tree_menu_ibtn_delete); imageBtnDelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { presenter.delete(treeNode); } }); }