Browse Source

订阅管理ui

RaoMeng 9 years ago
parent
commit
0b375f2c4d

+ 1 - 0
WeiChat/src/main/AndroidManifest.xml

@@ -159,6 +159,7 @@
         <activity android:name=".ui.erp.activity.InformActivity" />
         <activity android:name=".ui.erp.activity.TaskActivity" />
         <activity android:name=".ui.erp.activity.ScheduleActivity" />
+        <activity android:name=".ui.erp.activity.SubscribeDetailActivity"/>
         <!-- Contacts 模块 -->
         <activity android:name=".ui.erp.activity.CompanyContactsActivity" />
         <!-- 通用的activity 加载fragment -->

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/adapter/AllSubscriptionAdapter.java

@@ -89,7 +89,7 @@ public class AllSubscriptionAdapter extends BaseAdapter{
             viewHolder.applyTextView.setEnabled(false);
         }else if (mSubscriptionNumbers.get(position).getStatus() == 3){
 //            CommonUtil.textUnderlineForStyle(viewHolder.applyTextView,"申请","申请");
-            viewHolder.applyTextView.setText("订阅");
+            viewHolder.applyTextView.setText("订阅");
             viewHolder.applyTextView.setTextColor(Color.BLUE);
             viewHolder.applyTextView.setEnabled(true);
         }else if (mSubscriptionNumbers.get(position).getStatus() == 2){

+ 45 - 36
WeiChat/src/main/java/com/xzjmyk/pm/activity/adapter/MySubscriptionAdapter.java

@@ -1,6 +1,7 @@
 package com.xzjmyk.pm.activity.adapter;
 
 import android.content.Context;
+import android.graphics.Color;
 import android.os.Handler;
 import android.os.Message;
 import android.view.Gravity;
@@ -82,42 +83,50 @@ public class MySubscriptionAdapter extends BaseAdapter {
         }
         viewHolder.subscribeIv.setImageResource(mImageIds.get(i % 5));
         viewHolder.titleTv.setText(mPersonalSubscriptionBeans.get(i).getTITLE());
-        viewHolder.applyTv.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                View cancleView = View.inflate(mContext, R.layout.pop_cancle_my_subscribe, null);
-                TextView cancleTextView = (TextView) cancleView.findViewById(R.id.cancel_subscribe_cancle_tv);
-                TextView contineTextView = (TextView) cancleView.findViewById(R.id.cancel_subscribe_contine_tv);
-
-                cancleTextView.setOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        mCanclePosition = i;
-                        sendRemoveRequest(mCanclePosition);
-                        closeWarningPopupWindow();
-                    }
-                });
-
-                contineTextView.setOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        closeWarningPopupWindow();
-                    }
-                });
-
-                mCancleWindow = new PopupWindow(cancleView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
-                mCancleWindow.setAnimationStyle(R.style.MenuAnimationFade);
-                mCancleWindow.showAtLocation(viewGroup, Gravity.BOTTOM, 0, 0);
-                DisplayUtil.backgroundAlpha(mContext, 0.5f);
-
-                mCancleWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
-                    @Override
-                    public void onDismiss() {
-                        closeWarningPopupWindow();
-                    }
-                });
-            }
-        });
+        if (mPersonalSubscriptionBeans.get(i).getISAPPLED() == -1){
+            viewHolder.applyTv.setText("-退订");
+            viewHolder.applyTv.setTextColor(Color.BLUE);
+            viewHolder.applyTv.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    View cancleView = View.inflate(mContext, R.layout.pop_cancle_my_subscribe, null);
+                    TextView cancleTextView = (TextView) cancleView.findViewById(R.id.cancel_subscribe_cancle_tv);
+                    TextView contineTextView = (TextView) cancleView.findViewById(R.id.cancel_subscribe_contine_tv);
+
+                    cancleTextView.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            mCanclePosition = i;
+                            sendRemoveRequest(mCanclePosition);
+                            closeWarningPopupWindow();
+                        }
+                    });
+
+                    contineTextView.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            closeWarningPopupWindow();
+                        }
+                    });
+
+                    mCancleWindow = new PopupWindow(cancleView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
+                    mCancleWindow.setAnimationStyle(R.style.MenuAnimationFade);
+                    mCancleWindow.showAtLocation(viewGroup, Gravity.BOTTOM, 0, 0);
+                    DisplayUtil.backgroundAlpha(mContext, 0.5f);
+
+                    mCancleWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+                        @Override
+                        public void onDismiss() {
+                            closeWarningPopupWindow();
+                        }
+                    });
+                }
+            });
+        }else if (mPersonalSubscriptionBeans.get(i).getISAPPLED() == 0){
+            viewHolder.applyTv.setText("不可退订");
+            viewHolder.applyTv.setTextColor(Color.GRAY);
+        }
+
         return view;
     }
 

