Browse Source

消息页面

master
lh 8 years ago
parent
commit
387b35bf50
5 changed files with 108 additions and 54 deletions
  1. +31
    -21
      app/src/main/AndroidManifest.xml
  2. +58
    -0
      app/src/main/java/com/qhclh/ytzh/index/GetjpActivity.java
  3. +1
    -1
      app/src/main/java/com/qhclh/ytzh/index/MyBoradCReceiver.java
  4. +0
    -32
      app/src/main/java/com/qhclh/ytzh/index/TestActivity.java
  5. +18
    -0
      app/src/main/res/layout/act_getjp.xml

+ 31
- 21
app/src/main/AndroidManifest.xml View File

@ -64,8 +64,8 @@
android:name=".home.MainActivity" android:name=".home.MainActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<!--<activity--> <!--<activity-->
<!--android:name=".login.LoginActivity"-->
<!--android:screenOrientation="portrait" />-->
<!--android:name=".login.LoginActivity"-->
<!--android:screenOrientation="portrait" />-->
<activity <activity
android:name=".index.planorder.OrderActivity" android:name=".index.planorder.OrderActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
@ -116,8 +116,13 @@
android:windowSoftInputMode="stateAlwaysHidden" /> android:windowSoftInputMode="stateAlwaysHidden" />
<!-- 友盟 --> <!-- 友盟 -->
<meta-data android:value="5a1b5deaf43e4825b200070d" android:name="UMENG_APPKEY"/>
<meta-data android:value="Channel ID" android:name="UMENG_CHANNEL"/>
<meta-data
android:name="UMENG_APPKEY"
android:value="5a1b5deaf43e4825b200070d" />
<meta-data
android:name="UMENG_CHANNEL"
android:value="Channel ID" />
<activity <activity
android:name=".me.MineInfoActivity" android:name=".me.MineInfoActivity"
android:label="@string/title_activity_mine_info" android:label="@string/title_activity_mine_info"
@ -125,13 +130,12 @@
<activity android:name=".me.SettingActivity"></activity> <activity android:name=".me.SettingActivity"></activity>
<!-- Required SDK 核心功能--> <!-- Required SDK 核心功能-->
<!-- 可配置android:process参数将PushService放在其他进程中 --> <!-- 可配置android:process参数将PushService放在其他进程中 -->
<service <service
android:name="cn.jpush.android.service.PushService" android:name="cn.jpush.android.service.PushService"
android:enabled="true" android:enabled="true"
android:exported="false" >
android:exported="false">
<intent-filter> <intent-filter>
<action android:name="cn.jpush.android.intent.REGISTER" /> <action android:name="cn.jpush.android.intent.REGISTER" />
<action android:name="cn.jpush.android.intent.REPORT" /> <action android:name="cn.jpush.android.intent.REPORT" />
@ -143,10 +147,9 @@
<!-- since 3.0.9 Required SDK 核心功能--> <!-- since 3.0.9 Required SDK 核心功能-->
<provider <provider
android:authorities="com.qhclh.ytzh.DataProvider"
android:name="cn.jpush.android.service.DataProvider" android:name="cn.jpush.android.service.DataProvider"
android:exported="true"
/>
android:authorities="com.qhclh.ytzh.DataProvider"
android:exported="true" />
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 --> <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
<!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 --> <!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
@ -154,19 +157,19 @@
android:name="cn.jpush.android.service.DaemonService" android:name="cn.jpush.android.service.DaemonService"
android:enabled="true" android:enabled="true"
android:exported="true"> android:exported="true">
<intent-filter >
<intent-filter>
<action android:name="cn.jpush.android.intent.DaemonService" /> <action android:name="cn.jpush.android.intent.DaemonService" />
<category android:name="com.qhclh.ytzh"/>
<category android:name="com.qhclh.ytzh" />
</intent-filter> </intent-filter>
</service> </service>
<!-- Required SDK核心功能--> <!-- Required SDK核心功能-->
<receiver <receiver
android:name="cn.jpush.android.service.PushReceiver" android:name="cn.jpush.android.service.PushReceiver"
android:enabled="true" >
android:enabled="true">
<intent-filter android:priority="1000"> <intent-filter android:priority="1000">
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
<category android:name="com.qhclh.ytzh"/>
<category android:name="com.qhclh.ytzh" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.USER_PRESENT" /> <action android:name="android.intent.action.USER_PRESENT" />
@ -176,6 +179,7 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" /> <action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" /> <action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" /> <data android:scheme="package" />
</intent-filter> </intent-filter>
</receiver> </receiver>
@ -184,10 +188,11 @@
<activity <activity
android:name="cn.jpush.android.ui.PushActivity" android:name="cn.jpush.android.ui.PushActivity"
android:configChanges="orientation|keyboardHidden" android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar"
android:exported="false" >
android:exported="false"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter> <intent-filter>
<action android:name="cn.jpush.android.ui.PushActivity" /> <action android:name="cn.jpush.android.ui.PushActivity" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="com.qhclh.ytzh" /> <category android:name="com.qhclh.ytzh" />
</intent-filter> </intent-filter>
@ -209,8 +214,7 @@
<service <service
android:name="cn.jpush.android.service.DownloadService" android:name="cn.jpush.android.service.DownloadService"
android:enabled="true" android:enabled="true"
android:exported="false" >
</service>
android:exported="false"></service>
<!-- Required SDK核心功能--> <!-- Required SDK核心功能-->
<receiver android:name="cn.jpush.android.service.AlarmReceiver" /> <receiver android:name="cn.jpush.android.service.AlarmReceiver" />
@ -220,7 +224,7 @@
<!-- 该广播需要继承JPush提供的JPushMessageReceiver类, 并如下新增一个 Intent-Filter --> <!-- 该广播需要继承JPush提供的JPushMessageReceiver类, 并如下新增一个 Intent-Filter -->
<receiver <receiver
android:name=".index.MyJPReceiver" android:name=".index.MyJPReceiver"
android:enabled="true" >
android:enabled="true">
<intent-filter> <intent-filter>
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" /> <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
<category android:name="com.qhclh.ytzh" /> <category android:name="com.qhclh.ytzh" />
@ -251,11 +255,17 @@
<!-- 例如: --> <!-- 例如: -->
<!-- 发到 Google Play 的APK可以设置为 google-play; --> <!-- 发到 Google Play 的APK可以设置为 google-play; -->
<!-- 发到其他市场的 APK 可以设置为 xxx-market。 --> <!-- 发到其他市场的 APK 可以设置为 xxx-market。 -->
<meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
<meta-data
android:name="JPUSH_CHANNEL"
android:value="developer-default" />
<!-- Required. AppKey copied from Portal --> <!-- Required. AppKey copied from Portal -->
<meta-data android:name="JPUSH_APPKEY" android:value="2825a92d76c57b701e2d8308"/>
<meta-data
android:name="JPUSH_APPKEY"
android:value="2825a92d76c57b701e2d8308" />
<activity android:name=".index.TestActivity"/>
<activity
android:name=".index.GetjpActivity"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>

