List of usage examples for android.content DialogInterface cancel
void cancel();
From source file:com.zen.androidhtmleditor.AHEActivity.java
@SuppressLint("NewApi") @Override//from w w w . j av a 2 s. c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); setContentView(R.layout.main); SystemBarTintManager tintManager = new SystemBarTintManager(this); // enable status bar tint tintManager.setStatusBarTintEnabled(true); tintManager.setTintColor(Color.parseColor("#4acab4")); SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); Settings.init(settings); //Uncomment this for non Market installs. This will allow version checking. //new Version(this,getVersionName(this,DeveloperToolsActivity.class),"http://androidhtmleditor.com/version.php").execute(); deviceId = Secure.getString(this.getContentResolver(), Secure.ANDROID_ID); getOverflowMenu(); getActionBar().setIcon(R.drawable.icon_white); tabactivity = (TabActivity) this; tabHost = tabactivity.getTabHost(); hsv = (HorizontalScrollView) tabactivity.findViewById(R.id.topmenu); mLicenseCheckerCallback = new MyLicenseCheckerCallback(); mChecker = new LicenseChecker(this, new ServerManagedPolicy(this, new AESObfuscator(SALT, getPackageName(), deviceId)), BASE64_PUBLIC_KEY // Your public licensing key. ); mHandler = new Handler(); // doCheck(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (LinearLayout) findViewById(R.id.l1); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle("File(s)"); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle("Server"); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); Button button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { onButtonClickEvent(v); } }); Button disconnect_button = (Button) findViewById(R.id.disconnect_button); disconnect_button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { disconnect(); } }); /* Button button2 = (Button)findViewById(R.id.button2); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { hsv.setVisibility(View.GONE); v.setVisibility(View.GONE); RelativeLayout rl = (RelativeLayout)v.getParent(); Button button1 = (Button)findViewById(R.id.button1); button1.setVisibility(View.VISIBLE); Button button3 = (Button)findViewById(R.id.button3); button3.setVisibility(View.VISIBLE); ImageView logo = (ImageView)findViewById(R.id.logo); logo.setVisibility(View.VISIBLE); TextView slogan = (TextView)findViewById(R.id.appSlogan); slogan.setVisibility(View.VISIBLE); ScrollView frontLayout = (ScrollView)findViewById(R.id.front); frontLayout.setVisibility(View.VISIBLE); TextView appTitle = (TextView)findViewById(R.id.appTitle); appTitle.setVisibility(View.VISIBLE); Button backButton = (Button)rl.findViewById(R.id.backButton); backButton.setVisibility(View.GONE); arrayAdapter.clear(); arrayAdapter.notifyDataSetChanged(); TextView pathInfo = (TextView)rl.findViewById(R.id.path); pathInfo.setText(""); folderPath = ""; //new MyFetchTask("zenstudio.com.au", "zenstudi", ".-x$%Wmd5b#C","folder",folderPath).execute(); connectedTo = -1; Toast.makeText(AHEActivity.this, "Disconnected", Toast.LENGTH_SHORT).show(); } });*/ Button button3 = (Button) findViewById(R.id.button3); button3.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent SettingsIntent = new Intent(AHEActivity.this, Settings.class); startActivity(SettingsIntent); } }); /*Button backButton = (Button)findViewById(R.id.backButton); backButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String[] pathBits = folderPath.split("/"); folderPath = ""; for(int i=0;i<pathBits.length-1;i++){ folderPath += pathBits[i]+"/"; } arrayAdapter.clear(); //connectedTo SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); String currentServers = settings.getString("Accounts", ""); if(currentServers.equals("")){}else{ Gson gson = new Gson(); SearchResponse response = gson.fromJson(currentServers, SearchResponse.class); List<Result> results = response.data; Result l = results.get(connectedTo); if(l.serverName!="" && l.userName!="" && l.port.trim()!=""){ if(l.sftp.equals("0") || l.sftp.equals("1") || l.sftp.equals("2")){ new MyFetchTask(l.serverName, l.userName, l.passWord,"folder",folderPath,l.sftp,l.port).execute(); }else if(l.sftp.equals("3")){ new FetchSSLTask(l.serverName, l.userName, l.passWord,"folder",folderPath,l.sftp,l.port).execute(); } } } } });*/ TextView pathInfo = (TextView) findViewById(R.id.path); pathInfo.setText(folderPath); lstTest = (ListView) findViewById(R.id.list); // lstTest.setDividerHeight(10); lstTest.setPadding(0, 5, 0, 5); alrts = new ArrayList<String[]>(); arrayAdapter = new FetchAdapter(AHEActivity.this, R.layout.listitems, alrts); lstTest.setAdapter(arrayAdapter); lstTest.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) { final View d = v; final CharSequence[] items = { "Delete", "Rename", "Chmod", "Download" }; TextView t = (TextView) v.findViewById(R.id.fileFolderName); final String oldName = t.getText().toString(); final int position = pos; AlertDialog.Builder builder = new AlertDialog.Builder(AHEActivity.this); builder.setTitle("Choose Action"); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) { AlertDialog.Builder dbuilder = new AlertDialog.Builder(AHEActivity.this); dbuilder.setMessage("Delete this file?").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { deleteFile(d); dialog.cancel(); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog dalert = dbuilder.create(); dalert.show(); } else if (item == 1) { final Dialog renameDialog = new Dialog(AHEActivity.this); renameDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); renameDialog.setContentView(R.layout.renamediag); renameDialog.setCancelable(true); Button closeServer = (Button) renameDialog.findViewById(R.id.closeServer); closeServer.setOnClickListener(new OnClickListener() { public void onClick(View v) { renameDialog.cancel(); } }); Button saveServer = (Button) renameDialog.findViewById(R.id.saveServer); saveServer.setOnClickListener(new OnClickListener() { public void onClick(View v) { EditText themeUrl = (EditText) renameDialog.findViewById(R.id.themeLink); String newName = themeUrl.getText().toString(); //connectedTo SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); String currentServers = settings.getString("Accounts", ""); if (currentServers.equals("")) { } else { Gson gson = new Gson(); SearchResponse response = gson.fromJson(currentServers, SearchResponse.class); List<Result> results = response.data; Result l = results.get(connectedTo); if (l.serverName != "" && l.userName != "" && l.port.trim() != "") { new RenameTask(l.serverName, l.userName, l.passWord, oldName, newName, folderPath, l.sftp, l.port, position).execute(); renameDialog.cancel(); } } } }); renameDialog.show(); } else if (item == 2) { final Dialog chmodDialog = new Dialog(AHEActivity.this); chmodDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); chmodDialog.setContentView(R.layout.chmoddiag); chmodDialog.setCancelable(true); Button closeServer = (Button) chmodDialog.findViewById(R.id.closeServer); closeServer.setOnClickListener(new OnClickListener() { public void onClick(View v) { chmodDialog.cancel(); } }); Button saveServer = (Button) chmodDialog.findViewById(R.id.saveServer); saveServer.setOnClickListener(new OnClickListener() { public void onClick(View v) { EditText themeUrl = (EditText) chmodDialog.findViewById(R.id.themeLink); String perms = themeUrl.getText().toString(); //connectedTo SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); String currentServers = settings.getString("Accounts", ""); if (currentServers.equals("")) { } else { Gson gson = new Gson(); SearchResponse response = gson.fromJson(currentServers, SearchResponse.class); List<Result> results = response.data; Result l = results.get(connectedTo); if (l.serverName != "" && l.userName != "" && l.port.trim() != "") { if (l.sftp.equals("0") || l.sftp.equals("1") || l.sftp.equals("2")) { new ChmodTask(l.serverName, l.userName, l.passWord, oldName, perms, folderPath, l.sftp, l.port, position).execute(); } else { Toast.makeText(AHEActivity.this, "CHMOD could not be performed on your server via sftp", Toast.LENGTH_SHORT).show(); } chmodDialog.cancel(); } } } }); chmodDialog.show(); } else if (item == 3) { //Make new class to download a file SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); String currentServers = settings.getString("Accounts", ""); if (currentServers.equals("")) { } else { Gson gson = new Gson(); SearchResponse response = gson.fromJson(currentServers, SearchResponse.class); List<Result> results = response.data; Result l = results.get(connectedTo); if (l.serverName != "" && l.userName != "" && l.port.trim() != "") { if (l.sftp.equals("0") || l.sftp.equals("1") || l.sftp.equals("2")) { new DlTask(l.serverName, l.userName, l.passWord, oldName, l.sftp, l.port) .execute(); } } } } //Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show(); } }); AlertDialog alert = builder.create(); alert.show(); return true; } }); lstTest.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> av, View v, int pos, long id) { loadFileFolder(v); } }); }
From source file:com.homeworkreminder.Main.java
private void showDialogForNewSubject() { // TODO Auto-generated method stub AlertDialog.Builder alertDialog = new AlertDialog.Builder(context); alertDialog.setTitle("Create a new subject"); alertDialog.setMessage("Name the your subject"); final EditText input = new EditText(context); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(10, 0, 10, 0);//from w w w . j a v a 2s.c o m input.setLayoutParams(lp); alertDialog.setView(input); alertDialog.setPositiveButton("Create", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String subject = input.getText().toString(); if (subject.contentEquals("")) { Toast.makeText(context, "Subject name cannot be empty", Toast.LENGTH_LONG).show(); return; } if (!(subjectArray.contains(subject))) { addSubject(subject); dialog.dismiss(); } else if (subject.contentEquals(ADD_SUBJECT)) { Toast.makeText(context, "Cannot use this name", Toast.LENGTH_LONG).show(); dialog.dismiss(); } else { Toast.makeText(context, "Subject already exists", Toast.LENGTH_LONG).show(); dialog.dismiss(); } } }); // Setting Negative Button alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to execute after // dialog dialog.cancel(); } }); alertDialog.show(); }
From source file:com.abeo.tia.noordin.PropertyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_property); // load titles from strings.xml navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); // load icons from strings.xml navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons); // Find Set Function set(navMenuTitles, navMenuIcons);/*from w w w.j a va 2 s . co m*/ // Find Button by Id buttonWalkIn = (Button) findViewById(R.id.button_PropertyWalkin); buttonFind = (Button) findViewById(R.id.button_PropertyFind); buttonAdd = (Button) findViewById(R.id.button_PropertyAdd); buttonEdit = (Button) findViewById(R.id.button_PropertyEdit); buttonConfirm = (Button) findViewById(R.id.button_PropertyConfirm); buttonPropertyList = (Button) findViewById(R.id.button_PropertyList); buttonRelatedCaes = (Button) findViewById(R.id.button_PropertyRelateCases); ZoomButton_propertyPdf1 = (ZoomButton) findViewById(R.id.zoomButton_propertyPdf1); // Find EditText Fields propertytitleNo = (EditText) findViewById(R.id.editText_ProperTytitleNo); propertyLotType = (EditText) findViewById(R.id.editText_PropertyLotType); propertyLotPTDNo = (EditText) findViewById(R.id.editText_PropertyLotPTDNo); propertyFormerlyKnownAs = (EditText) findViewById(R.id.editText_PropertyFormerlyKnownAs); propertyBandarPekanMukin = (EditText) findViewById(R.id.editText_PropertyBandarPekanMukin); //propertyDaerahState = (EditText) findViewById(R.id.editText_PropertyDaerahState); propertyNageriArea = (EditText) findViewById(R.id.editText_PropertyNageriArea); propertyLOTAREA_SQM = (EditText) findViewById(R.id.editText_PropertyLotArea); //propertyLOTAREA_SQFT = (EditText) findViewById(R.id.editText_PropertySqMeter); propertyLASTUPDATEDON = (EditText) findViewById(R.id.editText_PropertyLastUpdateOn); propertyDEVLICNO = (EditText) findViewById(R.id.editText_PropertyDevLicense); propertyDVLPR_LOC = (EditText) findViewById(R.id.editText_PropertySolicitorLoc); propertyLSTCHG_BRANCH = (EditText) findViewById(R.id.editText_PropertyBranch); propertyLSTCHG_PANO = (EditText) findViewById(R.id.editText_PropertyPAName); propertyLSTCHG_PRSTNO = (EditText) findViewById(R.id.editText_PropertyPresentaionNo); // Find By Id spinner Address To Use spinnerpropertyTitleType = (Spinner) findViewById(R.id.spinner_PropertyTitleType); spinnerpropertyPROJECT = (Spinner) findViewById(R.id.spinner_PropertyProjectDropdown); spinnerpropertyLSTCHG_BANKNAME = (Spinner) findViewById(R.id.spinner_PropertyProjectBank); spinnerpropertyDEVELOPER = (Spinner) findViewById(R.id.spinner_PropertyDevelopoer); spinnerpropertyDEVSOLICTOR = (Spinner) findViewById(R.id.spinner_PropertySolicitor); spinnerpropertySTATE = (Spinner) findViewById(R.id.state); QryGroup13 = (CheckBox) findViewById(R.id.PropetyCharged); // Find the SharedPreferences Firstname SharedPreferences FirstName = getSharedPreferences("LoginData", Context.MODE_PRIVATE); String FirName = FirstName.getString("FIRSETNAME", ""); TextView welcome = (TextView) findViewById(R.id.textView_welcome); welcome.setText("Welcome " + FirName); // Spinner click listener spinnerpropertySTATE.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { ID = (TextView) view.findViewById(R.id.Id); stateval_id = ID.getText().toString(); TEXT = (TextView) view.findViewById(R.id.Name); stateval = TEXT.getText().toString(); // Showing selected spinner item //Toast.makeText(parent.getContext(), "Selected: " + developerValue, Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); // Spinner click listener // Spinner click listener spinnerpropertyTitleType.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { textTitle_id = (TextView) view.findViewById(R.id.Id); titleValue_id = textTitle_id.getText().toString(); textTitle = (TextView) view.findViewById(R.id.Name); titleValue = textTitle.getText().toString(); // Showing selected spinner item //Toast.makeText(parent.getContext(), "Selected: " + titleValue, Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); // Spinner click listener spinnerpropertyPROJECT.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { textProject_id = (TextView) view.findViewById(R.id.Id); projectValue_id = textProject_id.getText().toString(); textProject = (TextView) view.findViewById(R.id.Name); projectValue = textProject.getText().toString(); // Showing selected spinner item //Toast.makeText(parent.getContext(), "Selected: " + projectValue, Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); // Spinner click listener spinnerpropertyDEVELOPER.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { textDeveloper_id = (TextView) view.findViewById(R.id.Id); developerValue_id = textDeveloper_id.getText().toString(); textDeveloper = (TextView) view.findViewById(R.id.Name); developerValue = textDeveloper.getText().toString(); // Showing selected spinner item //Toast.makeText(parent.getContext(), "Selected: " + developerValue, Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); // Spinner click listener spinnerpropertyDEVSOLICTOR.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { textSolicitor_id = (TextView) view.findViewById(R.id.Id); solicitorValue_id = textSolicitor_id.getText().toString(); textSolicitor = (TextView) view.findViewById(R.id.Name); solicitorValue = textSolicitor.getText().toString(); // Showing selected spinner item //Toast.makeText(parent.getContext(), "Selected: " + solicitorValue, Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); // Spinner click listener spinnerpropertyLSTCHG_BANKNAME.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { textBank_id = (TextView) view.findViewById(R.id.Id); bankValue_id = textBank_id.getText().toString(); textBank = (TextView) view.findViewById(R.id.Name); bankValue = textBank.getText().toString(); // Showing selected spinner item //Toast.makeText(parent.getContext(), "Selected: " + bankValue, Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> parent) { // TODO Auto-generated method stub } }); spinnerpropertyTitleType.requestFocus(); // Find disable spinner spinnerpropertyDEVELOPER.setEnabled(false); spinnerpropertyDEVELOPER.setClickable(false); spinnerpropertyPROJECT.setEnabled(false); spinnerpropertyPROJECT.setClickable(false); spinnerpropertyDEVSOLICTOR.setEnabled(false); spinnerpropertyDEVSOLICTOR.setClickable(false); spinnerpropertyLSTCHG_BANKNAME.setEnabled(false); spinnerpropertyLSTCHG_BANKNAME.setClickable(false); // PropertyWalkin button enable buttonWalkIn.setEnabled(true); buttonWalkIn.setClickable(true); buttonWalkIn.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); // Find button enable buttonFind.setClickable(false); buttonFind.setTextColor(getApplication().getResources().getColor(R.color.gray)); // PropertyList button enable buttonPropertyList.setEnabled(true); buttonPropertyList.setClickable(true); buttonPropertyList.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); buttonFind.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { spinnerpropertyTitleType.requestFocus(); spinnerpropertyTitleType.setFocusableInTouchMode(true); // find button disable buttonFind.setClickable(false); buttonFind.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Property Related case list button enable buttonRelatedCaes.setEnabled(false); buttonRelatedCaes.setClickable(false); buttonRelatedCaes.setTextColor(getApplication().getResources().getColor(R.color.gray)); } }); // Add button enable buttonAdd.setClickable(true); buttonAdd.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); buttonAdd.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // change boolean flag isADD = true; // Add button disable buttonAdd.setClickable(false); buttonAdd.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Walk-in button enable buttonWalkIn.setEnabled(true); buttonWalkIn.setClickable(true); buttonWalkIn.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); // Confirm button enable buttonConfirm.setEnabled(true); buttonConfirm.setClickable(true); buttonConfirm.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); // Property List button enable buttonPropertyList.setEnabled(false); buttonPropertyList.setClickable(false); buttonPropertyList.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Related button enable buttonRelatedCaes.setEnabled(false); buttonRelatedCaes.setClickable(false); buttonRelatedCaes.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Related button enable buttonEdit.setEnabled(false); buttonEdit.setClickable(false); buttonEdit.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Set edit text enable spinnerpropertyTitleType.setEnabled(true); spinnerpropertyTitleType.setClickable(true); spinnerpropertyTitleType.setFocusable(true); spinnerpropertyTitleType.setFocusableInTouchMode(true); spinnerpropertyTitleType.setSelection(0); spinnerpropertySTATE.setEnabled(true); spinnerpropertySTATE.setClickable(true); spinnerpropertySTATE.setFocusable(true); spinnerpropertySTATE.setFocusableInTouchMode(true); spinnerpropertySTATE.setSelection(0); propertytitleNo.setEnabled(true); propertytitleNo.setClickable(true); propertytitleNo.setFocusableInTouchMode(true); propertytitleNo.setText(""); propertyLotType.setEnabled(true); propertyLotType.setClickable(true); propertyLotType.setFocusableInTouchMode(true); propertyLotType.setText(""); propertyLotPTDNo.setEnabled(true); propertyLotPTDNo.setClickable(true); propertyLotPTDNo.setFocusableInTouchMode(true); propertyLotPTDNo.setText(""); propertyFormerlyKnownAs.setEnabled(true); propertyFormerlyKnownAs.setClickable(true); propertyFormerlyKnownAs.setFocusableInTouchMode(true); propertyFormerlyKnownAs.setText(""); propertyBandarPekanMukin.setEnabled(true); propertyBandarPekanMukin.setClickable(true); propertyBandarPekanMukin.setFocusableInTouchMode(true); propertyBandarPekanMukin.setText(""); //propertyDaerahState.setEnabled(true); //propertyDaerahState.setClickable(true); //propertyDaerahState.setFocusableInTouchMode(true); //propertyDaerahState.setText(""); propertyNageriArea.setEnabled(true); propertyNageriArea.setClickable(true); propertyNageriArea.setFocusableInTouchMode(true); propertyNageriArea.setText(""); propertyLOTAREA_SQM.setEnabled(true); propertyLOTAREA_SQM.setClickable(true); propertyLOTAREA_SQM.setFocusableInTouchMode(true); propertyLOTAREA_SQM.setText(""); //propertyLOTAREA_SQFT.setEnabled(true); //propertyLOTAREA_SQFT.setClickable(true); //propertyLOTAREA_SQFT.setFocusableInTouchMode(true); //propertyLOTAREA_SQFT.setText(""); propertyLASTUPDATEDON.setEnabled(false); propertyLASTUPDATEDON.setClickable(false); propertyLASTUPDATEDON.setFocusableInTouchMode(false); propertyLASTUPDATEDON.setText(""); spinnerpropertyDEVELOPER.setEnabled(true); spinnerpropertyDEVELOPER.setClickable(true); spinnerpropertyDEVELOPER.setFocusableInTouchMode(true); spinnerpropertyDEVELOPER.setSelection(0); spinnerpropertyPROJECT.setEnabled(true); spinnerpropertyPROJECT.setClickable(true); spinnerpropertyPROJECT.setFocusableInTouchMode(true); spinnerpropertyPROJECT.setSelection(0); propertyDEVLICNO.setEnabled(true); propertyDEVLICNO.setClickable(true); propertyDEVLICNO.setFocusableInTouchMode(true); propertyDEVLICNO.setText(""); spinnerpropertyDEVSOLICTOR.setEnabled(true); spinnerpropertyDEVSOLICTOR.setClickable(true); spinnerpropertyDEVSOLICTOR.setFocusableInTouchMode(true); spinnerpropertyDEVSOLICTOR.setSelection(0); propertyDVLPR_LOC.setEnabled(true); propertyDVLPR_LOC.setClickable(true); propertyDVLPR_LOC.setFocusableInTouchMode(true); propertyDVLPR_LOC.setText(""); spinnerpropertyLSTCHG_BANKNAME.setEnabled(true); spinnerpropertyLSTCHG_BANKNAME.setClickable(true); spinnerpropertyLSTCHG_BANKNAME.setFocusableInTouchMode(true); spinnerpropertyLSTCHG_BANKNAME.setSelection(0); propertyLSTCHG_BRANCH.setEnabled(true); propertyLSTCHG_BRANCH.setClickable(true); propertyLSTCHG_BRANCH.setFocusableInTouchMode(true); propertyLSTCHG_BRANCH.setText(""); propertyLSTCHG_PANO.setEnabled(true); propertyLSTCHG_PANO.setClickable(true); propertyLSTCHG_PANO.setFocusableInTouchMode(true); propertyLSTCHG_PANO.setText(""); propertyLSTCHG_PRSTNO.setEnabled(true); propertyLSTCHG_PRSTNO.setClickable(true); propertyLSTCHG_PRSTNO.setFocusableInTouchMode(true); propertyLSTCHG_PRSTNO.setText(""); } }); buttonWalkIn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method Intent i = new Intent(PropertyActivity.this, WalkInActivity.class); startActivity(i); } }); // Find ZoomButton for property list ZoomButton_propertyPdf1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!TITLELINK.equals("")) { String pdfurl = "http://54.251.51.69:3878" + TITLELINK; //YOUR URL TO PDF String googleDocsUrl = "http://docs.google.com/viewer?url=" + pdfurl; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(googleDocsUrl), "text/html"); startActivity(intent); } } }); // Find Button for edit property details buttonEdit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // change the boolean flag isEdit = true; // Confirm button enable buttonConfirm.setEnabled(true); buttonConfirm.setClickable(true); buttonConfirm.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); // Add button disable buttonAdd.setEnabled(false); buttonAdd.setClickable(false); buttonAdd.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Edit button disable buttonEdit.setEnabled(false); buttonEdit.setClickable(false); buttonEdit.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Walk-in button disable buttonWalkIn.setEnabled(false); buttonWalkIn.setClickable(false); buttonWalkIn.setTextColor(getApplication().getResources().getColor(R.color.gray)); // PropertyList button disable buttonPropertyList.setEnabled(false); buttonPropertyList.setClickable(false); buttonPropertyList.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Related case button enable buttonRelatedCaes.setEnabled(true); buttonRelatedCaes.setClickable(true); buttonRelatedCaes.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); // edit text enable spinnerpropertyTitleType.setClickable(true); spinnerpropertyTitleType.setEnabled(true); spinnerpropertyTitleType.setFocusableInTouchMode(true); spinnerpropertySTATE.setClickable(true); spinnerpropertySTATE.setEnabled(true); spinnerpropertySTATE.setFocusableInTouchMode(true); propertytitleNo.setClickable(true); propertytitleNo.setEnabled(true); propertytitleNo.setFocusableInTouchMode(true); propertyLotType.setClickable(true); propertyLotType.setEnabled(true); propertyLotType.setFocusableInTouchMode(true); propertyLotPTDNo.setClickable(true); propertyLotPTDNo.setEnabled(true); propertyLotPTDNo.setFocusableInTouchMode(true); propertyFormerlyKnownAs.setClickable(true); propertyFormerlyKnownAs.setEnabled(true); propertyFormerlyKnownAs.setFocusableInTouchMode(true); propertyBandarPekanMukin.setClickable(true); propertyBandarPekanMukin.setEnabled(true); propertyBandarPekanMukin.setFocusableInTouchMode(true); //propertyDaerahState.setClickable(true); //propertyDaerahState.setEnabled(true); //propertyDaerahState.setFocusableInTouchMode(true); propertyNageriArea.setClickable(true); propertyNageriArea.setEnabled(true); propertyNageriArea.setFocusableInTouchMode(true); propertyLOTAREA_SQM.setClickable(true); propertyLOTAREA_SQM.setEnabled(true); propertyLOTAREA_SQM.setFocusableInTouchMode(true); //propertyLOTAREA_SQFT.setClickable(true); //propertyLOTAREA_SQFT.setEnabled(true); //propertyLOTAREA_SQFT.setFocusableInTouchMode(true); propertyLASTUPDATEDON.setClickable(false); propertyLASTUPDATEDON.setEnabled(false); propertyLASTUPDATEDON.setFocusableInTouchMode(false); spinnerpropertyDEVELOPER.setClickable(true); spinnerpropertyDEVELOPER.setEnabled(true); spinnerpropertyDEVELOPER.setFocusable(true); spinnerpropertyDEVELOPER.setFocusableInTouchMode(true); spinnerpropertyPROJECT.setClickable(true); spinnerpropertyPROJECT.setEnabled(true); spinnerpropertyPROJECT.setFocusableInTouchMode(true); propertyDEVLICNO.setClickable(true); propertyDEVLICNO.setEnabled(true); propertyDEVLICNO.setFocusableInTouchMode(true); spinnerpropertyDEVSOLICTOR.setClickable(true); spinnerpropertyDEVSOLICTOR.setEnabled(true); spinnerpropertyDEVSOLICTOR.setFocusableInTouchMode(true); propertyDVLPR_LOC.setClickable(true); propertyDVLPR_LOC.setEnabled(true); propertyDVLPR_LOC.setFocusableInTouchMode(true); spinnerpropertyLSTCHG_BANKNAME.setClickable(true); spinnerpropertyLSTCHG_BANKNAME.setEnabled(true); spinnerpropertyLSTCHG_BANKNAME.setFocusableInTouchMode(true); propertyLSTCHG_BRANCH.setClickable(true); propertyLSTCHG_BRANCH.setEnabled(true); propertyLSTCHG_BRANCH.setFocusableInTouchMode(true); propertyLSTCHG_PANO.setClickable(true); propertyLSTCHG_PANO.setEnabled(true); propertyLSTCHG_PANO.setFocusableInTouchMode(true); propertyLSTCHG_PRSTNO.setClickable(true); propertyLSTCHG_PRSTNO.setEnabled(true); propertyLSTCHG_PRSTNO.setFocusableInTouchMode(true); } }); // Find Confirm button buttonConfirm.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(PropertyActivity.this); // set title alertDialogBuilder.setTitle("Confirm"); // set dialog message alertDialogBuilder.setMessage("Click yes to save!").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (isADD == true && isEdit == false) { // call edit webservice for property details addDatapropertyDetails(); } else { // call edit webservice for property details sendDataEditpropertyDetails(); } Intent i = getIntent(); startActivity(i); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // if this button is clicked, just close // the dialog box and do nothing dialog.cancel(); } }); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); // show it alertDialog.show(); } }); // Find Property List on button Click buttonPropertyList.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { spinnerpropertyTitleType.setEnabled(true); spinnerpropertyTitleType.requestFocus(); spinnerpropertyTitleType.setClickable(true); spinnerpropertyTitleType.setFocusable(true); spinnerpropertySTATE.setEnabled(true); spinnerpropertySTATE.requestFocus(); spinnerpropertySTATE.setClickable(true); spinnerpropertySTATE.setFocusable(true); //Toast.makeText(PropertyActivity.this, "Search button clicked!", Toast.LENGTH_SHORT).show(); // Call web service webRequestPropertyDetails(); } }); // Find Property Case List on button click buttonRelatedCaes.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub webRequestPropertyCaseList(); //Toast.makeText(PropertyActivity.this, "Related case clicked", Toast.LENGTH_SHORT).show(); } }); // Result Bundle getting from list item click to property activity Bundle b = getIntent().getExtras(); if (b != null) { // Add button disable buttonAdd.setClickable(true); buttonAdd.setFocusable(true); buttonAdd.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); // Find button enable buttonFind.setClickable(false); buttonFind.setFocusable(false); buttonFind.setTextColor(getApplication().getResources().getColor(R.color.gray)); // PropertyList button enable buttonPropertyList.setClickable(false); buttonPropertyList.setFocusable(false); buttonPropertyList.setTextColor(getApplication().getResources().getColor(R.color.gray)); // Related Case button enable buttonRelatedCaes.setClickable(true); buttonRelatedCaes.setFocusable(true); buttonRelatedCaes.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); // Edit button enable buttonEdit.setClickable(true); buttonEdit.setFocusable(true); buttonEdit.setTextColor(getApplication().getResources().getColor(R.color.royalBlue)); codeDetailResponse = b.getString("CODE_T"); System.out.println("Property Text Details"); System.out.println(codeDetailResponse); codeResonse_listview = codeDetailResponse; titleTypeDetailResponse = b.getString("TITLETYPE_T"); System.out.println(titleTypeDetailResponse); spinnerpropertyTitleType.setEnabled(false); spinnerpropertyTitleType.setClickable(false); spinnerpropertySTATE.setEnabled(false); spinnerpropertySTATE.setClickable(false); titleNoDetailResponse = b.getString("TITLENO_T"); System.out.println(titleNoDetailResponse); propertytitleNo.setEnabled(false); propertytitleNo.setClickable(false); propertytitleNo.setText(titleNoDetailResponse); lotTypeDetailResponse = b.getString("LOTTYPE_T"); System.out.println(lotTypeDetailResponse); propertyLotType.setEnabled(false); propertyLotType.setClickable(false); propertyLotType.setText(lotTypeDetailResponse); lotNoDetailResponse = b.getString("LOTNO_T"); System.out.println(lotNoDetailResponse); propertyLotPTDNo.setEnabled(false); propertyLotPTDNo.setClickable(false); propertyLotPTDNo.setText(lotNoDetailResponse); formerlyDetailResponse = b.getString("FORMERLY_KNOWN_AS_T"); System.out.println(formerlyDetailResponse); propertyFormerlyKnownAs.setEnabled(false); propertyFormerlyKnownAs.setClickable(false); propertyFormerlyKnownAs.setText(formerlyDetailResponse); bpmDetailResponse = b.getString("BPM_T"); System.out.println(bpmDetailResponse); propertyBandarPekanMukin.setEnabled(false); propertyBandarPekanMukin.setClickable(false); propertyBandarPekanMukin.setText(bpmDetailResponse); stateDetailResponse = b.getString("STATE_T"); System.out.println(stateDetailResponse); statevalue = stateDetailResponse; //propertyDaerahState.setEnabled(false); //propertyDaerahState.setClickable(false); //propertyDaerahState.setText(stateDetailResponse); areaDetailResponse = b.getString("AREA_T"); System.out.println(areaDetailResponse); propertyNageriArea.setEnabled(false); propertyNageriArea.setClickable(false); propertyNageriArea.setText(areaDetailResponse); lotAreaDetailResponse = b.getString("LOTAREA_SQM_T"); System.out.println(lotAreaDetailResponse); propertyLOTAREA_SQM.setEnabled(false); propertyLOTAREA_SQM.setClickable(false); propertyLOTAREA_SQM.setText(lotAreaDetailResponse); lotaresSoftDetailResponse = b.getString("LOTAREA_SQFT_T"); System.out.println(lotaresSoftDetailResponse); //propertyLOTAREA_SQFT.setEnabled(false); //propertyLOTAREA_SQFT.setClickable(false); propertyLOTAREA_SQM.setText(lotaresSoftDetailResponse); lastupDateDetailResponse = b.getString("LASTUPDATEDON_T"); System.out.println(lastupDateDetailResponse); propertyLASTUPDATEDON.setEnabled(false); propertyLASTUPDATEDON.setClickable(false); propertyLASTUPDATEDON.setText(lastupDateDetailResponse); developerDetailResponse = b.getString("DEVELOPER_T"); System.out.println(developerDetailResponse); spinnerpropertyDEVELOPER.setEnabled(false); spinnerpropertyDEVELOPER.setClickable(false); developerCodeResponse = b.getString("DVLPR_CODE_T"); System.out.println(developerCodeResponse); spinnerpropertyDEVELOPER.setEnabled(false); spinnerpropertyDEVELOPER.setClickable(false); projectDetailResponse = b.getString("PROJECT_T"); System.out.println(projectDetailResponse); spinnerpropertyPROJECT.setEnabled(false); spinnerpropertyPROJECT.setClickable(false); DevlicNoDetailResponse = b.getString("DEVLICNO_T"); System.out.println(DevlicNoDetailResponse); propertyDEVLICNO.setEnabled(false); propertyDEVLICNO.setClickable(false); propertyDEVLICNO.setText(DevlicNoDetailResponse); devSolictorDetailResponse = b.getString("DEVSOLICTOR_T"); System.out.println(devSolictorDetailResponse); spinnerpropertyDEVSOLICTOR.setEnabled(false); spinnerpropertyDEVSOLICTOR.setClickable(false); devSolictorCodeResponse = b.getString("DVLPR_SOL_CODE_T"); System.out.println(devSolictorCodeResponse); spinnerpropertyDEVSOLICTOR.setEnabled(false); spinnerpropertyDEVSOLICTOR.setClickable(false); devSolictorLocDetailResponse = b.getString("DVLPR_LOC_T"); System.out.println(devSolictorLocDetailResponse); propertyDVLPR_LOC.setEnabled(false); propertyDVLPR_LOC.setClickable(false); propertyDVLPR_LOC.setText(devSolictorLocDetailResponse); bankCodeResponse = b.getString("LSTCHG_BANKNAME_T"); System.out.println(bankCodeResponse); spinnerpropertyLSTCHG_BANKNAME.setEnabled(false); spinnerpropertyLSTCHG_BANKNAME.setClickable(false); bankDetailResponse = b.getString("LSTCHG_BANKNAME_T"); System.out.println(bankDetailResponse); spinnerpropertyLSTCHG_BANKNAME.setEnabled(false); spinnerpropertyLSTCHG_BANKNAME.setClickable(false); branchDetailResponse = b.getString("LSTCHG_BRANCH_T"); System.out.println(branchDetailResponse); propertyLSTCHG_BRANCH.setEnabled(false); propertyLSTCHG_BRANCH.setClickable(false); propertyLSTCHG_BRANCH.setText(branchDetailResponse); panNoDetailResponse = b.getString("LSTCHG_PANO_T"); System.out.println(panNoDetailResponse); propertyLSTCHG_PANO.setEnabled(false); propertyLSTCHG_PANO.setClickable(false); propertyLSTCHG_PANO.setText(panNoDetailResponse); prsentDetailResponse = b.getString("LSTCHG_PRSTNO_T"); System.out.println(prsentDetailResponse); propertyLSTCHG_PRSTNO.setEnabled(false); propertyLSTCHG_PRSTNO.setClickable(false); propertyLSTCHG_PRSTNO.setText(prsentDetailResponse); TITLELINK = b.getString("TITLELINK_T"); if (b.getString("PROPERTYCHARGED_T").equals("Y")) QryGroup13.setChecked(true); if (b.getString("PROPERTYCHARGED_T").equals("N")) QryGroup13.setChecked(false); } try { // Dropdown function title type dropdownPorjectTitleType(); // Dropdown function project dropdownPorject(); dropdownState(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Dropdown BankDeveloperSolicitor function dropdownBankDeveloperSolicitor(); }
From source file:com.fastbootmobile.encore.app.fragments.NewPlaylistFragment.java
@NonNull @Override//from www. j a v a2 s .c o m public Dialog onCreateDialog(Bundle savedInstance) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View root = inflater.inflate(R.layout.dialog_new_playlist, null); final TextView playlistName = (TextView) root.findViewById(R.id.et_playlist_name); final CheckBox multiProviderPlaylist = (CheckBox) root.findViewById(R.id.cb_provider_specific); builder.setView(root).setPositiveButton(getString(R.string.create), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String playlistNameStr = playlistName.getText().toString().trim(); if (!playlistNameStr.isEmpty()) { Log.d(TAG, "Adding new playlist named '" + playlistNameStr + "'"); try { ProviderConnection connection; if (multiProviderPlaylist.isChecked()) { connection = PluginsLookup.getDefault().getMultiProviderPlaylistProvider(); } else { ProviderIdentifier identifier; if (mSong != null) { identifier = mSong.getProvider(); } else if (mAlbum != null) { identifier = mAlbum.getProvider(); } else if (mPlaylist != null) { identifier = mPlaylist.getProvider(); } else { throw new IllegalStateException( "Song, Album and Playlist are all null, cannot determine provider!"); } connection = PluginsLookup.getDefault().getProvider(identifier); } IMusicProvider binder = connection.getBinder(); String playlistRef = binder.addPlaylist(playlistName.getText().toString()); if (playlistRef != null) { if (mSong != null) { binder.addSongToPlaylist(mSong.getRef(), playlistRef, mSong.getProvider()); } else if (mAlbum != null) { Iterator<String> songs = mAlbum.songs(); while (songs.hasNext()) { binder.addSongToPlaylist(songs.next(), playlistRef, mAlbum.getProvider()); } } else if (mPlaylist != null) { Iterator<String> songs = mPlaylist.songs(); while (songs.hasNext()) { // TODO: This might cause issues if we add a playlist // from a multi-provider playlist to another one binder.addSongToPlaylist(songs.next(), playlistRef, mPlaylist.getProvider()); } } } else { throw new IllegalStateException("Playlist reference returned by the provider is null!"); } } catch (Exception e) { Log.e(TAG, "Unable to add playlist", e); Toast.makeText(getActivity(), getString(R.string.toast_playlist_track_add_error, playlistNameStr), Toast.LENGTH_SHORT).show(); } } else { Utils.shortToast(getActivity(), R.string.enter_name); } } }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).setTitle(getString(R.string.new_playlist)); return builder.create(); }
From source file:com.chaqianma.jd.fragment.CompanyInfoFragment.java
private void deleteCompany(final String parentId, final View v) { JDAlertDialog.showAlertDialog(getActivity(), "??", new DialogInterface.OnClickListener() { @Override//w ww. j a va2 s. c om public void onClick(DialogInterface dialog, int which) { HttpClientUtil.put(HttpRequestURL.deleteCompany + parentId, null, new JDHttpResponseHandler(getActivity(), new ResponseHandler() { @Override public void onSuccess(Object o) { switch (v.getId()) { case R.id.img_company_delete_1: isCompany1Show = false; JDAppUtil.addHiddenAction(layout_company_1); initCompanyData(0, sp_some_company_1.getSelectedItem().toString()); break; case R.id.img_company_delete_2: isCompany2Show = false; JDAppUtil.addHiddenAction(layout_company_2); initCompanyData(1, sp_some_company_2.getSelectedItem().toString()); break; case R.id.img_company_delete_3: isCompany3Show = false; JDAppUtil.addHiddenAction(layout_company_3); initCompanyData(2, sp_some_company_3.getSelectedItem().toString()); break; default: break; } } })); } }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); dialog.cancel(); } }); }
From source file:com.dsdar.thosearoundme.TeamViewActivity.java
@Override public void onBackPressed() { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setTitle("Exit Application?"); alertDialogBuilder.setMessage("Click yes to exit!").setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Remove Service stopService(new Intent(getBaseContext(), LocationUpdates.class)); // stopService(new Intent(getBaseContext(), // LocationService.class)); if (itsLocationUpdates != null) itsLocationUpdates.disconnectLocationClient(); mHandlerTaskServiceStop = new Runnable() { @Override public void run() { Log.d("tmf", "calling mHandlerTaskServiceStop......."); // Get and set team members location in // map // finish(); // moveTaskToBack(true); // // Intent amyProfileIntent = new Intent().setClass( // TeamViewActivity.this, WelcomeActivity.class); // startActivity(amyProfileIntent); // // // android.os.Process // .killProcess(android.os.Process // .myPid()); // System.exit(1); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); }/*from w w w.j a va2 s. com*/ }; itsHandlerServiceStop.postDelayed(mHandlerTaskServiceStop, 1500); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
From source file:com.chaqianma.jd.fragment.PersonalAssetsFragment.java
private void deleteCar(final String parentId, final View v) { JDAlertDialog.showAlertDialog(getActivity(), "?", new DialogInterface.OnClickListener() { @Override//from ww w . ja v a 2s .co m public void onClick(DialogInterface dialog, int which) { HttpClientUtil.put(HttpRequestURL.deleteCar + parentId, null, new JDHttpResponseHandler(getActivity(), new ResponseHandler() { @Override public void onSuccess(Object o) { switch (v.getId()) { case R.id.img_car_delete_1: isCar1Show = false; JDAppUtil.addHiddenAction(layout_asset_car_1); initCarData(0, sp_car_1.getSelectedItem().toString()); break; case R.id.img_car_delete_2: isCar2Show = false; JDAppUtil.addHiddenAction(layout_asset_car_2); initCarData(1, sp_car_2.getSelectedItem().toString()); break; case R.id.img_car_delete_3: isCar3Show = false; JDAppUtil.addHiddenAction(layout_asset_car_3); initCarData(2, sp_car_3.getSelectedItem().toString()); break; default: break; } } })); } }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); dialog.cancel(); } }); }
From source file:uk.bowdlerize.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.action_add: { AlertDialog.Builder builder = new AlertDialog.Builder(this); // Get the layout inflater LayoutInflater inflater = getLayoutInflater(); View dialogView = inflater.inflate(R.layout.dialog_add_url, null); final EditText urlET = (EditText) dialogView.findViewById(R.id.urlET); builder.setView(dialogView)//from ww w.j a v a 2 s . co m .setPositiveButton(R.string.action_add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { Bundle extras = new Bundle(); Intent receiveURLIntent = new Intent(MainActivity.this, CensorCensusService.class); extras.putString("url", urlET.getText().toString()); extras.putString("hash", MD5(urlET.getText().toString())); extras.putInt("urgency", 0); extras.putBoolean("local", true); //Add our extra info if (getSharedPreferences(MainActivity.class.getSimpleName(), Context.MODE_PRIVATE) .getBoolean("sendISPMeta", true)) { WifiManager wifiMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiMgr.getConnectionInfo(); TelephonyManager telephonyManager = ((TelephonyManager) getSystemService( Context.TELEPHONY_SERVICE)); if (wifiMgr.isWifiEnabled() && null != wifiInfo.getSSID()) { LocalCache lc = null; Pair<Boolean, String> seenBefore = null; try { lc = new LocalCache(MainActivity.this); lc.open(); seenBefore = lc.findSSID(wifiInfo.getSSID().replaceAll("\"", "")); } catch (Exception e) { e.printStackTrace(); } if (null != lc) lc.close(); if (seenBefore.first) { extras.putString("isp", seenBefore.second); } else { extras.putString("isp", "unknown"); } try { extras.putString("sim", telephonyManager.getSimOperatorName()); } catch (Exception e) { e.printStackTrace(); } } else { try { extras.putString("isp", telephonyManager.getNetworkOperatorName()); } catch (Exception e) { e.printStackTrace(); } try { extras.putString("sim", telephonyManager.getSimOperatorName()); } catch (Exception e) { e.printStackTrace(); } } } receiveURLIntent.putExtras(extras); startService(receiveURLIntent); dialog.cancel(); } }).setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); return true; } } return super.onOptionsItemSelected(item); }
From source file:com.chaqianma.jd.fragment.PersonalAssetsFragment.java
private void deleteHouse(final String parentId, final View v) { JDAlertDialog.showAlertDialog(getActivity(), "?", new DialogInterface.OnClickListener() { @Override//w ww . ja v a2 s. c o m public void onClick(DialogInterface dialog, int which) { HttpClientUtil.put(HttpRequestURL.deleteHouse + parentId, null, new JDHttpResponseHandler(getActivity(), new ResponseHandler() { @Override public void onSuccess(Object o) { switch (v.getId()) { case R.id.img_house_delete_1: isHouse1Show = false; // JDAppUtil.addHiddenAction(layout_asset_house_1); initHouseData(0, sp_house_1.getSelectedItem().toString()); break; case R.id.img_house_delete_2: isHouse2Show = false; JDAppUtil.addHiddenAction(layout_asset_house_2); initHouseData(1, sp_house_2.getSelectedItem().toString()); break; case R.id.img_house_delete_3: isHouse3Show = false; JDAppUtil.addHiddenAction(layout_asset_house_3); initHouseData(2, sp_house_3.getSelectedItem().toString()); break; default: break; } } })); } }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); dialog.cancel(); } }); }