private void setContactInfo(String content) {
    final FeedbackAgent fb = new FeedbackAgent(mContext);
    UserInfo userInfo = fb.getUserInfo();
    if (userInfo == null) {
      userInfo = new UserInfo();
    }
    Map<String, String> contact = userInfo.getContact();
    if (contact == null || contact.isEmpty()) {
      contact = new HashMap<String, String>();
    }
    int position = spContactType.getSelectedItemPosition();
    contact.put(keys[position], content);
    userInfo.setContact(contact);
    fb.setUserInfo(userInfo);

    new Thread(
            new Runnable() {
              @Override
              public void run() {
                fb.updateUserInfo();
              }
            })
        .start();
    types[position] = content;
    showContactInfo();
  }
Example #2
0
 @Override
 public boolean onPreferenceClick(Preference preference) {
   String key = preference.getKey();
   if ("share_account".equals(key)) {
     UMSocialService controller =
         UMServiceFactory.getUMSocialService("Android", RequestType.SOCIAL);
     controller.openUserCenter(this);
   } else if ("check_update".equals(key)) {
     new Mumeng().update(this);
   } else if ("advise".equals(key)) {
     FeedbackAgent feedbackAgent = new FeedbackAgent(this);
     feedbackAgent.startFeedbackActivity();
   } else if ("about".equals(key)) {
     Intent intent = new Intent(this, WebViewActivity.class);
     intent.putExtra("title", "关于播播");
     intent.putExtra("url", "file:///android_asset/about.html");
     startActivity(intent);
   } else if ("author".equals(key)) {
     Intent intent = new Intent(this, WebViewActivity.class);
     intent.putExtra("title", "关于作者");
     intent.putExtra("url", "file:///android_asset/about_author.html");
     startActivity(intent);
   } else if ("sound_hint".equals(key)) {
     ExampleApplication.sound_hint = sound_hint.isChecked();
     settingSP.edit().putBoolean("sound_hint", sound_hint.isChecked()).commit();
   }
   return true;
 }
 @Override
 public boolean onMenuItemClick(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.add_cid:
       showAddCameraDlg();
       break;
     case R.id.add_cid_by_qr:
       Intent intent = new Intent();
       intent.setClass(this, CaptureActivity.class);
       intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
       startActivityForResult(intent, SCANNIN_GREQUEST_CODE);
       break;
     case R.id.help:
       Intent guideIntent = new Intent();
       guideIntent.setClass(getApplicationContext(), GuideActivity.class);
       guideIntent.putExtra(GuideActivity.START_AVS_ACTIVITY, false);
       startActivity(guideIntent);
       break;
     case R.id.feedback:
       FeedbackAgent agent = new FeedbackAgent(this);
       agent.startFeedbackActivity();
       break;
     case R.id.about:
       showAboutDialog();
       break;
     case R.id.disclaimer:
       showDisclaimerDlg();
       break;
     default:
       break;
   }
   return false;
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash_layout);
    final int currentVersionCode = getVersionCode();
    boolean isFirst = currentVersionCode != MoccaPreferences.ISFIRSTSTART.get() ? true : false;

    if (isFirst) {
      viewPager = (ViewPager) findViewById(R.id.viewpager_splash);
      circlePageIndicator = (CirclePageIndicator) findViewById(R.id.pager_indicator2);
      int[] drawables = {
        R.drawable.start_1, R.drawable.start_2, R.drawable.start_3, R.drawable.start_4
      };
      for (int i = 0; i <= 3; i++) {
        ImageView iv = new ImageView(this);
        iv.setLayoutParams(
            new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));
        iv.setScaleType(ScaleType.FIT_XY);
        iv.setImageResource(drawables[i]);
        views.add(iv);
      }
      View iv = new View(this);
      iv.setLayoutParams(
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));
      views.add(iv);

      viewPager.setAdapter(new SplashAdapter());
      circlePageIndicator.setViewPager(viewPager);
      circlePageIndicator.setOnPageChangeListener(
          new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageSelected(int arg0) {
              if (arg0 == views.size() - 1) {
                MoccaPreferences.ISFIRSTSTART.put(currentVersionCode);
                viewPager.setCurrentItem(views.size() - 2);
                Intent intent = new Intent(SplashActivity.this, NineShowMainActivity.class);
                startActivity(intent);
                finish();
              }
            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {}

            @Override
            public void onPageScrollStateChanged(int arg0) {}
          });
    } else {
      ivSplash = (ImageView) findViewById(R.id.iv_splash);
      ivSplash.setVisibility(View.VISIBLE);
      drawable = (AnimationDrawable) ivSplash.getBackground();
      uiHandler.sendEmptyMessageDelayed(100, 2 * 1000);
    }
    FeedbackAgent agent = new FeedbackAgent(this);
    agent.sync();
    autoLogin();
  }