+ 258 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/SubscribeDetailActivity.java

@@ -0,0 +1,258 @@
+package com.xzjmyk.pm.activity.ui.erp.activity;
+
+import android.annotation.TargetApi;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.PopupWindow;
+import android.widget.TextView;
+
+import com.umeng.socialize.ShareAction;
+import com.umeng.socialize.bean.SHARE_MEDIA;
+import com.umeng.socialize.media.UMImage;
+import com.xzjmyk.pm.activity.R;
+import com.xzjmyk.pm.activity.ui.base.BaseActivity;
+import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
+import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
+import com.xzjmyk.pm.activity.ui.erp.util.Constants;
+import com.xzjmyk.pm.activity.util.DeviceInfoUtil;
+import com.xzjmyk.pm.activity.util.DisplayUtil;
+import com.xzjmyk.pm.activity.view.crouton.Crouton;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Created by RaoMeng on 2016/10/11.
+ */
+public class SubscribeDetailActivity extends BaseActivity {
+    private ImageView mHeadImageView;
+    private TextView mNameTextView,mTitleTextView,mContentTextView;
+    private Button mApplyButton;
+    private int mSubId;
+    private String mSubName;
+    private int mSubStatus = -1;
+    private int mIsApplied = -2;
+    private Intent intent;
+    private final static int REMOVE_MY_SUBSCRIPTION = 66;
+    private final static int APPLY_DETAIL_SUBSCRIPTION = 55;
+    private PopupWindow mCancleWindow;
+    private String flag;
+
+    private Handler mHandler = new Handler(){
+        @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what){
+                case APPLY_DETAIL_SUBSCRIPTION:
+                    progressDialog.dismiss();
+                    Log.d("applysubscription", msg.getData().getString("result"));
+                    CommonUtil.imageToast(mContext, R.drawable.ic_apply_submit_success, "", 2000);
+                    mSubStatus = 2;
+                    mApplyButton.setText("已申请");
+                    mApplyButton.setEnabled(false);
+                    Intent intent = new Intent();
+                    intent.putExtra("status",mSubStatus);
+                    SubscribeDetailActivity.this.setResult(9,intent);
+                    break;
+                case REMOVE_MY_SUBSCRIPTION:
+                    progressDialog.dismiss();
+                    Crouton.makeText(mContext, "取消订阅成功");
+                    Intent myIntent = new Intent();
+                    setResult(44,myIntent);
+                    mApplyButton.setText("+订阅");
+                    flag = "all";
+                    break;
+                case Constants.APP_SOCKETIMEOUTEXCEPTION:
+                    progressDialog.dismiss();
+                    Crouton.makeText(mContext, msg.getData().getString("result"));
+                    break;
+            }
+        }
+    };
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_subscribe_detail);
+        getSupportActionBar().setTitle("订阅号详情");
+        intent = getIntent();
+        if (intent != null){
+            mSubId = intent.getIntExtra("subId", 0);
+            mSubName = intent.getStringExtra("subTitle");
+            flag = intent.getStringExtra("flag");
+            if ("all".equals(flag)){
+                mSubStatus = intent.getIntExtra("subStatus", 0);
+            }else if ("my".equals(flag)){
+                mIsApplied = intent.getIntExtra("isApplied", -1);
+            }
+        }
+        initViews();
+        initEvents();
+        initDatas();
+    }
+
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.menu_about, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.app_about:
+                new ShareAction(activity).setDisplayList(
+                        SHARE_MEDIA.SINA,
+                        SHARE_MEDIA.QQ,
+                        SHARE_MEDIA.QZONE,
+                        SHARE_MEDIA.WEIXIN,
+                        SHARE_MEDIA.WEIXIN_CIRCLE,
+                        SHARE_MEDIA.WEIXIN_FAVORITE,
+                        SHARE_MEDIA.MORE)
+                        .withTitle("UU互联")
+                        .withText("UU互联 Android客户端"+ DeviceInfoUtil.getVersionName(mContext))
+                        .withMedia(new UMImage(activity, "http://img.my.csdn.net/uploads/201609/30/1475204542_1365.png"))
+                        .withTargetUrl("http://www.usoftchina.com/usoft/uas_client.html")
+                        .setCallback(CommonUtil.umShareListener)
+                        .open();
+                break;
+            case android.R.id.home:
+                onBackPressed();
+                break;
+        }
+        return true;
+    }
+
+    private void initEvents() {
+        mApplyButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if ("all".equals(flag)) {
+                    sendApplySubs();
+                } else if ("my".equals(flag)) {
+                    View cancleView = View.inflate(mContext, R.layout.pop_cancle_my_subscribe, null);
+                    TextView cancleTextView = (TextView) cancleView.findViewById(R.id.cancel_subscribe_cancle_tv);
+                    TextView contineTextView = (TextView) cancleView.findViewById(R.id.cancel_subscribe_contine_tv);
+
+                    cancleTextView.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            sendRemoveRequest();
+                            closeWarningPopupWindow();
+                        }
+                    });
+
+                    contineTextView.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            closeWarningPopupWindow();
+                        }
+                    });
+
+                    mCancleWindow = new PopupWindow(cancleView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
+                    mCancleWindow.setAnimationStyle(R.style.MenuAnimationFade);
+                    mCancleWindow.showAtLocation(mApplyButton, Gravity.BOTTOM, 0, 0);
+                    DisplayUtil.backgroundAlpha(mContext, 0.5f);
+
+                    mCancleWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+                        @Override
+                        public void onDismiss() {
+                            closeWarningPopupWindow();
+                        }
+                    });
+                }
+            }
+        });
+    }
+
+    private void closeWarningPopupWindow() {
+        if (mCancleWindow != null) {
+            mCancleWindow.dismiss();
+            mCancleWindow = null;
+            DisplayUtil.backgroundAlpha(mContext, 1f);
+
+        }
+
+    }
+
+
+    /**
+     * 取消订阅
+     */
+    private void sendRemoveRequest() {
+        progressDialog.show();
+        String subsUrl = Constants.getAppBaseUrl(mContext) + "common/charts/removeSubsMans.action";
+        Map<String, Object> params = new HashMap<>();
+        params.put("emcode", CommonUtil.getSharedPreferences(mContext, "erp_username"));
+        params.put("numIds", mSubId);
+
+        LinkedHashMap headers = new LinkedHashMap();
+        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(mContext, "sessionId"));
+        ViewUtil.httpSendRequest(mContext, subsUrl, params, mHandler, headers, REMOVE_MY_SUBSCRIPTION, null, null, "post");
+
+    }
+
+    /**
+     * 申请订阅
+     */
+    private void sendApplySubs() {
+        progressDialog.show();
+        String applyUrl = Constants.getAppBaseUrl(mContext) + "common/charts/vastAddSubsApply.action";
+        Map<String,Object> params = new HashMap<>();
+        params.put("ids",mSubId);
+        params.put("caller", "VastAddSubsApply");
+
+        LinkedHashMap<String,Object> headers = new LinkedHashMap<>();
+        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(mContext, "sessionId"));
+        ViewUtil.httpSendRequest(mContext, applyUrl, params, mHandler, headers, APPLY_DETAIL_SUBSCRIPTION, null, null, "post");
+    }
+
+    private void initDatas() {
+        if (!TextUtils.isEmpty(mSubName)){
+            mNameTextView.setText(mSubName);
+        }
+        if (mSubStatus != -1){
+            if (mSubStatus == 1){
+                mApplyButton.setText("已订阅");
+                mApplyButton.setEnabled(false);
+            }else if (mSubStatus == 2){
+                mApplyButton.setText("已申请");
+                mApplyButton.setEnabled(false);
+            }else if (mSubStatus == 3){
+                mApplyButton.setText("+订阅");
+                mApplyButton.setEnabled(true);
+            }
+        }
+        if (mIsApplied != -2){
+            if (mIsApplied == -1){
+                mApplyButton.setText("-退订");
+                mApplyButton.setEnabled(true);
+            }else if (mIsApplied == 0){
+                mApplyButton.setText("该订阅号不可退订");
+                mApplyButton.setEnabled(false);
+            }
+        }
+    }
+
+    private void initViews() {
+        mHeadImageView = (ImageView) findViewById(R.id.subscribe_detail_iv);
+        mNameTextView = (TextView) findViewById(R.id.subscribe_detail_name_tv);
+        mTitleTextView = (TextView) findViewById(R.id.subscribe_detail_title_tv);
+        mContentTextView = (TextView) findViewById(R.id.subscribe_detail_content_tv);
+        mApplyButton = (Button) findViewById(R.id.subscribe_detail_apply_btn);
+    }
+}

