List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.gh4a.IssueCreateActivity.java
@Override public void onLoadFinished(Loader loader, Object object) { HashMap<Integer, Object> result = (HashMap<Integer, Object>) object; if (!isLoaderError(result)) { Object data = result.get(LoaderResult.DATA); if (loader.getId() == 0) { mAllLabel = (List<Label>) data; fillLabels();//from w ww. j a v a 2s . co m } else if (loader.getId() == 1) { stopProgressDialog(mProgressDialog); mAllMilestone = (List<Milestone>) data; showMilestonesDialog(); } else if (loader.getId() == 2) { stopProgressDialog(mProgressDialog); mAllAssignee = (List<User>) data; showAssigneesDialog(); } else if (loader.getId() == 3) { hideLoading(); mEditIssue = (Issue) data; getSupportLoaderManager().getLoader(4).forceLoad(); fillIssueData(); } else { isCollaborator = (Boolean) data; LinearLayout ll = (LinearLayout) findViewById(R.id.for_collaborator); if (isCollaborator) { ll.setVisibility(View.VISIBLE); getSupportLoaderManager().getLoader(0).forceLoad(); } else { ll.setVisibility(View.GONE); } } } else { hideLoading(); stopProgressDialog(mProgressDialog); } }
From source file:org.digitalcampus.oppia.activity.OppiaMobileActivity.java
private void updateReminders() { if (prefs.getBoolean(PrefsActivity.PREF_SHOW_SCHEDULE_REMINDERS, false)) { DbHelper db = DbHelper.getInstance(OppiaMobileActivity.this); int max = Integer.valueOf(prefs.getString(PrefsActivity.PREF_NO_SCHEDULE_REMINDERS, "2")); long userId = db.getUserId(SessionManager.getUsername(this)); ArrayList<Activity> activities = db.getActivitiesDue(max, userId); this.drawReminders(activities); } else {//from w w w . j a v a 2 s . c o m LinearLayout ll = (LinearLayout) findViewById(R.id.schedule_reminders); ll.setVisibility(View.GONE); } }
From source file:org.sufficientlysecure.keychain.ui.base.RecyclerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { final Context context = getContext(); FrameLayout root = new FrameLayout(context); LinearLayout progressContainer = new LinearLayout(context); progressContainer.setId(INTERNAL_PROGRESS_CONTAINER_ID); progressContainer.setOrientation(LinearLayout.VERTICAL); progressContainer.setGravity(Gravity.CENTER); progressContainer.setVisibility(View.GONE); ProgressBar progressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); progressContainer.addView(progressBar, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(progressContainer, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); FrameLayout listContainer = new FrameLayout(context); listContainer.setId(INTERNAL_LIST_CONTAINER_ID); TextView textView = new TextView(context); textView.setId(INTERNAL_EMPTY_VIEW_ID); textView.setGravity(Gravity.CENTER); listContainer.addView(textView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); RecyclerView listView = new RecyclerView(context); listView.setId(INTERNAL_LIST_VIEW_ID); int padding = FormattingUtils.dpToPx(context, 8); listView.setPadding(padding, 0, padding, 0); listView.setClipToPadding(false);/*from w w w . j ava 2s. co m*/ listContainer.addView(listView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(listContainer, 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.gluu.super_gluu.app.fragments.LicenseFragment.LicenseFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.license_fragment, container, false); WebView licenseWebView = (WebView) view.findViewById(R.id.license_webView); licenseWebView.loadDataWithBaseURL(null, readLicenseTxt(), "text/html", "UTF-8", null); // licenseTextView.setMovementMethod(new ScrollingMovementMethod()); Button aceptButton = (Button) view.findViewById(R.id.accept_button); LinearLayout action_left_button = (LinearLayout) view.findViewById(R.id.action_left_button); action_left_button.setOnClickListener(new View.OnClickListener() { @Override//from w w w .j a va 2 s. c om public void onClick(View v) { getActivity().onBackPressed(); } }); aceptButton.setOnClickListener(this); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) licenseWebView.getLayoutParams(); if (!isForFirstLoading) { aceptButton.setVisibility(View.GONE); action_left_button.setVisibility(View.VISIBLE); params.weight = 0.25f; } else { action_left_button.setVisibility(View.GONE); params.weight = 0.98f; } licenseWebView.setLayoutParams(params); //Setup fonts Typeface face = Typeface.createFromAsset(getActivity().getAssets(), "ProximaNova-Regular.otf"); aceptButton.setTypeface(face); return view; }
From source file:org.telegram.ui.LanguageSelectActivity.java
@Override public View createView(Context context) { searching = false;// w w w . java 2 s . c om searchWas = false; actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle(LocaleController.getString("Language", R.string.Language)); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } } }); ActionBarMenu menu = actionBar.createMenu(); ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true) .setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() { @Override public void onSearchExpand() { searching = true; } @Override public void onSearchCollapse() { search(null); searching = false; searchWas = false; if (listView != null) { emptyTextView.setVisibility(View.GONE); listView.setAdapter(listAdapter); } } @Override public void onTextChanged(EditText editText) { String text = editText.getText().toString(); search(text); if (text.length() != 0) { searchWas = true; if (listView != null) { listView.setAdapter(searchListViewAdapter); } } } }); item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search)); listAdapter = new ListAdapter(context); searchListViewAdapter = new SearchAdapter(context); fragmentView = new FrameLayout(context); fragmentView.setBackgroundColor(ContextCompat.getColor(context, R.color.card_background)); LinearLayout emptyTextLayout = new LinearLayout(context); emptyTextLayout.setVisibility(View.INVISIBLE); emptyTextLayout.setOrientation(LinearLayout.VERTICAL); ((FrameLayout) fragmentView).addView(emptyTextLayout); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emptyTextLayout.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; layoutParams.gravity = Gravity.TOP; emptyTextLayout.setLayoutParams(layoutParams); emptyTextLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); emptyTextView = new TextView(context); emptyTextView.setTextColor(0xff808080); emptyTextView.setTextSize(20); emptyTextView.setGravity(Gravity.CENTER); emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult)); emptyTextLayout.addView(emptyTextView); LinearLayout.LayoutParams layoutParams1 = (LinearLayout.LayoutParams) emptyTextView.getLayoutParams(); layoutParams1.width = LayoutHelper.MATCH_PARENT; layoutParams1.height = LayoutHelper.MATCH_PARENT; layoutParams1.weight = 0.5f; emptyTextView.setLayoutParams(layoutParams1); FrameLayout frameLayout = new FrameLayout(context); emptyTextLayout.addView(frameLayout); layoutParams1 = (LinearLayout.LayoutParams) frameLayout.getLayoutParams(); layoutParams1.width = LayoutHelper.MATCH_PARENT; layoutParams1.height = LayoutHelper.MATCH_PARENT; layoutParams1.weight = 0.5f; frameLayout.setLayoutParams(layoutParams1); listView = new ListView(context); listView.setEmptyView(emptyTextLayout); listView.setVerticalScrollBarEnabled(false); listView.setDivider(null); listView.setDividerHeight(0); listView.setAdapter(listAdapter); ((FrameLayout) fragmentView).addView(listView); layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; listView.setLayoutParams(layoutParams); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { LocaleController.LocaleInfo localeInfo = null; if (searching && searchWas) { if (i >= 0 && i < searchResult.size()) { localeInfo = searchResult.get(i); } } else { if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) { localeInfo = LocaleController.getInstance().sortedLanguages.get(i); } } if (localeInfo != null) { LocaleController.getInstance().applyLanguage(localeInfo, true); parentLayout.rebuildAllFragmentViews(false); } finishFragment(); } }); listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { LocaleController.LocaleInfo localeInfo = null; if (searching && searchWas) { if (i >= 0 && i < searchResult.size()) { localeInfo = searchResult.get(i); } } else { if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) { localeInfo = LocaleController.getInstance().sortedLanguages.get(i); } } if (localeInfo == null || localeInfo.pathToFile == null || getParentActivity() == null) { return false; } final LocaleController.LocaleInfo finalLocaleInfo = localeInfo; AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setMessage(LocaleController.getString("DeleteLocalization", R.string.DeleteLocalization)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (LocaleController.getInstance().deleteLanguage(finalLocaleInfo)) { if (searchResult != null) { searchResult.remove(finalLocaleInfo); } if (listAdapter != null) { listAdapter.notifyDataSetChanged(); } if (searchListViewAdapter != null) { searchListViewAdapter.notifyDataSetChanged(); } } } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); return true; } }); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView absListView, int i) { if (i == SCROLL_STATE_TOUCH_SCROLL && searching && searchWas) { AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus()); } } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); return fragmentView; }
From source file:org.digitalcampus.oppia.activity.OppiaMobileActivity.java
private void displayCourses() { courses.clear();/*from ww w. j ava 2s. co m*/ courses.addAll(coursesRepository.getCourses(this)); LinearLayout llLoading = (LinearLayout) this.findViewById(R.id.loading_courses); llLoading.setVisibility(View.GONE); if (courses.size() < MobileLearning.DOWNLOAD_COURSES_DISPLAY) { displayDownloadSection(); } else { TextView tv = (TextView) this.findViewById(R.id.manage_courses_text); tv.setText(R.string.no_courses); llNone.setVisibility(View.GONE); } courseListAdapter.notifyDataSetChanged(); this.updateReminders(); this.scanMedia(); }
From source file:org.gdgsp.fragment.RSVPFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); view = inflater.inflate(R.layout.fragment_rsvp, container, false); event = (Event) getActivity().getIntent().getSerializableExtra("event"); responseSwitch = (SwitchCompat) view.findViewById(R.id.response_switch); responseText = (TextView) view.findViewById(R.id.response_text); final LinearLayout content = (LinearLayout) view.findViewById(R.id.content); if (event.getResponse() == null) { event.setResponse("no"); }//from www.j ava2 s . com final boolean checked = !event.getResponse().equals("no"); final boolean isWaitlist = event.getYes_rsvp_count() == event.getRsvp_limit() && !event.getResponse().equals("yes"); content.setVisibility(checked ? View.VISIBLE : View.GONE); responseSwitch.setChecked(checked); responseText.setText(checked ? isWaitlist ? getString(R.string.wait_list) : getString(R.string.yes) : getString(R.string.no)); responseSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton p1, boolean p2) { responseText.setText(p2 ? isWaitlist ? getString(R.string.wait_list) : getString(R.string.yes) : getString(R.string.no)); content.setVisibility(p2 ? View.VISIBLE : View.GONE); } }); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); for (int i = 0; i < event.getSurvey_questions().size(); i++) { Question question = event.getSurvey_questions().get(i); TextView textView = new TextView(activity); textView.setText(question.getQuestion()); EditText editText = new AppCompatEditText(activity); editText.setSingleLine(true); editText.setMaxLines(1); InputFilter[] FilterArray = new InputFilter[1]; FilterArray[0] = new InputFilter.LengthFilter(250); editText.setFilters(FilterArray); if (event.getAnswers() != null) { editText.setText(event.getAnswers().get(i).getAnswer()); } entries.add(editText); content.addView(textView, params); content.addView(editText, params); } final Button send = (Button) view.findViewById(R.id.button_send); send.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { ObjectToSend toSend = new ObjectToSend(); toSend.setResponse(responseSwitch.isChecked() ? "yes" : "no"); List<Question> list = new ArrayList<Question>(); for (int i = 0; i < entries.size(); i++) { Question question = event.getSurvey_questions().get(i); question.setAnswer(entries.get(i).getText().toString()); list.add(question); } toSend.setAnswers(list); Gson gson = new Gson(); String json = gson.toJson(toSend); send.setEnabled(false); Ion.with(getContext()).load(Other.getRSVPUrl(activity, event.getId())) .setBodyParameter("json", json) .setBodyParameter("refresh_token", Other.getRefreshToken(activity)).asString() .setCallback(new FutureCallback<String>() { @Override public void onCompleted(Exception e, String response) { if (e != null) { send.setEnabled(true); Other.showToast(activity, getString(R.string.rsvp_error)); return; } if (response.matches("waitlist|yes|no")) { String message = ""; switch (response) { case "yes": message = getString(R.string.rsvp_success); break; case "waitlist": message = getString(R.string.rsvp_waitlist); break; case "no": message = getString(R.string.rsvp_no); break; } Other.showToast(activity, message); Intent intent = new Intent(activity, MainActivity.class); intent.putExtra("fromrsvp", true); MainActivity.openEvent = event.getId(); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else { send.setEnabled(true); Other.showToast(activity, getString(R.string.rsvp_error)); } } }); } }); return view; }
From source file:org.ewicom.pps.unitinfo.TabAddressFragment.java
public void setDescription() { TextView desc = (TextView) getView().findViewById(R.id.text_unitdescription); LinearLayout descPanel = (LinearLayout) getView().findViewById(R.id.panel_unitdescription); String sDescription = unit.getDescription(); if (!sDescription.isEmpty()) { desc.setText(sDescription);/* ww w. jav a 2 s . c om*/ } else { descPanel.setVisibility(View.GONE); } }
From source file:eu.power_switch.gui.adapter.RoomRecyclerViewAdapter.java
@Override public void onBindViewHolder(final RoomRecyclerViewAdapter.ViewHolder holder, int position) { // Get the data model based on position final Room room = rooms.get(holder.getAdapterPosition()); // Set item views based on the data model holder.roomName.setText(room.getName()); final LinearLayout linearLayout = holder.linearLayoutOfReceivers; holder.roomName.setOnClickListener(new View.OnClickListener() { @Override/*w ww. j av a2s.c om*/ public void onClick(View v) { if (linearLayout.getVisibility() == View.VISIBLE) { room.setCollapsed(true); linearLayout.setVisibility(View.GONE); } else { room.setCollapsed(false); linearLayout.setVisibility(View.VISIBLE); } } }); holder.roomName.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { EditRoomDialog editRoomDialog = EditRoomDialog.newInstance(room.getId()); editRoomDialog.setTargetFragment(recyclerViewFragment, 0); editRoomDialog.show(fragmentActivity.getSupportFragmentManager(), null); return true; } }); View.OnClickListener onClickListener = new View.OnClickListener() { @Override public void onClick(View v) { if (SmartphonePreferencesHandler.getVibrateOnButtonPress()) { VibrationHandler.vibrate(fragmentActivity, SmartphonePreferencesHandler.getVibrationDuration()); } android.widget.Button buttonView = (android.widget.Button) v; String buttonName = buttonView.getText().toString(); new AsyncTask<String, Void, Void>() { @Override protected Void doInBackground(String... buttonNames) { try { String buttonName = buttonNames[0]; // send signal ActionHandler.execute(fragmentActivity, room, buttonName); } catch (Exception e) { } return null; } @Override protected void onPostExecute(Void aVoid) { updateReceiverViews(holder, room); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, buttonName); } }; holder.buttonAllOn.setOnClickListener(onClickListener); holder.buttonAllOff.setOnClickListener(onClickListener); if (!SmartphonePreferencesHandler.getShowRoomAllOnOff()) { holder.buttonAllOn.setVisibility(View.GONE); holder.buttonAllOff.setVisibility(View.GONE); } else { holder.buttonAllOn.setVisibility(View.VISIBLE); holder.buttonAllOff.setVisibility(View.VISIBLE); } updateReceiverViews(holder, room); // collapse room if (room.isCollapsed()) { linearLayout.setVisibility(View.GONE); } else { linearLayout.setVisibility(View.VISIBLE); } if (holder.getAdapterPosition() == getItemCount() - 1) { holder.footer.setVisibility(View.VISIBLE); } else { holder.footer.setVisibility(View.GONE); } }
From source file:uguess.qucai.com.merchant.business.common.ui.PictureViewPagerActivity.java
/** * ?ActionBar/*from w w w . ja v a 2s . co m*/ */ private void initActionBar() { //?actionbar?? QCActionBar actionBar = (QCActionBar) findViewById(R.id.action_bar); ImageView back = (ImageView) actionBar.findViewById(R.id.bar_left); LinearLayout iconLayout = (LinearLayout) actionBar.findViewById(R.id.iconLinear); LinearLayout operationLayout = (LinearLayout) actionBar.findViewById(R.id.operatorLinear); back.setImageResource(R.drawable.ic_common_back); actionBar.setTitle(null); actionBar.setBackground(getResources().getColor(R.color.transparent)); iconLayout.setBackgroundColor(getResources().getColor(R.color.transparent)); actionBar.showSystemBar(); // iconLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); operationLayout.setVisibility(View.INVISIBLE); }