Example #5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppUtils.switchLanguage(getApplicationContext());
    exitWithUserOption = false;
    EventBus.getDefault().register(this);
    initSlidingMenu();
    setContentView(R.layout.activity_main);
    Trace.e(tag, getString(R.string.lang));
    fMgr = getSupportFragmentManager();
    imageLoader = BaseApplication.getImageLoader(this);
    options =
        new DisplayImageOptions.Builder()
            .bitmapConfig(Bitmap.Config.RGB_565)
            .showStubImage(R.drawable.tab_center_normal)
            .showImageForEmptyUri(R.drawable.tab_center_normal)
            .showImageOnFail(R.drawable.tab_center_normal)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .build();
    if (AppUtils.isLogin(this)) majorTeamGsonModel = AppSharePreferences.getMajorTeam(this);
    mTitleView = (TitleView) findViewById(R.id.titlebar_layout);
    mTitleView.initTitleBar(null, 0, 0);
    mTitleView.setRightMenuButton();
    mTitleView.setTitleViewListener(mTitleViewListener);
    dealBottomButtonsClickEvent();
    initFragment(savedInstanceState);
    if (majorTeamGsonModel != null && !TextUtils.isEmpty(majorTeamGsonModel.avatar)) {
      File file = DiskCacheUtils.findInCache(majorTeamGsonModel.avatar, imageLoader.getDiskCache());
      if (file == null || !file.exists()) {
        imageLoader.displayImage(majorTeamGsonModel.avatar, majorImageView, options);
      } else {
        majorImageView.setImageBitmap(BitmapFactory.decodeFile(file.getAbsolutePath()));
      }
    } else {
      if (AppSharePreferences.getFollowFlag(getApplicationContext())) {
        majorImageView.setImageResource(R.drawable.tab_center_notset_normal);
      } else {
        majorImageView.setImageResource(R.drawable.tab_center_normal);
      }
    }

    mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);

    AppService.startCheckVersion(this, false);
    mDownloadReceiver = new DownloadCompleteReceiver();
    registerReceiver(mDownloadReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
    FeedbackAgent agent = new FeedbackAgent(this);
    agent.sync();

    /*
     * if
     * (AppSharePreferences.getDefault().getBoolean("MAIN_TOURNAMENT_GUIDE",
     * true)) { startActivity(new Intent(MainActivity.this,
     * GuideActivity.class)); }
     */

  }
 public void sendInfoToUmeng(String content) {
   String contact =
       currentAccount.getPhone() == null ? currentAccount.getEmail() : currentAccount.getPhone();
   UserInfo info = new UserInfo();
   Map<String, String> map = info.getContact();
   if (map == null) map = new HashMap<String, String>();
   map.put("plain", contact);
   info.setContact(map);
   agent.setUserInfo(info);
   defaultConversation = agent.getDefaultConversation();
   defaultConversation.addUserReply(content);
   defaultConversation.sync(this);
 }
