Java Code Examples for com.gc.materialdesign.widgets.Dialog#setOnAcceptButtonClickListener()

The following examples show how to use com.gc.materialdesign.widgets.Dialog#setOnAcceptButtonClickListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecruitItemBaseAdapter.java    From Social with Apache License 2.0 6 votes vote down vote up
private void handleDeleteRecruit(Message msg){
    String result = msg.obj.toString();
    Log.d("RecruitItemBase", result);
    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    Root root = gson.fromJson(result, Root.class);

    if(root==null){
        new Dialog(context,"错误","链接服务器失败").show();
        return ;
    }
    if (root.success == false){
        new Dialog(context,"错误",root.message).show();
    }

    final Dialog dialog = new Dialog(context,"Tips","删除成功");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent("com.allever.social.updateNearbyRecruit");
            context.sendBroadcast(intent);
            dialog.cancel();
        }
    });
    dialog.show();
}
 
Example 2
Source File: MyEaseChatFragment.java    From Social with Apache License 2.0 5 votes vote down vote up
private void showVipDialog(){
    Dialog dialog = new Dialog(getActivity(),"提示","邀请好友免费开通VIP会员");
    dialog.setCancelable(false);
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //弹出分享对话框
            //Toast.makeText(getActivity(), "弹出分享对话框", Toast.LENGTH_LONG).show();
            Intent intent = new Intent(getActivity(), ShareDialogActivity.class);
            startActivityForResult(intent,REQUEST_CODE_SHARE_DIALOG_ACTIVITY);
        }
    });
    dialog.show();
}
 
Example 3
Source File: GroupItemArrayAdapter.java    From Social with Apache License 2.0 5 votes vote down vote up
private void handleJoinGroup(Message msg, final ViewHolder viewHolder){
    String result = msg.obj.toString();
    Log.d("NearbyFragment", result);
    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    Root root = gson.fromJson(result, Root.class);

    if(root==null){
        new Dialog(context,"错误","链接服务器失败").show();
        return ;
    }
    if (root.success == false){
        new Dialog(context,"错误",root.message).show();
    }

    Dialog dialog = new Dialog(context,"Tips","加群成功");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
           // viewHolder.btn_join.setVisibility(View.INVISIBLE);
            //viewHolder.btn_chat.setVisibility(View.VISIBLE);\
            Intent intent = new Intent("com.allever.social.refresh_group_list");
            context.sendBroadcast(intent);

        }
    });
    dialog.show();

}
 
Example 4
Source File: ModifyPostActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
/**
 * 处理修改职位信息
 * **/
private void handleModify(Message msg){
    String  result = msg.obj.toString();
    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    Root root = gson.fromJson(result, Root.class);

    if (root == null){
        //new Dialog(this,"错误","链接服务器失败").show();
        Toast.makeText(this, "服务器繁忙,请重试", Toast.LENGTH_LONG).show();
        return;
    }

    if (!root.success){
        if (root.message.equals("未登录")){
            OkhttpUtil.autoLogin(handler);
            return;
        }
        new Dialog(this,"提示",root.message).show();
        return ;
    }

    final Dialog dialog = new Dialog(this,"Tips", "修改成功.");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
            Intent intent = new Intent("com.allever.social.updateNearbyPost");
            sendBroadcast(intent);
            setResult(RESULT_OK);
            ModifyPostActivity.this.finish();
        }
    });
    dialog.show();



}
 
Example 5
Source File: AddGroupActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
private void handleAddGroup(Message msg){
    String result = msg.obj.toString();
    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    Root root = gson.fromJson(result, Root.class);

    if (root == null){
        Toast.makeText(this, "服务器繁忙,请重试", Toast.LENGTH_LONG).show();
        return;
    }

    if (!root.success){
        new Dialog(this,"提示",root.message).show();
        return ;
    }

    closeProgressDialog();


    Dialog dialog = new Dialog(this,"Tipx","提交成功.");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //发广播通知修改界面
            Intent intent = new Intent("com.allever.social.refresh_group_list");
            sendBroadcast(intent);
            AddGroupActivity.this.finish();
        }
    });
    dialog.show();
    //CommentUtil.closeProgressDialog();
}
 
Example 6
Source File: GetVipActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
private void handleGetVip(Message msg){
    String result = msg.obj.toString();
    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    Root root = gson.fromJson(result, Root.class);

    if(root==null){
        //new Dialog(this,"错误","链接服务器失败").show();
        Toast.makeText(this,"服务器繁忙,请重试",Toast.LENGTH_LONG).show();
        return ;
    }

    if (!root.success){
        new Dialog(this,"Tips",root.message).show();
        return;
    }

    SharedPreferenceUtil.setVip("1");
    Dialog dialog = new Dialog(this,"Tips","恭喜,您已成为会员");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            GetVipActivity.this.setResult(RESULT_OK);
            GetVipActivity.this.finish();
        }
    });
    dialog.show();

}
 
Example 7
Source File: AddPostActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
private void handleAddPost(Message msg){
    String  result = msg.obj.toString();
    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    Root root = gson.fromJson(result, Root.class);

    if (root == null){
        //new Dialog(this,"错误","链接服务器失败").show();
        Toast.makeText(this, "服务器繁忙,请重试", Toast.LENGTH_LONG).show();
        return;
    }

    if (!root.success){
        if (root.message.equals("未登录")){
            OkhttpUtil.autoLogin(handler);
            return;
        }
        new Dialog(this,"提示",root.message).show();
        return ;
    }

    final Dialog dialog = new Dialog(this,"Tips", "添加成功.");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
            Intent intent = new Intent("com.allever.social.updateNearbyPost");
            sendBroadcast(intent);
            AddPostActivity.this.finish();
        }
    });

    dialog.show();
}
 
