List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE
String LAYOUT_INFLATER_SERVICE
To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.
Click Source Link
From source file:com.cybrosys.scientific.EventListener.java
@SuppressWarnings("deprecation") public void showHistory() { shPref = ScientificActivity.ctx.getSharedPreferences("myHistpref", 0); int inSize = shPref.getInt("HistIndex", 0); System.out.println("" + inSize); String[] str = new String[inSize]; for (int inI = 0; inI < inSize; inI++) { str[inI] = shPref.getString("hist" + inI, ""); System.out.println(str[inI]); }// w ww .j a va 2 s .com LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); vwLayout = inflater.inflate(R.layout.pop_history, (ViewGroup) ((Activity) ctx).findViewById(R.id.popup_element)); popmW1 = new PopupWindow(vwLayout, PalmCalcActivity.inDispwidth, PalmCalcActivity.inDispheight, true); popmW1.setBackgroundDrawable(new BitmapDrawable()); popmW1.setOutsideTouchable(true); popmW1.showAtLocation(vwLayout, Gravity.CENTER, 0, 0); tblltTable = (TableLayout) vwLayout.findViewById(R.id.tablelay); ImageButton btnCancel = (ImageButton) vwLayout.findViewById(R.id.butcancelmain); btnCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { popmW1.dismiss(); } }); txtvHistory = new TextView[inSize]; btnHistory = new Button[inSize]; tblrRowL = new TableRow[inSize]; TableRow.LayoutParams buttonParams = new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT, 1f); TableRow.LayoutParams textParams = new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT, .1f); int inJ = 0, inL = inSize - 1; for (int inI = 0; inI < inSize; inI++) { if (!str[inI].equalsIgnoreCase("")) { btnHistory[inJ] = new Button(ctx); txtvHistory[inJ] = new TextView(ctx); txtvHistory[inJ].setText("" + (inJ + 1)); txtvHistory[inJ].setGravity(Gravity.CENTER); txtvHistory[inJ].setTextColor(ScientificActivity.ctx.getResources().getColor(R.color.HistColor)); txtvHistory[inJ].setLayoutParams(textParams); btnHistory[inJ].setText(str[inL]); btnHistory[inJ].setTextColor(Color.WHITE); btnHistory[inJ].setGravity(Gravity.LEFT); btnHistory[inJ].setLayoutParams(buttonParams); btnHistory[inJ].setBackgroundDrawable(ctx.getResources().getDrawable(R.drawable.button_effect)); tblrRowL[inJ] = new TableRow(ctx); tblrRowL[inJ].addView(txtvHistory[inJ]); tblrRowL[inJ].addView(btnHistory[inJ]); tblltTable.addView(tblrRowL[inJ]); final int inK = inJ; btnHistory[inK].setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // etxt.setText(btns[inK].getText().toString()); mHandler.insert(btnHistory[inK].getText().toString()); popmW1.dismiss(); } }); inJ++; inL--; } } if (inSize == 0) { TextView txtvHistory = new TextView(ctx); txtvHistory.setLayoutParams(textParams); txtvHistory.setGravity(Gravity.CENTER); txtvHistory.setTextColor(Color.WHITE); txtvHistory.setText("History Empty"); TableRow tblrRowL = new TableRow(ctx); tblrRowL.addView(txtvHistory); tblltTable.addView(tblrRowL); } }
From source file:in.shick.diode.threads.ThreadsListActivity.java
/** * Resets the output UI list contents, retains session state. * @param threadsAdapter A ThreadsListAdapter to use. Pass in null if you want a new empty one created. *//*w w w . jav a 2s .co m*/ void resetUI(ThreadsListAdapter threadsAdapter) { findViewById(R.id.loading_light).setVisibility(View.GONE); findViewById(R.id.loading_dark).setVisibility(View.GONE); if (mSettings.isAlwaysShowNextPrevious()) { if (mNextPreviousView != null) { getListView().removeFooterView(mNextPreviousView); mNextPreviousView = null; } } else { findViewById(R.id.next_previous_layout).setVisibility(View.GONE); if (getListView().getFooterViewsCount() == 0) { // If we are not using the persistent navbar, then show as ListView footer instead LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); mNextPreviousView = inflater.inflate(R.layout.next_previous_list_item, null); getListView().addFooterView(mNextPreviousView); } } synchronized (THREAD_ADAPTER_LOCK) { if (threadsAdapter == null) { // Reset the list to be empty. mObjectStates.mThreadsList = new ArrayList<ThingInfo>(); mThreadsAdapter = new ThreadsListAdapter(this, mObjectStates.mThreadsList); } else { mThreadsAdapter = threadsAdapter; } setListAdapter(mThreadsAdapter); mThreadsAdapter.mIsLoading = false; mThreadsAdapter.notifyDataSetChanged(); // Just in case } Common.updateListDrawables(this, mSettings.getTheme()); updateNextPreviousButtons(); }
From source file:com.devwang.logcabin.LogCabinMainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent serverIntent = null;/*from w w w . j a v a 2 s.c o m*/ Toast toast = Toast.makeText(LogCabinMainActivity.this, "", Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); switch (item.getItemId()) { case R.id.secure_connect_scan:// // Launch the DeviceListActivity to see devices and do scan serverIntent = new Intent(this, DeviceListActivity.class); startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_SECURE); return true; case R.id.insecure_connect_scan:// // Launch the DeviceListActivity to see devices and do scan serverIntent = new Intent(this, DeviceListActivity.class); startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_INSECURE); return true; case R.id.app_developer: toastDisplay(LogCabinMainActivity.this, ": \n\nQQ:1120341494\n:dongleixiaxue314\n :http://www.devwang.com", Gravity.CENTER, R.drawable.hutview, Toast.LENGTH_SHORT); return true; case R.id.app_cmd_what: case R.id.app_voice_what: toast.setText( "\n\n\n\n..."); toast.show(); return true; case R.id.app_college: toast.setText(R.string.str_college); toast.show(); return true; case R.id.app_web_url: toastDisplay(LogCabinMainActivity.this, getString(R.string.http_devwang_sinaapp_com_logcabin_logcabin_web_php), Gravity.CENTER, 0, Toast.LENGTH_SHORT); return true; case R.id.app_update: android.app.AlertDialog.Builder dialog = new AlertDialog.Builder(LogCabinMainActivity.this); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dialogview_appupdate, null); dialog.setView(layout); appUpdateEditText = (EditText) layout.findViewById(R.id.et_appupdate); dialog.setPositiveButton(R.string.str_app_update_sure, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String appUpdateEditTextString = appUpdateEditText.getText().toString(); if ("devwang".equals(appUpdateEditTextString.toString())) { AppUpdate = true; Toast.makeText(getApplicationContext(), R.string.str_app_update_pass_toast, Toast.LENGTH_SHORT).show(); } } }); dialog.show(); return true; } return false; }
From source file:com.activiti.android.ui.fragments.task.TaskDetailsFoundationFragment.java
private void displayPeopleSection(List<LightUserRepresentation> people) { show(R.id.task_details_people_card); if (people.isEmpty() || isEnded) { hide(R.id.task_details_people_card); return;// ww w . j a v a2 s .c o m } // USER INVOLVED LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout userContainer = (LinearLayout) viewById(R.id.task_details_people_container); userContainer.removeAllViews(); View v; if (people == null || people.isEmpty()) { v = inflater.inflate(R.layout.row_single_line, userContainer, false); ((TextView) v.findViewById(R.id.toptext)).setText(R.string.task_message_no_people_involved); v.findViewById(R.id.icon).setVisibility(View.GONE); userContainer.addView(v); } else { TwoLinesViewHolder vh; for (LightUserRepresentation user : people) { v = inflater.inflate(R.layout.row_two_lines_swipe, userContainer, false); v.setTag(user.getId()); String fullName = user.getFullname(); vh = HolderUtils.configure(v, fullName != null && !fullName.isEmpty() ? fullName : user.getEmail(), null, R.drawable.ic_account_circle_grey); if (picasso != null) { picasso.cancelRequest(vh.icon); picasso.load(getAPI().getUserGroupService().getPicture(user.getId())) .placeholder(R.drawable.ic_account_circle_grey).fit().transform(roundedTransformation) .into(vh.icon); } SwipeLayout swipeLayout = (SwipeLayout) v.findViewById(R.id.swipe_layout); swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown); swipeLayout.setDragEdge(SwipeLayout.DragEdge.Right); LinearLayout actions = (LinearLayout) swipeLayout.findViewById(R.id.bottom_wrapper); ImageButton action = (ImageButton) inflater.inflate(R.layout.form_swipe_action_, (LinearLayout) swipeLayout.findViewById(R.id.bottom_wrapper), false); action.setImageResource(R.drawable.ic_remove_circle_outline_white); action.setTag(user); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { removeInvolved(((LightUserRepresentation) v.getTag()), new InvolveTaskRepresentation(((LightUserRepresentation) v.getTag()).getId())); } }); actions.addView(action); userContainer.addView(v); } } if (!isEnded) { v = inflater.inflate(R.layout.footer_two_buttons_borderless, userContainer, false); Button b = (Button) v.findViewById(R.id.button_action_left); b.setVisibility(View.GONE); b = (Button) v.findViewById(R.id.button_action_right); b.setText(R.string.task_action_involve); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startInvolveAction(); } }); userContainer.addView(v); } }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
@SuppressLint("InflateParams") private void optionFilter() { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.filters, null); final CheckBox cbFUsed = (CheckBox) view.findViewById(R.id.cbFUsed); final CheckBox cbFInternet = (CheckBox) view.findViewById(R.id.cbFInternet); final CheckBox cbFPermission = (CheckBox) view.findViewById(R.id.cbFPermission); final CheckBox cbFRestriction = (CheckBox) view.findViewById(R.id.cbFRestriction); final CheckBox cbFRestrictionNot = (CheckBox) view.findViewById(R.id.cbFRestrictionNot); final CheckBox cbFOnDemand = (CheckBox) view.findViewById(R.id.cbFOnDemand); final CheckBox cbFOnDemandNot = (CheckBox) view.findViewById(R.id.cbFOnDemandNot); final CheckBox cbFUser = (CheckBox) view.findViewById(R.id.cbFUser); final CheckBox cbFSystem = (CheckBox) view.findViewById(R.id.cbFSystem); final Button btnDefault = (Button) view.findViewById(R.id.btnDefault); // Get settings final int userId = Util.getUserId(Process.myUid()); boolean fUsed = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUsed, false); boolean fInternet = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFInternet, false); boolean fPermission = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFPermission, true); boolean fRestriction = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFRestriction, false); boolean fRestrictionNot = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFRestrictionNot, false);/* w w w . ja v a 2 s .c o m*/ boolean fOnDemand = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFOnDemand, false); boolean fOnDemandNot = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFOnDemandNot, false); boolean fUser = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFUser, true); boolean fSystem = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFSystem, false); boolean ondemand = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingOnDemand, true); // Setup checkboxes cbFUsed.setChecked(fUsed); cbFInternet.setChecked(fInternet); cbFPermission.setChecked(fPermission); cbFRestriction.setChecked(fRestriction); cbFRestrictionNot.setChecked(fRestrictionNot); cbFOnDemand.setChecked(fOnDemand && ondemand); cbFOnDemandNot.setChecked(fOnDemandNot && ondemand); cbFUser.setChecked(fUser); cbFSystem.setChecked(fSystem); cbFRestrictionNot.setEnabled(fRestriction); cbFOnDemand.setEnabled(ondemand); cbFOnDemandNot.setEnabled(fOnDemand && ondemand); // Manage user/system filter exclusivity OnCheckedChangeListener checkListener = new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (buttonView == cbFUser) { if (isChecked) cbFSystem.setChecked(false); } else if (buttonView == cbFSystem) { if (isChecked) cbFUser.setChecked(false); } else if (buttonView == cbFRestriction) cbFRestrictionNot.setEnabled(cbFRestriction.isChecked()); else if (buttonView == cbFOnDemand) cbFOnDemandNot.setEnabled(cbFOnDemand.isChecked()); } }; cbFUser.setOnCheckedChangeListener(checkListener); cbFSystem.setOnCheckedChangeListener(checkListener); cbFRestriction.setOnCheckedChangeListener(checkListener); cbFOnDemand.setOnCheckedChangeListener(checkListener); // Clear button btnDefault.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { cbFUsed.setChecked(false); cbFInternet.setChecked(false); cbFPermission.setChecked(true); cbFRestriction.setChecked(false); cbFRestrictionNot.setChecked(false); cbFOnDemand.setChecked(false); cbFOnDemandNot.setChecked(false); cbFUser.setChecked(true); cbFSystem.setChecked(false); } }); // Build dialog AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityMain.this); alertDialogBuilder.setTitle(R.string.menu_filter); alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher)); alertDialogBuilder.setView(view); alertDialogBuilder.setPositiveButton(ActivityMain.this.getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { PrivacyManager.setSetting(userId, PrivacyManager.cSettingFUsed, Boolean.toString(cbFUsed.isChecked())); PrivacyManager.setSetting(userId, PrivacyManager.cSettingFInternet, Boolean.toString(cbFInternet.isChecked())); PrivacyManager.setSetting(userId, PrivacyManager.cSettingFRestriction, Boolean.toString(cbFRestriction.isChecked())); PrivacyManager.setSetting(userId, PrivacyManager.cSettingFRestrictionNot, Boolean.toString(cbFRestrictionNot.isChecked())); PrivacyManager.setSetting(userId, PrivacyManager.cSettingFPermission, Boolean.toString(cbFPermission.isChecked())); PrivacyManager.setSetting(userId, PrivacyManager.cSettingFOnDemand, Boolean.toString(cbFOnDemand.isChecked())); PrivacyManager.setSetting(userId, PrivacyManager.cSettingFOnDemandNot, Boolean.toString(cbFOnDemandNot.isChecked())); PrivacyManager.setSetting(userId, PrivacyManager.cSettingFUser, Boolean.toString(cbFUser.isChecked())); PrivacyManager.setSetting(userId, PrivacyManager.cSettingFSystem, Boolean.toString(cbFSystem.isChecked())); invalidateOptionsMenu(); applyFilter(); } }); alertDialogBuilder.setNegativeButton(ActivityMain.this.getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); // Show dialog AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
From source file:com.fullteem.yueba.app.ui.ChatActivity.java
/** * window//from w w w . j ava 2 s . c o m */ private void windowShow() { if (popupWindow == null) { LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); menuView = layoutInflater.inflate(R.layout.popwindow_msgmenu, null); listviewMsgMenus = (ListView) menuView.findViewById(R.id.listviewMsgPop); mma = new MessageMenuAdapter(this, menuTexts); listviewMsgMenus.setAdapter(mma); // PopuWidow popupWindow = new PopupWindow(menuView, 300, 500); } // ? popupWindow.setFocusable(true); // ? popupWindow.setOutsideTouchable(true); // Back??? popupWindow.setBackgroundDrawable(new BitmapDrawable()); WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); // ?:??-PopupWindow? int xPos = windowManager.getDefaultDisplay().getWidth() / 2 - popupWindow.getWidth() / 2; Log.i("coder", "windowManager.getDefaultDisplay().getWidth()/2:" + windowManager.getDefaultDisplay().getWidth() / 2); // Log.i("coder", "popupWindow.getWidth()/2:" + popupWindow.getWidth() / 2); Log.i("coder", "xPos:" + xPos); popupWindow.showAsDropDown(viewBtnMore, xPos, 0); listviewMsgMenus.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { if (popupWindow != null) { popupWindow.dismiss(); } // if (menuTexts[position].equals("")) { String strName = getString(R.string.add_firend); String msg = String.format(strName, userNickName); popMenu = new CommonPopWindow(ChatActivity.this, msg, new OnClickListener() { @Override public void onClick(View v) { addContact(); addFriendPop.dismiss(); } }, new OnClickListener() { @Override public void onClick(View v) { addFriendPop.dismiss(); } }); // ? popMenu.setIsEditText(false); // popMenu.preperShow(); addFriendPop = popMenu.getMenu(); addFriendPop.setOutsideTouchable(true); if (addFriendPop == null) { return; } if (addFriendPop.isShowing()) { addFriendPop.dismiss(); return; } addFriendPop.showAtLocation(getWindow().getDecorView(), Gravity.CENTER, 0, 0); } else if (menuTexts[position].equals("?")) { } // ? else if (menuTexts[position].equals("")) { // try { // EMContactManager.getInstance().deleteContact( // toChatUsername); // } catch (EaseMobException e) { // showToast(""); // } deleteFriends(); } else if (menuTexts[position].equals("?")) {// bill Intent intentDatePublish = new Intent(ChatActivity.this, DatePublishActivity.class); // TODO ????id,????????idname DBFriendListDao friendListDao = new DBFriendListDao(ChatActivity.this); UserCommonModel um = friendListDao.getContacter(toChatUsername); if (um == null) return; UmengUtil.onEvent(ChatActivity.this, "friend_chat_access_post_date_button_hits"); LogUtil.printUmengLog("friend_chat_access_post_date_button_hits"); intentDatePublish.putExtra(GlobleConstant.DATE_FAVORITE_ID, Integer.valueOf(TextUtils.isEmpty(um.getUserId()) ? "0" : um.getUserId())); // userIdint intentDatePublish.putExtra(GlobleConstant.DATE_FAVORITE_NAME, um.getUserName()); // String intentDatePublish.putExtra(GlobleConstant.DATE_FAVORITE_MOBILE, um.getUserMobile()); intentDatePublish.putExtra(GlobleConstant.DATE_FAVORITE_URL, um.getUserLogoUrl()); intentDatePublish.putExtra("isExist", true); startActivity(intentDatePublish); } else if (menuTexts[position].equals("")) { HttpRequest.getInstance(ChatActivity.this).getOutGroup(appContext.getUserInfo().getUserMobile(), toChatUsername, new CustomAsyncResponehandler() { @Override public void onSuccess(ResponeModel baseModel) { if (baseModel != null && baseModel.isStatus()) { showToast("?"); finish(); return; } showToast(getString(R.string.hint_operationError)); } @Override public void onFailure(Throwable error, String content) { showToast(getString(R.string.hint_operationError)); } }); } } }); }
From source file:com.appybite.customer.AllowedHotels.java
private void updateHotelList() { llHotelList.removeAllViews();/*from w w w .j ava2 s . co m*/ for (int i = 0; i < aryHotelList.size(); i++) { final HotelInfo value = aryHotelList.get(i); LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View item = null; if (DeviceUtil.isTabletByRes(this)) item = vi.inflate(R.layout.item_hotel_tab, llHotelList, false); else item = vi.inflate(R.layout.item_hotel, llHotelList, false); ImageView ivThumb = (ImageView) item.findViewById(R.id.ivThumb); if (value.id == -1) { ivThumb.setImageResource(R.drawable.home_hotel_bg); } else { ImageLoader.getInstance().displayImage(value.hotel_logo, ivThumb, options, animateFirstListener); } TextView tvTitle = (TextView) item.findViewById(R.id.tvTitle); tvTitle.setText(value.hotel_name); tvTitle.setSelected(true); if (i == 0) tvTitle.setTextColor(getResources().getColor(R.color.Goldenrod)); item.setTag(tvTitle); item.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { unselectHotels(); ((TextView) arg0.getTag()).setTextColor(getResources().getColor(R.color.Goldenrod)); if (value.id == -1) { PrefValue.setString(AllowedHotels.this, R.string.pref_hotel_id, "-1"); if (DeviceUtil.isTabletByRes(AllowedHotels.this)) goHome_Tab(); else goHome(); } else { PrefValue.setString(AllowedHotels.this, R.string.pref_hotel_id, String.valueOf(value.hotel_id)); goHotel(value); } } }); if (!PRJFUNC.DEFAULT_SCREEN) { PRJFUNC.mGrp.relayoutView(item, LayoutLib.LP_LinearLayout); PRJFUNC.mGrp.setTextViewFontScale(tvTitle); PRJFUNC.mGrp.repaddingView(tvTitle); PRJFUNC.mGrp.relayoutView(item.findViewById(R.id.ivShadowTop), LayoutLib.LP_RelativeLayout); PRJFUNC.mGrp.relayoutView(item.findViewById(R.id.ivShadowBottom), LayoutLib.LP_RelativeLayout); } llHotelList.addView(item); } }
From source file:com.huofu.RestaurantOS.ui.splash.activate.java
/** * ?/*from ww w .ja v a2s.c om*/ * * @param msg: * @param result:-1->? 0-??? */ public void showDialogError(String msg, final int result) { LayoutInflater inflater = (LayoutInflater) ctxt.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View grid = inflater.inflate(R.layout.dialog_show_error_one_option, null); TextView tvContent = (TextView) grid.findViewById(R.id.tv_dialog_error_content); final Button btn_close = (Button) grid.findViewById(R.id.btn_dialog_error_close); tvContent.setText(msg); OnClickListener ocl = new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (v.getId() == btn_close.getId()) { if (dialog_show_error != null) { if (dialog_show_error.isShowing()) { dialog_show_error.dismiss(); } } if (result == -1) { finishWithNextActivity(LoginActivity.class); } } } }; btn_close.setOnClickListener(ocl); int width = CommonUtils.getScreenWidth(ctxt); int height = CommonUtils.getScreenHeight(ctxt); if (dialog_show_error == null) { dialog_show_error = new PopupWindow(grid, width, height, true); } dialog_show_error.setBackgroundDrawable(new BitmapDrawable()); dialog_show_error.setContentView(grid); dialog_show_error.setFocusable(true); dialog_show_error.setOutsideTouchable(true); dialog_show_error.setAnimationStyle(R.style.AutoDialogAnimation); try { dialog_show_error.showAtLocation(rl_activate, Gravity.NO_GRAVITY, 0, 0); } catch (Exception e) { } }
From source file:cl.gisred.android.PowerOnActivity.java
public void dialogBusqueda() { AlertDialog.Builder dialogBusqueda = new AlertDialog.Builder(this); dialogBusqueda.setTitle("Busqueda"); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.dialog_busqueda, null); dialogBusqueda.setView(v);//ww w. j a v a 2 s .c om Spinner spinner = (Spinner) v.findViewById(R.id.spinnerBusqueda); final LinearLayout llBuscar = (LinearLayout) v.findViewById(R.id.llBuscar); final LinearLayout llDireccion = (LinearLayout) v.findViewById(R.id.llBuscarDir); final LinearLayout llOrden = (LinearLayout) v.findViewById(R.id.llBuscarOrden); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, searchArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { SpiBusqueda = position; if (position == 6) { if (llDireccion != null) llDireccion.setVisibility(View.GONE); if (llBuscar != null) llBuscar.setVisibility(View.GONE); if (llOrden != null) llOrden.setVisibility(View.VISIBLE); } else if (position == 4) { if (llBuscar != null) llBuscar.setVisibility(View.GONE); if (llOrden != null) llOrden.setVisibility(View.GONE); if (llDireccion != null) llDireccion.setVisibility(View.VISIBLE); } else { if (llDireccion != null) llDireccion.setVisibility(View.GONE); if (llOrden != null) llOrden.setVisibility(View.GONE); if (llBuscar != null) llBuscar.setVisibility(View.VISIBLE); } } @Override public void onNothingSelected(AdapterView<?> parent) { Toast.makeText(getApplicationContext(), "Nada seleccionado", Toast.LENGTH_SHORT).show(); } }); final EditText eSearch = (EditText) v.findViewById(R.id.txtBuscar); final EditText eStreet = (EditText) v.findViewById(R.id.txtCalle); final EditText eNumber = (EditText) v.findViewById(R.id.txtNum); final EditText eOrder = (EditText) v.findViewById(R.id.txtOrden); dialogBusqueda.setPositiveButton("Buscar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (SpiBusqueda == 4) { txtBusqueda = new String(); if (!eStreet.getText().toString().isEmpty()) txtBusqueda = (eNumber.getText().toString().trim().isEmpty()) ? "0 " : eNumber.getText().toString().trim() + " "; txtBusqueda = txtBusqueda + eStreet.getText().toString(); } else if (SpiBusqueda == 6) { txtBusqueda = eOrder.getText().toString() + "-1"; } else { txtBusqueda = eSearch.getText().toString(); } if (txtBusqueda.trim().isEmpty()) { Toast.makeText(myMapView.getContext(), "Debe ingresar un valor", Toast.LENGTH_SHORT).show(); } else { // Escala de calle para busquedas por default iBusqScale = 4000; switch (SpiBusqueda) { case 0: callQuery(txtBusqueda, getValueByEmp("CLIENTES_XY_006.nis"), LyCLIENTES.getUrl().concat("/0")); if (LyCLIENTES.getLayers() != null && LyCLIENTES.getLayers().length > 0) iBusqScale = LyCLIENTES.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 1: callQuery(txtBusqueda, "codigo", LySED.getUrl().concat("/1")); if (LySED.getLayers() != null && LySED.getLayers().length > 1) iBusqScale = LySED.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 2: callQuery(txtBusqueda, "rotulo", LyPOSTES.getUrl().concat("/0")); if (LyPOSTES.getLayers() != null && LyPOSTES.getLayers().length > 0) iBusqScale = LyPOSTES.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 3: callQuery(txtBusqueda, "serie_medidor", LyMEDIDORES.getUrl().concat("/1")); if (LyMEDIDORES.getLayers() != null && LyMEDIDORES.getLayers().length > 1) iBusqScale = LyMEDIDORES.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 4: iBusqScale = 5000; String[] sBuscar = { eStreet.getText().toString(), eNumber.getText().toString() }; String[] sFields = { "nombre_calle", "numero" }; callQuery(sBuscar, sFields, LyDIRECCIONES.getUrl().concat("/0")); break; case 5: callQuery(txtBusqueda, new String[] { "id_equipo", "nombre" }, LyEQUIPOSLINEA.getUrl().concat("/0")); if (LyEQUIPOSLINEA.getLayers() != null && LyEQUIPOSLINEA.getLayers().length > 0) iBusqScale = LyEQUIPOSLINEA.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 6: callQuery(txtBusqueda, getValueByEmp("ARCGIS.dbo.POWERON_CLIENTES.id_orden"), LyPOCLIENTES.getUrl().concat("/1")); if (LyPOCLIENTES.getLayers() != null && LyPOCLIENTES.getLayers().length > 0) if (LyPOCLIENTES.getLayers()[1].getLayerServiceInfo().getMinScale() > 0) iBusqScale = LyPOCLIENTES.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 7: callQueryInt(txtBusqueda, getValueByEmp("ARCGIS.dbo.POWERON_CLIENTES.id_incidencia"), LyPOCLIENTES.getUrl().concat("/1")); if (LyPOCLIENTES.getLayers() != null && LyPOCLIENTES.getLayers().length > 0) if (LyPOCLIENTES.getLayers()[1].getLayerServiceInfo().getMinScale() > 0) iBusqScale = LyPOCLIENTES.getLayers()[1].getLayerServiceInfo().getMinScale(); break; } } } }); dialogBusqueda.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); dialogBusqueda.show(); }
From source file:com.github.jthuraisamy.yellowusage.ui.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem refreshItem = menu.findItem(R.id.action_refresh); Log.d(TAG, "isMobileDataEnabled = " + isMobileDataEnabled(connectivityManager)); Log.d(TAG, "isMobileDataConnected = " + isMobileDataConnected(telephonyManager)); Log.d(TAG, "isWifiConnected = " + isWifiConnected(wifiManager)); // Stop refresh icon animation if it's already ongoing. if (refreshItemActionView != null) refreshItemActionView.clearAnimation(); refreshItem.setActionView(null);/*from www. ja v a2 s.co m*/ boolean waitingForData = (!taskQueue.isEmpty()) && (!isMobileDataConnected(telephonyManager)); // (Re-)Start preparing refresh icon animation while waiting for mobile data connection. if (waitingForData) { LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); @SuppressLint("InflateParams") ImageView animatingRefreshIcon = (ImageView) layoutInflater.inflate(R.layout.icon_refresh, null); Animation clockwiseRotation = AnimationUtils.loadAnimation(this, R.anim.counterclockwise_refresh); animatingRefreshIcon.startAnimation(clockwiseRotation); refreshItem.setActionView(animatingRefreshIcon); // getActionView() always returns null in the else block, so it's assigned to a member variable. refreshItemActionView = refreshItem.getActionView(); } // (Re-)Start refresh icon animation only if there are ongoing tasks. if (ongoingTasks > 0) { LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); @SuppressLint("InflateParams") ImageView animatingRefreshIcon = (ImageView) layoutInflater.inflate(R.layout.icon_refresh, null); Animation clockwiseRotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh); animatingRefreshIcon.startAnimation(clockwiseRotation); refreshItem.setActionView(animatingRefreshIcon); // getActionView() always returns null in the else block, so it's assigned to a member variable. refreshItemActionView = refreshItem.getActionView(); } return super.onPrepareOptionsMenu(menu); }