Example #7
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.rlaboutWe:
       openActivity(AboutMeActivity.class);
       break;
     case R.id.rlcontactWe:
       openActivity(ContactMeActivity.class);
       break;
     case R.id.rlversionUpdate:
       if (NetUtil.checkNet(getActivity())) {
         UmengUpdateAgent.update(getActivity());
         UmengUpdateAgent.setUpdateOnlyWifi(false);
         UmengUpdateAgent.setUpdateAutoPopup(false);
         UmengUpdateAgent.setUpdateListener(
             new UmengUpdateListener() {
               @Override
               public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) {
                 switch (updateStatus) {
                   case 0: // has update
                     UmengUpdateAgent.showUpdateDialog(getActivity(), updateInfo);
                     break;
                   case 1: // has no update
                     showShortToast("已经是最新版本");
                     break;
                   case 2: // none wifi
                     showShortToast("没有wifi连接, 只在wifi下更新");
                     break;
                   case 3: // time out
                     showShortToast("连接服务器超时");
                     break;
                 }
               }
             });
       } else {
         showShortToast(R.string.NoSignalException);
       }
       break;
     case R.id.rlIdea:
       FeedbackAgent agent = new FeedbackAgent(getActivity());
       agent.startFeedbackActivity();
       break;
     case R.id.rlShare:
       recommandToYourFriend(Constants.APP_DOWNLOAD_URL, "想停车不再难么,猛戳这里,(微信用户,请复制链接在浏览器打开)");
       break;
     default:
       break;
   }
 }
Example #8
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    overridePendingTransition(R.anim.fade_in, 0);

    // 初始化控件
    initWidget();
    // adapter绑定list
    noteList = noteDetailDao.getAllNoteForListView(currentGroupIndex, orderString);

    // 初始化用户反馈
    agent = new FeedbackAgent(this);
    // 刷新回复
    agent.sync();

    // 设置新浪SSO handler
    umSocialService =
        UMServiceFactory.getUMSocialService(MainActivity.class.getName(), RequestType.SOCIAL);
    umSocialService.getConfig().setSinaSsoHandler(new SinaSsoHandler());

    // 检查更新
    UmengUpdateAgent.update(this);

    // 读取系统设置
    sharedPreferences = getSharedPreferences("setting", MODE_PRIVATE);

    // 当typeGroup中改变按钮时
    typeGroup.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            // 改变radiobutton字体颜色
            changeRadioButoonColor();

            RadioButton radioButton = (RadioButton) findViewById(checkedId);
            String typeName = radioButton.getText().toString();
            showTypeView.setText(typeName);

            // 获取分组的全部记事本
            if (typeName.equals("全部")) {
              // 如果是“全部”则显示全部记事本
              currentGroupIndex = 1;
            } else {
              // 否则根据分组名获取tid找出全部记事本
              currentGroupIndex = noteTypeDao.getTid(typeName);
            }
            // 刷新listview
            showListView();
          }
        });

    // 默认选中"全部"分组
    SelectOneType(0);
  }
