List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.coinblesk.client.ui.authview.AuthenticationDialog.java
@Override @NonNull/*ww w .j a v a 2s. c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { address = getArguments().getString(ARG_ADDRESS); amount = Coin.valueOf(getArguments().getLong(ARG_AMOUNT)); final String paymentReq = getArguments().getString(ARG_PAYMENT_REQUEST); final boolean isPayerMode = getArguments().getBoolean(ARG_IS_PAYER_MODE); authView = getActivity().getLayoutInflater().inflate(R.layout.fragment_authview_dialog, null); final TextView addressTextView = (TextView) authView.findViewById(R.id.authview_address_content); addressTextView.setText(address); final LinearLayout authviewContainer = (LinearLayout) authView.findViewById(R.id.authview_container); authviewContainer.addView(new AuthenticationView(getContext(), paymentReq.getBytes())); final LinearLayout feeContainer = (LinearLayout) authView.findViewById(R.id.authview_fee_container); feeContainer.setVisibility(isPayerMode ? View.VISIBLE : View.GONE); final Button cancelButton = (Button) authView.findViewById(R.id.authview_button_cancel); //cancelButton.setEnabled(false); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (listener != null) { listener.authViewNegativeResponse(); } dismiss(); } }); final Switch cancelSwitch = (Switch) authView.findViewById(R.id.authview_switch_cancel); cancelSwitch.setVisibility(View.GONE); /*cancelSwitch.setChecked(false); cancelSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { cancelButton.setEnabled(isChecked); } });*/ final Button acceptButton = (Button) authView.findViewById(R.id.authview_button_accept); if (isPayerMode) { acceptButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (listener != null) { listener.authViewPositiveResponse(); } dismiss(); } }); } else { acceptButton.setVisibility(View.GONE); } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialogAccent); builder.setTitle(R.string.authview_title).setView(authView).setCancelable(false); /* .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (listener != null) { listener.authViewNegativeResponse(); } } }); if (isPayerMode) { builder.setPositiveButton(R.string.accept, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (listener != null) { listener.authViewPositiveResponse(); } } }); } */ return builder.create(); }
From source file:com.inovex.zabbixmobile.activities.fragments.ChecksApplicationsFragment.java
/** * Dismisses the loading spinner view./*w w w .j a v a 2 s. c o m*/ * * If the view has not yet been created, the status is saved and when the * view is created, the spinner will not be shown at all. */ public void dismissApplicationsProgressBar() { mApplicationsProgressBarVisible = false; if (getView() != null) { LinearLayout progressLayout = (LinearLayout) getView().findViewById(R.id.applications_progress_layout); if (progressLayout != null) { progressLayout.setVisibility(View.GONE); } } }
From source file:com.ashoksm.pinfinder.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar); setSupportActionBar(toolbar);/* w w w .j av a 2s .com*/ // add to fix crashes in 2.3.x devices due to google play services try { Class.forName("android.os.AsyncTask"); } catch (ClassNotFoundException e) { } // Create the interstitial. interstitial = new InterstitialAd(this); interstitial.setAdUnitId(getString(R.string.admob_id)); // load ad final LinearLayout adParent = (LinearLayout) this.findViewById(R.id.ad); final AdView ad = new AdView(this); ad.setAdUnitId(getString(R.string.admob_id)); ad.setAdSize(AdSize.SMART_BANNER); final AdListener listener = new AdListener() { @Override public void onAdLoaded() { adParent.setVisibility(View.VISIBLE); super.onAdLoaded(); } @Override public void onAdFailedToLoad(int errorCode) { adParent.setVisibility(View.GONE); super.onAdFailedToLoad(errorCode); } }; ad.setAdListener(listener); adParent.addView(ad); AdRequest adRequest = new AdRequest.Builder().build(); ad.loadAd(adRequest); // Begin loading your interstitial. interstitial.loadAd(adRequest); if (savedInstanceState == null) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); SlidingTabsBasicFragment fragment = new SlidingTabsBasicFragment(); transaction.replace(R.id.pinfinder_content_fragment, fragment); transaction.commit(); } }
From source file:mx.klozz.xperience.tweaker.fragments.BatteryInfo.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup root, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.battery_info, root, false); mBattery_Percent = (TextView) view.findViewById(R.id.battery_percent); mBattery_volt = (TextView) view.findViewById(R.id.battery_volt); mBattery_Status = (TextView) view.findViewById(R.id.battery_status); mBatteryIcon = (ImageView) view.findViewById(R.id.battery_icon); //Checamos si existe algo relacionado con la direccion de voltajes if (new File(BAT_VOLT_PATH).exists()) { int volt = Integer.parseInt(Helpers.LeerUnaLinea(BAT_VOLT_PATH));//vemos si existe el directorio if (volt > 5000) volt = (int) Math.round(volt / 1000.0);//Convertimos a microvolts mBattery_volt.setText(volt + " mV");//Hacemos visible los datos mBatteryIcon.setVisibility(ImageView.GONE); mBattery_volt.setVisibility(TextView.VISIBLE); mBattery_volt.setOnClickListener(new View.OnClickListener() { @Override//from ww w . j a va2 s. c o m public void onClick(View view) { Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY); if (powerUsageIntent.resolveActivity(context.getPackageManager()) != null) startActivity(powerUsageIntent); } }); mBattery_volt.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { mBatteryIcon.setVisibility(ImageView.VISIBLE); mBattery_volt.setVisibility(TextView.GONE); return true; } }); } else { mBatteryIcon.setVisibility(ImageView.VISIBLE); mBattery_volt.setVisibility(TextView.GONE); mBatteryIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY); startActivity(powerUsageIntent); } catch (Exception e) { } } }); } mFastChargePath = Helpers.fastcharge_path(); if (mFastChargePath != null) { no_settings = false; mFastChargeOnBoot = (Switch) view.findViewById(R.id.fastcharge_sob); mFastChargeOnBoot.setChecked( mPreferences.getBoolean(PREF_FASTCHARGE, Helpers.LeerUnaLinea(mFastChargePath).equals("1"))); mFastChargeOnBoot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton v, boolean checked) { mPreferences.edit().putBoolean(PREF_FASTCHARGE, checked).apply(); final NotificationManager NM = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); if (checked) { new CMDProcessor().su.runWaitFor("busybox exho 1 > " + mFastChargePath); Notification N = new Notification.Builder(context) .setContentTitle(context.getText(R.string.app_name)) .setContentText(context.getText(R.string.fast_charge_notification_title)) .setTicker(context.getText(R.string.fast_charge_notification_title)) .setSmallIcon(R.drawable.ic_fastcharge).setWhen(System.currentTimeMillis()) .getNotification(); NM.notify(1337, N); } else { new CMDProcessor().su.runWaitFor("busybox echo 0 > " + mFastChargePath); NM.cancel(1337); } } }); } else { LinearLayout mPart = (LinearLayout) view.findViewById(R.id.fastcharge_layout); mPart.setVisibility(LinearLayout.GONE); } if (no_settings) { LinearLayout NS = (LinearLayout) view.findViewById(R.id.no_settings); NS.setVisibility(LinearLayout.VISIBLE); } return view; }
From source file:de.grobox.liberario.StationsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); // remember view for UI changes when fragment is not active mView = inflater.inflate(R.layout.fragment_stations, container, false); NetworkProvider np = NetworkProviderFactory.provider(Preferences.getNetworkId(getActivity())); if (np.hasCapabilities(Capability.DEPARTURES)) { setDeparturesView();//ww w. ja va 2 s . c o m } else { LinearLayout departuresLayout = (LinearLayout) mView.findViewById(R.id.departuresLayout); departuresLayout.setVisibility(View.GONE); } if (np.hasCapabilities(Capability.NEARBY_STATIONS)) { setNearbyStationsView(); } else { LinearLayout nearbyStationsLayout = (LinearLayout) mView.findViewById(R.id.nearbyStationsLayout); nearbyStationsLayout.setVisibility(View.GONE); } return mView; }
From source file:com.dwdesign.tweetings.fragment.PullToRefreshListFragment.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 www . ja va 2 s . co 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 PullToRefreshListView plv = new PullToRefreshListView(context); plv.setOnRefreshListener(this); mPullToRefreshListView = plv; final ListView lv = plv.getRefreshableView(); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(plv, 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; }
From source file:com.nadmm.airports.wx.PirepFragment.java
protected void showError(String error) { View detail = findViewById(R.id.wx_detail_layout); detail.setVisibility(View.GONE); LinearLayout layout = (LinearLayout) findViewById(R.id.wx_status_layout); layout.removeAllViews();// w ww. ja v a 2s.com layout.setVisibility(View.GONE); TextView tv = (TextView) findViewById(R.id.status_msg); tv.setVisibility(View.VISIBLE); tv.setText(error); View title = findViewById(R.id.wx_title_layout); title.setVisibility(View.GONE); stopRefreshAnimation(); setContentShown(true); return; }
From source file:org.mariotaku.twidere.fragment.PullToRefreshListFragment.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 ww w . ja v a 2s . c om * * <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 HoloProgressBar(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 PullToRefreshListView plv = new PullToRefreshListView(context); plv.setOnRefreshListener(this); mPullToRefreshListView = plv; final ListView lv = plv.getRefreshableView(); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(plv, 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; }
From source file:pro.jariz.reisplanner.fragments.PlannerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); thisView = inflater.inflate(R.layout.fragment_planner, container, false); final SlidingFragmentActivity context = (SlidingFragmentActivity) this.getActivity(); //make sure we've got some actionbar buttons setHasOptionsMenu(true);/*from ww w . j a v a 2s . co m*/ //context.getSupportMenuInflater(). CheckBox extra = (CheckBox) thisView.findViewById(R.id.extraOptions); extra.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { LinearLayout time = (LinearLayout) thisView.findViewById(R.id.time); LinearLayout date = (LinearLayout) thisView.findViewById(R.id.date); if (isChecked) { time.setVisibility(View.VISIBLE); date.setVisibility(View.VISIBLE); Animation anim = AnimationUtils.loadAnimation(context, R.anim.fadein); time.startAnimation(anim); date.startAnimation(anim); } else { time.setVisibility(View.GONE); date.setVisibility(View.GONE); //Animation anim = AnimationUtils.loadAnimation(context, R.anim.fadeout); //time.startAnimation(anim); //date.startAnimation(anim); } } }); context.getSupportActionBar().setTitle("Planner"); Time time = new Time(); time.setToNow(); Integer lastCacheTime = DB.getLastCacheTime("stations"); Time difference = new Time(); difference.set(time.toMillis(true) - lastCacheTime); //no stations present or cache is outdated? refresh. if (DB.getStationCount() == 0 || (lastCacheTime != 0 && difference.monthDay >= 10)) { Crouton.showText(context, getResources().getString(R.string.updating_station_list), CroutonStyles.infoStyle); new NSTask(this).execute(NSTask.TYPE_STATIONS); } else { //cache time! new NSTask(this).execute(NSTask.TYPE_STATIONS_DB); } return thisView; }
From source file:com.inovex.zabbixmobile.activities.fragments.BaseSeverityFilterDetailsFragment.java
/** * Shows a loading spinner instead of this page's list view. *//*from www . java2 s. c o m*/ public void showLoadingSpinner() { mLoadingSpinnerVisible = true; if (getView() != null) { LinearLayout progressLayout = (LinearLayout) getView() .findViewById(R.id.severity_details_progress_layout); if (progressLayout != null) progressLayout.setVisibility(View.VISIBLE); } }