diff --git a/OSSDKDemo/app/build.gradle b/OSSDKDemo/app/build.gradle index e197c95..949a839 100644 --- a/OSSDKDemo/app/build.gradle +++ b/OSSDKDemo/app/build.gradle @@ -32,4 +32,5 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' implementation files('libs/CloudserviceLib.jar') + implementation files('libs/PopupMessageLib.jar') } diff --git a/OSSDKDemo/app/libs/PopupMessageLib.jar b/OSSDKDemo/app/libs/PopupMessageLib.jar new file mode 100644 index 0000000..aeda1b8 Binary files /dev/null and b/OSSDKDemo/app/libs/PopupMessageLib.jar differ diff --git a/OSSDKDemo/app/src/main/AndroidManifest.xml b/OSSDKDemo/app/src/main/AndroidManifest.xml index 0e4eb73..6d773a2 100644 --- a/OSSDKDemo/app/src/main/AndroidManifest.xml +++ b/OSSDKDemo/app/src/main/AndroidManifest.xml @@ -13,6 +13,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> + @@ -20,6 +21,10 @@ + + \ No newline at end of file diff --git a/OSSDKDemo/app/src/main/assets/Wildlife.wmv b/OSSDKDemo/app/src/main/assets/Wildlife.wmv new file mode 100755 index 0000000..bc3ff06 Binary files /dev/null and b/OSSDKDemo/app/src/main/assets/Wildlife.wmv differ diff --git a/OSSDKDemo/app/src/main/assets/test.jpg b/OSSDKDemo/app/src/main/assets/test.jpg new file mode 100644 index 0000000..bc45c7c Binary files /dev/null and b/OSSDKDemo/app/src/main/assets/test.jpg differ diff --git a/OSSDKDemo/app/src/main/java/com/jeejio/ossdk/demo/MainActivity.java b/OSSDKDemo/app/src/main/java/com/jeejio/ossdk/demo/MainActivity.java index 2bb89ef..7c5fe2b 100644 --- a/OSSDKDemo/app/src/main/java/com/jeejio/ossdk/demo/MainActivity.java +++ b/OSSDKDemo/app/src/main/java/com/jeejio/ossdk/demo/MainActivity.java @@ -2,7 +2,9 @@ import androidx.appcompat.app.AppCompatActivity; +import android.content.Intent; import android.os.Bundle; +import android.view.View; public class MainActivity extends AppCompatActivity { @@ -11,4 +13,8 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } + + public void start_pop(View view){ + startActivity(new Intent(MainActivity.this, PopupMessageActivity.class)); + } } diff --git a/OSSDKDemo/app/src/main/java/com/jeejio/ossdk/demo/PopupMessageActivity.java b/OSSDKDemo/app/src/main/java/com/jeejio/ossdk/demo/PopupMessageActivity.java new file mode 100644 index 0000000..8f63358 --- /dev/null +++ b/OSSDKDemo/app/src/main/java/com/jeejio/ossdk/demo/PopupMessageActivity.java @@ -0,0 +1,80 @@ +package com.jeejio.ossdk.demo; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; + +import jeejio.popup.PopUpMessageProvider; +import jeejio.popup.PopupMessageImp; +import jeejio.popup.PopupMessageManagerImp; + +public class PopupMessageActivity extends AppCompatActivity { + + private String TAG = PopupMessageActivity.class.getSimpleName(); + private PopupMessageManagerImp managerImp; + private Button local_picture, net_picture, local_video, net_video; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_popup_message); + try { + managerImp = PopupMessageManagerImp.getInstance(getApplicationContext()); + } catch (IllegalAccessException e) { + Log.e(TAG,"get PopupMessageService failed!"); + e.printStackTrace(); + return; + } + + local_picture = findViewById(R.id.local_picture); + local_picture.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + PopupMessageImp imp = new PopupMessageImp.Builder(PopupMessageActivity.this) + .setContentTitle("本地图片") + .setContentPath(PopUpMessageProvider.parse(PopupMessageActivity.this,"test.jpg")) + .setContentType(PopupMessageManagerImp.POPUP_MESSAGE_PICTURE).build(); + managerImp.notify(imp); + } + }); + + net_picture = findViewById(R.id.net_picture); + net_picture.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + PopupMessageImp imp = new PopupMessageImp.Builder(PopupMessageActivity.this) + .setContentTitle("山水美景") + .setContentPath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606213359863&di=45e4efd5c301ecd244d6f87a8d6ce9b8&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F2018-12-15%2F5c149eec524ff.jpg") + .setContentType(PopupMessageManagerImp.POPUP_MESSAGE_PICTURE).build(); + managerImp.notify(imp); + } + }); + + local_video = findViewById(R.id.local_video); + local_video.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + PopupMessageImp imp = new PopupMessageImp.Builder(PopupMessageActivity.this) + .setContentTitle("视频") + .setContentPath(PopUpMessageProvider.parse(PopupMessageActivity.this,"Wildlife.wmv")) + .setContentType(PopupMessageManagerImp.POPUP_MESSAGE_VIDEO).build(); + managerImp.notify(imp); + } + }); + + net_video = findViewById(R.id.net_video); + net_video.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + PopupMessageImp imp = new PopupMessageImp.Builder(PopupMessageActivity.this) + .setContentTitle("CCTV-1") + .setContentPath("http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8") + .setContentType(PopupMessageManagerImp.POPUP_MESSAGE_VIDEO).build(); + managerImp.notify(imp); + } + }); + } + +} diff --git a/OSSDKDemo/app/src/main/res/layout/activity_main.xml b/OSSDKDemo/app/src/main/res/layout/activity_main.xml index c031404..4b9e692 100644 --- a/OSSDKDemo/app/src/main/res/layout/activity_main.xml +++ b/OSSDKDemo/app/src/main/res/layout/activity_main.xml @@ -1,15 +1,16 @@ - - + android:text="@string/message_title"/> - \ No newline at end of file + \ No newline at end of file diff --git a/OSSDKDemo/app/src/main/res/layout/activity_popup_message.xml b/OSSDKDemo/app/src/main/res/layout/activity_popup_message.xml new file mode 100644 index 0000000..9ce3256 --- /dev/null +++ b/OSSDKDemo/app/src/main/res/layout/activity_popup_message.xml @@ -0,0 +1,30 @@ + + + +