Example #9
0
  private void setUpUmengFeedback() {
    fb = new FeedbackAgent(this);
    // check if the app developer has replied to the feedback or not.
    fb.sync();
    fb.openAudioFeedback();
    fb.openFeedbackPush();

    // fb.setWelcomeInfo();
    fb.setWelcomeInfo("请输入您的意见和建议,您的支持是作者最大的动力,谢谢。");
    FeedbackPush.getInstance(this).init(true);
    PushAgent.getInstance(this).setPushIntentServiceClass(MyPushIntentService.class);

    new Thread(
            new Runnable() {
              @Override
              public void run() {
                boolean result = fb.updateUserInfo();
              }
            })
        .start();
  }
  /** 反馈意见收到条目数 */
  private void sysFeedback() {

    AppLockApplication appLockApplication = AppLockApplication.getInstance();
    txt_drawer_version_num.setText(
        getString(R.string.version_now) + appLockApplication.getApplicationVersion());

    setReplySize(appLockApplication.getReplySize());

    mAgent = new FeedbackAgent(this);
    mComversation = mAgent.getDefaultConversation();
    sync();
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
      case R.id.menu_about:
        Intent intent = new Intent(BaseActivity.this, AboutActivity.class);
        startActivity(intent);
        overridePendingTransition(R.anim.small_2_big, R.anim.fade_out);
        return true;
      case R.id.menu_feedback:
        FeedbackAgent agent = new FeedbackAgent(this);
        agent.startFeedbackActivity();
        overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
        return true;
      case R.id.menu_share:
        final UMSocialService mController =
            UMServiceFactory.getUMSocialService("com.umeng.share", RequestType.SOCIAL);
        mController.openShare(BaseActivity.this, false);
        overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
Example #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.umeng_fb_activity_conversation);
    agent = new FeedbackAgent(this);

    layoutBack = (LinearLayout) findViewById(R.id.umeng_left_layout);

    // backBtn = (ImageView) this.findViewById(com.umeng.fb.res.IdMapper.umeng_fb_back(this));
    // saveBtn = (ImageView) this.findViewById(com.umeng.fb.res.IdMapper.umeng_fb_save(this));
    // contactInfoEdit = (EditText)
    // this.findViewById(com.umeng.fb.res.IdMapper.umeng_fb_contact_info(this));
    contactInfoEdit = (EditText) findViewById(R.id.umeng_fb_reply_content);
    // lastUpdateAtText = (TextView)
    // this.findViewById(com.umeng.fb.res.IdMapper.umeng_fb_contact_update_at(this));
    lastUpdateAtText = (TextView) findViewById(R.id.umeng_fb_contact_update_at);
    try {
      String contact_info = agent.getUserInfo().getContact().get(KEY_UMENG_CONTACT_INFO_PLAIN_TEXT);
      contactInfoEdit.setText(contact_info);

      long time = agent.getUserInfoLastUpdateAt();

      if (time > 0) {
        Date date = new Date(time);
        // String prefix =
        // this.getResources().getString(com.umeng.fb.res.StringMapper.umeng_fb_contact_update_at(this));
        String prefix = this.getResources().getString(R.string.umeng_fb_contact_update_at);
        lastUpdateAtText.setText(prefix + SimpleDateFormat.getDateTimeInstance().format(date));
        lastUpdateAtText.setVisibility(View.VISIBLE);
      } else {
        lastUpdateAtText.setVisibility(View.GONE);
      }

      // If user has never entered any contact information, request focus
      // on the edittext on startup.
      if (Utility.isNullOrEmpty(contact_info)) {
        contactInfoEdit.requestFocus();
        InputMethodManager imm =
            (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm != null) imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
      }

    } catch (NullPointerException e) {
      e.printStackTrace();
    }

    layoutBack.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            back();
          }
        });
    saveBtn.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            try {
              UserInfo info = agent.getUserInfo();
              if (info == null) info = new UserInfo();
              Map<String, String> contact = info.getContact();
              if (contact == null) contact = new HashMap<String, String>();
              String contact_info = contactInfoEdit.getEditableText().toString();
              contact.put(KEY_UMENG_CONTACT_INFO_PLAIN_TEXT, contact_info);
              info.setContact(contact);

              //					Map<String, String> remark = info.getRemark();
              //					if (remark == null)
              //						remark = new HashMap<String, String>();
              //					remark.put("tag1", "game");
              //					info.setRemark(remark);

              agent.setUserInfo(info);

            } catch (Exception e) {
              e.printStackTrace();
            }
            back();
          }
        });
  }