+ 53 - 23
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/fragment/SubscriptionAllFragment.java

@@ -1,11 +1,13 @@
 package com.xzjmyk.pm.activity.ui.erp.fragment;
 
+import android.content.Intent;
 import android.os.Handler;
 import android.os.Message;
 import android.util.Log;
 import android.util.TypedValue;
 import android.view.Gravity;
 import android.view.View;
+import android.widget.AdapterView;
 import android.widget.LinearLayout;
 import android.widget.ListView;
 import android.widget.RadioButton;
@@ -17,6 +19,7 @@ import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.adapter.AllSubscriptionAdapter;
 import com.xzjmyk.pm.activity.bean.SubscriptionNumber;
 import com.xzjmyk.pm.activity.bean.message.AllSubscriptonKindMessage;
+import com.xzjmyk.pm.activity.ui.erp.activity.SubscribeDetailActivity;
 import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.Constants;
@@ -48,6 +51,8 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
     private RadioGroup mRadioGroup;
     private int rbPos = 0;
     private List<String> keyStrings = new ArrayList<>();
+    private final static int SUBSCRIBE_DETAIL_REQUEST = 33;
+    private static int mClickedPos = -1;
 
     @Override
     protected int getLayout() {
@@ -61,9 +66,9 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
         mPullToRefreshListView = (PullToRefreshListView) root.findViewById(R.id.subscription_all_ptlv);
         mAllSubscriptonKindMessages = new ArrayList<>();
         mSubscriptionNumbers = new ArrayList<>();
-        mAllSubscriptionAdapter = new AllSubscriptionAdapter(getActivity(),mSubscriptionNumbers);
+        mAllSubscriptionAdapter = new AllSubscriptionAdapter(getActivity(), mSubscriptionNumbers);
 
-        mEmptyLayout = new EmptyLayout(getActivity(),mPullToRefreshListView.getRefreshableView());
+        mEmptyLayout = new EmptyLayout(getActivity(), mPullToRefreshListView.getRefreshableView());
         mEmptyLayout.setShowLoadingButton(false);
         mEmptyLayout.setShowEmptyButton(false);
         mEmptyLayout.setShowErrorButton(false);
@@ -93,8 +98,20 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
                 }, 1000);
             }
         });
