List of usage examples for android.widget RelativeLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:nl.hnogames.domoticz.app.DomoticzCardFragment.java
private void setMessage(String message) { RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout); if (errorLayout != null) { errorLayout.setVisibility(View.VISIBLE); ImageView errorImage = (ImageView) root.findViewById(R.id.errorImage); errorImage.setImageResource(R.drawable.empty); errorImage.setAlpha(0.5f);//w w w. j a va 2 s . c o m errorImage.setVisibility(View.VISIBLE); TextView errorTextWrong = (TextView) root.findViewById(R.id.errorTextWrong); errorTextWrong.setVisibility(View.GONE); TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage); errorTextMessage.setText(message); } else throw new RuntimeException("Layout should have a RelativeLayout defined with the ID of errorLayout"); }
From source file:nl.hnogames.domoticz.app.DomoticzCardFragment.java
private void setErrorLayoutMessage(String message) { if (mPhoneConnectionUtil.isNetworkAvailable()) { RelativeLayout errorLayout = (RelativeLayout) root.findViewById(R.id.errorLayout); if (errorLayout != null) { errorLayout.setVisibility(View.VISIBLE); TextView errorTextMessage = (TextView) root.findViewById(R.id.errorTextMessage); errorTextMessage.setText(message); } else//w ww . ja v a 2s.com throw new RuntimeException( "Layout should have a RelativeLayout defined with the ID of errorLayout"); } }
From source file:com.maxleap.mall.fragments.MainFragment.java
private void initBanner(final View view) { RelativeLayout bannerLayout = (RelativeLayout) view.findViewById(R.id.banner_layout); bannerLayout.setVisibility(View.GONE); if (mBanners == null) { mBanners = new ArrayList<Banner>(); }/*from ww w . ja v a 2 s . c om*/ if (mBanners.isEmpty()) { fetchBannerData(bannerLayout); } else { bannerLayout.setVisibility(View.VISIBLE); } viewPager = (ViewPager) view.findViewById(R.id.head_view_pager); mBannerAdapter = new BannerAdapter(mContext, mBanners); viewPager.setAdapter(mBannerAdapter); final Indicator indicatorLayout = (Indicator) view.findViewById(R.id.head_indicator_layout); indicatorLayout.setCount(mBanners.size()); indicatorLayout.select(0); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { indicatorLayout.select(position); } @Override public void onPageScrollStateChanged(int state) { mSwipeRefreshLayout.setEnabled(state == ViewPager.SCROLL_STATE_IDLE); } }); final GestureDetector tapGestureDetector = new GestureDetector(getActivity(), new TapGestureListener()); viewPager.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { tapGestureDetector.onTouchEvent(event); return false; } }); }
From source file:fr.cph.chicago.fragment.BikeFragment.java
private final void loadList() { EditText filter = (EditText) mRootView.findViewById(R.id.bike_filter); if (mAdapter == null) { mAdapter = new BikeAdapter(mActivity); }//from w w w .ja v a 2 s. c om mListView.setAdapter(mAdapter); filter.addTextChangedListener(new TextWatcher() { private List<BikeStation> bikeStations = null; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { this.bikeStations = new ArrayList<BikeStation>(); } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { for (BikeStation bikeStation : BikeFragment.this.mBikeStations) { if (StringUtils.containsIgnoreCase(bikeStation.getName(), s.toString().trim())) { this.bikeStations.add(bikeStation); } } } @Override public void afterTextChanged(Editable s) { mAdapter.setBikeStations(this.bikeStations); mAdapter.notifyDataSetChanged(); } }); mListView.setVisibility(ListView.VISIBLE); mFilterView.setVisibility(ListView.VISIBLE); mLoadingLayout.setVisibility(RelativeLayout.INVISIBLE); RelativeLayout errorLayout = (RelativeLayout) mRootView.findViewById(R.id.error_layout); errorLayout.setVisibility(RelativeLayout.INVISIBLE); }
From source file:dynamite.zafroshops.app.fragment.ZopItemFragment.java
private void setLayout(LayoutInflater inflater, LinearLayout layout, final FullMobileZop zop, RelativeLayout loader) { LinearLayout item = (LinearLayout) layout.findViewById(R.id.itemZop); loader.setVisibility(View.VISIBLE); item.setVisibility(View.INVISIBLE); if (zop != null && zop.id != null && !zop.id.trim().equals("")) { MainActivity activity = (MainActivity) getActivity(); (activity).setCurrentItem(zop.id, zop); LinearLayout list = (LinearLayout) layout.findViewById(R.id.zopOpeningHours); ArrayList<MobileOpeningHourData> ohs = zop.getGroupedOpeningHours(); // set other fields ((ImageView) item.findViewById(R.id.zopImg)).setImageResource(R.drawable.nopictureyet); ((TextView) item.findViewById(R.id.zopName)).setText(zop.Name); ((TextView) item.findViewById(R.id.zopStreet)).setText(zop.Street + " " + zop.StreetNumber); ((TextView) item.findViewById(R.id.zopCity)).setText(zop.City); ((TextView) item.findViewById(R.id.zopCountry)).setText(zop.CountryName); LinearLayout linearLayout = ((LinearLayout) item.findViewById(R.id.zopServiceIcons)); linearLayout.removeAllViews();// w ww . j av a 2 s . c o m setView(zop.Type.toString(), zop.Type.getText(), linearLayout, inflater); for (Object s : zop.Services) { ZopServiceType zopServiceType = ((MobileZopService) s).Service; if (!zopServiceType.toString().equals(zop.Type.toString())) { setView(zopServiceType.toString(), zopServiceType.getText(), linearLayout, inflater); } } if (zop.Distance > 0) { ((TextView) item.findViewById(R.id.locatoin_km)).setText( " (" + String.format("%.0f", zop.Distance) + " " + getString(R.string.far_away) + ")"); } if (zop.PhoneNumber == null || zop.PhoneNumber.trim().equals("")) { item.findViewById(R.id.zopPhoneNumberLabel).setVisibility(View.INVISIBLE); } else { item.findViewById(R.id.zopPhoneNumberLabel).setVisibility(View.VISIBLE); ((TextView) item.findViewById(R.id.zopPhoneNumber)) .setText(zop.CountryPhoneCode + " " + zop.PhoneNumber); } if (zop.Details == null || zop.Details.trim().equals("")) { item.findViewById(R.id.zopDetailsLabel).setVisibility(View.INVISIBLE); } else { item.findViewById(R.id.zopDetailsLabel).setVisibility(View.VISIBLE); ((TextView) item.findViewById(R.id.zopDetails)).setText(zop.Details); } // set opening hours setOpeningsList(ohs, list, inflater, (TextView) item.findViewById(R.id.zopOpeningHoursLabel)); loader.setVisibility(View.INVISIBLE); item.setVisibility(View.VISIBLE); } }
From source file:com.greatspeeches.slides.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.description_layout, container, false); final android.support.v4.app.FragmentManager fragmentManager = myContext.getSupportFragmentManager(); fragmentManager.addOnBackStackChangedListener(new OnBackStackChangedListener() { @Override//from www .j a va2 s .c om public void onBackStackChanged() { if (fragmentManager.getBackStackEntryCount() == 0) { closeYVplayer(); } } }); scroll = (StickyScrollView) rootView.findViewById(R.id.topScroll); scroll.setTouchListener(touchHandler); fragmentsLayout = (FrameLayout) rootView.findViewById(R.id.video_container); // Set the title view to show the page number. infoData = ((TextView) rootView.findViewById(R.id.person_info)); infoData.setMaxLines(Integer.MAX_VALUE); infoData.setMovementMethod(new ScrollingMovementMethod()); infoData.setText("\t\t\t" + mPersonObj.getInfo()); personImg = (ImageView) rootView.findViewById(R.id.person_image); personImg.setBackgroundResource(GreateSpeechesUtil.getResId(mPersonObj.getImageId(), R.drawable.class)); cVideoView = (CustomVideoView) rootView.findViewById(R.id.surface_video); closeImg = (ImageView) rootView.findViewById(R.id.closeBtn); videoRel = (RelativeLayout) rootView.findViewById(R.id.forVideo); videoRel.setOnTouchListener(customTouchListener); fragmentsLayout.setOnTouchListener(customTouchListener); if (null != mPersonObj.getdDate() && mPersonObj.getdDate().length() == 0) { RelativeLayout dRel = (RelativeLayout) rootView.findViewById(R.id.dDateRel); dRel.setVisibility(View.GONE); } TextView bDateTxt = (TextView) rootView.findViewById(R.id.bDate); bDateTxt.setText("" + mPersonObj.getbDate()); TextView bachievementTxt = (TextView) rootView.findViewById(R.id.C_info); bachievementTxt.setText("" + mPersonObj.getAchievement()); // TextView pNameTxt = (TextView)rootView.findViewById(R.id.acTitleTxt); // pNameTxt.setText(""+getResources().getString(R.string.achievement, mPersonObj.getName())); TextView dDateTxt = (TextView) rootView.findViewById(R.id.dDate); dDateTxt.setText("" + mPersonObj.getdDate()); closeImg.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub closeVplayer(); } }); return rootView; }
From source file:be.artoria.belfortapp.fragments.MapFragment.java
private void toggleMap(boolean showMap) { final RelativeLayout mapview = (RelativeLayout) getView().findViewById(R.id.mapContainer); mapview.setVisibility(showMap ? View.VISIBLE : View.GONE); final ListView cntDesc = (ListView) getView().findViewById(R.id.lstRouteDesc); cntDesc.setVisibility(showMap ? View.GONE : View.VISIBLE); }
From source file:dynamite.zafroshops.app.fragment.ZopItemFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true);// ww w . j a v a2s . 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:dynamite.zafroshops.app.fragment.AllZopsFragment.java
private void setZops(boolean force) { Activity activity = getActivity();/*from w w w. j a v a 2 s. com*/ adapter = new AllZopsGridViewAdapter(activity, R.id.gridItem, types); final SharedPreferences preferences = activity.getPreferences(0); final SharedPreferences.Editor editor = preferences.edit(); if (!preferences.contains(StorageKeys.ZOPCATEGORY_KEY)) { InputStream is = getResources().openRawResource(R.raw.zops); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); HashMap<String, MobileZop> temp = new HashMap<>(); types = new ArrayList<>( (ArrayList<MobileZop>) new Gson().fromJson(reader, new TypeToken<ArrayList<MobileZop>>() { }.getType())); for (MobileZop type : types) { String key = type.Type.toString(); if (!temp.containsKey(key)) { temp.put(key, type); } } types = new ArrayList<>(temp.values()); if (adapter != null) { adapter.setObjects(types); adapter.notifyDataSetChanged(); } try { FileOutputStream fos = activity.openFileOutput(StorageKeys.ZOPCATEGORY_KEY, Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(types); oos.close(); fos.close(); editor.putString(StorageKeys.ZOPCATEGORY_KEY, Integer.toString(types.size())); editor.commit(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else { if (preferences.contains(StorageKeys.ZOPCATEGORY_KEY)) { try { FileInputStream fis = activity.openFileInput(StorageKeys.ZOPCATEGORY_KEY); ObjectInputStream ois = new ObjectInputStream(fis); types = (ArrayList) ois.readObject(); ois.close(); fis.close(); if (adapter != null) { adapter.setObjects(types); adapter.notifyDataSetChanged(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (StreamCorruptedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } ListenableFuture<JsonElement> result = MainActivity.MobileClient.invokeApi("mobileZop", "GET", new ArrayList<Pair<String, String>>() { { add(new Pair<String, String>("count", "true")); } }); Futures.addCallback(result, new FutureCallback<JsonElement>() { @Override public void onSuccess(JsonElement result) { Activity activity = getActivity(); JsonArray typesAsJson = result.getAsJsonArray(); if (typesAsJson != null) { types = new Gson().fromJson(result, new TypeToken<ArrayList<MobileZop>>() { }.getType()); try { FileOutputStream fos = activity.openFileOutput(StorageKeys.ZOPCATEGORY_KEY, Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(types); oos.close(); fos.close(); editor.putString(StorageKeys.ZOPCATEGORY_KEY, Integer.toString(types.size())); editor.commit(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } if (adapter != null) { adapter.setObjects(types); GridView zops = (GridView) activity.findViewById(R.id.gridViewZops); RelativeLayout loader = (RelativeLayout) activity.findViewById(R.id.relativeLayoutLoader); loader.setVisibility(View.INVISIBLE); zops.setVisibility(View.VISIBLE); adapter.notifyDataSetChanged(); } } @Override public void onFailure(@NonNull Throwable t) { Activity activity = getActivity(); if (activity != null && types.size() == 0) { GridView zops = (GridView) activity.findViewById(R.id.gridViewZops); RelativeLayout loader = (RelativeLayout) activity.findViewById(R.id.relativeLayoutLoader); zops.setVisibility(View.INVISIBLE); loader.setVisibility(View.VISIBLE); } } }); } }
From source file:dynamite.zafroshops.app.fragment.AddZopFragment.java
public void resetVisibility() { View view = getView();/*from ww w . j a v a 2 s .co m*/ RelativeLayout loader = (RelativeLayout) view.findViewById(R.id.relativeLayoutLoader); LinearLayout zop = (LinearLayout) view.findViewById(R.id.itemZopAdd); loader.setVisibility(View.INVISIBLE); zop.setVisibility(View.VISIBLE); }