Browse Source

no message

master
lh 8 years ago
parent
commit
daffc946b0
2 changed files with 10 additions and 15 deletions
  1. +4
    -6
      app/src/main/java/com/qhclh/ytzh/home/MainActivity.java
  2. +6
    -9
      app/src/main/java/com/qhclh/ytzh/index/MyBoradCReceiver.java

+ 4
- 6
app/src/main/java/com/qhclh/ytzh/home/MainActivity.java View File

@ -16,7 +16,6 @@ import com.google.gson.Gson;
import com.qhclh.ytzh.R; import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseActivity; import com.qhclh.ytzh.base.BaseActivity;
import com.qhclh.ytzh.bean.DownLoadBean; import com.qhclh.ytzh.bean.DownLoadBean;
import com.qhclh.ytzh.bean.FalgBean;
import com.qhclh.ytzh.index.IndexFragment; import com.qhclh.ytzh.index.IndexFragment;
import com.qhclh.ytzh.index.JPInfoActivity; import com.qhclh.ytzh.index.JPInfoActivity;
import com.qhclh.ytzh.index.fumudai.FumudaiFragment; import com.qhclh.ytzh.index.fumudai.FumudaiFragment;
@ -26,7 +25,6 @@ import com.qhclh.ytzh.utils.ApkUtils;
import com.qhclh.ytzh.utils.Urltool; import com.qhclh.ytzh.utils.Urltool;
import com.qhclh.ytzh.work.WorkFragment; import com.qhclh.ytzh.work.WorkFragment;
import org.litepal.crud.DataSupport;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
@ -92,9 +90,9 @@ public class MainActivity extends BaseActivity {
@Override @Override
protected void initData() { protected void initData() {
FalgBean falgBean = new FalgBean();
falgBean.setFlag(0);
falgBean.save();
// FalgBean falgBean = new FalgBean();
// falgBean.setFlag(0);
// falgBean.save();
} }
@Override @Override
@ -110,7 +108,7 @@ public class MainActivity extends BaseActivity {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
DataSupport.deleteAll(FalgBean.class);
// DataSupport.deleteAll(FalgBean.class);
} }
@OnClick({R.id.ll_index, R.id.ll_work, R.id.ll_me}) @OnClick({R.id.ll_index, R.id.ll_work, R.id.ll_me})


+ 6
- 9
app/src/main/java/com/qhclh/ytzh/index/MyBoradCReceiver.java View File

@ -1,19 +1,16 @@
package com.qhclh.ytzh.index; package com.qhclh.ytzh.index;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import com.qhclh.ytzh.bean.FalgBean;
import com.qhclh.ytzh.bean.NewsBean; import com.qhclh.ytzh.bean.NewsBean;
import com.qhclh.ytzh.utils.DateTimeUtil; import com.qhclh.ytzh.utils.DateTimeUtil;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.litepal.crud.DataSupport;
import java.util.Iterator; import java.util.Iterator;
@ -33,8 +30,8 @@ public class MyBoradCReceiver extends BroadcastReceiver {
// Log.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle)); // Log.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
// System.out.println("aaa1111111111++++++"+bundle.getString(JPushInterface.EXTRA_EXTRA)); // System.out.println("aaa1111111111++++++"+bundle.getString(JPushInterface.EXTRA_EXTRA));
// System.out.println("aaa2222222222++++++"+bundle.getString(JPushInterface.EXTRA_ALERT)); // System.out.println("aaa2222222222++++++"+bundle.getString(JPushInterface.EXTRA_ALERT));
int flag = DataSupport.findAll(FalgBean.class).get(0).getFlag();
if (flag ==0) {
// int flag = DataSupport.findAll(FalgBean.class).get(0).getFlag();
// if (flag ==0) {
if (bundle != null) { if (bundle != null) {
String title = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE); String title = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
String content = bundle.getString(JPushInterface.EXTRA_ALERT); String content = bundle.getString(JPushInterface.EXTRA_ALERT);
@ -48,12 +45,12 @@ public class MyBoradCReceiver extends BroadcastReceiver {
newsBean.setType("01"); newsBean.setType("01");
newsBean.setRed(1); newsBean.setRed(1);
newsBean.save(); newsBean.save();
ContentValues values = new ContentValues();
values.put("flag", 1);
DataSupport.updateAll(FalgBean.class, values);
// ContentValues values = new ContentValues();
// values.put("flag", 1);
// DataSupport.updateAll(FalgBean.class, values);
} }
} }
}
// }
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) { if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID); String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);


Loading…
Cancel
Save