Example #13
0
  public void onClick(View v) {
    // TODO Auto-generated method stub
    Intent intent = null;
    switch (v.getId()) {
      case R.id.seeallbtn:
        slidingMenu.toggle();
        break;

      case R.id.addnotebtn:
        intent = new Intent(MainActivity.this, AddNoteActivity.class);
        intent.putExtra("index", currentGroupIndex);
        startActivityForResult(intent, ADDNOTE);
        break;

      case R.id.addtype_btn:
        showDialog(ADDTYPE);
        break;

      case R.id.delete_btn_main:
        showDialog(SURE_DEL_NOTE);

        break;

      case R.id.share_btn_main:
        int which = 0; // 判断选中哪个一个记事本
        for (int i = 0; i < listAdapter.map.size(); i++) {
          if (listAdapter.map.get(i)) {
            which = i;
            break;
          }
        }

        // 通过which获取记事本的nid,再获取该记事本的基本信息
        NoteDetail noteDetail = noteDetailDao.getOneNote(noteList.get(which).get("nid").toString());

        intent = new Intent(Intent.ACTION_SEND);
        intent.setType("image/*");
        // 设置邮件默认标题
        intent.putExtra(Intent.EXTRA_SUBJECT, "我正在使用XNote超级记事本!");

        // 分享图片
        if (noteList.get(which).get("pic") != null) {
          File file = new File(Utils.PIC_PATH + noteList.get(which).get("pic"));
          intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
        }

        // 分享的内容
        intent.putExtra(Intent.EXTRA_TEXT, "我用XNote写了一篇记事:\n" + noteDetail.getContent());
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        // gettitle获取app的名字,显示在最上面
        startActivity(Intent.createChooser(intent, getTitle()));
        break;

      case R.id.move_btn_main:
        showDialog(SELECT_GROUP);
        break;

      case R.id.searchbtn_sidebar:
        if (listAdapter == null) {
          Toast.makeText(MainActivity.this, "暂无记事本,不能进行搜索服务", Toast.LENGTH_SHORT).show();
        } else {
          // 收取侧栏
          slidingMenu.toggle();
          toSearch();
        }

        break;

      case R.id.startsearch_btn:
        if (searchEditText.getText().toString().trim().equals("")) {
          searchEditText.setError("请输入内容");
        } else {
          String searchString = prepareSearch(searchEditText.getText().toString());

          System.out.println("组号----------" + currentGroupIndex);
          List<Map<String, Object>> searchList =
              noteDetailDao.getSearchResult(currentGroupIndex, searchString);
          if (searchList.size() > 0) {
            toNormal();
            // 让软键盘消失
            ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
                .hideSoftInputFromWindow(
                    MainActivity.this.getCurrentFocus().getWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);
            showListView(searchList);

          } else {
            searchEditText.setError("对不起,无搜索结果");
          }
        }
        break;

      case R.id.calendarbtn_sidebar:
        // 收起侧栏
        slidingMenu.toggle();
        // 选中“全部”
        SelectOneType(0);
        intent = new Intent(MainActivity.this, CalendarActivity.class);
        startActivityForResult(intent, CALENDAR);

        break;

      case R.id.albumbtn_sidebar:
        PictureDao pictureDao = new PictureDao(this);
        if (pictureDao.checkHasPic()) {
          intent = new Intent(MainActivity.this, AlbumActivity.class);
          startActivity(intent);
        } else {
          Toast toast = Toast.makeText(this, "您的记事本中还没有添加相片哦!", Toast.LENGTH_SHORT);
          toast.setGravity(Gravity.CENTER, 0, 0);
          toast.show();
        }

        break;

      case R.id.passwdbtn_sidebar:

        // 查看用户是否设置过密码,若无则创建密码
        if (Utils.getPasswd(sharedPreferences) == null) {
          showDialog(CREATE_PASSWD);
        } else {
          intent = new Intent(MainActivity.this, EncryptSettingActivity.class);
          startActivity(intent);
        }

        break;

      case R.id.feedbackbtn_sidebar:
        agent.startFeedbackActivity();
        break;

      case R.id.shareappbtn_sidebar:
        // UMServiceFactory.shareTo(MainActivity.this,
        // "我使用了快速分享接口(UMServiceFactory.share)", null);

        // UMSocialService controller = UMServiceFactory.getUMSocialService(
        // MainActivity.class.getName(), RequestType.SOCIAL);
        umSocialService.setShareContent(
            "我正在使用一款功能强大的记事本XNote,个性化的工具和多媒体的记录让我爱不释手,你们也赶快去下载吧,各大安卓应用市场搜索“XNote”!"); // 设置分享文字内容

        // 设置分享图片
        UMImage shareImage = new UMImage(MainActivity.this, getString(R.string.poster_url));

        umSocialService.setShareMedia(shareImage);

        UMWXHandler.WX_APPID = "wxab4a81c9399bba08"; // 设置微信的Appid

        // 添加微信平台
        umSocialService.getConfig().supportWXPlatform(MainActivity.this);

        // 添加微信朋友圈
        umSocialService
            .getConfig()
            .supportWXPlatform(
                MainActivity.this,
                UMServiceFactory.getUMWXHandler(MainActivity.this).setToCircle(true));
        // 微信图文分享必须设置一个url,默认"http://www.umeng.com"
        UMWXHandler.CONTENT_URL = getString(R.string.poster_url);

        umSocialService.openShare(MainActivity.this, false);
        break;

      case R.id.aboutbtn_sidebar:
        intent = new Intent(MainActivity.this, AboutActivity.class);
        startActivity(intent);

        break;

      case R.id.voice_search_btn:
        // 显示语音输入提示框
        voiceRecognizerDialog.show();
        break;

      case R.id.changebtn:
        if (orderString.contains("asc")) {
          // 如果为顺序则改为逆序
          orderString = orderString.replace("asc", "desc");
        } else {
          // 如果为逆序则改为顺序
          orderString = orderString.replace("desc", "asc");
        }

        showListView();

        break;

      case R.id.locked_btn_main:

        // 查看用户是否设置过密码,若无则创建密码
        if (Utils.getPasswd(sharedPreferences) == null) {
          showDialog(CREATE_PASSWD);
        } else {
          for (int i = 0; i < listAdapter.map.size(); i++) {
            // 找出选中的记事本并加锁
            if (listAdapter.map.get(i)) {
              noteDetailDao.updateNoteLock(noteList.get(i).get("nid").toString(), 1);
            }
          }

          Toast.makeText(MainActivity.this, "加锁成功!", Toast.LENGTH_SHORT).show();
          // 回到正常模式
          toNormal();
          // 刷新列表
          showListView();
        }

        break;

      case R.id.unlocked_btn_main:
        boolean hasLocked = false;
        // 判断是否选中的记事本均未加锁
        for (int i = 0; i < listAdapter.map.size(); i++) {
          // 找出选中的记事本
          if (listAdapter.map.get(i)) {
            if (noteList.get(i).get("locked").toString().equals("1")) {
              hasLocked = true;
            }
          }
        }
        // 如果选中的都未加锁则直接返回
        if (!hasLocked) {
          Toast.makeText(MainActivity.this, "亲,没有加锁怎么解锁呢?!", Toast.LENGTH_SHORT).show();
          return;
        }

        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
        builder.setTitle("请输入密码进行解锁!");
        final EditText editText = new EditText(MainActivity.this);
        editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
        editText.setHint("请输入密码");
        builder.setNegativeButton("取消", null);
        builder.setPositiveButton(
            "确定",
            new DialogInterface.OnClickListener() {

              public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                String passwdString = editText.getText().toString();
                // 密码正确
                if (passwdString.equals(Utils.getPasswd(sharedPreferences))) {
                  for (int i = 0; i < listAdapter.map.size(); i++) {
                    // 找出选中的记事本并解锁
                    if (listAdapter.map.get(i)) {
                      noteDetailDao.updateNoteLock(noteList.get(i).get("nid").toString(), 0);
                    }
                  }

                  Toast.makeText(MainActivity.this, "密码正确,解锁成功!", Toast.LENGTH_SHORT).show();

                  toNormal();
                  // 刷新列表
                  showListView();
                } else {
                  Toast.makeText(MainActivity.this, "密码错误,解锁失败!", Toast.LENGTH_SHORT).show();
                }
              }
            });

        builder.setView(editText);
        builder.show();

        break;
    }
  }