List of usage examples for android.widget CheckedTextView isChecked
@ViewDebug.ExportedProperty public boolean isChecked()
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
private void setImportOkBtnEnabled(final CheckedTextView ctv_reset_profile, final CheckedTextView ctv_import_settings, final CheckedTextView ctv_import_schedule, final AdapterExportImportSyncTask imp_list_adapt, final Button ok_btn) { if (ctv_import_settings.isChecked() || ctv_import_schedule.isChecked() || imp_list_adapt.isItemSelected()) ok_btn.setEnabled(true);//from w ww.j av a 2 s . c om else ok_btn.setEnabled(false); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
public void invokeSelectRemoteShareDlg(Dialog dialog) { final TextView dlg_msg = (TextView) dialog.findViewById(R.id.edit_sync_folder_dlg_msg); final EditText edituser = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_user); final EditText editpass = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_pass); final EditText editshare = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_share_name); final EditText edithost = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_server); final CheckedTextView ctv_use_userpass = (CheckedTextView) dialog .findViewById(R.id.edit_sync_folder_dlg_ctv_use_user_pass); final EditText editport = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_port); final CheckedTextView ctv_use_port_number = (CheckedTextView) dialog .findViewById(R.id.edit_sync_folder_dlg_ctv_use_remote_port_number); String remote_addr, remote_user = "", remote_pass = "", remote_host; if (ctv_use_userpass.isChecked()) { remote_user = edituser.getText().toString(); remote_pass = editpass.getText().toString(); }// ww w . j a v a 2s . c om if (edithost.getText().toString().length() < 1) { dlg_msg.setText(mContext.getString(R.string.msgs_audit_hostname_not_spec)); return; } if (hasInvalidChar(remote_pass, new String[] { "\t" })) { remote_pass = removeInvalidChar(remote_pass); dlg_msg.setText( String.format(mContext.getString(R.string.msgs_audit_msgs_password1), detectedInvalidCharMsg)); editpass.setText(remote_pass); editpass.requestFocus(); return; } if (hasInvalidChar(remote_user, new String[] { "\t" })) { remote_user = removeInvalidChar(remote_user); dlg_msg.setText( String.format(mContext.getString(R.string.msgs_audit_msgs_username1), detectedInvalidCharMsg)); edituser.setText(remote_user); edituser.requestFocus(); return; } setSmbUserPass(remote_user, remote_pass); String t_url = ""; if (NetworkUtil.isValidIpAddress(edithost.getText().toString())) { remote_addr = edithost.getText().toString(); t_url = remote_addr; } else { remote_host = edithost.getText().toString(); t_url = remote_host; } String h_port = ""; if (ctv_use_port_number.isChecked()) { if (editport.getText().length() > 0) h_port = ":" + editport.getText().toString(); else { dlg_msg.setText(mContext.getString(R.string.msgs_audit_hostport_not_spec)); return; } } String remurl = "smb://" + t_url + h_port + "/"; NotifyEvent ntfy = new NotifyEvent(mContext); //Listen setRemoteShare response ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context arg0, Object[] arg1) { editshare.setText((String) arg1[0]); } @Override public void negativeResponse(Context arg0, Object[] arg1) { if (arg1 != null) dlg_msg.setText((String) arg1[0]); else dlg_msg.setText(""); } }); selectRemoteShareDlg(remurl, "", ntfy); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
public void selectRemoteDirectory(Dialog dialog) { final TextView dlg_msg = (TextView) dialog.findViewById(R.id.edit_sync_folder_dlg_msg); final EditText edithost = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_server); final EditText edituser = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_user); final EditText editpass = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_pass); final EditText editshare = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_share_name); final EditText editdir = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_directory_name); final CheckedTextView ctv_use_userpass = (CheckedTextView) dialog .findViewById(R.id.edit_sync_folder_dlg_ctv_use_user_pass); final EditText editport = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_port); final CheckedTextView ctv_use_port_number = (CheckedTextView) dialog .findViewById(R.id.edit_sync_folder_dlg_ctv_use_remote_port_number); String remote_addr, remote_user = "", remote_pass = "", remote_share, remote_host; if (ctv_use_userpass.isChecked()) { remote_user = edituser.getText().toString(); remote_pass = editpass.getText().toString(); }/* w w w. j a v a 2s . co m*/ remote_share = editshare.getText().toString(); if (edithost.getText().toString().length() < 1) { dlg_msg.setText(mContext.getString(R.string.msgs_audit_hostname_not_spec)); return; } if (remote_share.length() < 1) { dlg_msg.setText(mContext.getString(R.string.msgs_audit_share_not_spec)); return; } if (hasInvalidChar(remote_pass, new String[] { "\t" })) { remote_pass = removeInvalidChar(remote_pass); dlg_msg.setText( String.format(mContext.getString(R.string.msgs_audit_msgs_password1), detectedInvalidCharMsg)); editpass.setText(remote_pass); editpass.requestFocus(); return; } if (hasInvalidChar(remote_user, new String[] { "\t" })) { remote_user = removeInvalidChar(remote_user); dlg_msg.setText( String.format(mContext.getString(R.string.msgs_audit_msgs_username1), detectedInvalidCharMsg)); edituser.setText(remote_user); edituser.requestFocus(); return; } String p_dir = editdir.getText().toString(); setSmbUserPass(remote_user, remote_pass); String t_url = ""; if (NetworkUtil.isValidIpAddress(edithost.getText().toString())) { remote_addr = edithost.getText().toString(); t_url = remote_addr; } else { remote_host = edithost.getText().toString(); t_url = remote_host; } String h_port = ""; if (ctv_use_port_number.isChecked()) { if (editport.getText().length() > 0) h_port = ":" + editport.getText().toString(); else { dlg_msg.setText(mContext.getString(R.string.msgs_audit_hostport_not_spec)); return; } } String remurl = "smb://" + t_url + h_port + "/" + remote_share + "/"; NotifyEvent ntfy = new NotifyEvent(mContext); //Listen setRemoteShare response ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context arg0, Object[] arg1) { editdir.setText((String) arg1[0]); } @Override public void negativeResponse(Context arg0, Object[] arg1) { if (arg1 != null) dlg_msg.setText((String) arg1[0]); else dlg_msg.setText(""); } }); setRemoteDir(remurl, "", p_dir, ntfy); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
public void ipAddressScanButtonDlg(Dialog dialog) { final TextView dlg_msg = (TextView) dialog.findViewById(R.id.edit_sync_folder_dlg_msg); final EditText edithost = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_server); final CheckedTextView ctv_use_port_number = (CheckedTextView) dialog .findViewById(R.id.edit_sync_folder_dlg_ctv_use_remote_port_number); final EditText editport = (EditText) dialog.findViewById(R.id.edit_sync_folder_dlg_remote_port); NotifyEvent ntfy = new NotifyEvent(mContext); //Listen setRemoteShare response ntfy.setListener(new NotifyEventListener() { @Override//from w w w . jav a 2 s. c o m public void positiveResponse(Context arg0, Object[] arg1) { edithost.setText((String) arg1[1]); } @Override public void negativeResponse(Context arg0, Object[] arg1) { dlg_msg.setText(""); } }); String port_num = ""; if (ctv_use_port_number.isChecked()) port_num = editport.getText().toString(); scanRemoteNetworkDlg(ntfy, port_num, false); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
public void promptPasswordForExport(final String fpath, final NotifyEvent ntfy_pswd) { // ??/*from w ww. j av a 2 s. c om*/ final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setContentView(R.layout.password_input_dlg); LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.password_input_dlg_view); ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color); final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.password_input_title_view); final TextView title = (TextView) dialog.findViewById(R.id.password_input_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.password_input_msg); final CheckedTextView ctv_protect = (CheckedTextView) dialog.findViewById(R.id.password_input_ctv_protect); final Button btn_ok = (Button) dialog.findViewById(R.id.password_input_ok_btn); final Button btn_cancel = (Button) dialog.findViewById(R.id.password_input_cancel_btn); final EditText et_password = (EditText) dialog.findViewById(R.id.password_input_password); final EditText et_confirm = (EditText) dialog.findViewById(R.id.password_input_password_confirm); dlg_msg.setText(mContext.getString(R.string.msgs_export_import_pswd_specify_password)); CommonDialog.setDlgBoxSizeCompact(dialog); ctv_protect.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ctv_protect.toggle(); boolean isChecked = ctv_protect.isChecked(); setPasswordFieldVisibility(isChecked, et_password, et_confirm, btn_ok, dlg_msg); } }); ctv_protect.setChecked(mGp.settingExportedProfileEncryptRequired); setPasswordFieldVisibility(mGp.settingExportedProfileEncryptRequired, et_password, et_confirm, btn_ok, dlg_msg); et_password.setEnabled(true); et_confirm.setEnabled(false); et_password.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { btn_ok.setEnabled(false); setPasswordPromptOkButton(et_password, et_confirm, btn_ok, dlg_msg); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } }); et_confirm.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { btn_ok.setEnabled(false); setPasswordPromptOkButton(et_password, et_confirm, btn_ok, dlg_msg); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } }); //OK button btn_ok.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String passwd = et_password.getText().toString(); if ((ctv_protect.isChecked() && !mGp.settingExportedProfileEncryptRequired) || (!ctv_protect.isChecked() && mGp.settingExportedProfileEncryptRequired)) { mGp.settingExportedProfileEncryptRequired = ctv_protect.isChecked(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); prefs.edit().putBoolean(mContext.getString(R.string.settings_exported_profile_encryption), ctv_protect.isChecked()).commit(); } if (!ctv_protect.isChecked()) { dialog.dismiss(); ntfy_pswd.notifyToListener(true, new Object[] { "" }); } else { if (!passwd.equals(et_confirm.getText().toString())) { //Unmatch dlg_msg.setText( mContext.getString(R.string.msgs_export_import_pswd_unmatched_confirm_pswd)); } else { dialog.dismiss(); ntfy_pswd.notifyToListener(true, new Object[] { passwd }); } } } }); // CANCEL? btn_cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); ntfy_pswd.notifyToListener(false, null); } }); // Cancel? dialog.setOnCancelListener(new Dialog.OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { btn_cancel.performClick(); } }); // dialog.setCancelable(false); // dialog.setOnKeyListener(new DialogOnKeyListener(context)); dialog.show(); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
public void scanRemoteNetworkDlg(final NotifyEvent p_ntfy, String port_number, boolean scan_start) { //??//from w w w. j a va 2 s.c o m final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setContentView(R.layout.scan_remote_ntwk_dlg); LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_dlg_view); ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color); final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_title_view); final TextView title = (TextView) dialog.findViewById(R.id.scan_remote_ntwk_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setTextColor(mGp.themeColorList.text_color_dialog_title); final Button btn_scan = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_ok); final Button btn_cancel = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_cancel); final TextView tvmsg = (TextView) dialog.findViewById(R.id.scan_remote_ntwk_msg); final TextView tv_result = (TextView) dialog.findViewById(R.id.scan_remote_ntwk_scan_result_title); tvmsg.setText(mContext.getString(R.string.msgs_scan_ip_address_press_scan_btn)); tv_result.setVisibility(TextView.GONE); final String from = CommonUtilities.getLocalIpAddress(); String subnet = from.substring(0, from.lastIndexOf(".")); String subnet_o1, subnet_o2, subnet_o3; subnet_o1 = subnet.substring(0, subnet.indexOf(".")); subnet_o2 = subnet.substring(subnet.indexOf(".") + 1, subnet.lastIndexOf(".")); subnet_o3 = subnet.substring(subnet.lastIndexOf(".") + 1, subnet.length()); final EditText baEt1 = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_begin_address_o1); final EditText baEt2 = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_begin_address_o2); final EditText baEt3 = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_begin_address_o3); final EditText baEt4 = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_begin_address_o4); final EditText eaEt4 = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_end_address_o4); baEt1.setText(subnet_o1); baEt2.setText(subnet_o2); baEt3.setText(subnet_o3); baEt4.setText("1"); baEt4.setSelection(1); eaEt4.setText("254"); baEt4.requestFocus(); final CheckedTextView ctv_use_port_number = (CheckedTextView) dialog .findViewById(R.id.scan_remote_ntwk_ctv_use_port); final EditText et_port_number = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_port_number); CommonDialog.setDlgBoxSizeLimit(dialog, true); if (port_number.equals("")) { et_port_number.setEnabled(false); ctv_use_port_number.setChecked(false); } else { et_port_number.setEnabled(true); et_port_number.setText(port_number); ctv_use_port_number.setChecked(true); } ctv_use_port_number.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ctv_use_port_number.toggle(); boolean isChecked = ctv_use_port_number.isChecked(); et_port_number.setEnabled(isChecked); } }); final NotifyEvent ntfy_lv_click = new NotifyEvent(mContext); ntfy_lv_click.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { dialog.dismiss(); p_ntfy.notifyToListener(true, o); } @Override public void negativeResponse(Context c, Object[] o) { } }); final ArrayList<ScanAddressResultListItem> ipAddressList = new ArrayList<ScanAddressResultListItem>(); // ScanAddressResultListItem li=new ScanAddressResultListItem(); // li.server_name=mContext.getString(R.string.msgs_ip_address_no_address); // ipAddressList.add(li); final ListView lv = (ListView) dialog.findViewById(R.id.scan_remote_ntwk_scan_result_list); final AdapterScanAddressResultList adap = new AdapterScanAddressResultList(mContext, R.layout.scan_address_result_list_item, ipAddressList, ntfy_lv_click); lv.setAdapter(adap); lv.setScrollingCacheEnabled(false); lv.setScrollbarFadingEnabled(false); //SCAN? btn_scan.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ipAddressList.clear(); NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { if (ipAddressList.size() < 1) { tvmsg.setText(mContext.getString(R.string.msgs_scan_ip_address_not_detected)); tv_result.setVisibility(TextView.GONE); } else { tvmsg.setText(mContext.getString(R.string.msgs_scan_ip_address_select_detected_host)); tv_result.setVisibility(TextView.VISIBLE); } // adap.clear(); // for (int i=0;i<ipAddressList.size();i++) // adap.add(ipAddressList.get(i)); } @Override public void negativeResponse(Context c, Object[] o) { } }); if (auditScanAddressRangeValue(dialog)) { tv_result.setVisibility(TextView.GONE); String ba1 = baEt1.getText().toString(); String ba2 = baEt2.getText().toString(); String ba3 = baEt3.getText().toString(); String ba4 = baEt4.getText().toString(); String ea4 = eaEt4.getText().toString(); String subnet = ba1 + "." + ba2 + "." + ba3; int begin_addr = Integer.parseInt(ba4); int end_addr = Integer.parseInt(ea4); scanRemoteNetwork(dialog, lv, adap, ipAddressList, subnet, begin_addr, end_addr, ntfy); } else { //error } } }); //CANCEL? btn_cancel.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) { btn_cancel.performClick(); } }); dialog.show(); if (scan_start) btn_scan.performClick(); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
private void scanRemoteNetwork(final Dialog dialog, final ListView lv_ipaddr, final AdapterScanAddressResultList adap, final ArrayList<ScanAddressResultListItem> ipAddressList, final String subnet, final int begin_addr, final int end_addr, final NotifyEvent p_ntfy) { final Handler handler = new Handler(); final ThreadCtrl tc = new ThreadCtrl(); final LinearLayout ll_addr = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_scan_address); final LinearLayout ll_prog = (LinearLayout) dialog.findViewById(R.id.scan_remote_ntwk_progress); final TextView tvmsg = (TextView) dialog.findViewById(R.id.scan_remote_ntwk_progress_msg); final Button btn_scan = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_ok); final Button btn_cancel = (Button) dialog.findViewById(R.id.scan_remote_ntwk_btn_cancel); final Button scan_cancel = (Button) dialog.findViewById(R.id.scan_remote_ntwk_progress_cancel); final CheckedTextView ctv_use_port_number = (CheckedTextView) dialog .findViewById(R.id.scan_remote_ntwk_ctv_use_port); final EditText et_port_number = (EditText) dialog.findViewById(R.id.scan_remote_ntwk_port_number); tvmsg.setText(""); scan_cancel.setText(R.string.msgs_scan_progress_spin_dlg_addr_cancel); ll_addr.setVisibility(LinearLayout.GONE); ll_prog.setVisibility(LinearLayout.VISIBLE); btn_scan.setVisibility(Button.GONE); btn_cancel.setVisibility(Button.GONE); adap.setButtonEnabled(false);/*from w ww . j a v a 2s . c om*/ scan_cancel.setEnabled(true); dialog.setOnKeyListener(new DialogBackKeyListener(mContext)); dialog.setCancelable(false); // CANCEL? scan_cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { scan_cancel.setText(mContext.getString(R.string.msgs_progress_dlg_canceling)); scan_cancel.setEnabled(false); util.addDebugMsg(1, "W", "IP Address list creation was cancelled"); tc.setDisabled(); } }); dialog.show(); util.addDebugMsg(1, "I", "Scan IP address ransge is " + subnet + "." + begin_addr + " - " + end_addr); final String scan_prog = mContext.getString(R.string.msgs_ip_address_scan_progress); String p_txt = String.format(scan_prog, 0); tvmsg.setText(p_txt); new Thread(new Runnable() { @Override public void run() {//non UI thread mScanCompleteCount = 0; mScanAddrCount = end_addr - begin_addr + 1; int scan_thread = 60; String scan_port = ""; if (ctv_use_port_number.isChecked()) scan_port = et_port_number.getText().toString(); for (int i = begin_addr; i <= end_addr; i += scan_thread) { if (!tc.isEnabled()) break; boolean scan_end = false; for (int j = i; j < (i + scan_thread); j++) { if (j <= end_addr) { startRemoteNetworkScanThread(handler, tc, dialog, p_ntfy, lv_ipaddr, adap, tvmsg, subnet + "." + j, ipAddressList, scan_port); } else { scan_end = true; } } if (!scan_end) { for (int wc = 0; wc < 210; wc++) { if (!tc.isEnabled()) break; SystemClock.sleep(30); } } } if (!tc.isEnabled()) { handler.post(new Runnable() {// UI thread @Override public void run() { closeScanRemoteNetworkProgressDlg(dialog, p_ntfy, lv_ipaddr, adap, tvmsg); } }); } else { handler.postDelayed(new Runnable() {// UI thread @Override public void run() { closeScanRemoteNetworkProgressDlg(dialog, p_ntfy, lv_ipaddr, adap, tvmsg); } }, 10000); } } }).start(); }
From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java
private void selectImportProfileItem(final AdapterSyncTask tfl, final NotifyEvent p_ntfy) { final Dialog dialog = new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.export_import_profile_dlg); dialog.setCanceledOnTouchOutside(false); LinearLayout ll_dlg_view = (LinearLayout) dialog.findViewById(R.id.export_import_profile_view); ll_dlg_view.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color); ArrayList<ExportImportProfileListItem> eipl = new ArrayList<ExportImportProfileListItem>(); for (int i = 0; i < tfl.getCount(); i++) { SyncTaskItem pl = tfl.getItem(i); ExportImportProfileListItem eipli = new ExportImportProfileListItem(); eipli.isChecked = true;//from w w w. j a va 2 s. c om eipli.item_name = pl.getSyncTaskName(); eipl.add(eipli); } // Collections.sort(eipl, new Comparator<ExportImportProfileListItem>(){ // @Override // public int compare(ExportImportProfileListItem arg0, // ExportImportProfileListItem arg1) { // if (arg0.item_name.equals(arg1.item_name)) return arg0.item_type.compareToIgnoreCase(arg1.item_type); // return arg0.item_name.compareToIgnoreCase(arg1.item_name); // } // }); // ExportImportProfileListItem eipli=new ExportImportProfileListItem(); // eipli.isChecked=true; // eipli.item_type="*"; // eipli.item_name=mContext.getString(R.string.msgs_export_import_profile_setting_parms); // eipl.add(eipli); final AdapterExportImportSyncTask imp_list_adapt = new AdapterExportImportSyncTask(mContext, R.layout.export_import_profile_list_item, eipl); ListView lv = (ListView) dialog.findViewById(R.id.export_import_profile_listview); lv.setAdapter(imp_list_adapt); CommonDialog.setDlgBoxSizeLimit(dialog, true); final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.export_import_profile_title_view); final TextView title = (TextView) dialog.findViewById(R.id.export_import_profile_title); title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color); title.setTextColor(mGp.themeColorList.text_color_dialog_title); title.setText(mContext.getString(R.string.msgs_export_import_profile_title)); // TextView tv_msgx=(TextView)dialog.findViewById(R.id.export_import_profile_msg); // tv_msgx.setVisibility(LinearLayout.GONE); LinearLayout ll_filelist = (LinearLayout) dialog.findViewById(R.id.export_import_profile_file_list); ll_filelist.setVisibility(LinearLayout.GONE); final Button ok_btn = (Button) dialog.findViewById(R.id.export_import_profile_dlg_btn_ok); Button cancel_btn = (Button) dialog.findViewById(R.id.export_import_profile_dlg_btn_cancel); final Button rb_select_all = (Button) dialog.findViewById(R.id.export_import_profile_list_select_all); final Button rb_unselect_all = (Button) dialog.findViewById(R.id.export_import_profile_list_unselect_all); final CheckedTextView ctv_reset_profile = (CheckedTextView) dialog .findViewById(R.id.export_import_profile_list_ctv_reset_profile); final CheckedTextView ctv_import_settings = (CheckedTextView) dialog .findViewById(R.id.export_import_profile_list_ctv_import_settings); final CheckedTextView ctv_import_schedule = (CheckedTextView) dialog .findViewById(R.id.export_import_profile_list_ctv_import_schedule); ctv_reset_profile.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((CheckedTextView) v).toggle(); setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt, ok_btn); } }); ctv_import_settings.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((CheckedTextView) v).toggle(); setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt, ok_btn); } }); ctv_import_schedule.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((CheckedTextView) v).toggle(); setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt, ok_btn); } }); ctv_import_settings.setChecked(true); ctv_import_schedule.setChecked(true); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { // imp_list_adapt.getItem(pos).isChecked=!imp_list_adapt.getItem(pos).isChecked; // imp_list_adapt.notifyDataSetChanged(); // if (imp_list_adapt.isItemSelected()) { // ok_btn.setEnabled(true); // } else { // ok_btn.setEnabled(false); // } setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt, ok_btn); } }); // lv.setOnItemLongClickListener(new OnItemLongClickListener(){ // @Override // public boolean onItemLongClick(AdapterView<?> arg0, View arg1, // int pos, long arg3) { // ccMenu.addMenuItem( // mContext.getString(R.string.msgs_export_import_profile_select_all),R.drawable.blank) // .setOnClickListener(new CustomContextMenuOnClickListener() { // @Override // final public void onClick(CharSequence menuTitle) { // for (int i=0;i<imp_list_adapt.getCount();i++) // imp_list_adapt.getItem(i).isChecked=true; // imp_list_adapt.notifyDataSetChanged(); // ok_btn.setEnabled(true); // } // }); // ccMenu.addMenuItem( // mContext.getString(R.string.msgs_export_import_profile_unselect_all),R.drawable.blank) // .setOnClickListener(new CustomContextMenuOnClickListener() { // @Override // final public void onClick(CharSequence menuTitle) { // for (int i=0;i<imp_list_adapt.getCount();i++) // imp_list_adapt.getItem(i).isChecked=false; // imp_list_adapt.notifyDataSetChanged(); // ok_btn.setEnabled(false); // } // }); // ccMenu.createMenu(); // return false; // } // }); rb_select_all.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { for (int i = 0; i < imp_list_adapt.getCount(); i++) imp_list_adapt.getItem(i).isChecked = true; ctv_import_settings.setChecked(true); ctv_import_schedule.setChecked(true); imp_list_adapt.notifyDataSetChanged(); ok_btn.setEnabled(true); } }); rb_unselect_all.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { for (int i = 0; i < imp_list_adapt.getCount(); i++) imp_list_adapt.getItem(i).isChecked = false; ctv_import_settings.setChecked(false); ctv_import_schedule.setChecked(false); imp_list_adapt.notifyDataSetChanged(); ok_btn.setEnabled(false); } }); NotifyEvent ntfy_ctv_listener = new NotifyEvent(mContext); ntfy_ctv_listener.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { // if (imp_list_adapt.isItemSelected()) { // ok_btn.setEnabled(true); // } else { // if (ctv_import_settings.isChecked()) ok_btn.setEnabled(true); // else ok_btn.setEnabled(false); // } setImportOkBtnEnabled(ctv_reset_profile, ctv_import_settings, ctv_import_schedule, imp_list_adapt, ok_btn); } @Override public void negativeResponse(Context c, Object[] o) { } }); imp_list_adapt.setCheckButtonListener(ntfy_ctv_listener); ok_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (ctv_reset_profile.isChecked()) mGp.syncTaskAdapter.clear(); importSelectedSyncTaskItem(imp_list_adapt, tfl, ctv_import_settings.isChecked(), ctv_import_schedule.isChecked(), p_ntfy); dialog.dismiss(); } }); cancel_btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { dialog.dismiss(); } }); dialog.show(); }