diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 46017895..6ccac52e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -106,6 +106,18 @@ android:name=".test.window.WindowHVChangeActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout" android:screenOrientation="portrait" /> + + + + \ No newline at end of file diff --git a/app/src/main/java/com/herewhite/demo/StartActivity.java b/app/src/main/java/com/herewhite/demo/StartActivity.java index fa503ea0..09044848 100644 --- a/app/src/main/java/com/herewhite/demo/StartActivity.java +++ b/app/src/main/java/com/herewhite/demo/StartActivity.java @@ -9,6 +9,7 @@ import androidx.appcompat.widget.Toolbar; import com.herewhite.demo.common.DemoAPI; +import com.herewhite.demo.test.window.WindowAppliancePluginActivity; import com.herewhite.demo.test.window.WindowAppsActivity; import com.herewhite.demo.test.window.WindowTestActivity; @@ -126,4 +127,14 @@ public void windowAppsTest(View view) { Intent intent = new Intent(this, WindowAppsActivity.class); startActivity(intent); } + + public void appliancePlugin(View view) { + if (demoAPI.invalidToken()) { + tokenAlert(); + return; + } + + Intent intent = new Intent(this, WindowAppliancePluginActivity.class); + startActivity(intent); + } } diff --git a/app/src/main/java/com/herewhite/demo/common/SampleBaseActivity.java b/app/src/main/java/com/herewhite/demo/common/SampleBaseActivity.java index c349ac49..2cc07393 100644 --- a/app/src/main/java/com/herewhite/demo/common/SampleBaseActivity.java +++ b/app/src/main/java/com/herewhite/demo/common/SampleBaseActivity.java @@ -48,7 +48,9 @@ abstract public class SampleBaseActivity extends BaseActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getContentView()); - Objects.requireNonNull(getSupportActionBar()).hide(); + if (getSupportActionBar() != null) { + getSupportActionBar().hide(); + } logView = findViewById(R.id.logDisplay); whiteboardView = findViewById(R.id.white); diff --git a/app/src/main/java/com/herewhite/demo/test/window/WindowAppliancePluginActivity.java b/app/src/main/java/com/herewhite/demo/test/window/WindowAppliancePluginActivity.java new file mode 100644 index 00000000..bde0ed76 --- /dev/null +++ b/app/src/main/java/com/herewhite/demo/test/window/WindowAppliancePluginActivity.java @@ -0,0 +1,126 @@ +package com.herewhite.demo.test.window; + +import android.view.View; + +import com.herewhite.demo.common.SampleBaseActivity; +import com.herewhite.demo.databinding.ActivityWindowAppliancePluginBinding; +import com.herewhite.sdk.WhiteSdkConfiguration; +import com.herewhite.sdk.domain.Appliance; +import com.herewhite.sdk.domain.CameraConfig; +import com.herewhite.sdk.domain.ImageInformationWithUrl; +import com.herewhite.sdk.domain.MemberState; +import com.herewhite.sdk.domain.ShapeType; +import com.herewhite.sdk.domain.StrokeType; +import com.herewhite.sdk.domain.WindowAppParam; + +public class WindowAppliancePluginActivity extends SampleBaseActivity { + + private ActivityWindowAppliancePluginBinding binding; + + @Override + protected View getContentView() { + binding = ActivityWindowAppliancePluginBinding.inflate(getLayoutInflater()); + return binding.getRoot(); + } + + @Override + protected void initView() { + binding.insertNewDynamic.setOnClickListener(v -> { + String prefixUrl = "https://conversion-demo-cn.oss-cn-hangzhou.aliyuncs.com/demo/dynamicConvert"; + String taskUuid = "3e3a2b8845194f998e6e05adab70e1a1"; + WindowAppParam param = WindowAppParam.createSlideApp(taskUuid, prefixUrl, "Projector App"); + room.addApp(param, null); + }); + + binding.insertImage.setOnClickListener(v -> { + room.insertImage(new ImageInformationWithUrl(0d, + 0d, + 100d, + 200d, + "https://p5.ssl.qhimg.com/t01a2bd87890397464a.png")); + }); + + binding.redo.setOnClickListener(v -> { + room.redo(); + }); + + binding.undo.setOnClickListener(v -> { + room.undo(); + }); + + binding.clear.setOnClickListener(v -> { + room.cleanScene(true); + }); + + binding.pluginPencil.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.PENCIL); + state.setStrokeType(StrokeType.Stroke); + room.setMemberState(state); + }); + + binding.selector.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.SELECTOR); + room.setMemberState(state); + }); + + binding.laserPen.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.LASER_PENCIL); + state.setStrokeType(StrokeType.Normal); + room.setMemberState(state); + }); + + binding.eraser.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.ERASER); + room.setMemberState(state); + }); + + binding.text.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.TEXT); + room.setMemberState(state); + + }); + + binding.star.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setShapeType(ShapeType.Pentagram); + room.setMemberState(state); + }); + + binding.clicker.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.CLICKER); + room.setMemberState(state); + }); + + binding.head.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.HAND); + room.setMemberState(state); + }); + + binding.resetCamera.setOnClickListener(v -> { + CameraConfig config = new CameraConfig(); + config.setCenterX(0d); + config.setCenterY(0d); + config.setScale(1d); + room.moveCamera(config); + }); + } + + protected WhiteSdkConfiguration generateSdkConfig() { + WhiteSdkConfiguration configuration = new WhiteSdkConfiguration(demoAPI.getAppId(), true); + configuration.setUseMultiViews(true); + configuration.setEnableAppliancePlugin(true); + return configuration; + } + + @Override + protected void onJoinRoomSuccess() { + room.disableSerialization(false); + } +} diff --git a/app/src/main/java/com/herewhite/demo/test/window/WindowNoAppliancePluginActivity.java b/app/src/main/java/com/herewhite/demo/test/window/WindowNoAppliancePluginActivity.java new file mode 100644 index 00000000..f3025249 --- /dev/null +++ b/app/src/main/java/com/herewhite/demo/test/window/WindowNoAppliancePluginActivity.java @@ -0,0 +1,124 @@ +package com.herewhite.demo.test.window; + +import android.view.View; + +import com.herewhite.demo.common.SampleBaseActivity; +import com.herewhite.demo.databinding.ActivityWindowAppliancePluginBinding; +import com.herewhite.sdk.WhiteSdkConfiguration; +import com.herewhite.sdk.domain.Appliance; +import com.herewhite.sdk.domain.CameraConfig; +import com.herewhite.sdk.domain.ImageInformationWithUrl; +import com.herewhite.sdk.domain.MemberState; +import com.herewhite.sdk.domain.ShapeType; +import com.herewhite.sdk.domain.StrokeType; +import com.herewhite.sdk.domain.WindowAppParam; + +public class WindowNoAppliancePluginActivity extends SampleBaseActivity { + + private ActivityWindowAppliancePluginBinding binding; + + @Override + protected View getContentView() { + binding = ActivityWindowAppliancePluginBinding.inflate(getLayoutInflater()); + return binding.getRoot(); + } + + @Override + protected void initView() { + binding.insertNewDynamic.setOnClickListener(v -> { + String prefixUrl = "https://conversion-demo-cn.oss-cn-hangzhou.aliyuncs.com/demo/dynamicConvert"; + String taskUuid = "3e3a2b8845194f998e6e05adab70e1a1"; + WindowAppParam param = WindowAppParam.createSlideApp(taskUuid, prefixUrl, "Projector App"); + room.addApp(param, null); + }); + + binding.insertImage.setOnClickListener(v -> { + room.insertImage(new ImageInformationWithUrl(0d, + 0d, + 100d, + 200d, + "https://p5.ssl.qhimg.com/t01a2bd87890397464a.png")); + }); + + binding.redo.setOnClickListener(v -> { + room.redo(); + }); + + binding.undo.setOnClickListener(v -> { + room.undo(); + }); + + binding.clear.setOnClickListener(v -> { + room.cleanScene(true); + }); + + binding.pluginPencil.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.PENCIL); + room.setMemberState(state); + }); + + binding.selector.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.SELECTOR); + room.setMemberState(state); + }); + + binding.laserPen.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.LASER_PENCIL); + state.setStrokeType(StrokeType.Normal); + room.setMemberState(state); + }); + + binding.eraser.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.ERASER); + room.setMemberState(state); + }); + + binding.text.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.TEXT); + room.setMemberState(state); + + }); + + binding.star.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setShapeType(ShapeType.Pentagram); + room.setMemberState(state); + }); + + binding.clicker.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.CLICKER); + room.setMemberState(state); + }); + + binding.head.setOnClickListener(v -> { + MemberState state = new MemberState(); + state.setCurrentApplianceName(Appliance.HAND); + room.setMemberState(state); + }); + + binding.resetCamera.setOnClickListener(v -> { + CameraConfig config = new CameraConfig(); + config.setCenterX(0d); + config.setCenterY(0d); + config.setScale(1d); + room.moveCamera(config); + }); + } + + protected WhiteSdkConfiguration generateSdkConfig() { + WhiteSdkConfiguration configuration = new WhiteSdkConfiguration(demoAPI.getAppId(), true); + configuration.setUseMultiViews(true); + return configuration; + } + + @Override + protected void onJoinRoomSuccess() { + room.disableSerialization(false); + } +} diff --git a/app/src/main/res/layout/activity_window_appliance_plugin.xml b/app/src/main/res/layout/activity_window_appliance_plugin.xml new file mode 100644 index 00000000..dba4a19f --- /dev/null +++ b/app/src/main/res/layout/activity_window_appliance_plugin.xml @@ -0,0 +1,94 @@ + + + + + + + + + +