-
         mRadioGroup.setOnCheckedChangeListener(this);
+        mPullToRefreshListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                mClickedPos = position;
+                Intent intent = new Intent();
+                intent.setClass(getActivity(), SubscribeDetailActivity.class);
+                intent.putExtra("flag","all");
+                intent.putExtra("subId", mSubscriptionNumbers.get(position - 1).getId());
+                intent.putExtra("subTitle", mSubscriptionNumbers.get(position - 1).getTitle());
+                intent.putExtra("subStatus", mSubscriptionNumbers.get(position - 1).getStatus());
+                startActivityForResult(intent, SUBSCRIBE_DETAIL_REQUEST);
+            }
+        });
     }
 
     @Override
@@ -109,18 +126,18 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
         progressDialog.show();
         String allSubsUrl = Constants.getAppBaseUrl(getActivity()) + "common/charts/getApplySubs.action";
         Map<String, Object> params = new HashMap<>();
-        params.put("em_code", CommonUtil.getSharedPreferences(getActivity(),"erp_username"));
+        params.put("em_code", CommonUtil.getSharedPreferences(getActivity(), "erp_username"));
 
         LinkedHashMap headers = new LinkedHashMap();
-        headers.put("Cookie","JSESSIONID="+CommonUtil.getSharedPreferences(getActivity(),"sessionId"));
-        ViewUtil.httpSendRequest(getActivity(),allSubsUrl,params,mHandler,headers,GET_ALL_SUBSCRIPTION,null,null,"post");
+        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(getActivity(), "sessionId"));
+        ViewUtil.httpSendRequest(getActivity(), allSubsUrl, params, mHandler, headers, GET_ALL_SUBSCRIPTION, null, null, "post");
     }
 
     private final static int GET_ALL_SUBSCRIPTION = 44;