Example 8
Source File: GroupDataActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
private void handleDeleteGroup(Message msg){
    String result = msg.obj.toString();
    Log.d("NearbyFragment", result);
    gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    root = gson.fromJson(result, Root.class);

    if(root==null){
        //new Dialog(this,"错误","链接服务器失败").show();
        Toast.makeText(this,"服务器繁忙,请重试",Toast.LENGTH_LONG).show();
        return ;
    }
    if (root.success == false){
        new Dialog(this,"错误",root.message).show();
    }

    new Thread(new Runnable() {
        @Override
        public void run() {
         try {
             EMClient.getInstance().groupManager().destroyGroup(hx_group_id);//需异步处理
         }catch (HyphenateException e){
             e.printStackTrace();
         }
        }
    }).start();

    Dialog dialog = new Dialog(this,"Tips","删除成功");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent("com.allever.social.refresh_group_list");
            sendBroadcast(intent);
            GroupDataActivity.this.finish();
        }
    });
    dialog.show();
}
 
Example 9
Source File: GroupDataActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
private void handleJoinGroup(Message msg){
    String result = msg.obj.toString();
    Log.d("NearbyFragment", result);
    gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    root = gson.fromJson(result, Root.class);

    if(root==null){
        //new Dialog(this,"错误","链接服务器失败").show();
        Toast.makeText(this,"服务器繁忙,请重试",Toast.LENGTH_LONG).show();
        return ;
    }
    if (root.success == false){
        new Dialog(this,"错误",root.message).show();
    }



    Dialog dialog = new Dialog(this,"Tips","加群成功");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent("com.allever.social.refresh_group_list");
            sendBroadcast(intent);
            btn_join.setVisibility(View.INVISIBLE);
            btn_drop.setVisibility(View.VISIBLE);
        }
    });
    dialog.show();


}
 
Example 10
Source File: ModifyRecruitActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
private void handleModifyRecruit(Message msg){
    String  result = msg.obj.toString();
    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    Root root = gson.fromJson(result, Root.class);

    if (root == null){
        //new Dialog(this,"错误","链接服务器失败").show();
        Toast.makeText(this, "服务器繁忙,请重试", Toast.LENGTH_LONG).show();
        return;
    }

    if (!root.success){
        if (root.message.equals("未登录")){
            OkhttpUtil.autoLogin(handler);
            return;
        }
        new Dialog(this,"提示",root.message).show();
        return ;
    }

    final Dialog dialog = new Dialog(this,"Tips", "修改成功.");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
            Intent intent = new Intent("com.allever.social.updateNearbyPost");
            sendBroadcast(intent);
            setResult(RESULT_OK);
            ModifyRecruitActivity.this.finish();
        }
    });
    dialog.show();
}
 
Example 11
Source File: AddNewsActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
/**
 *处理发布动态
 **/
private void handleAddNews(Message msg){
    result = msg.obj.toString();
    gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    root = gson.fromJson(result, Root.class);

    if (root == null){
        //new Dialog(this,"错误","链接服务器失败").show();
        Toast.makeText(this,"服务器繁忙,请重试",Toast.LENGTH_LONG).show();
        return;
    }

    if (!root.success){
        if (root.message.equals("未登录")){
            OkhttpUtil.autoLogin(handler);
            return;
        }
        new Dialog(this,"提示",root.message).show();
        return ;
    }

    closeProgressDialog();

    final Dialog dialog = new Dialog(AddNewsActivity.this,"提示","发布成功");


    Intent intent = new Intent("com.allever.social.refresh_nearby_news");
    sendBroadcast(intent);

    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    dialog.show();
    return;
}
 
Example 12
Source File: MainActivity.java    From SpeedMeter with GNU General Public License v2.0 5 votes vote down vote up
public void showGpsDisabledDialog(){
    Dialog dialog = new Dialog(this, getResources().getString(R.string.gps_disabled), getResources().getString(R.string.please_enable_gps));

    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"));
        }
    });
    dialog.show();
}
 
Example 13
Source File: GroupDataActivity.java    From Social with Apache License 2.0 4 votes vote down vote up
private void handleDropGroup(Message msg){
    String result = msg.obj.toString();
    Log.d("NearbyFragment", result);
    gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
    root = gson.fromJson(result, Root.class);

    if(root==null){
        //new Dialog(this,"错误","链接服务器失败").show();
        Toast.makeText(this,"服务器繁忙,请重试",Toast.LENGTH_LONG).show();
        return ;
    }
    if (root.success == false){
        new Dialog(this,"错误",root.message).show();
    }

    //退出环信群组
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                EMClient.getInstance().groupManager().leaveGroup(hx_group_id);//需异步处理
            }catch (HyphenateException e){
                e.printStackTrace();
            }
        }
    }).start();

    Dialog dialog = new Dialog(this,"Tips","退群成功");
    dialog.setOnAcceptButtonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent("com.allever.social.refresh_group_list");
            sendBroadcast(intent);
            btn_join.setVisibility(View.VISIBLE);
            btn_drop.setVisibility(View.INVISIBLE);
        }
    });
    dialog.show();


}