List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:org.ciasaboark.tacere.activity.fragment.EventsFragment.java
private void showErrorBox() { LinearLayout errorBox = (LinearLayout) rootView.findViewById(R.id.error_box); errorBox.setVisibility(View.VISIBLE); }
From source file:com.imobile.mt8382hotkeydefine.GridFragment.java
/** * Provide default implementation to return a simple grid view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a GridView 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 grid 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 . ja v a 2 s . c o m*/ @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); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); GridView lv = new GridView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lv.setColumnWidth(convertDpToPixels(60, getActivity())); lv.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); lv.setNumColumns(GridView.AUTO_FIT); lv.setHorizontalSpacing(convertDpToPixels(20, getActivity())); lv.setVerticalSpacing(convertDpToPixels(20, getActivity())); lv.setSmoothScrollbarEnabled(true); // disable overscroll if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { lv.setOverScrollMode(ListView.OVER_SCROLL_NEVER); } lframe.addView(lv, 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.ckdroid.ilauncher.ShowGridFragment.java
/** * Provide default implementation to return a simple grid view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a GridView 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 grid is empty. * <p/>//from w w w . ja v a2s . 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(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); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); GridView lv = new GridView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lv.setColumnWidth(convertDpToPixels(80, getActivity())); lv.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); lv.setNumColumns(GridView.AUTO_FIT); lv.setNumColumns(4); lv.setHorizontalSpacing(convertDpToPixels(10, getActivity())); lv.setVerticalSpacing(convertDpToPixels(10, getActivity())); lv.setSmoothScrollbarEnabled(true); // disable overscroll if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { lv.setOverScrollMode(ListView.OVER_SCROLL_NEVER); } lframe.addView(lv, 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:org.ciasaboark.tacere.activity.fragment.EventDetailsFragment.java
private void setupWidgetsForView() { TextView eventTitle = (TextView) view.findViewById(R.id.event_title); eventTitle.setText(event.getTitle()); TextView calendarTitle = (TextView) view.findViewById(R.id.calendar_title); calendarTitle.setText(databaseInterface.getCalendarNameForId(event.getCalendarId())); LinearLayout eventRepetitonBox = (LinearLayout) view.findViewById(R.id.event_details_repetitions_box); if (databaseInterface.doesEventRepeat(event.getEventId())) { eventRepetitonBox.setVisibility(View.VISIBLE); TextView eventRepetitionText = (TextView) view.findViewById(R.id.event_details_repetition_text); long eventRepetitions = databaseInterface.getEventRepetitionCount(event.getEventId()); eventRepetitionText.setText("Repeats " + eventRepetitions + " times"); } else {//from w w w . ja va 2 s . c om eventRepetitonBox.setVisibility(View.GONE); } drawExtendMinutesWidgets(); colorizeIcons(); ImageView buttonNormal = (ImageView) view.findViewById(R.id.imageButtonNormal); ImageView buttonVibrate = (ImageView) view.findViewById(R.id.imageButtonVibrate); ImageView buttonSilent = (ImageView) view.findViewById(R.id.imageButtonSilent); ImageView buttonIgnore = (ImageView) view.findViewById(R.id.imageButtonIgnore); buttonNormal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { setRingerType(RingerType.NORMAL); } }); buttonVibrate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { setRingerType(RingerType.VIBRATE); } }); buttonSilent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { setRingerType(RingerType.SILENT); } }); buttonIgnore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { setRingerType(RingerType.IGNORE); } }); }
From source file:de.vanita5.twittnuker.fragment.support.BaseSupportListFragment.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./*w w w . j ava 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.setTextAppearance(context, ThemeUtils.getTextAppearanceLarge(context)); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lv.setOnScrollListener(this); lframe.addView(lv, 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.ckdroid.ilauncher.AllGridFragment.java
/** * Provide default implementation to return a simple grid view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a GridView 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 grid is empty. * <p/>//from w ww . ja v a 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(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); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); GridView lv = new GridView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lv.setColumnWidth(convertDpToPixels(60, getActivity())); lv.setStretchMode(GridView.STRETCH_COLUMN_WIDTH); lv.setNumColumns(GridView.AUTO_FIT); lv.setHorizontalSpacing(convertDpToPixels(20, getActivity())); lv.setVerticalSpacing(convertDpToPixels(20, getActivity())); lv.setSmoothScrollbarEnabled(true); // disable overscroll if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { lv.setOverScrollMode(ListView.OVER_SCROLL_NEVER); } lframe.addView(lv, 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)); root.setPadding(24, 30, 24, 30); root.setBackgroundColor(getResources().getColor(R.color.bg_white)); return root; }
From source file:org.klnusbaum.udj.PullToRefresh.RefreshableListFragment.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 . ja 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(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.FILL_PARENT, ViewGroup.LayoutParams.FILL_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); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ListView lv = new ListView(getActivity()); PullToRefreshListView lv = (PullToRefreshListView) inflater.inflate(R.layout.pull_to_refresh_listview, null); pullToRefreshView = lv; lv.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { // Do work to refresh the list here. doRefreshWork(); } }); // 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:org.ciasaboark.tacere.activity.fragment.EventsFragment.java
private void hideEventList() { ListView listview = (ListView) rootView.findViewById(R.id.eventListView); listview.setVisibility(View.GONE); //also hide the warning box LinearLayout warningBox = (LinearLayout) rootView.findViewById(R.id.main_service_warning); warningBox.setVisibility(View.GONE); }
From source file:at.alladin.rmbt.android.map.overlay.RMBTBalloonOverlayView.java
public void setBalloonData(final RMBTBalloonOverlayItem item, final ViewGroup parent) { // map our custom item data to fields // title.setText(item.getTitle()); resultItems = item.getResultItems(); resultListView.removeAllViews();//from w w w . j a v a 2 s .c o m final float scale = getResources().getDisplayMetrics().density; final int leftRightItem = Helperfunctions.dpToPx(5, scale); final int topBottomItem = Helperfunctions.dpToPx(3, scale); final int leftRightDiv = Helperfunctions.dpToPx(0, scale); final int topBottomDiv = Helperfunctions.dpToPx(0, scale); final int heightDiv = Helperfunctions.dpToPx(1, scale); final int topBottomImg = Helperfunctions.dpToPx(1, scale); if (resultItems != null && resultItems.length() > 0) { for (int i = 0; i < 1; i++) // JSONObject resultListItem; try { final JSONObject result = resultItems.getJSONObject(i); final LayoutInflater resultInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View resultView = resultInflater.inflate(R.layout.balloon_overlay_listitem, parent); final LinearLayout measurementLayout = (LinearLayout) resultView .findViewById(R.id.resultMeasurementList); measurementLayout.setVisibility(View.GONE); final LinearLayout netLayout = (LinearLayout) resultView.findViewById(R.id.resultNetList); netLayout.setVisibility(View.GONE); final TextView measurementHeader = (TextView) resultView.findViewById(R.id.resultMeasurement); measurementHeader.setVisibility(View.GONE); final TextView netHeader = (TextView) resultView.findViewById(R.id.resultNet); netHeader.setVisibility(View.GONE); final TextView dateHeader = (TextView) resultView.findViewById(R.id.resultDate); dateHeader.setVisibility(View.GONE); dateHeader.setText(result.optString("time_string")); final JSONArray measurementArray = result.getJSONArray("measurement"); final JSONArray netArray = result.getJSONArray("net"); for (int j = 0; j < measurementArray.length(); j++) { final JSONObject singleItem = measurementArray.getJSONObject(j); final LinearLayout measurememtItemLayout = new LinearLayout(context); // (LinearLayout)measurememtItemView.findViewById(R.id.measurement_item); measurememtItemLayout.setLayoutParams( new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT)); measurememtItemLayout.setGravity(Gravity.CENTER_VERTICAL); measurememtItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem, topBottomItem); final TextView itemTitle = new TextView(context, null, R.style.balloonResultItemTitle); itemTitle.setLayoutParams( new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.4f)); itemTitle.setTextAppearance(context, R.style.balloonResultItemTitle); itemTitle.setWidth(0); itemTitle.setGravity(Gravity.LEFT); itemTitle.setText(singleItem.getString("title")); measurememtItemLayout.addView(itemTitle); final ImageView itemClassification = new ImageView(context); itemClassification.setLayoutParams( new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0.1f)); itemClassification.setPadding(0, topBottomImg, 0, topBottomImg); // itemClassification.set setGravity(Gravity.LEFT); itemClassification.setImageDrawable(getResources().getDrawable( Helperfunctions.getClassificationImage(singleItem.getInt("classification")))); measurememtItemLayout.addView(itemClassification); final TextView itemValue = new TextView(context, null, R.style.balloonResultItemValue); itemValue.setLayoutParams( new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.5f)); itemValue.setTextAppearance(context, R.style.balloonResultItemValue); itemValue.setWidth(0); itemValue.setGravity(Gravity.LEFT); itemValue.setText(singleItem.getString("value")); measurememtItemLayout.addView(itemValue); measurementLayout.addView(measurememtItemLayout); final View divider = new View(context); divider.setLayoutParams(new LinearLayout.LayoutParams( android.view.ViewGroup.LayoutParams.MATCH_PARENT, heightDiv, 1)); divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv); divider.setBackgroundResource(R.drawable.bg_trans_light_10); measurementLayout.addView(divider); measurementLayout.invalidate(); } for (int j = 0; j < netArray.length(); j++) { final JSONObject singleItem = netArray.getJSONObject(j); final LinearLayout netItemLayout = new LinearLayout(context); // (LinearLayout)measurememtItemView.findViewById(R.id.measurement_item); netItemLayout.setLayoutParams( new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT)); netItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem, topBottomItem); netItemLayout.setGravity(Gravity.CENTER_VERTICAL); final TextView itemTitle = new TextView(context, null, R.style.balloonResultItemTitle); itemTitle.setLayoutParams( new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.4f)); itemTitle.setTextAppearance(context, R.style.balloonResultItemTitle); itemTitle.setWidth(0); itemTitle.setGravity(Gravity.LEFT); itemTitle.setText(singleItem.getString("title")); netItemLayout.addView(itemTitle); final ImageView itemClassification = new ImageView(context); itemClassification.setLayoutParams( new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0.1f)); itemClassification.setPadding(0, topBottomImg, 0, topBottomImg); itemClassification.setImageDrawable( context.getResources().getDrawable(R.drawable.traffic_lights_none)); netItemLayout.addView(itemClassification); final TextView itemValue = new TextView(context, null, R.style.balloonResultItemValue); itemValue.setLayoutParams( new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.5f)); itemValue.setTextAppearance(context, R.style.balloonResultItemValue); itemValue.setWidth(0); itemValue.setGravity(Gravity.LEFT); itemValue.setText(singleItem.optString("value", null)); netItemLayout.addView(itemValue); netLayout.addView(netItemLayout); final View divider = new View(context); divider.setLayoutParams(new LinearLayout.LayoutParams( android.view.ViewGroup.LayoutParams.MATCH_PARENT, heightDiv, 1)); divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv); divider.setBackgroundResource(R.drawable.bg_trans_light_10); netLayout.addView(divider); netLayout.invalidate(); } measurementHeader.setVisibility(View.VISIBLE); netHeader.setVisibility(View.VISIBLE); measurementLayout.setVisibility(View.VISIBLE); netLayout.setVisibility(View.VISIBLE); dateHeader.setVisibility(View.VISIBLE); resultListView.addView(resultView); Log.d(DEBUG_TAG, "View Added"); // codeText.setText(resultListItem.getString("sync_code")); } catch (final JSONException e) { e.printStackTrace(); } progessBar.setVisibility(View.GONE); emptyView.setVisibility(View.GONE); resultListView.setVisibility(View.VISIBLE); resultListView.invalidate(); } else { Log.i(DEBUG_TAG, "LEERE LISTE"); progessBar.setVisibility(View.GONE); emptyView.setVisibility(View.VISIBLE); emptyView.setText(context.getString(R.string.error_no_data)); emptyView.invalidate(); } }
From source file:org.ciasaboark.tacere.activity.fragment.AdvancedSettingsFragment.java
private void drawBetaWidgets() { LinearLayout betaSettingsBox = (LinearLayout) rootView.findViewById(R.id.beta_settings_box); final BetaPrefs betaPrefs = new BetaPrefs(getActivity()); if (betaPrefs.isBetaPrefsUnlocked()) { betaSettingsBox.setVisibility(View.VISIBLE); final CheckBox useLargeDisplayCheckbox = (CheckBox) rootView .findViewById(R.id.beta_largedisplay_checkbox); final RelativeLayout useLargeDisplayBox = (RelativeLayout) rootView .findViewById(R.id.large_display_box); if (betaPrefs.getUseLargeDisplay()) { useLargeDisplayCheckbox.setChecked(true); }/* www. ja v a 2 s . c o m*/ useLargeDisplayBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { useLargeDisplayCheckbox.performClick(); betaPrefs.setUseLargeDisplay(useLargeDisplayCheckbox.isChecked()); } }); final CheckBox disableNotificationsCheckbox = (CheckBox) rootView .findViewById(R.id.beta_notifications_checkbox); final RelativeLayout disableNotificationsBox = (RelativeLayout) rootView .findViewById(R.id.disable_notifications_box); if (betaPrefs.getDisableNotifications()) { disableNotificationsCheckbox.setChecked(true); } disableNotificationsBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { disableNotificationsCheckbox.performClick(); betaPrefs.setDisableNotifications(disableNotificationsCheckbox.isChecked()); AlarmManagerWrapper alarmManagerWrapper = new AlarmManagerWrapper(getActivity()); alarmManagerWrapper.scheduleImmediateAlarm(RequestTypes.NORMAL); // if (disableNotificationsCheckbox.isChecked()) { // NotificationManagerWrapper notificationManagerWrapper = new NotificationManagerWrapper(context); // notificationManagerWrapper.cancelAllNotifications(); // } } }); final CheckBox disableVibrationCheckbox = (CheckBox) rootView .findViewById(R.id.beta_vibration_checkbox); final RelativeLayout disableVibrationBox = (RelativeLayout) rootView .findViewById(R.id.disable_vibration_box); if (betaPrefs.getDisableVibration()) { disableVibrationCheckbox.setChecked(true); } disableVibrationBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { disableVibrationCheckbox.performClick(); betaPrefs.setDisableVibration(disableVibrationCheckbox.isChecked()); } }); } else { betaSettingsBox.setVisibility(View.GONE); } }