+ 58
- 0
app/src/main/java/com/qhclh/ytzh/index/GetjpActivity.java View File

@ -0,0 +1,58 @@
package com.qhclh.ytzh.index;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;
import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseActivity;
import butterknife.BindView;
import cn.jpush.android.api.JPushInterface;
/**
* Created by 青花瓷 on 2017/12/6.
*/
public class GetjpActivity extends BaseActivity{
@BindView(R.id.toolbar)
Toolbar mToolbar;
@BindView(R.id.tv_getjp)
TextView tv_getjp;
@Override
protected int setLayoutId() {
return R.layout.act_getjp;
}
@Override
protected void initView() {
initToolbar(mToolbar, "消息", new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
@Override
protected void initData() {
Intent intent = getIntent();
if (null != intent) {
Bundle bundle = getIntent().getExtras();
String title = null;
String content = null;
if(bundle!=null){
title = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
content = bundle.getString(JPushInterface.EXTRA_ALERT);
}
tv_getjp.setText("Title : " + title + " " + "Content : " + content);
}
}
@Override
protected void initOper() {
}
}

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

@ -44,7 +44,7 @@ public class MyBoradCReceiver extends BroadcastReceiver {
// Logger.d(TAG, "[MyReceiver] 用户点击打开了通知"); // Logger.d(TAG, "[MyReceiver] 用户点击打开了通知");
//打开自定义的Activity //打开自定义的Activity
Intent i = new Intent(context, TestActivity.class);
Intent i = new Intent(context, GetjpActivity.class);
i.putExtras(bundle); i.putExtras(bundle);
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP ); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );


+ 0
- 32
app/src/main/java/com/qhclh/ytzh/index/TestActivity.java View File

@ -1,32 +0,0 @@
package com.qhclh.ytzh.index;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import cn.jpush.android.api.JPushInterface;
public class TestActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("用户自定义打开的Activity");
Intent intent = getIntent();
if (null != intent) {
Bundle bundle = getIntent().getExtras();
String title = null;
String content = null;
if(bundle!=null){
title = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
content = bundle.getString(JPushInterface.EXTRA_ALERT);
}
tv.setText("Title : " + title + " " + "Content : " + content);
}
addContentView(tv, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}
}

+ 18
- 0
app/src/main/res/layout/act_getjp.xml View File

@ -0,0 +1,18 @@
<?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:background="@color/greyf4f4f4"
android:orientation="vertical">
<include layout="@layout/include_tool_bar" />
<TextView
android:id="@+id/tv_getjp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/dp_10"
android:textColor="@color/black303030"
android:textSize="@dimen/text_size_18" />
</LinearLayout>

Loading…
Cancel
Save