Example usage for android.app Dialog findViewById

List of usage examples for android.app Dialog findViewById

Introduction

In this page you can find the example usage for android.app Dialog findViewById.

Prototype

@Nullable
public <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID or null if the ID is invalid (< 0), there is no matching view in the hierarchy, or the dialog has not yet been fully created (for example, via #show() or #create() ).

Usage

From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java

private void aboutSMBSync() {

    // common ??/*from   w w w  .j  ava 2s.  com*/
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.about_dialog);
    ((TextView) dialog.findViewById(R.id.about_dialog_title))
            .setText(getString(R.string.msgs_dlg_title_about) + "(Ver " + packageVersionName + ")");
    final WebView func_view = (WebView) dialog.findViewById(R.id.about_dialog_function);
    //      func_view.loadDataWithBaseURL("file:///android_asset/",
    //            getString(R.string.msgs_dlg_title_about_func_desc),"text/html","UTF-8","");
    func_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_func_desc));
    func_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    func_view.getSettings().setBuiltInZoomControls(true);

    final WebView change_view = (WebView) dialog.findViewById(R.id.about_dialog_change_history);
    change_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_change_desc));
    change_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    change_view.getSettings().setBuiltInZoomControls(true);

    final Button btnFunc = (Button) dialog.findViewById(R.id.about_dialog_btn_show_func);
    final Button btnChange = (Button) dialog.findViewById(R.id.about_dialog_btn_show_change);
    final Button btnOk = (Button) dialog.findViewById(R.id.about_dialog_btn_ok);

    func_view.setVisibility(TextView.VISIBLE);
    change_view.setVisibility(TextView.GONE);
    btnChange.setBackgroundResource(R.drawable.button_bg_color_selector);
    btnFunc.setBackgroundResource(R.drawable.button_bg_color_selector);
    btnChange.setTextColor(Color.DKGRAY);
    btnFunc.setTextColor(Color.GREEN);
    btnFunc.setEnabled(false);

    //      btnOk.setTextColor(Color.DKGRAY);
    //      btnOk.setTextColor(Color.GREEN);
    //      btnOk.setBackgroundResource(R.drawable.button_back_ground_color_selector);

    CommonDialog.setDlgBoxSizeLimit(dialog, true);

    // func?
    btnFunc.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            change_view.setVisibility(TextView.GONE);
            func_view.setVisibility(TextView.VISIBLE);
            CommonDialog.setDlgBoxSizeLimit(dialog, true);
            //            func_view.setEnabled(true);
            //            change_view.setEnabled(false);
            btnFunc.setTextColor(Color.GREEN);
            btnChange.setTextColor(Color.DKGRAY);
            btnChange.setEnabled(true);
            btnFunc.setEnabled(false);
        }
    });

    // change?
    btnChange.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            change_view.setVisibility(TextView.VISIBLE);
            func_view.setVisibility(TextView.GONE);
            CommonDialog.setDlgBoxSizeLimit(dialog, true);
            //            func_view.setEnabled(true);
            //            change_view.setEnabled(false);
            btnChange.setTextColor(Color.GREEN);
            btnFunc.setTextColor(Color.DKGRAY);
            btnChange.setEnabled(false);
            btnFunc.setEnabled(true);
        }
    });

    // OK?
    btnOk.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    // 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.ActivityMain.java

