Skip to content

Commit

Permalink
更新升级引用库的版本
Browse files Browse the repository at this point in the history
  • Loading branch information
dongxl committed Nov 4, 2019
1 parent 0d9b0e4 commit 414d100
Show file tree
Hide file tree
Showing 29 changed files with 461 additions and 23 deletions.
33 changes: 17 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
local.properties
/local.properties

*.iml
.idea/
.gradle/
build/
captures/

.DS_Store
.settings/
*.properties
*.project
*.classPath


/.gradle/
/.idea/
/build/
/captures/
/codeStyleSettings.xml
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml

*.iml
*.project
*.classPath
.DS_Store
/build
/captures
/.gradle
/gradle/
/.settings
/codeStyleSettings.xml
.externalNativeBuild

/app/.settings/
/app/build/
Expand Down
10 changes: 5 additions & 5 deletions dongxlpush/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
/*华为推送引用*/
implementation 'com.huawei.hms:push:3.0.0.302'
implementation 'com.huawei.hms:opendevice:3.0.0.302'
implementation 'com.huawei.hms:push:3.0.2.300'
implementation 'com.huawei.hms:opendevice:3.0.2.300'
/*魅族*/
implementation 'com.meizu.flyme.internet:push-internal:3.8.3'
/*极光*/
// implementation 'cn.jiguang.sdk:jpush:3.3.4' // 此处以JPush 3.3.4 版本为例。
// implementation 'cn.jiguang.sdk:jcore:2.1.2' // 此处以JCore 2.1.2 版本为例。
/*极光*/
// implementation 'cn.jiguang.sdk:jcore:2.1.6' // 此处以JCore 2.1.6 版本为例。
// implementation 'cn.jiguang.sdk:jpush:3.3.9' // 此处以JPush 3.3.9 版本为例。
}
Binary file removed dongxlpush/libs/MiPush_SDK_Client_3_6_19.jar
Binary file not shown.
Binary file added dongxlpush/libs/MiPush_SDK_Client_3_7_0.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added dongxlpush/libs/com.coloros.mcssdk-1.1.0.jar
Binary file not shown.
Binary file removed dongxlpush/libs/com.coloros.mcssdk.v1.0.1.jar
Binary file not shown.
Binary file removed dongxlpush/libs/jcore-android-2.1.2.jar
Binary file not shown.
Binary file added dongxlpush/libs/jcore-android-2.1.6.jar
Binary file not shown.
Binary file removed dongxlpush/libs/jpush-android-3.3.4.jar
Binary file not shown.
Binary file added dongxlpush/libs/jpush-android-3.3.9.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,94 @@ public static void setAcceptTime(Context context, int startHour, int startMin, i
}
}

/**
* 检查推送是否打开
* @param context
* @return 默认返回true
*/
public static boolean checkTurnOnOrOffPush(Context context) {
if (!PhoneUtils.isChinaCountry(context)) {
return false;
}
boolean isOn = false;
switch (getSupportPushPlatform(context)) {
case PushConstants.PushPlatform.PLATFORM_XIAOMI:
isOn = MiPushClient.shouldUseMIUIPush(context);
break;
case PushConstants.PushPlatform.PLATFORM_HUAWEI:
isOn = HuaweiPushRegister.checkTurnOnOrOffHuaweiPush(context);
break;
case PushConstants.PushPlatform.PLATFORM_OPPO:
com.coloros.mcssdk.PushManager.getInstance().getPushStatus();
isOn = true;
break;
case PushConstants.PushPlatform.PLATFORM_VIVO:
isOn = true;
break;
case PushConstants.PushPlatform.PLATFORM_FLYME:
com.meizu.cloud.pushsdk.PushManager.checkPush(context, PushConstants.MEIZU_APP_ID, PushConstants.MEIZU_APP_KEY, com.meizu.cloud.pushsdk.PushManager.getPushId(context));
isOn = true;
break;
case PushConstants.PushPlatform.PLATFORM_JPSUH:
isOn = !JPushInterface.isPushStopped(context);;
break;
default:
isOn = false;
break;
}
return isOn;
}

/**
* 打开或者关闭推送
*
* @param context
* @param isOn true 打开
*/
public static void setTurnOnOrOffPush(Context context, boolean isOn) {
if (!PhoneUtils.isChinaCountry(context)) {
return;
}
switch (getSupportPushPlatform(context)) {
case PushConstants.PushPlatform.PLATFORM_XIAOMI:
if(isOn){
MiPushClient.resumePush(context, null);
}else{
MiPushClient.pausePush(context, null);
}
break;
case PushConstants.PushPlatform.PLATFORM_HUAWEI:
HuaweiPushRegister.turnOnOrOffHuaweiPush(context, isOn);
break;
case PushConstants.PushPlatform.PLATFORM_OPPO:
if(isOn){
com.coloros.mcssdk.PushManager.getInstance().resumePush();
}else{
com.coloros.mcssdk.PushManager.getInstance().pausePush();
}
break;
case PushConstants.PushPlatform.PLATFORM_VIVO:
if(isOn){
new VivoPushOperation().turnOnPush(context);
}else{
new VivoPushOperation().turnOffPush(context);
}
break;
case PushConstants.PushPlatform.PLATFORM_FLYME:
com.meizu.cloud.pushsdk.PushManager.switchPush(context, PushConstants.MEIZU_APP_ID, PushConstants.MEIZU_APP_KEY, com.meizu.cloud.pushsdk.PushManager.getPushId(context), isOn);
break;
case PushConstants.PushPlatform.PLATFORM_JPSUH:
if(isOn){
JPushInterface.resumePush(context);
}else{
JPushInterface.stopPush(context);
}
break;
default:
break;
}
}

