List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.krayzk9s.imgurholo.ui.MessagingFragment.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; Log.d("Theme", settings.getString("theme", MainActivity.HOLO_LIGHT) + ""); if (settings.getString("theme", MainActivity.HOLO_LIGHT).equals(MainActivity.HOLO_LIGHT)) messageAdapter = new MessageAdapter(activity, R.layout.message_layout); else/*from www .j ava 2s . c o m*/ messageAdapter = new MessageAdapter(activity, R.layout.message_layout_dark); if (savedInstanceState == null) { getMessages(); } else { ArrayList<JSONParcelable> messageDataArray = savedInstanceState.getParcelableArrayList("content"); messageAdapter.addAll(messageDataArray); messageAdapter.notifyDataSetChanged(); } mDrawerList.setAdapter(messageAdapter); if (messageData != null) mDrawerList.setClickable(false); else mDrawerList.setOnItemClickListener(new ItemClickListener()); return view; }
From source file:dynamite.zafroshops.app.fragment.ZopItemFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true);//from www .java 2 s . c o m final String id = getArguments().getString(ARG_ZOP_ID); InputStream is = getResources().openRawResource(R.raw.zops); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); ArrayList<FullMobileZop> zops = new ArrayList<>(Collections2.filter( (ArrayList<FullMobileZop>) new Gson().fromJson(reader, new TypeToken<ArrayList<FullMobileZop>>() { }.getType()), new Predicate<FullMobileZop>() { @Override public boolean apply(FullMobileZop input) { return input.id.equals(id); } })); if (zops.size() == 1) { zop = zops.get(0); } ArrayList<Pair<String, String>> parameters = new ArrayList<Pair<String, String>>() { { add(new Pair<>("fullId", id)); } }; ListenableFuture<JsonElement> result = MainActivity.MobileClient.invokeApi("mobileZop", "GET", parameters); Futures.addCallback(result, new FutureCallback<JsonElement>() { Activity activity = getActivity(); @Override public void onSuccess(JsonElement result) { JsonObject typesAsJson = result.getAsJsonObject(); if (typesAsJson != null) { zop = new Gson().fromJson(result, FullMobileZop.class); } setZop(activity); } @Override public void onFailure(@NonNull Throwable t) { if (zop == null) { LinearLayout itemZop = (LinearLayout) activity.findViewById(R.id.itemZop); RelativeLayout loader = (RelativeLayout) activity.findViewById(R.id.relativeLayoutLoader); itemZop.setVisibility(View.INVISIBLE); loader.setVisibility(View.VISIBLE); } } }); }
From source file:org.ciasaboark.tacere.activity.fragment.EventDetailsFragment.java
private void drawExtendMinutesWidgets() { final LinearLayout extendMinutesBox = (LinearLayout) view.findViewById(R.id.event_extend_box); if (event.getExtendMinutes() == 0) { extendMinutesBox.setVisibility(View.GONE); } else {/*from ww w .jav a 2 s .c om*/ extendMinutesBox.setVisibility(View.VISIBLE); TextView extendMinutesText = (TextView) view.findViewById(R.id.event_extend_text); extendMinutesText.setText("+" + event.getExtendMinutes() + " minutes"); Button extendMinutesResetButton = (Button) view.findViewById(R.id.event_extend_button); extendMinutesResetButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(context, ExtendEventService.class); i.putExtra(ExtendEventService.INSTANCE_ID, event.getId()); i.putExtra(ExtendEventService.NEW_EXTEND_LENGTH, 0); context.startService(i); extendMinutesBox.setVisibility(View.INVISIBLE); } }); } }
From source file:ca.frozen.rpicameraviewer.activities.SourceFragment.java
public void configure(Source source, boolean forCamera) { // save the parameters this.source = source; this.forCamera = forCamera; final View view = getView(); if (forCamera) { Spinner spinner = (Spinner) view.findViewById(R.id.source_connection_type); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override//ww w .j av a 2s .c o m public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { configureConnectionType(view, connectionTypes.get(position)); } @Override public void onNothingSelected(AdapterView<?> parentView) { } }); connectionTypes = new ArrayList<>(); connectionTypes.add(Source.ConnectionType.RawTcpIp); connectionTypes.add(Source.ConnectionType.RawHttp); connectionTypes.add(Source.ConnectionType.RawMulticast); configureConnectionType(view, getConnectionType(view)); } else { LinearLayout layout = (LinearLayout) view.findViewById(R.id.source_connection_type_row); layout.setVisibility(View.GONE); if (source.connectionType != Source.ConnectionType.RawMulticast) { layout = (LinearLayout) view.findViewById(R.id.source_address_row); layout.setVisibility(View.GONE); } EditText edit = (EditText) view.findViewById(R.id.source_port); edit.setHint(""); edit = (EditText) view.findViewById(R.id.source_width); edit.setHint(R.string.use_stream_width); edit = (EditText) view.findViewById(R.id.source_height); edit.setHint(R.string.use_stream_height); edit = (EditText) view.findViewById(R.id.source_fps); edit.setHint(R.string.dont_set); edit = (EditText) view.findViewById(R.id.source_bps); edit.setHint(R.string.dont_set); } // set the view values setViews(source); }
From source file:com.i2max.i2smartwork.common.work.WorkDetailViewFragment.java
public void setFilesLayout(String title, LinearLayout targetLayout, Object object) { final List<LinkedTreeMap<String, String>> filesList = (List<LinkedTreeMap<String, String>>) object; if (filesList == null || filesList.size() <= 0) { targetLayout.setVisibility(View.GONE); } else {//from ww w . j av a 2 s .c o m Log.e(TAG, "fileList size =" + filesList.size()); targetLayout.setVisibility(View.VISIBLE); targetLayout.removeAllViews(); //addTitleView LinearLayout.LayoutParams tvParam = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); tvParam.setMargins(0, DisplayUtil.dip2px(getActivity(), 12), 0, DisplayUtil.dip2px(getActivity(), 10)); TextView tvTitle = new TextView(getActivity()); tvTitle.setLayoutParams(tvParam); if (Build.VERSION.SDK_INT < 23) { tvTitle.setTextAppearance(getActivity(), android.R.style.TextAppearance_Material_Medium); } else { tvTitle.setTextAppearance(android.R.style.TextAppearance_Material_Medium); } tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15); tvTitle.setTextColor(getResources().getColor(R.color.text_color_black)); tvTitle.setText(title); targetLayout.addView(tvTitle); //addFilesView for (int i = 0; i < filesList.size(); i++) { final LinkedTreeMap<String, String> fileMap = filesList.get(i); LayoutInflater inflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View fileView = inflater.inflate(R.layout.view_item_file, null); ImageView ivIcFileExt = (ImageView) fileView.findViewById(R.id.iv_ic_file_ext); TextView tvFileNm = (TextView) fileView.findViewById(R.id.tv_file_nm); //?? ? ivIcFileExt.setImageResource(R.drawable.ic_file_doc); String fileNm = FormatUtil.getStringValidate(fileMap.get("file_nm")); tvFileNm.setText(fileNm); FileUtil.setFileExtIcon(ivIcFileExt, fileNm); final String fileExt = FileUtil.getFileExtsion(fileNm); final String downloadURL = I2UrlHelper.File .getDownloadFile(FormatUtil.getStringValidate(fileMap.get("file_id"))); fileView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = null; if ("Y".equals(FormatUtil.getStringValidate(fileMap.get("conv_yn")))) { //i2viewer ? ( conv_yn='Y') intent = IntentUtil.getI2ViewerIntent( FormatUtil.getStringValidate(fileMap.get("file_id")), FormatUtil.getStringValidate(fileMap.get("file_nm"))); getActivity().startActivity(intent); } else if ("mp4".equalsIgnoreCase(fileExt) || "fla".equalsIgnoreCase(fileExt) || "wmv".equalsIgnoreCase(fileExt) || "avi".equalsIgnoreCase(fileExt)) { //video intent = IntentUtil.getVideoPlayIntent(downloadURL); } else { //? ?? intent = new Intent(Intent.ACTION_VIEW, Uri.parse(downloadURL)); Bundle bundle = new Bundle(); bundle.putString("Authorization", I2UrlHelper.getTokenAuthorization()); intent.putExtra(Browser.EXTRA_HEADERS, bundle); Log.d(TAG, "intent:" + intent.toString()); } getActivity().startActivity(intent); } }); targetLayout.addView(fileView); } } }
From source file:de.enlightened.peris.ForumSettingsFragment.java
private void setupDisplayNameButton() { //Display name button final LinearLayout forumSettingDisplayName = (LinearLayout) getActivity() .findViewById(R.id.forum_setting_display_name); forumSettingDisplayName.setVisibility(View.GONE); }
From source file:net.palacesoft.cngstation.client.StationActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.refresh: try {/*from ww w . j a v a 2 s . c o m*/ Address locationAddress = lookupAddressFromLocation(currentLocation); new StationLoader(this, locationAddress, getZoomLevel(), STATIONS_URL).execute(); } catch (AddressEmptyException e) { showInfoMessage("Could not determine your current location"); } catch (IOException e) { showInfoMessage("Network error. Try refreshing."); } break; case R.id.search: LinearLayout linearLayout = (LinearLayout) findViewById(R.id.searchLayout); if (linearLayout.getVisibility() == View.VISIBLE) { linearLayout.setVisibility(View.INVISIBLE); } else { linearLayout.setVisibility(View.VISIBLE); if (countries == null) { initSearchForm(); loadAvailableCountriesList(); } } break; case R.id.settings: startActivity(new Intent(this, Preferences.class)); break; case R.id.cheapest: try { stationOverlay.popupCheapest(); } catch (Exception e) { logError(e, "Could not show the cheapest station"); } break; case R.id.closest: try { stationOverlay.popupClosest(); } catch (Exception e) { logError(e, "Could not show the closest station"); } break; } return false; }
From source file:org.onebusaway.android.ui.ListFragment.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 ww w. j a v a 2 s . c o m*/ @Override @SuppressWarnings("deprecation") 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(R.id.loading); 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(R.id.listContainer); TextView tv = new TextView(getActivity()); tv.setId(R.id.internalEmpty); tv.setGravity(Gravity.CENTER); lframe.addView(tv, 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:de.grobox.liberario.StationsFragment.java
@Override public void onNetworkProviderChanged(NetworkProvider np) { if (mView == null) return;//from w w w . j a va2 s . co m LinearLayout departuresLayout = (LinearLayout) mView.findViewById(R.id.departuresLayout); if (np.hasCapabilities(Capability.DEPARTURES)) { departuresLayout.setVisibility(View.VISIBLE); // clear favorites for auto-complete AutoCompleteTextView stationView = ((AutoCompleteTextView) mView.findViewById(R.id.stationView)); if (stationView.getAdapter() != null) { ((LocationAdapter) stationView.getAdapter()).resetList(); } // clear text view setStation(null); // hide text clear button ImageButton stationClearButton = (ImageButton) mView.findViewById(R.id.stationClearButton); stationClearButton.setVisibility(View.GONE); } else { departuresLayout.setVisibility(View.GONE); } LinearLayout nearbyStationsLayout = (LinearLayout) mView.findViewById(R.id.nearbyStationsLayout); if (np.hasCapabilities(Capability.NEARBY_STATIONS)) { nearbyStationsLayout.setVisibility(View.VISIBLE); } else { nearbyStationsLayout.setVisibility(View.GONE); } }
From source file:edu.byu.scriptures.controller.fragment.RestartableRecyclerFragment.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 av a2 s . c om*/ @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.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_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); tv.setTextSize(18); int padding = ((MainActivity) getActivity()).getMetricsManager().dpToRawPixels(20); tv.setPadding(padding, 0, padding, 0); tv.setTextColor(ContextCompat.getColor(getActivity(), R.color.text_normal)); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); RecyclerView recyclerView = new RecyclerView(getActivity()); recyclerView.setId(android.R.id.list); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); // lv.setDrawSelectorOnTop(false); lframe.addView(recyclerView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 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; }