-    private Handler mHandler = new Handler(){
+    private Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
-            switch (msg.what){
+            switch (msg.what) {
                 case GET_ALL_SUBSCRIPTION:
                     progressDialog.dismiss();
                     String resultJson = msg.getData().getString("result");
@@ -130,23 +147,23 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
                         JSONArray datasArray = resultObject.getJSONArray("datas");
                         JSONObject datasObject = datasArray.getJSONObject(0);
                         Iterator<String> iterator = datasObject.keys();
-                        if (!iterator.hasNext()){
+                        if (!iterator.hasNext()) {
                             mEmptyLayout.showEmpty();
-                            if (mPullToRefreshListView.isRefreshing()){
+                            if (mPullToRefreshListView.isRefreshing()) {
                                 mPullToRefreshListView.onRefreshComplete();
-                                Crouton.makeText(getActivity(),"没有订阅数据", 0xff99cc00,1500).show();
+                                Crouton.makeText(getActivity(), "没有订阅数据", 0xff99cc00, 1500).show();
                             }
                             return;
                         }
 
                         keyStrings.clear();
                         mRadioGroup.removeAllViews();
-                        while (iterator.hasNext()){
+                        while (iterator.hasNext()) {
                             String key = iterator.next().toString();
 
                             keyStrings.add(key);
 
-                            Log.d("allsubskeys: ",key);
+                            Log.d("allsubskeys: ", key);
                             AllSubscriptonKindMessage subscriptonKindMessage = new AllSubscriptonKindMessage();
                             subscriptonKindMessage.setSubscriptionKind(key);
                             List<SubscriptionNumber> subscriptionNumbers = new ArrayList<>();
@@ -160,11 +177,11 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
                                 subscriptionNumber.setTitle(subsObject.getString("title"));
                                 subscriptionNumber.setKind(subsObject.getString("kind"));
                                 subscriptionNumber.setStatus(subsObject.getInt("status"));
-                                if (subsObject.getInt("status") != 1){
+                                if (subsObject.getInt("status") != 1) {
                                     subscriptionNumbers.add(subscriptionNumber);
                                 }
                             }
-                            if (subscriptionNumbers.size() != 0){
+                            if (subscriptionNumbers.size() != 0) {
                                 subscriptonKindMessage.setSubscriptionNumbers(subscriptionNumbers);
                                 mAllSubscriptonKindMessages.add(subscriptonKindMessage);
                             }
@@ -174,9 +191,9 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
                         e.printStackTrace();
                     }
 
-                    if (keyStrings.size() == 0){
+                    if (keyStrings.size() == 0) {
                         mRadioGroup.setVisibility(View.GONE);
-                    }else {
+                    } else {
                         mRadioGroup.setVisibility(View.VISIBLE);
                         for (int i = 0; i < keyStrings.size(); i++) {
                             RadioButton radioButton = new RadioButton(getActivity());
@@ -185,13 +202,14 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
                             radioButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
                             radioButton.setBackground(getResources().getDrawable(R.drawable.selector_subscribe_bg));
                             radioButton.setText(keyStrings.get(i));
+                            radioButton.setTextColor(getResources().getColor(R.color.selector_subscribe_tv));
                             radioButton.setPadding(0, 30, 0, 30);
                             radioButton.setId(i);
 
-                            if (i == rbPos){
+                            if (i == rbPos) {
 //                                radioButton.setTextColor(getResources().getColor(R.color.red));
                                 radioButton.setChecked(true);
-                            }else {
+                            } else {
 //                                radioButton.setTextColor(getResources().getColor(R.color.black));
                                 radioButton.setChecked(false);
                             }
@@ -201,16 +219,16 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
                     }
                     mSubscriptionNumbers.clear();
                     mSubscriptionNumbers.addAll(mAllSubscriptonKindMessages.get(rbPos).getSubscriptionNumbers());
-                    Log.d("allsubscription:",mSubscriptionNumbers.toString());
+                    Log.d("allsubscription:", mSubscriptionNumbers.toString());
                     mAllSubscriptionAdapter.notifyDataSetChanged();
-                    if (mPullToRefreshListView.isRefreshing()){
+                    if (mPullToRefreshListView.isRefreshing()) {
                         mPullToRefreshListView.onRefreshComplete();
-                        Crouton.makeText(getActivity(),"刷新成功", 0xff99cc00,1500).show();
+                        Crouton.makeText(getActivity(), "刷新成功", 0xff99cc00, 1500).show();
                     }
                     break;
                 case Constants.APP_SOCKETIMEOUTEXCEPTION:
                     progressDialog.dismiss();
-                    Crouton.makeText(getActivity(),msg.getData().getString("result"), Style.ALERT).show();
+                    Crouton.makeText(getActivity(), msg.getData().getString("result"), Style.ALERT).show();
                     break;
             }
         }
@@ -232,4 +250,16 @@ public class SubscriptionAllFragment extends BaseFragment implements RadioGroup.
         mSubscriptionNumbers.addAll(mAllSubscriptonKindMessages.get(rbPos).getSubscriptionNumbers());
         mAllSubscriptionAdapter.notifyDataSetChanged();
     }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == SUBSCRIBE_DETAIL_REQUEST && resultCode == 9 && data != null) {
+            int statu = data.getIntExtra("status", 0);
+            if (mClickedPos != -1){
+                mSubscriptionNumbers.get(mClickedPos - 1).setStatus(statu);
+                mAllSubscriptionAdapter.notifyDataSetChanged();
+            }
+
+        }
+    }
 }

+ 29 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/fragment/SubscriptionMyFragment.java

@@ -1,8 +1,11 @@
 package com.xzjmyk.pm.activity.ui.erp.fragment;
 
+import android.content.Intent;
 import android.os.Handler;
 import android.os.Message;
 import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
 import android.widget.ScrollView;
 import android.widget.Toast;
 
@@ -11,6 +14,7 @@ import com.handmark.pulltorefresh.library.PullToRefreshScrollView;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.adapter.MySubscriptionAdapter;
 import com.xzjmyk.pm.activity.bean.PersonalSubscriptionBean;
+import com.xzjmyk.pm.activity.ui.erp.activity.SubscribeDetailActivity;
 import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.Constants;
@@ -41,6 +45,9 @@ public class SubscriptionMyFragment extends BaseFragment {
     private final static int GET_MY_SUBSCRIPTION = 12;
 
     private EmptyLayout mEmptyLayout;
+    private static int mClickedPosition = -1;
+    private static int SUBSCRIBE_MY_DETAIL_REQUEST = 45;
+
     @Override
     protected int getLayout() {
         return R.layout.fragment_my_subscription;
@@ -77,6 +84,20 @@ public class SubscriptionMyFragment extends BaseFragment {
                 mPullToRefreshScrollView.onRefreshComplete();
             }
         });
+
+        mMyListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                mClickedPosition = position;
+                Intent intent = new Intent();
+                intent.setClass(getActivity(), SubscribeDetailActivity.class);
+                intent.putExtra("flag","my");
+                intent.putExtra("subId", mPersonalSubscriptionBeans.get(position).getNUM_ID());
+                intent.putExtra("subTitle", mPersonalSubscriptionBeans.get(position).getTITLE());
+                intent.putExtra("isApplied", mPersonalSubscriptionBeans.get(position).getISAPPLED());
+                startActivityForResult(intent, SUBSCRIBE_MY_DETAIL_REQUEST);
+            }
+        });
     }
 
     @Override
@@ -98,6 +119,14 @@ public class SubscriptionMyFragment extends BaseFragment {
         ViewUtil.httpSendRequest(getActivity(), subsUrl, params, mHandler, headers, GET_MY_SUBSCRIPTION, null, null, "post");
     }
 
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == SUBSCRIBE_MY_DETAIL_REQUEST && resultCode == 44){
+            mPersonalSubscriptionBeans.remove(mClickedPosition);
+            mMySubscriptionAdapter.notifyDataSetChanged();
+        }
+    }
+
     private Handler mHandler = new Handler(){
         @Override
         public void handleMessage(Message msg) {

+ 7 - 0
WeiChat/src/main/res/drawable/bg_blue_button.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_pressed="true" android:drawable="@drawable/bg_button_focus"/>
+    <item android:state_enabled="true" android:drawable="@drawable/bg_button_enabled"/>
+    <item android:state_enabled="false" android:drawable="@drawable/bg_button_invalid"/>
+    <item android:drawable="@drawable/bg_button_normal"/>
+</selector>

+ 9 - 0
WeiChat/src/main/res/drawable/bg_button_enabled.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="@color/button_normal"/>
+            <corners android:radius="5dip"/>
+        </shape>
+    </item>
+</layer-list>

+ 9 - 0
WeiChat/src/main/res/drawable/bg_button_focus.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="@color/button_focus"/>
+            <corners android:radius="5dip"/>
+        </shape>
+    </item>
+</layer-list>

+ 9 - 0
WeiChat/src/main/res/drawable/bg_button_invalid.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="@color/button_invalid"/>
+            <corners android:radius="5dip"/>
+        </shape>
+    </item>
+</layer-list>

+ 9 - 0
WeiChat/src/main/res/drawable/bg_button_normal.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="@color/text_normal"/>
+            <corners android:radius="5dip"/>
+        </shape>
+    </item>
+</layer-list>

+ 81 - 0
WeiChat/src/main/res/layout/activity_subscribe_detail.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1">
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="80dp"
+                android:padding="15dp"
+                android:background="#F5F3F4"
+                android:orientation="horizontal">
+
+                <ImageView
+                    android:id="@+id/subscribe_detail_iv"
+                    android:layout_width="50dp"
+                    android:layout_height="50dp"
+                    android:layout_marginLeft="10dp"
+                    android:src="@drawable/ic_subscription_icon1"/>
+                <TextView
+                    android:id="@+id/subscribe_detail_name_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center_vertical"
+                    android:textSize="18sp"
+                    android:layout_marginLeft="10dp"
+                    android:text="当月采购订单分析"/>
+            </LinearLayout>
+            <View
+                style="@style/app_line_gray_1dp"/>
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:padding="15dp">
+                <TextView
+                    android:id="@+id/subscribe_detail_jianjie_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="简介:"
+                    android:textColor="@color/red"/>
+                <TextView
+                    android:id="@+id/subscribe_detail_title_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_toRightOf="@id/subscribe_detail_jianjie_tv"
+                    android:text="当月采购金额汇总表"/>
+                <TextView
+                    android:id="@+id/subscribe_detail_content_tv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@id/subscribe_detail_title_tv"
+                    android:layout_alignLeft="@id/subscribe_detail_title_tv"
+                    android:layout_marginTop="10dp"
+                    android:text="描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述"/>
+            </RelativeLayout>
+
+            <View
+                style="@style/app_line_gray_1dp"/>
+        </LinearLayout>
+    </ScrollView>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:padding="10dp"
+        android:background="@color/transparent">
+        <Button
+            android:id="@+id/subscribe_detail_apply_btn"
+            style="@style/BlueButtonStyle"
+            android:layout_height="match_parent"
+            android:text="+订阅"/>
+    </LinearLayout>
+
+</LinearLayout>

+ 1 - 1
WeiChat/src/main/res/layout/layout_all_subscription_list.xml

@@ -35,7 +35,7 @@
             android:layout_height="wrap_content"
             android:layout_marginRight="5dp"
             android:layout_marginLeft="10dp"
-            android:text="订阅"
+            android:text="订阅"
             android:layout_gravity="center_vertical|right"
             android:gravity="center_vertical|right"
             android:textColor="@color/blue"/>

+ 2 - 3
WeiChat/src/main/res/layout/layout_my_subscribe_list.xml

@@ -20,8 +20,7 @@
         android:layout_marginLeft="10dp"
         android:layout_centerVertical="true"
         android:textSize="18sp"
-        android:textStyle="bold"
-        android:text="xxxxxxx"/>
+        android:textStyle="bold"/>
 
     <TextView
         android:id="@+id/my_subscribe_apply_tv"
@@ -29,7 +28,7 @@
         android:layout_height="wrap_content"
         android:layout_alignParentRight="true"
         android:layout_marginRight="10dp"
-        android:text="退订"
+        android:text="退订"
         android:gravity="center_vertical"
         android:textColor="@color/blue"
         android:layout_centerVertical="true"/>

+ 5 - 0
WeiChat/src/main/res/values/colors.xml

@@ -288,4 +288,9 @@
     <color name="oa_background_orange">#DC9A54</color>
 
     <color name="toast_bg">#60808080</color><!--自定义toast背景色-->
+
+    <color name="button_normal">#7AB9EE</color>
+    <color name="button_invalid">#C0C0C0</color>
+    <color name="button_focus">#2475FB</color>
+    <color name="text_normal">#808A87</color>
 </resources>

+ 10 - 0
WeiChat/src/main/res/values/styles.xml

@@ -959,4 +959,14 @@
         <item name="android:layout_marginTop">6dp</item>
         <item name="android:layout_marginBottom">6dp</item>
     </style>
+
+    <!--Button-->
+    <style name="BlueButtonStyle">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:gravity">center</item>
+        <item name="android:textSize">20dp</item>
+        <item name="android:textColor">#ffffff</item>
+        <item name="android:background">@drawable/bg_blue_button</item>
+    </style>
 </resources>