List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:org.linphone.InCallActivity.java
private void displayOrHideContactPicture(LinearLayout callView, Uri pictureUri, Uri thumbnailUri, boolean hide) { AvatarWithShadow contactPicture = (AvatarWithShadow) callView.findViewById(R.id.contactPicture); if (pictureUri != null) { LinphoneUtils.setImagePictureFromUri(callView.getContext(), contactPicture.getView(), Uri.parse(pictureUri.toString()), thumbnailUri, R.drawable.unknown_small); }//from w w w . j a va 2 s . c o m callView.setVisibility(hide ? View.GONE : View.VISIBLE); }
From source file:com.mibr.android.intelligentreminder.INeedToo.java
@Override public Dialog onCreateDialog(int id) { switch (id) { case DIALOG_REMINDER_CONTACTS_SERVICE_FAILED_LICENSING: AlertDialog.Builder buildersvc = new AlertDialog.Builder(this); buildersvc.setMessage(/*from w w w . j ava2s . c om*/ "The Reminder Contact Service add-on that you've got installed is not a licensed version"); buildersvc.setCancelable(false) .setNeutralButton(R.string.msg_cus, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { String[] mailto = { "info@intelligentreminder.com", "" }; Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "".toString()); sendIntent.putExtra(Intent.EXTRA_TEXT, "".toString()); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, "Send EMail...")); } }).setPositiveButton(R.string.msg_register, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (INeedToo.IS_ANDROID_VERSION) { String uri = getString(R.string.indeedtopayforservice); Intent ii3 = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(ii3); } else { Uri uri = Uri.parse( "http://www.amazon.com/gp/mas/dl/android?p=com.mibr.android.remindercontacts"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } isReminderContactsAvailable = true; iDidReminderContacts = false; } }).setNegativeButton(R.string.msg_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); AlertDialog alert = buildersvc.create(); return alert; case DOING_SAMPLE_NEEDS_DIALOG: if (allItems == null) { return null; } dialogDoingSamples = new Dialog(this); dialogDoingSamples.setOwnerActivity(this); dialogDoingSamples.setContentView(R.layout.ineedvoiceprogress); dialogDoingSamples.setTitle("Working ..."); ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_cancel)).setEnabled(true); ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_ok)).setEnabled(false); ; // dialogDoingSamples.show(); ArrayList stuff = new ArrayList(); stuff.add(dialogDoingSamples); stuff.add(getApplicationContext()); stuff.add(this); stuff.add(getLocationManager()); stuff.add(getDbAdapter()); stuff.add(allItems.get(whereImAtInAllItems)); stuff.add(new Integer(1)); new NeedByVoiceProgress().execute(stuff); return dialogDoingSamples; case DIALOG_SAMPLES: Dialog aDialog = null; AlertDialog.Builder builder2; LayoutInflater inflater2 = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View layout2 = inflater2.inflate(R.layout.ineedsamples, (ViewGroup) findViewById(R.id.hijklmnop)); builder2 = new AlertDialog.Builder(this); builder2.setView(layout2); builder2.setTitle("Build Sample Data Set"); builder2.setPositiveButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { allItems = new ArrayList<ArrayList<String>>(); Boolean doit = false; StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); StringBuilder sb3 = new StringBuilder(); int cnt = 0; Boolean dw = false; ArrayList<String> jdmatchesSS = null; ; sb.append("I need Print Cartridges description HP 28 and 48 "); if (mWalmart != null && mWalmart.isChecked()) { sb.append(" location Walmart "); dw = true; } if (mWalgreens != null && mWalgreens.isChecked()) { sb.append(" location Walgreens "); dw = true; } if (dw) { // they checked something doit = true; jdmatchesSS = new ArrayList<String>(); jdmatchesSS.add(sb.toString()); allItems.add(jdmatchesSS); cnt++; } if (mSevenEleven != null && mSevenEleven.isChecked()) { sb3.append("I need Energy Drink description Red Bull location 7-Eleven "); ArrayList<String> jdmatches = new ArrayList<String>(); jdmatches.add(sb3.toString()); allItems.add(jdmatches); cnt++; doit = true; } if (mStarbucks != null && mStarbucks.isChecked()) { sb2.append("I need Coffee description French Roast location Starbucks"); ArrayList<String> jdmatches = new ArrayList<String>(); jdmatches.add(sb2.toString()); allItems.add(jdmatches); cnt++; doit = true; } if (doit) { whereImAtInAllItems = 0; INeedToo.this.showDialog(DOING_SAMPLE_NEEDS_DIALOG); } } }); mWalmart = (CheckBox) layout2.findViewById(R.id.BuildWalmart); mWalgreens = (CheckBox) layout2.findViewById(R.id.BuildWalgreens); mSevenEleven = (CheckBox) layout2.findViewById(R.id.Build7Eleven); mStarbucks = (CheckBox) layout2.findViewById(R.id.BuildStarbucks); aDialog = builder2.create(); return aDialog; case DIALOG_SPLASH: /* jdd=new Dialog(mContext); jdd.setContentView(R.layout.ineed2splash); jdd.setTitle("W E L C O M E"); */ AlertDialog.Builder builder; LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.ineed2splashv2, (ViewGroup) findViewById(R.id.ScrollView01lmnop2)); builder = new AlertDialog.Builder(this); builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mWantSample != null) { if (mWantSample.isChecked()) { showDialog(DIALOG_SAMPLES); } } } }); builder.setTitle("W E L C O M E"); if (getDbAdapter().thereAreSomeLocationsOnSystem()) { LinearLayout ll = (LinearLayout) layout.findViewById(R.id.CreateDefaultValues); ll.setVisibility(View.INVISIBLE); } else { mWantSample = (CheckBox) layout.findViewById(R.id.BuildDefaultValues); } builder.setView(layout); jdd = builder.create(); //Button butt=(Button)jdd.findViewById(R.id.Button01); /*butt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { jdd.cancel(); } }); */ break; default: return null; } return jdd; }
From source file:nl.mpcjanssen.simpletask.Simpletask.java
private void updateFilterBar() { ListView lv = getListView();//from ww w .j a va 2 s . c o m int index = lv.getFirstVisiblePosition(); View v = lv.getChildAt(0); int top = (v == null) ? 0 : v.getTop(); lv.setSelectionFromTop(index, top); final LinearLayout actionbar = (LinearLayout) findViewById(R.id.actionbar); final TextView filterText = (TextView) findViewById(R.id.filter_text); if (mFilter.hasFilter()) { actionbar.setVisibility(View.VISIBLE); } else { actionbar.setVisibility(View.GONE); } int count = m_adapter != null ? m_adapter.getCountVisbleTasks() : 0; int total = getTaskBag() != null ? getTaskBag().size() : 0; filterText.setText(mFilter.getTitle(count, total, getText(R.string.priority_prompt), getText(R.string.project_prompt), getText(R.string.context_prompt), getText(R.string.search), getText(R.string.script), getText(R.string.title_filter_applied), getText(R.string.no_filter))); }
From source file:com.sentaroh.android.Utilities.Dialog.FileSelectDialogFragment.java
private void initViewWidget() { if (mDebugEnable) Log.v(APPLICATION_TAG, "initViewWidget"); if (mDebugEnable) Log.v(APPLICATION_TAG, "Create=" + mDialogEnableCreate + ", Title=" + mDialogTitle + ", lurl=" + mDialogLocalUrl + ", ldir=" + mDialogLocalDir + ", file name=" + mDialogFileName); mThemeColorList = ThemeUtil.getThemeColorList(getActivity()); mDialog.setContentView(R.layout.file_select_edit_dlg); LinearLayout title_view = (LinearLayout) mDialog.findViewById(R.id.file_select_edit_dlg_title_view); title_view.setBackgroundColor(mThemeColorList.dialog_title_background_color); TextView title = (TextView) mDialog.findViewById(R.id.file_select_edit_dlg_title); title.setTextColor(mThemeColorList.text_color_dialog_title); title.setText(mDialogTitle);/* w ww. j a va 2 s. co m*/ final TextView dlg_msg = (TextView) mDialog.findViewById(R.id.file_select_edit_dlg_msg); final Button btnHome = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_home_dir_btn); btnHome.setTextColor(mThemeColorList.text_color_primary); btnHome.setVisibility(Button.VISIBLE); final Button btnCreate = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_create_btn); btnCreate.setTextColor(mThemeColorList.text_color_primary); final Button btnOk = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_ok_btn); // btnOk.setTextColor(mThemeColorList.text_color_primary); final Button btnCancel = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_cancel_btn); btnCancel.setTextColor(mThemeColorList.text_color_primary); final Button btnRefresh = (Button) mDialog.findViewById(R.id.file_select_edit_dlg_refresh_btn); btnRefresh.setTextColor(mThemeColorList.text_color_primary); LinearLayout ll_dlg_view = (LinearLayout) mDialog.findViewById(R.id.file_select_edit_dlg_view); ll_dlg_view.setBackgroundColor(mThemeColorList.dialog_msg_background_color); final Activity activity = getActivity(); final Context context = activity.getApplicationContext(); if (mDialogEnableCreate) { btnCreate.setVisibility(TextView.VISIBLE); } mLocalMountPointSpinner = (Spinner) mDialog.findViewById(R.id.file_select_edit_dlg_rdir); setSpinnerBackground(context, mLocalMountPointSpinner, mThemeColorList.theme_is_light); mLocalMountPointSpinner.setVisibility(Spinner.VISIBLE); // Root directory spinner CustomSpinnerAdapter adapter = new CustomSpinnerAdapter(activity, R.layout.custom_simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mLocalMountPointSpinner.setPrompt(context.getString(R.string.msgs_file_select_edit_local_mount_point)); mLocalMountPointSpinner.setAdapter(adapter); int a_no = -1; ArrayList<String> ml = LocalMountPoint.getLocalMountPointList(context); mLocalMountPointSpinner.setOnItemSelectedListener(null); if (mDialogMpLimitInternalAndSdcard) { adapter.add(Environment.getExternalStorageDirectory().toString()); File[] fl = ContextCompat.getExternalFilesDirs(context, null); for (File item : fl) { if (!item.getPath().startsWith(Environment.getExternalStorageDirectory().toString())) { adapter.add(item.getPath().substring(0, item.getPath().indexOf("/Android"))); break; } } mLocalMountPointSpinner.setEnabled(true); for (int i = 0; i < adapter.getCount(); i++) { if (adapter.getItem(i).equals(mDialogLocalUrl)) { a_no = i; break; } } mLocalMountPointSpinner.setSelection(a_no); } else { if (ml.size() == 0) { if (mDialogIncludeRoot) adapter.add("/"); adapter.add(mDialogLocalUrl); mLocalMountPointSpinner.setEnabled(false); } else { mLocalMountPointSpinner.setEnabled(true); if (mDialogIncludeRoot) adapter.add("/"); for (int i = 0; i < ml.size(); i++) adapter.add(ml.get(i)); for (int i = 0; i < ml.size(); i++) { if (mDialogLocalUrl.startsWith(ml.get(i))) { a_no = i; break; } } mLocalMountPointSpinner.setSelection(a_no); } } LinearLayout ll_mp = (LinearLayout) mDialog.findViewById(R.id.file_select_edit_dlg_mp_view); if (mDialogHideMp) ll_mp.setVisibility(LinearLayout.GONE); else ll_mp.setVisibility(LinearLayout.VISIBLE); // ll_mp.setVisibility(LinearLayout.GONE); // final TextView v_spacer=(TextView)mDialog.findViewById(R.id.file_select_edit_dlg_spacer); mTreeFileListView = (ListView) mDialog.findViewById(android.R.id.list); final CustomTextView dir_name = (CustomTextView) mDialog.findViewById(R.id.file_select_edit_dlg_dir_name); dir_name.setTextColor(mThemeColorList.text_color_primary); final EditText file_name = (EditText) mDialog.findViewById(R.id.file_select_edit_dlg_file_name); if (!mDialogSingleSelect) file_name.setVisibility(EditText.GONE); else file_name.setVisibility(EditText.VISIBLE); if (mDialogFileOnly) { file_name.setVisibility(EditText.VISIBLE); file_name.setEnabled(true); dir_name.setVisibility(EditText.VISIBLE); } else { if (mDialogDirectoryOnly) { file_name.setVisibility(EditText.GONE); file_name.setEnabled(false); dir_name.setVisibility(EditText.VISIBLE); btnHome.setVisibility(EditText.VISIBLE); } else { file_name.setVisibility(EditText.VISIBLE); file_name.setEnabled(true); dir_name.setVisibility(EditText.VISIBLE); btnHome.setVisibility(EditText.VISIBLE); } } file_name.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View arg0, int keyCode, KeyEvent event) { if (//event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { return true; } return false; } }); // if (dirs.size()<=2) v_spacer.setVisibility(TextView.VISIBLE); mTreeFilelistAdapter = new TreeFilelistAdapter(activity, mDialogSingleSelect, true); mTreeFileListView.setAdapter(mTreeFilelistAdapter); if (mDialogLocalUrl.equals("")) mDialogLocalUrl = ml.get(0); ArrayList<TreeFilelistItem> tfl = createLocalFilelist(mDialogFileOnly, mDialogLocalUrl, ""); if (tfl.size() == 0) { tfl.add(new TreeFilelistItem(context.getString(R.string.msgs_file_select_edit_dir_empty))); } else { mTreeFilelistAdapter.setDataList(tfl); if (!mDialogLocalDir.equals("")) { String sel_dir = mDialogLocalDir; String n_dir = "", e_dir = ""; if (sel_dir.startsWith("/")) n_dir = sel_dir.substring(1); else n_dir = sel_dir; if (n_dir.endsWith("/")) e_dir = n_dir.substring(0, n_dir.length() - 1); else e_dir = n_dir; // Log.v("","mp="+mDialogLocalUrl+", se;_dir="+sel_dir+", e_dir="+e_dir); selectLocalDirTree(e_dir); } if (!mDialogFileName.equals("")) selectLocalDirTreeFile(mDialogFileName); } mTreeFileListView.setScrollingCacheEnabled(false); mTreeFileListView.setScrollbarFadingEnabled(false); if (mSavedViewContentsValue != null && mSavedViewContentsValue.mainDialogFilename != null) { file_name.setText(mSavedViewContentsValue.mainDialogFilename); file_name.setSelection(mSavedViewContentsValue.mainDialogFilenameSelStart, mSavedViewContentsValue.mainDialogFilenameTextSelEnd); dir_name.setText(mSavedViewContentsValue.mainDialogDirName); } else { String d_name = mDialogLocalDir.equals("") ? mDialogLocalUrl + "/" : mDialogLocalUrl + mDialogLocalDir + "/"; dir_name.setText(d_name); file_name.setText(mDialogFileName); } if (!mDialogSingleSelect) btnOk.setEnabled(false); NotifyEvent cb_ntfy = new NotifyEvent(context); // set file list thread response listener cb_ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { int p = (Integer) o[0]; boolean p_chk = (Boolean) o[1]; String turl = (String) mLocalMountPointSpinner.getSelectedItem(); if (mDialogSingleSelect) { if (mTreeFilelistAdapter.getDataItem(p).isChecked() && !p_chk) { if (p != -1) { if (mTreeFilelistAdapter.getDataItem(p).isChecked()) { if (mTreeFilelistAdapter.getDataItem(p).isDir()) { dir_name.setText(turl + mTreeFilelistAdapter.getDataItem(p).getPath() + mTreeFilelistAdapter.getDataItem(p).getName() + "/"); // file_name.setText(""); } else { dir_name.setText(turl + mTreeFilelistAdapter.getDataItem(p).getPath()); file_name.setText(mTreeFilelistAdapter.getDataItem(p).getName()); } } } } if (mDialogFileOnly) { if (file_name.getText().length() > 0) { btnOk.setEnabled(true); putDlgMsg(dlg_msg, ""); } else { btnOk.setEnabled(false); putDlgMsg(dlg_msg, context.getString(R.string.msgs_file_select_edit_dlg_filename_not_specified)); } } else { if (mTreeFilelistAdapter.isDataItemIsSelected() || file_name.getText().length() > 0) { btnOk.setEnabled(true); putDlgMsg(dlg_msg, ""); } else { putDlgMsg(dlg_msg, context.getString(R.string.msgs_file_select_edit_dlg_directory_not_selected)); btnOk.setEnabled(false); } } } else { if (mTreeFilelistAdapter.getDataItem(p).isDir()) { dir_name.setText(turl + mTreeFilelistAdapter.getDataItem(p).getPath() + mTreeFilelistAdapter.getDataItem(p).getName() + "/"); // file_name.setText(""); } else { dir_name.setText(turl + mTreeFilelistAdapter.getDataItem(p).getPath()); file_name.setText(mTreeFilelistAdapter.getDataItem(p).getName()); } putDlgMsg(dlg_msg, ""); btnOk.setEnabled(true); } } @Override public void negativeResponse(Context c, Object[] o) { boolean checked = false; // int p=(Integer) o[0]; boolean p_chk = (Boolean) o[1]; if (mDialogSingleSelect) { if (p_chk) { for (int i = 0; i < mTreeFilelistAdapter.getDataItemCount(); i++) { if (mTreeFilelistAdapter.getDataItem(i).isChecked()) { checked = true; break; } } if (checked) btnOk.setEnabled(true); else btnOk.setEnabled(false); } } else { // Log.v("","sel="+p_chk); btnOk.setEnabled(false); for (int i = 0; i < mTreeFilelistAdapter.getDataItemCount(); i++) { if (mTreeFilelistAdapter.getDataItem(i).isChecked()) { btnOk.setEnabled(true); break; } } } } }); mTreeFilelistAdapter.setCbCheckListener(cb_ntfy); if (mDialogLocalUrl.equals(file_name.getText().toString())) btnOk.setEnabled(false); if (mDialogFileOnly && mDialogFileName.equals("")) { btnOk.setEnabled(false); putDlgMsg(dlg_msg, context.getString(R.string.msgs_file_select_edit_dlg_filename_not_specified)); } file_name.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { if (mDialogSingleSelect) { if (s.length() != 0) { btnOk.setEnabled(true); putDlgMsg(dlg_msg, ""); } else { btnOk.setEnabled(false); putDlgMsg(dlg_msg, context.getString(R.string.msgs_file_select_edit_dlg_filename_not_specified)); } } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } }); NotifyEvent ntfy_expand_close = new NotifyEvent(context); ntfy_expand_close.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { int idx = (Integer) o[0]; final int pos = mTreeFilelistAdapter.getItem(idx); final TreeFilelistItem tfi = mTreeFilelistAdapter.getDataItem(pos); if (tfi.getName().startsWith("---")) return; String turl = (String) mLocalMountPointSpinner.getSelectedItem(); if (tfi.isDir()) processLocalDirTree(mDialogFileOnly, turl, pos, tfi, mTreeFilelistAdapter); else { mTreeFilelistAdapter.setDataItemIsSelected(pos); dir_name.setText((turl + mTreeFilelistAdapter.getDataItem(pos).getPath())); file_name.setText(mTreeFilelistAdapter.getDataItem(pos).getName()); if (mTreeFilelistAdapter.getDataItem(pos).isDir() && mDialogFileOnly) btnOk.setEnabled(false); else btnOk.setEnabled(true); } } @Override public void negativeResponse(Context c, Object[] o) { } }); mTreeFilelistAdapter.setExpandCloseListener(ntfy_expand_close); mTreeFileListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> items, View view, int idx, long id) { final int pos = mTreeFilelistAdapter.getItem(idx); final TreeFilelistItem tfi = mTreeFilelistAdapter.getDataItem(pos); if (tfi.getName().startsWith("---")) return; String turl = (String) mLocalMountPointSpinner.getSelectedItem(); if (tfi.isDir()) processLocalDirTree(mDialogFileOnly, turl, pos, tfi, mTreeFilelistAdapter); else { mTreeFilelistAdapter.setDataItemIsSelected(pos); dir_name.setText((turl + mTreeFilelistAdapter.getDataItem(pos).getPath())); file_name.setText(mTreeFilelistAdapter.getDataItem(pos).getName()); if (mTreeFilelistAdapter.getDataItem(pos).isDir() && mDialogFileOnly) btnOk.setEnabled(false); else btnOk.setEnabled(true); } } }); mTreeFileListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, final int position, long arg3) { return true; } }); btnHome.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dir_name.setText(mLocalMountPointSpinner.getSelectedItem().toString() + "/"); } }); //Create button btnCreate.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { NotifyEvent ntfy = new NotifyEvent(context); // set file list thread response listener ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { // btnRefresh.performClick(); } @Override public void negativeResponse(Context c, Object[] o) { } }); fileSelectEditDialogCreateBtn(activity, context, dir_name.getText().substring(0, dir_name.getText().length() - 1), "", mLocalMountPointSpinner.getSelectedItem().toString(), mTreeFilelistAdapter, ntfy, mTreeFileListView); } }); //Refresh button btnRefresh.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String mp = mLocalMountPointSpinner.getSelectedItem().toString(); ArrayList<TreeFilelistItem> tfl = createLocalFilelist(mDialogFileOnly, mp, "");//mDialogLocalUrl,""); if (tfl.size() < 1) tfl.add(new TreeFilelistItem(context.getString(R.string.msgs_file_select_edit_dir_empty))); mTreeFilelistAdapter.setDataList(tfl); } }); //OK button // btnOk.setEnabled(false); btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (mDialogSingleSelect) { String[] sl_array = new String[] { dir_name.getText() + file_name.getText().toString() }; if (mNotifyEvent != null) mNotifyEvent.notifyToListener(true, sl_array); } else { ArrayList<String> sl = new ArrayList<String>(); ArrayList<TreeFilelistItem> tfl = mTreeFilelistAdapter.getDataList(); for (TreeFilelistItem li : tfl) { if (li.isChecked()) { if (li.isDir()) sl.add(li.getPath() + li.getName()); else sl.add(li.getPath() + li.getName()); } } String[] sl_array = new String[sl.size()]; String mp = mLocalMountPointSpinner.getSelectedItem().toString(); for (int i = 0; i < sl.size(); i++) { if (mDialogSelectedFilePathWithMountPoint) sl_array[i] = mp + sl.get(i); else sl_array[i] = sl.get(i); // Log.v("","sel="+sl_array[i]); } if (mNotifyEvent != null) mNotifyEvent.notifyToListener(true, sl_array); } // mDialog.dismiss(); mFragment.dismiss(); } }); // CANCEL? btnCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // mDialog.dismiss(); mFragment.dismiss(); if (mNotifyEvent != null) mNotifyEvent.notifyToListener(false, null); } }); Handler hndl = new Handler(); hndl.postDelayed(new Runnable() { @Override public void run() { mLocalMountPointSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // Log.v("","MP selected="+position); Spinner spinner = (Spinner) parent; String turl = (String) spinner.getSelectedItem(); ArrayList<TreeFilelistItem> tfl = createLocalFilelist(mDialogFileOnly, turl, ""); if (tfl.size() < 1) tfl.add(new TreeFilelistItem( context.getString(R.string.msgs_file_select_edit_dir_empty))); mTreeFilelistAdapter.setDataList(tfl); mTreeFilelistAdapter.notifyDataSetChanged(); if (turl.startsWith(mSafFileMgr.getExternalSdcardPath())) { if (mSafFileMgr.getSdcardSafFile() == null) btnCreate.setEnabled(false); else btnCreate.setEnabled(true); } else btnCreate.setEnabled(true); dir_name.setText(turl + "/"); Handler hndl_sel = new Handler(); hndl_sel.post(new Runnable() { @Override public void run() { mTreeFileListView.setSelection(0); } }); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); } }, 100); }
From source file:org.rm3l.ddwrt.fragments.status.StatusWirelessFragment.java
/** * Called when a previously created loader has finished its load. Note * that normally an application is <em>not</em> allowed to commit fragment * transactions while in this call, since it can happen after an * activity's state is saved. See {@link android.support.v4.app.FragmentManager#beginTransaction() * FragmentManager.openTransaction()} for further discussion on this. * <p/>//from w w w .j a v a 2 s . co m * <p>This function is guaranteed to be called prior to the release of * the last data that was supplied for this Loader. At this point * you should remove all use of the old data (since it will be released * soon), but should not do your own release of the data since its Loader * owns it and will take care of that. The Loader will take care of * management of its data so you don't have to. In particular: * <p/> * <ul> * <li> <p>The Loader will monitor for changes to the data, and report * them to you through new calls here. You should not monitor the * data yourself. For example, if the data is a {@link android.database.Cursor} * and you place it in a {@link android.widget.CursorAdapter}, use * the {@link android.widget.CursorAdapter#CursorAdapter(android.content.Context, * android.database.Cursor, int)} constructor <em>without</em> passing * in either {@link android.widget.CursorAdapter#FLAG_AUTO_REQUERY} * or {@link android.widget.CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER} * (that is, use 0 for the flags argument). This prevents the CursorAdapter * from doing its own observing of the Cursor, which is not needed since * when a change happens you will get a new Cursor throw another call * here. * <li> The Loader will release the data once it knows the application * is no longer using it. For example, if the data is * a {@link android.database.Cursor} from a {@link android.content.CursorLoader}, * you should not call close() on it yourself. If the Cursor is being placed in a * {@link android.widget.CursorAdapter}, you should use the * {@link android.widget.CursorAdapter#swapCursor(android.database.Cursor)} * method so that the old Cursor is not closed. * </ul> * * @param loader The Loader that has finished. * @param tiles The data generated by the Loader. */ @Override public void onLoadFinished(final Loader<Collection<DDWRTTile>> loader, @Nullable final Collection<DDWRTTile> tiles) { Log.d(LOG_TAG, "Done loading background task for " + StatusWirelessFragment.class.getCanonicalName()); this.mIfaceTiles = tiles; if (viewGroup == null || tiles == null || tiles.isEmpty()) { return; } final SherlockFragmentActivity sherlockActivity = getSherlockActivity(); final int themeBackgroundColor = getThemeBackgroundColor(sherlockActivity, router.getUuid()); final boolean isThemeLight = isThemeLight(sherlockActivity, themeBackgroundColor); final LinearLayout dynamicTilessViewGroup = (LinearLayout) viewGroup .findViewById(R.id.tiles_container_scrollview_layout_dynamic_items); //Remove everything first dynamicTilessViewGroup.removeAllViews(); for (@NotNull final DDWRTTile tile : tiles) { @Nullable final ViewGroup tileViewGroupLayout = tile.getViewGroupLayout(); if (tileViewGroupLayout == null) { continue; } if (isThemeLight) { final View titleView = tileViewGroupLayout.findViewById(tile.getTileTitleViewId()); if (titleView instanceof TextView) { ((TextView) titleView).setTextColor(getResources().getColor(android.R.color.holo_blue_dark)); } } tileViewGroupLayout.setBackgroundColor(getResources().getColor(android.R.color.transparent)); //Init loaders for these tiles getSherlockActivity().getSupportLoaderManager() .initLoader(Long.valueOf(Utils.getNextLoaderId()).intValue(), null, tile); //Add row for this iface final CardView cardView = new CardView(sherlockActivity); cardView.setCardBackgroundColor(themeBackgroundColor); cardView.setOnClickListener(tile); tileViewGroupLayout.setOnClickListener(tile); cardView.addView(tileViewGroupLayout); //Remove view prior to adding it again to parent dynamicTilessViewGroup.addView(cardView); } //Make it visible now dynamicTilessViewGroup.setVisibility(View.VISIBLE); }
From source file:org.xingjitong.InCallActivity.java
private void displayOrHideContactPicture(LinearLayout callView, Uri pictureUri, boolean hide) { //yyppcallingui AvatarWithShadow-AvatarWithShadowcalling AvatarWithShadowcalling contactPicture = (AvatarWithShadowcalling) callView .findViewById(R.id.contactPicture); if (pictureUri != null) { LinphoneUtils.setImagePictureFromUri(callView.getContext(), contactPicture.getView(), Uri.parse(pictureUri.toString()), R.drawable.unknown_small); //callingcontact //unknown_small//yyppcallingui }// w ww .j a v a 2s . c o m callView.setVisibility(hide ? View.GONE : View.VISIBLE); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
public void setOverlayVisibility(boolean isVisible) { final LinearLayout overlay = (LinearLayout) findViewById(R.id.overlay); if (isVisible) { overlay.setVisibility(View.VISIBLE); overlay.setClickable(true);//from w w w. j a v a 2s . c o m overlay.bringToFront(); } else { overlay.setVisibility(View.GONE); } }
From source file:com.nadmm.airports.afd.AirportDetailsFragment.java
protected void showRunwayDetails(Cursor[] result) { LinearLayout rwyLayout = (LinearLayout) findViewById(R.id.detail_rwy_layout); LinearLayout heliLayout = (LinearLayout) findViewById(R.id.detail_heli_layout); TextView tv;/* ww w . ja v a 2s . c o m*/ int rwyNum = 0; int heliNum = 0; Cursor rwy = result[1]; if (rwy.moveToFirst()) { do { String rwyId = rwy.getString(rwy.getColumnIndex(Runways.RUNWAY_ID)); if (rwyId.startsWith("H")) { // This is a helipad addRunwayRow(heliLayout, rwy); ++heliNum; } else { // This is a runway addRunwayRow(rwyLayout, rwy); ++rwyNum; } } while (rwy.moveToNext()); } if (rwyNum == 0) { // No runways so remove the section tv = (TextView) findViewById(R.id.detail_rwy_label); tv.setVisibility(View.GONE); rwyLayout.setVisibility(View.GONE); } if (heliNum == 0) { // No helipads so remove the section tv = (TextView) findViewById(R.id.detail_heli_label); tv.setVisibility(View.GONE); heliLayout.setVisibility(View.GONE); } }
From source file:com.citrus.sample.WalletPaymentFragment.java
private void showDynamicPricingPrompt() { final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); String message = "Apply Dynamic Pricing"; String positiveButtonText = "Apply"; final Utils.DPRequestType[] dpRequestType = new Utils.DPRequestType[1]; ScrollView scrollView = new ScrollView(getActivity()); LinearLayout linearLayout = (LinearLayout) getActivity().getLayoutInflater() .inflate(R.layout.dynamic_pricing_input_layout, null); final EditText editTransactionAmount = (EditText) linearLayout.findViewById(R.id.edit_txn_amount); final EditText editCouponCode = (EditText) linearLayout.findViewById(R.id.edit_coupon_code); final EditText editAlteredAmount = (EditText) linearLayout.findViewById(R.id.edit_altered_amount); final LinearLayout layoutCouponCode = (LinearLayout) linearLayout.findViewById(R.id.layout_for_coupon_code); final LinearLayout layoutAlteredAmount = (LinearLayout) linearLayout .findViewById(R.id.layout_for_altered_amount); Spinner spinner = (Spinner) linearLayout.findViewById(R.id.spinner_dp_request_type); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override//from w w w .j a v a 2 s. c o m public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: dpRequestType[0] = Utils.DPRequestType.SEARCH_AND_APPLY; layoutCouponCode.setVisibility(View.GONE); layoutAlteredAmount.setVisibility(View.GONE); break; case 1: dpRequestType[0] = Utils.DPRequestType.CALCULATE_PRICING; layoutCouponCode.setVisibility(View.VISIBLE); layoutAlteredAmount.setVisibility(View.GONE); break; case 2: dpRequestType[0] = Utils.DPRequestType.VALIDATE_RULE; layoutCouponCode.setVisibility(View.VISIBLE); layoutAlteredAmount.setVisibility(View.VISIBLE); break; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); alert.setTitle("Perform Dynamic Pricing"); alert.setMessage(message); scrollView.addView(linearLayout); alert.setView(scrollView); alert.setPositiveButton(positiveButtonText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String amount = editTransactionAmount.getText().toString(); String alteredAmount = editAlteredAmount.getText().toString(); String couponCode = editCouponCode.getText().toString(); mListener.onPaymentTypeSelected(dpRequestType[0], new Amount(amount), couponCode, new Amount(alteredAmount)); // Hide the keyboard. InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editTransactionAmount.getWindowToken(), 0); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); editTransactionAmount.requestFocus(); alert.show(); }
From source file:net.olejon.mdapp.MedicationNlhFragment.java
@SuppressLint("SetJavaScriptEnabled") @Override//from ww w. ja v a 2s. c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) { ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.fragment_medication_nlh, container, false); // Activity final Activity activity = getActivity(); // Context final Context context = activity.getApplicationContext(); // Tools final MyTools mTools = new MyTools(context); // Arguments Bundle bundle = getArguments(); final String pageUri = bundle.getString("uri"); // Progress bar final ProgressBar progressBar = (ProgressBar) activity .findViewById(R.id.medication_toolbar_progressbar_horizontal); // Toolbar final LinearLayout toolbarSearchLayout = (LinearLayout) activity .findViewById(R.id.medication_toolbar_search_layout); final EditText toolbarSearchEditText = (EditText) activity.findViewById(R.id.medication_toolbar_search); // Web view WEBVIEW = (WebView) viewGroup.findViewById(R.id.medication_nlh_content); WebSettings webSettings = WEBVIEW.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setAppCachePath(context.getCacheDir().getAbsolutePath()); webSettings.setCacheMode(WebSettings.LOAD_DEFAULT); WEBVIEW.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (!mTools.isDeviceConnected()) { mTools.showToast(getString(R.string.device_not_connected), 0); return true; } else if (url.matches(".*/[^#]+#[^/]+$")) { WEBVIEW.loadUrl(url.replaceAll("#[^/]+$", "")); return true; } else if (url.matches("^https?://.*?\\.pdf$")) { mTools.downloadFile(view.getTitle(), url); return true; } return false; } }); WEBVIEW.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int newProgress) { if (newProgress == 100) { progressBar.setVisibility(View.INVISIBLE); } else { progressBar.setVisibility(View.VISIBLE); progressBar.setProgress(newProgress); toolbarSearchLayout.setVisibility(View.GONE); toolbarSearchEditText.setText(""); } } }); if (savedInstanceState == null) { WEBVIEW.loadUrl(pageUri); } else { WEBVIEW.restoreState(savedInstanceState); } return viewGroup; }