/**
* 清空推送通知根据id
*
Expand Down Expand Up @@ -731,7 +819,7 @@ public static void clearAllPushNotification(Context context, String platform) {
*/
private static String getSupportPushPlatform(Context context) {
Context mContext = context.getApplicationContext();
if (RomUtil.isMiui()) {
if (RomUtil.isMiui() && MiPushClient.shouldUseMIUIPush(context)) {
return PushConstants.PushPlatform.PLATFORM_XIAOMI;
} else if (RomUtil.isEmui()) {
return PushConstants.PushPlatform.PLATFORM_HUAWEI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ public void onComplete(Task<Void> task) {
}
}

/**
* 检查推送是否打开
* @param context
* @return
*/
public static boolean checkTurnOnOrOffHuaweiPush(final Context context){
return true;
}

public static final class HuaweiResultCode {
/**
* huawei 成功 | success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void onGetTags(int code, List<SubscribeResult> list) {
}

/**
* push 时间
* Push状态正常
* @param code
* @param status
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,52 @@ public void onStateChanged(int state) {
});
}

/**
* 打开推送设置
*
* @param context
*/
public void turnOnPush(final Context context) {
PushClient.getInstance(context.getApplicationContext()).turnOnPush(new IPushActionListener() {

@Override
public void onStateChanged(int state) {
final PushDataBean pushData = new PushDataBean(PushConstants.HandlerWhat.WHAT_PUSH_OTHER, state);
String reason;
if (state == VivoResultCode.VIVO_SUCCESS) {
reason = "Vivo turnOnPush Result SUCCESS msg=" + state;
} else {
reason = "Vivo turnOnPush Result Failed code=" + state;
}
pushData.setReason(reason);
sendPushDataToService(context, pushData);
}
});
}

/**
* 关闭推送设置
*
* @param context
*/
public void turnOffPush(final Context context) {
PushClient.getInstance(context.getApplicationContext()).turnOffPush(new IPushActionListener() {

@Override
public void onStateChanged(int state) {
final PushDataBean pushData = new PushDataBean(PushConstants.HandlerWhat.WHAT_PUSH_OTHER, state);
String reason;
if (state == VivoResultCode.VIVO_SUCCESS) {
reason = "Vivo turnOffPush Result SUCCESS msg=" + state;
} else {
reason = "Vivo turnOffPush Result Failed code=" + state;
}
pushData.setReason(reason);
sendPushDataToService(context, pushData);
}
});
}

public class VivoResultCode {
public static final int VIVO_SUCCESS = 0;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 获得焦点但未按下时的背景图片 -->
<item
android:state_focused="true"
android:state_enabled="true"
android:state_pressed="false"
android:drawable="@drawable/jpush_ic_richpush_actionbar_back" />
<!-- 按下时的背景图片 -->
<item
android:state_enabled="true"
android:state_pressed="true"
android:drawable="@android:color/darker_gray" />
<!-- 按下时的背景图片 -->
<item
android:state_enabled="true"
android:state_checked="true"
android:drawable="@android:color/darker_gray" />
<!-- 默认时的背景图片 -->
<item android:drawable="@drawable/jpush_ic_richpush_actionbar_back" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- 背景 gradient是渐变,corners定义的是圆角 -->
<item android:id="@android:id/background">
<shape>
<solid android:color="#ffffff" />
</shape>
</item>

<!-- 进度条 -->
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="#4393ea" />
</shape>
</clip>
</item>

</layer-list>
15 changes: 15 additions & 0 deletions dongxlpush/src/main/res/layout/jpush_popwin_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popLayoutId"
style="@style/MyDialogStyle"
android:orientation="vertical"
android:layout_width="280dp"
android:layout_height="250dp" >

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/wvPopwin"/>

</LinearLayout>
59 changes: 59 additions & 0 deletions dongxlpush/src/main/res/layout/jpush_webview_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<cn.jpush.android.ui.FullScreenView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/actionbarLayoutId"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<RelativeLayout
android:id="@+id/rlRichpushTitleBar"
android:layout_width="match_parent"
android:layout_height="40.0dp"
android:background="#29313a">

<ImageButton
android:id="@+id/imgRichpushBtnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="9dp"
android:layout_marginRight="10dp"
android:background="@drawable/jpush_richpush_btn_selector" />

<ImageView
android:id="@+id/imgView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/imgRichpushBtnBack"
android:clickable="false"
android:src="@drawable/jpush_ic_richpush_actionbar_divider" />

<TextView
android:id="@+id/tvRichpushTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="7dp"
android:layout_marginRight="5dp"
android:layout_toRightOf="@id/imgView"
android:clickable="false"
android:text=" "
android:textSize="20sp"
android:textColor="#ffffff" />
</RelativeLayout>

<ProgressBar
android:id="@+id/pushPrograssBar"
android:layout_width="match_parent"
android:layout_height="1dp"
android:progress="0"
android:progressDrawable="@drawable/jpush_richpush_progressbar"
style="?android:attr/progressBarStyleHorizontal" />
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fullWebView"
android:background="#000000" />

</cn.jpush.android.ui.FullScreenView>
Loading

0 comments on commit 414d100

Please sign in to comment.