@SuppressLint("InflateParams")
private void aboutSMBSync() {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.about_dialog);

    final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.about_dialog_title_view);
    final TextView title = (TextView) dialog.findViewById(R.id.about_dialog_title);
    title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color);
    title.setTextColor(mGp.themeColorList.text_color_dialog_title);
    title.setText(getString(R.string.msgs_dlg_title_about) + "(Ver " + packageVersionName + ")");

    // get our tabHost from the xml
    final TabHost tab_host = (TabHost) dialog.findViewById(R.id.about_tab_host);
    tab_host.setup();/*from  w w w  .j  av  a2s .co m*/

    final TabWidget tab_widget = (TabWidget) dialog.findViewById(android.R.id.tabs);

    if (Build.VERSION.SDK_INT >= 11) {
        tab_widget.setStripEnabled(false);
        tab_widget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }

    CustomTabContentView tabViewProf = new CustomTabContentView(this,
            getString(R.string.msgs_about_dlg_func_btn));
    tab_host.addTab(tab_host.newTabSpec("func").setIndicator(tabViewProf).setContent(android.R.id.tabcontent));

    CustomTabContentView tabViewHist = new CustomTabContentView(this,
            getString(R.string.msgs_about_dlg_change_btn));
    tab_host.addTab(
            tab_host.newTabSpec("change").setIndicator(tabViewHist).setContent(android.R.id.tabcontent));

    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout ll_func = (LinearLayout) vi.inflate(R.layout.about_dialog_func, null);
    LinearLayout ll_change = (LinearLayout) vi.inflate(R.layout.about_dialog_change, null);

    final WebView func_view = (WebView) ll_func.findViewById(R.id.about_dialog_function);
    func_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_func_desc));
    func_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    func_view.getSettings().setBuiltInZoomControls(true);

    final WebView change_view = (WebView) ll_change.findViewById(R.id.about_dialog_change_history);
    change_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_change_desc));
    change_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    change_view.getSettings().setBuiltInZoomControls(true);

    final CustomViewPagerAdapter mAboutViewPagerAdapter = new CustomViewPagerAdapter(this,
            new WebView[] { func_view, change_view });
    final CustomViewPager mAboutViewPager = (CustomViewPager) dialog.findViewById(R.id.about_view_pager);
    //       mMainViewPager.setBackgroundColor(mThemeColorList.window_color_background);
    mAboutViewPager.setAdapter(mAboutViewPagerAdapter);
    mAboutViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            //             util.addDebugMsg(2,"I","onPageSelected entered, pos="+position);
            tab_widget.setCurrentTab(position);
            tab_host.setCurrentTab(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
            //             util.addDebugMsg(2,"I","onPageScrollStateChanged entered, state="+state);
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            //             util.addDebugMsg(2,"I","onPageScrolled entered, pos="+position);
        }
    });

    tab_host.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            util.addDebugMsg(2, "I", "onTabchanged entered. tab=" + tabId);
            mAboutViewPager.setCurrentItem(tab_host.getCurrentTab());
        }
    });

    final Button btnOk = (Button) dialog.findViewById(R.id.about_dialog_btn_ok);

    CommonDialog.setDlgBoxSizeLimit(dialog, true);

    // OK?
    btnOk.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    // Cancel?
    dialog.setOnCancelListener(new Dialog.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface arg0) {
            btnOk.performClick();
        }
    });

    dialog.show();
}

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;/*from   ww w .  ja  va 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.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 = ",";
                }//from   w  ww  .j  a  va 2  s  .  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.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// ww w  .ja  v a2 s  .  c om
        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 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();
    }//from   w w  w.j  ava  2s . c  o  m

    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  ww  . ja  v a  2  s  . 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

private boolean auditScanAddressRangeValue(Dialog dialog) {
    boolean result = false;
    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);
    final TextView tvmsg = (TextView) dialog.findViewById(R.id.scan_remote_ntwk_msg);

    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();

    tvmsg.setText("");
    if (ba1.equals("")) {
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_begin_notspecified));
        baEt1.requestFocus();//from   w w  w. j a  va  2s.  c  om
        return false;
    } else if (ba2.equals("")) {
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_begin_notspecified));
        baEt2.requestFocus();
        return false;
    } else if (ba3.equals("")) {
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_begin_notspecified));
        baEt3.requestFocus();
        return false;
    } else if (ba4.equals("")) {
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_begin_notspecified));
        baEt4.requestFocus();
        return false;
    } else if (ea4.equals("")) {
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_end_notspecified));
        eaEt4.requestFocus();
        return false;
    }
    int iba1 = Integer.parseInt(ba1);
    if (iba1 > 255) {
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_addr_range_error));
        baEt1.requestFocus();
        return false;
    }
    int iba2 = Integer.parseInt(ba2);
    if (iba2 > 255) {
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_addr_range_error));
        baEt2.requestFocus();
        return false;
    }
    int iba3 = Integer.parseInt(ba3);
    if (iba3 > 255) {
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_addr_range_error));
        baEt3.requestFocus();
        return false;
    }
    int iba4 = Integer.parseInt(ba4);
    int iea4 = Integer.parseInt(ea4);
    if (iba4 > 0 && iba4 < 255) {
        if (iea4 > 0 && iea4 < 255) {
            if (iba4 <= iea4) {
                result = true;
            } else {
                baEt4.requestFocus();
                tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_begin_addr_gt_end_addr));
            }
        } else {
            eaEt4.requestFocus();
            tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_end_range_error));
        }
    } else {
        baEt4.requestFocus();
        tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_begin_range_error));
    }

    if (iba1 == 192 && iba2 == 168) {
        //class c private
    } else {
        if (iba1 == 10) {
            //class a private
        } else {
            if (iba1 == 172 && (iba2 >= 16 && iba2 <= 31)) {
                //class b private
            } else {
                //not private
                result = false;
                tvmsg.setText(mContext.getString(R.string.msgs_ip_address_range_dlg_not_private));
            }
        }
    }

    return result;
}

From source file:com.sentaroh.android.SMBSync2.SyncTaskUtility.java

private void closeScanRemoteNetworkProgressDlg(final Dialog dialog, final NotifyEvent p_ntfy,
        final ListView lv_ipaddr, final AdapterScanAddressResultList adap, final TextView tvmsg) {
    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 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);
    ll_addr.setVisibility(LinearLayout.VISIBLE);
    ll_prog.setVisibility(LinearLayout.GONE);
    btn_scan.setVisibility(Button.VISIBLE);
    btn_cancel.setVisibility(Button.VISIBLE);
    adap.setButtonEnabled(true);//from w  w  w.j  av a2s  . c  om
    dialog.setOnKeyListener(null);
    dialog.setCancelable(true);
    if (p_ntfy != null)
        p_ntfy.notifyToListener(true, null);

}