List of usage examples for android.app Dialog setOnCancelListener
public void setOnCancelListener(@Nullable OnCancelListener listener)
From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java
private void checkMixedMountPoint(final ArrayList<LocalFileLastModifiedMaintListItem> maint_list) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (!prefs.getBoolean(SMBSYNC_SUPPRESS_WARNING_MIXED_MP, false)) { boolean mixed_mp = false; String mp_name = null;/* www .j av a 2 s.co m*/ for (int i = 0; i < mGp.profileAdapter.getCount(); i++) { ProfileListItem s_pli = mGp.profileAdapter.getItem(i); if (s_pli.getType().equals(SMBSYNC_PROF_TYPE_SYNC) && s_pli.getActive().equals(SMBSYNC_PROF_ACTIVE)) { ProfileListItem o_pli = null; if (s_pli.getMasterType().equals(SMBSYNC_PROF_TYPE_LOCAL)) { o_pli = getProfileListItem(SMBSYNC_PROF_TYPE_LOCAL, s_pli.getMasterName()); } else { o_pli = getProfileListItem(SMBSYNC_PROF_TYPE_LOCAL, s_pli.getTargetName()); } if (o_pli != null) { if (mp_name != null) { // Log.v("","mp_name="+o_pli.getLocalMountPoint()); if (!o_pli.getLocalMountPoint().equals(mp_name)) { mixed_mp = true; break; } } else { // Log.v("","mp_name init ="+mp_name); mp_name = o_pli.getLocalMountPoint(); } } } } // Log.v("","mixed_mp="+mixed_mp); if (!mixed_mp) { checkLastModifiedCorrupted(maint_list); } else { final Dialog dialog = new Dialog(mContext);//, android.R.style.Theme_Black); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.mixed_mount_point_dialog); TextView title = (TextView) dialog.findViewById(R.id.mixed_mount_point_dialog_title); title.setText(mContext.getString(R.string.msgs_common_dialog_warning)); title.setTextColor(Color.YELLOW); ((TextView) dialog.findViewById(R.id.mixed_mount_point_dialog_subtitle)) .setText(mContext.getString(R.string.msgs_local_file_modified_maint_mixed_old_new_title)); ((TextView) dialog.findViewById(R.id.mixed_mount_point_dialog_msg)) .setText(mContext.getString(R.string.msgs_local_file_modified_maint_mixed_old_new_msg)); final Button btnOk = (Button) dialog.findViewById(R.id.common_dialog_btn_ok); final CheckBox cbSuppr = (CheckBox) dialog.findViewById(R.id.mixed_mount_point_dialog_suppress); CommonDialog.setDlgBoxSizeCompact(dialog); cbSuppr.setChecked(false); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); if (cbSuppr.isChecked()) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); prefs.edit().putBoolean(SMBSYNC_SUPPRESS_WARNING_MIXED_MP, true).commit(); } checkLastModifiedCorrupted(maint_list); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnOk.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(mContext)); // dialog.setCancelable(false); dialog.show(); } } }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
private void editDirFilter(final int edit_idx, final AdapterFilterList fa, final FilterListItem fli, final String filter) { // ??/* w w w .ja v a 2 s . c om*/ final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setContentView(R.layout.filter_edit_dlg); LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.filter_edit_dlg_view); ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color); final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.filter_edit_dlg_title_view); final TextView title = (TextView) dialog.findViewById(R.id.filter_edit_dlg_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setTextColor(mGp.themeColorList.text_color_dialog_title); CommonDialog.setDlgBoxSizeCompact(dialog); final EditText et_filter = (EditText) dialog.findViewById(R.id.filter_edit_dlg_filter); et_filter.setText(filter); // CANCEL? final Button btn_cancel = (Button) dialog.findViewById(R.id.filter_edit_dlg_cancel_btn); btn_cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); // glblParms.profileListView.setSelectionFromTop(currentViewPosX,currentViewPosY); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btn_cancel.performClick(); } }); // OK? Button btn_ok = (Button) dialog.findViewById(R.id.filter_edit_dlg_ok_btn); btn_ok.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TextView dlg_msg = (TextView) dialog.findViewById(R.id.filter_edit_dlg_msg); String newfilter = et_filter.getText().toString(); if (!filter.equals(newfilter)) { if (isFilterExists(newfilter, fa)) { String mtxt = mContext.getString(R.string.msgs_filter_list_duplicate_filter_specified); dlg_msg.setText(String.format(mtxt, newfilter)); return; } } dialog.dismiss(); fa.remove(fli); fa.insert(fli, edit_idx); fli.setFilter(newfilter); et_filter.setText(""); fa.setNotifyOnChange(true); fa.sort(new Comparator<FilterListItem>() { @Override public int compare(FilterListItem lhs, FilterListItem rhs) { return lhs.getFilter().compareToIgnoreCase(rhs.getFilter()); }; }); // p_ntfy.notifyToListener(true, null); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
final private void copyProfileGroupDlg(final String old_loc) { // ??//from w ww . j a va 2 s .co m final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // dialog.getWindow().setSoftInputMode( // WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); dialog.setContentView(R.layout.single_item_input_dlg); final TextView dlg_title = (TextView) dialog.findViewById(R.id.single_item_input_title); final EditText dlg_et_name = (EditText) dialog.findViewById(R.id.single_item_input_dir); // final TextView dlg_msg = (TextView) dialog.findViewById(R.id.single_item_input_msg); final Button btnCancel = (Button) dialog.findViewById(R.id.single_item_input_cancel_btn); final Button btnOK = (Button) dialog.findViewById(R.id.single_item_input_ok_btn); btnOK.setEnabled(false); dlg_title.setText(mContext.getString(R.string.msgs_profile_group_copy_profile_group)); CommonDialog.setDlgBoxSizeCompact(dialog); dlg_et_name.setText(old_loc); dlg_et_name.addTextChangedListener(new TextWatcher() { @Override final public void afterTextChanged(Editable s) { if (s.length() != 0) { // dlg_et_name.selectAll(); String newgrp = dlg_et_name.getText().toString(); if (!newgrp.startsWith("*")) { btnOK.setEnabled(true); for (int i = 0; i < mGlblParms.profileGroupAdapter.getCount(); i++) { if (mGlblParms.profileGroupAdapter.getItem(i).getProfileGroupName().equals(newgrp)) { btnOK.setEnabled(false); break; } } } else btnOK.setEnabled(false); } else btnOK.setEnabled(false); } @Override final public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override final public void onTextChanged(CharSequence s, int start, int before, int count) { } }); final NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override final public void positiveResponse(Context c, Object[] o) { dlg_et_name.selectAll(); String new_loc = dlg_et_name.getText().toString(); copyProfileGroup(true, old_loc, new_loc); } @Override final public void negativeResponse(Context c, Object[] o) { } }); // CANCEL? btnCancel.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { dialog.dismiss(); } }); // OK? btnOK.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { ntfy.notifyToListener(POSITIVE, null); dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnCancel.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
final private void renameProfileGroupDlg(final String old_loc) { // ??// ww w . j av a 2s.c o m final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // dialog.getWindow().setSoftInputMode( // WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); dialog.setContentView(R.layout.single_item_input_dlg); final TextView dlg_title = (TextView) dialog.findViewById(R.id.single_item_input_title); final EditText dlg_et_name = (EditText) dialog.findViewById(R.id.single_item_input_dir); // final TextView dlg_msg = (TextView) dialog.findViewById(R.id.single_item_input_msg); final Button btnCancel = (Button) dialog.findViewById(R.id.single_item_input_cancel_btn); final Button btnOK = (Button) dialog.findViewById(R.id.single_item_input_ok_btn); btnOK.setEnabled(false); dlg_title.setText(mContext.getString(R.string.msgs_profile_group_rename_profile_group)); CommonDialog.setDlgBoxSizeCompact(dialog); dlg_et_name.setText(old_loc); dlg_et_name.addTextChangedListener(new TextWatcher() { @Override final public void afterTextChanged(Editable s) { if (s.length() != 0) { // dlg_et_name.selectAll(); String newgrp = dlg_et_name.getText().toString(); if (!newgrp.startsWith("*")) { btnOK.setEnabled(true); for (int i = 0; i < mGlblParms.profileGroupAdapter.getCount(); i++) { if (mGlblParms.profileGroupAdapter.getItem(i).getProfileGroupName().equals(newgrp)) { btnOK.setEnabled(false); break; } } } else btnOK.setEnabled(false); } else btnOK.setEnabled(false); } @Override final public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override final public void onTextChanged(CharSequence s, int start, int before, int count) { } }); final NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override final public void positiveResponse(Context c, Object[] o) { dlg_et_name.selectAll(); String new_loc = dlg_et_name.getText().toString(); renameProfileGroup(true, old_loc, new_loc); } @Override final public void negativeResponse(Context c, Object[] o) { } }); // CANCEL? btnCancel.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { dialog.dismiss(); } }); // OK? btnOK.setOnClickListener(new View.OnClickListener() { final public void onClick(View v) { ntfy.notifyToListener(POSITIVE, null); dialog.dismiss(); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnCancel.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); dialog.show(); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
private void createRemoteFileList(String remurl, String remdir, final NotifyEvent p_event, boolean readSubDirCnt) { final ArrayList<TreeFilelistItem> remoteFileList = new ArrayList<TreeFilelistItem>(); final ThreadCtrl tc = new ThreadCtrl(); tc.setEnabled();//from ww w .j a v a2s .co m tc.setThreadResultSuccess(); // ?? final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setContentView(R.layout.progress_spin_dlg); LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.progress_spin_dlg_view); ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color); final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.progress_spin_dlg_title_view); final TextView title = (TextView) dialog.findViewById(R.id.progress_spin_dlg_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setTextColor(mGp.themeColorList.text_color_dialog_title); title.setText(R.string.msgs_progress_spin_dlg_filelist_getting); final Button btn_cancel = (Button) dialog.findViewById(R.id.progress_spin_dlg_btn_cancel); btn_cancel.setText(R.string.msgs_progress_spin_dlg_filelist_cancel); // (dialog.context.findViewById(R.id.progress_spin_dlg)).setVisibility(TextView.GONE); // (dialog.context.findViewById(R.id.progress_spin_dlg)).setEnabled(false); CommonDialog.setDlgBoxSizeCompact(dialog); // CANCEL? btn_cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { tc.setDisabled();//disableAsyncTask(); btn_cancel.setText(mContext.getString(R.string.msgs_progress_dlg_canceling)); btn_cancel.setEnabled(false); util.addDebugMsg(1, "W", "Sharelist is cancelled."); } }); dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btn_cancel.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); // dialog.show(); showDelayedProgDlg? final Handler hndl = new Handler(); NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { hndl.post(new Runnable() { @Override public void run() { dialog.dismiss(); String err; util.addDebugMsg(1, "I", "FileListThread result=" + tc.getThreadResult() + "," + "msg=" + tc.getThreadMessage() + ", enable=" + tc.isEnabled()); if (tc.isThreadResultSuccess()) { p_event.notifyToListener(true, new Object[] { remoteFileList }); } else { if (tc.isThreadResultCancelled()) err = mContext.getString(R.string.msgs_filelist_cancel); else err = mContext.getString(R.string.msgs_filelist_error) + "\n" + tc.getThreadMessage(); p_event.notifyToListener(false, new Object[] { err }); } } }); } @Override public void negativeResponse(Context c, Object[] o) { } }); Thread tf = new Thread(new ReadSmbFilelist(mContext, tc, remurl, remdir, remoteFileList, smbUser, smbPass, ntfy, true, readSubDirCnt, mGp)); tf.start(); // showDelayedProgDlg(200,dialog, tc); dialog.show(); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
public void logonToRemoteDlg(final String host, final String addr, final String port, final String user, final String pass, final NotifyEvent p_ntfy) { final ThreadCtrl tc = new ThreadCtrl(); tc.setEnabled();//from w ww .ja v a 2 s . c om tc.setThreadResultSuccess(); // ?? final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setContentView(R.layout.progress_spin_dlg); LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.progress_spin_dlg_view); ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color); final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.progress_spin_dlg_title_view); final TextView title = (TextView) dialog.findViewById(R.id.progress_spin_dlg_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setTextColor(mGp.themeColorList.text_color_dialog_title); title.setText(R.string.msgs_progress_spin_dlg_test_logon); final Button btn_cancel = (Button) dialog.findViewById(R.id.progress_spin_dlg_btn_cancel); btn_cancel.setText(R.string.msgs_progress_spin_dlg_test_logon_cancel); // (dialog.context.findViewById(R.id.progress_spin_dlg)).setVisibility(TextView.GONE); // (dialog.context.findViewById(R.id.progress_spin_dlg)).setEnabled(false); CommonDialog.setDlgBoxSizeCompact(dialog); // CANCEL? btn_cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { tc.setDisabled();//disableAsyncTask(); btn_cancel.setText(mContext.getString(R.string.msgs_progress_dlg_canceling)); btn_cancel.setEnabled(false); util.addDebugMsg(1, "W", "Logon is cancelled."); } }); dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btn_cancel.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); // dialog.setCancelable(false); // dialog.show(); showDelayedProgDlg? Thread th = new Thread() { @Override public void run() { util.addDebugMsg(1, "I", "Test logon started, host=" + host + ", addr=" + addr + ", port=" + port + ", user=" + user); NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, user, pass); NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { dialog.dismiss(); String err_msg = (String) o[0]; if (tc.isEnabled()) { if (err_msg != null) { commonDlg.showCommonDialog(false, "E", mContext.getString(R.string.msgs_remote_profile_dlg_logon_error), err_msg, null); if (p_ntfy != null) p_ntfy.notifyToListener(false, null); } else { commonDlg.showCommonDialog(false, "I", "", mContext.getString(R.string.msgs_remote_profile_dlg_logon_success), null); if (p_ntfy != null) p_ntfy.notifyToListener(true, null); } } else { commonDlg.showCommonDialog(false, "I", "", mContext.getString(R.string.msgs_remote_profile_dlg_logon_cancel), null); if (p_ntfy != null) p_ntfy.notifyToListener(true, null); } } @Override public void negativeResponse(Context c, Object[] o) { } }); if (host.equals("")) { boolean reachable = false; if (port.equals("")) { if (NetworkUtil.isIpAddressAndPortConnected(addr, 139, 3500) || NetworkUtil.isIpAddressAndPortConnected(addr, 445, 3500)) { reachable = true; } } else { reachable = NetworkUtil.isIpAddressAndPortConnected(addr, Integer.parseInt(port), 3500); } if (reachable) { testAuth(auth, addr, port, ntfy); } else { util.addDebugMsg(1, "I", "Test logon failed, remote server not connected"); String unreachble_msg = ""; if (port.equals("")) { unreachble_msg = String .format(mContext.getString(R.string.msgs_mirror_smb_addr_not_connected), addr); } else { unreachble_msg = String.format( mContext.getString(R.string.msgs_mirror_smb_addr_not_connected_with_port), addr, port); } ntfy.notifyToListener(true, new Object[] { unreachble_msg }); } } else { if (NetworkUtil.getSmbHostIpAddressFromName(host) != null) testAuth(auth, host, port, ntfy); else { util.addDebugMsg(1, "I", "Test logon failed, remote server not connected"); String unreachble_msg = ""; unreachble_msg = mContext.getString(R.string.msgs_mirror_smb_name_not_found) + host; ntfy.notifyToListener(true, new Object[] { unreachble_msg }); } } } }; th.start(); dialog.show(); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
public void showSelectSdcardMsg(final NotifyEvent ntfy, String msg) { final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.show_select_sdcard_dlg); final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.show_select_sdcard_dlg_title_view); final TextView title = (TextView) dialog.findViewById(R.id.show_select_sdcard_dlg_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setTextColor(mGp.themeColorList.text_color_dialog_title); final TextView dlg_msg = (TextView) dialog.findViewById(R.id.show_select_sdcard_dlg_msg); dlg_msg.setText(msg);/* w ww . java2 s . com*/ ; final ImageView func_view = (ImageView) dialog.findViewById(R.id.show_select_sdcard_dlg_image); try { InputStream is = mContext.getResources().getAssets() .open(mContext.getString(R.string.msgs_main_external_sdcard_select_required_select_msg_file)); Bitmap bm = BitmapFactory.decodeStream(is); func_view.setImageBitmap(bm); } catch (IOException e) { /* ? */ } final Button btnOk = (Button) dialog.findViewById(R.id.show_select_sdcard_dlg_btn_ok); final Button btnCancel = (Button) dialog.findViewById(R.id.show_select_sdcard_dlg_btn_cancel); CommonDialog.setDlgBoxSizeLimit(dialog, true); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); ntfy.notifyToListener(true, null); } }); // Cancel? btnCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); ntfy.notifyToListener(false, null); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnCancel.performClick(); } }); dialog.show(); }
From source file:com.sentaroh.android.SMBSync2.ActivityMain.java
private void confirmUseAppSpecificDir(final ArrayList<SyncTaskItem> alp, final NotifyEvent p_ntfy) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); if (!prefs.getBoolean(getString(R.string.settings_suppress_warning_app_specific_dir), false)) { boolean app_specific_used = false; String prof_list = "", sep = ""; for (int i = 0; i < alp.size(); i++) { if (alp.get(i).getTargetFolderType().equals(SyncTaskItem.SYNC_FOLDER_TYPE_INTERNAL) || alp.get(i).getTargetFolderType().equals(SyncTaskItem.SYNC_FOLDER_TYPE_SDCARD)) { if (alp.get(i).getTargetDirectoryName().startsWith(APP_SPECIFIC_DIRECTORY)) { app_specific_used = true; prof_list += sep + alp.get(i).getSyncTaskName(); sep = ","; }//www .j a v a 2s . c om } } if (app_specific_used) { final Dialog dialog = new Dialog(mActivity);//, android.R.style.Theme_Black); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirm_app_specific_dir_dlg); final LinearLayout title_view = (LinearLayout) dialog .findViewById(R.id.confirm_app_specific_dlg_title_view); final TextView title = (TextView) dialog.findViewById(R.id.confirm_app_specific_dlg_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setText(mContext.getString(R.string.msgs_local_mount_point_app_specific_dir_used_title)); title.setTextColor(mGp.themeColorList.text_color_warning); ((TextView) dialog.findViewById(R.id.confirm_app_specific_dlg_msg)) .setText(mContext.getString(R.string.msgs_local_mount_point_app_specific_dir_used_msg) + "\n\n" + prof_list + "\n"); final Button btnOk = (Button) dialog.findViewById(R.id.confirm_app_specific_dlg_ok); final Button btnCancel = (Button) dialog.findViewById(R.id.confirm_app_specific_dlg_cancel); final CheckedTextView ctvSuppr = (CheckedTextView) dialog .findViewById(R.id.confirm_app_specific_dlg_ctv_suppress); CommonUtilities.setCheckedTextView(ctvSuppr); CommonDialog.setDlgBoxSizeCompact(dialog); ctvSuppr.setChecked(false); // OK? btnOk.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); if (ctvSuppr.isChecked()) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); prefs.edit().putBoolean(getString(R.string.settings_suppress_warning_app_specific_dir), true).commit(); } p_ntfy.notifyToListener(true, null); } }); // Cancel? btnCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); p_ntfy.notifyToListener(false, null); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btnOk.performClick(); } }); // dialog.setOnKeyListener(new DialogOnKeyListener(mContext)); // dialog.setCancelable(false); dialog.show(); } else { p_ntfy.notifyToListener(true, null); } } else { p_ntfy.notifyToListener(true, null); } }
From source file:com.xplink.android.carchecklist.CarCheckListActivity.java
private void SlideDocumentLayout() { final SharedPreferences settings = getSharedPreferences("mysettings", 0); final SharedPreferences.Editor editor = settings.edit(); final Dialog documentdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog); documentdialog.requestWindowFeature(Window.FEATURE_NO_TITLE); documentdialog.setContentView(R.layout.documentdialoglayout); documentdialog.getWindow().getAttributes().windowAnimations = R.style.DocumentDialogAnimation; documentdialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); // make everything around Dialog brightness than default WindowManager.LayoutParams lp = documentdialog.getWindow().getAttributes(); lp.dimAmount = 0f;/* w w w . j av a 2 s . c om*/ final CheckBox chkinsurance = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_insurance); final CheckBox chkactTaxLabel = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_actTaxLabel); final CheckBox chkbill = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_bill); final CheckBox chklicensePlate = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_licensePlate); final CheckBox chklicenseManual = (CheckBox) documentdialog.getWindow() .findViewById(R.id.doc_licenseManual); final CheckBox chkcarPartPaper = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_carPartPaper); final CheckBox chkcarManual = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_carManual); final CheckBox chklicenseRegister = (CheckBox) documentdialog.getWindow() .findViewById(R.id.doc_licenseRegister); final CheckBox chkgift = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_gift); // Change font chkinsurance.setTypeface(type); chkactTaxLabel.setTypeface(type); chkbill.setTypeface(type); chklicensePlate.setTypeface(type); chklicenseManual.setTypeface(type); chkcarPartPaper.setTypeface(type); chkcarManual.setTypeface(type); chklicenseRegister.setTypeface(type); chkgift.setTypeface(type); documentdialog.setCanceledOnTouchOutside(true); documentdialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { headdocument.setVisibility(ImageView.VISIBLE); TranslateAnimation slideoutheaddocument = new TranslateAnimation(0, 0, 350, 800); slideoutheaddocument.setDuration(500); slideoutheaddocument.setFillAfter(true); headdocument.startAnimation(slideoutheaddocument); Map<String, Boolean> mp = new HashMap<String, Boolean>(); mp.put("doc_insurance", chkinsurance.isChecked()); mp.put("doc_actTaxLabel", chkactTaxLabel.isChecked()); mp.put("doc_bill", chkbill.isChecked()); mp.put("doc_licensePlate", chklicensePlate.isChecked()); mp.put("doc_licenseManual", chklicenseManual.isChecked()); mp.put("doc_carPartPaper", chkcarPartPaper.isChecked()); mp.put("doc_carManual", chkcarManual.isChecked()); mp.put("doc_licenseRegister", chklicenseRegister.isChecked()); mp.put("doc_gift", chkgift.isChecked()); filterStore("document", mp); save(mp); } }); TextView document = (TextView) documentdialog.getWindow().findViewById(R.id.Document); document.setTypeface(type); Button documentback = (Button) documentdialog.getWindow().findViewById(R.id.Documentback); documentback.setTypeface(type); documentback.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { documentdialog.dismiss(); headdocument.setVisibility(ImageView.VISIBLE); TranslateAnimation slideoutheaddocument = new TranslateAnimation(0, 0, 350, 800); slideoutheaddocument.setDuration(500); slideoutheaddocument.setFillAfter(true); headdocument.startAnimation(slideoutheaddocument); Map<String, Boolean> mp = new HashMap<String, Boolean>(); mp.put("doc_insurance", chkinsurance.isChecked()); mp.put("doc_actTaxLabel", chkactTaxLabel.isChecked()); mp.put("doc_bill", chkbill.isChecked()); mp.put("doc_licensePlate", chklicensePlate.isChecked()); mp.put("doc_licenseManual", chklicenseManual.isChecked()); mp.put("doc_carPartPaper", chkcarPartPaper.isChecked()); mp.put("doc_carManual", chkcarManual.isChecked()); mp.put("doc_licenseRegister", chklicenseRegister.isChecked()); mp.put("doc_gift", chkgift.isChecked()); filterStore("document", mp); save(mp); } }); chkinsurance.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkactTaxLabel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkbill.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chklicensePlate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chklicenseManual.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkcarPartPaper.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkcarManual.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chklicenseRegister.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkgift.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); headdocument.setVisibility(ImageView.VISIBLE); TranslateAnimation slideheaddocument = new TranslateAnimation(0, 0, 800, 350); slideheaddocument.setDuration(500); slideheaddocument.setFillAfter(true); headdocument.startAnimation(slideheaddocument); documentdialog.show(); WindowManager.LayoutParams params = documentdialog.getWindow().getAttributes(); params.y = 350; params.x = 60; params.gravity = Gravity.TOP | Gravity.LEFT; documentdialog.getWindow().setAttributes(params); chkinsurance.setChecked(load("doc_insurance")); chkactTaxLabel.setChecked(load("doc_actTaxLabel")); chkbill.setChecked(load("doc_bill")); chklicensePlate.setChecked(load("doc_licensePlate")); chklicenseManual.setChecked(load("doc_licenseManual")); chkcarPartPaper.setChecked(load("doc_carPartPaper")); chkcarManual.setChecked(load("doc_carManual")); chklicenseRegister.setChecked(load("doc_licenseRegister")); chkgift.setChecked(load("doc_gift")); }
From source file:com.xplink.android.carchecklist.CarCheckListActivity.java
private void SlideExteriorLayout() { final SharedPreferences settings = getSharedPreferences("mysettings", 0); final SharedPreferences.Editor editor = settings.edit(); final Dialog exteriordialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog); exteriordialog.requestWindowFeature(Window.FEATURE_NO_TITLE); exteriordialog.setContentView(R.layout.exteriordialoglayout); exteriordialog.getWindow().getAttributes().windowAnimations = R.style.ExteriorDialogAnimation; exteriordialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); // make everything around Dialog brightness than default WindowManager.LayoutParams lp = exteriordialog.getWindow().getAttributes(); lp.dimAmount = 0f;//from www. ja v a2 s . co m final CheckBox chkoutside_color = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_color); final CheckBox chkoutside_window = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_window); final CheckBox chkoutside_doorHood = (CheckBox) exteriordialog.getWindow() .findViewById(R.id.outside_doorHood); final CheckBox chkoutside_jack = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_jack); final CheckBox chkoutside_wrench = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_wrench); final CheckBox chkoutside_tires = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_tires); final CheckBox chkoutside_light = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_light); final CheckBox chkoutside_seal = (CheckBox) exteriordialog.getWindow().findViewById(R.id.outside_seal); final CheckBox chkoutside_tirePart = (CheckBox) exteriordialog.getWindow() .findViewById(R.id.outside_tirePart); // Change font chkoutside_color.setTypeface(type); chkoutside_window.setTypeface(type); chkoutside_doorHood.setTypeface(type); chkoutside_jack.setTypeface(type); chkoutside_wrench.setTypeface(type); chkoutside_tires.setTypeface(type); chkoutside_light.setTypeface(type); chkoutside_seal.setTypeface(type); chkoutside_tirePart.setTypeface(type); exteriordialog.setCanceledOnTouchOutside(true); exteriordialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { headexterior.setVisibility(ImageView.VISIBLE); TranslateAnimation slideoutheadexterior = new TranslateAnimation(0, 0, 380, -400); slideoutheadexterior.setDuration(500); slideoutheadexterior.setFillAfter(true); headexterior.startAnimation(slideoutheadexterior); Map<String, Boolean> mp = new HashMap<String, Boolean>(); mp.put("outside_color", chkoutside_color.isChecked()); mp.put("outside_window", chkoutside_window.isChecked()); mp.put("outside_doorHood", chkoutside_doorHood.isChecked()); mp.put("outside_jack", chkoutside_jack.isChecked()); mp.put("outside_wrench", chkoutside_wrench.isChecked()); mp.put("outside_tires", chkoutside_tires.isChecked()); mp.put("outside_light", chkoutside_light.isChecked()); mp.put("outside_seal", chkoutside_seal.isChecked()); mp.put("outside_tirePart", chkoutside_tirePart.isChecked()); filterStore("exterior", mp); save(mp); } }); TextView exterior = (TextView) exteriordialog.getWindow().findViewById(R.id.Exterior); exterior.setTypeface(type); Button exteriorback = (Button) exteriordialog.getWindow().findViewById(R.id.Exteriorback); exteriorback.setTypeface(type); exteriorback.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { exteriordialog.dismiss(); headexterior.setVisibility(ImageView.VISIBLE); TranslateAnimation slideoutheadexterior = new TranslateAnimation(0, 0, 380, -400); slideoutheadexterior.setDuration(500); slideoutheadexterior.setFillAfter(true); headexterior.startAnimation(slideoutheadexterior); Map<String, Boolean> mp = new HashMap<String, Boolean>(); mp.put("outside_color", chkoutside_color.isChecked()); mp.put("outside_window", chkoutside_window.isChecked()); mp.put("outside_doorHood", chkoutside_doorHood.isChecked()); mp.put("outside_jack", chkoutside_jack.isChecked()); mp.put("outside_wrench", chkoutside_wrench.isChecked()); mp.put("outside_tires", chkoutside_tires.isChecked()); mp.put("outside_light", chkoutside_light.isChecked()); mp.put("outside_seal", chkoutside_seal.isChecked()); mp.put("outside_tirePart", chkoutside_tirePart.isChecked()); filterStore("exterior", mp); save(mp); } }); chkoutside_color.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkoutside_window.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkoutside_doorHood.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkoutside_jack.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkoutside_wrench.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkoutside_tires.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkoutside_light.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkoutside_seal.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkoutside_tirePart.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalExterior(increment); } else { increment = false; getTotalExterior(increment); } ExteriorProgress.setProgress(PercenExterior); percenexterior.setText("" + PercenExterior + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); headexterior.setVisibility(ImageView.VISIBLE); TranslateAnimation slideheadexterior = new TranslateAnimation(0, 0, 0, 380); slideheadexterior.setDuration(500); slideheadexterior.setFillAfter(true); headexterior.startAnimation(slideheadexterior); exteriordialog.show(); WindowManager.LayoutParams params = exteriordialog.getWindow().getAttributes(); params.y = 0; params.x = 60; params.gravity = Gravity.TOP | Gravity.LEFT; exteriordialog.getWindow().setAttributes(params); chkoutside_color.setChecked(load("outside_color")); chkoutside_window.setChecked(load("outside_window")); chkoutside_doorHood.setChecked(load("outside_doorHood")); chkoutside_jack.setChecked(load("outside_jack")); chkoutside_wrench.setChecked(load("outside_wrench")); chkoutside_tires.setChecked(load("outside_tires")); chkoutside_light.setChecked(load("outside_light")); chkoutside_seal.setChecked(load("outside_seal")); chkoutside_tirePart.setChecked(load("outside_tirePart")); }