# StandOut **Repository Path**: hihopeorg/StandOut ## Basic Information - **Project Name**: StandOut - **Description**: 应用中创建浮动窗口 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-02 - **Last Updated**: 2021-11-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # StandOut **本项目是基于开源项目StandOut进行ohos化的移植和开发的,可以通过项目标签以及github地址(https://github.com/pingpongboss/StandOut )追踪到原项目版本** #### 项目介绍 - 项目名称:StandOut - 所属系列:ohos的第三方组件适配移植 - 功能: 应用中创建浮动窗口 - 项目移植状态:完成 - 调用差异:无 - 项目作者和维护人:hihope - 联系方式:hihope@hoperun.com - 原项目Doc地址:https://github.com/pingpongboss/StandOut - 原项目基线版本:sha1:0ed141188abda5743fa85b1fcdeb54cebd55af2e - 编程语言:Java - 外部库依赖:无 #### 效果演示 #### 安装教程 方案一: 1. 编译har包StandOut.har。 2. 启动 DevEco Studio,将har包导入工程目录“app->libs”下。 3. 在moudle级别下的build.gradle文件中添加依赖,在dependences标签中增加对libs目录下har包的引用。 ```groovy repositories { flatDir { dirs 'libs' } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) implementation(name: 'StandOut', ext: 'har') …… } ``` 方案二: 1. 在工程的build.gradle的allprojects中,添加HAR所在的Maven仓地址 ``` repositories { maven { url 'http://106.15.92.248:8081/repository/Releases/' } } ``` 2. 在应用模块的build.gradle的dependencies闭包中,添加如下代码: ``` dependencies { implementation 'wei.mark.ohos:standout:1.0.0' } ``` #### 使用说明 自定义的窗口类,如:SimpleWindow,MultiWindow,WidgetsWindow ``` // 自定义窗口 继承library中StandOutWindow public class MultiWindow extends StandOutWindow { private final HiLogLabel TAG = new HiLogLabel(HiLog.LOG_APP, 0x0000101, "MultiWindow"); @Override public String getAppName() { return "MultiWindow"; } @Override public int getAppIcon() { return ResourceTable.Media_ic_menu_add; } @Override public String getTitle(int id) { return getAppName() + " " + id; } // 窗口显示视图 @Override public void createAndAttachView(int id, StackLayout frame) { // create a new layout from body.xml LayoutScatter inflater = LayoutScatter.getInstance(this); Component view = inflater.parse(ResourceTable.Layout_body, frame, true); Text idText = (Text) view.findComponentById(wei.mark.example.ResourceTable.Id_id); idText.setText(String.valueOf(id)); } // every window is initially same size @Override public StandOutLayoutParams getParams(int id, Window window) { // 4 3 return new StandOutLayoutParams(id, 700, 700, StandOutLayoutParams.AUTO_POSITION, StandOutLayoutParams.AUTO_POSITION, 500, 500); } // we want the system window decorations, we want to drag the body, we want // the ability to hide windows, and we want to tap the window to bring to // front @Override public int getFlags(int id) { return StandOutFlags.FLAG_DECORATION_SYSTEM | StandOutFlags.FLAG_BODY_MOVE_ENABLE | StandOutFlags.FLAG_WINDOW_HIDE_ENABLE | StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP | StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE | StandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE | StandOutFlags.FLAG_DECORATION_MAXIMIZE_DISABLE | StandOutFlags.FLAG_ADD_FUNCTIONALITY_DROP_DOWN_DISABLE; } @Override public String getPersistentNotificationTitle(int id) { return getAppName() + " Running"; } @Override public String getPersistentNotificationMessage(int id) { return "Click to add a new " + getAppName(); } // return an Intent that creates a new MultiWindow @Override public Intent getPersistentNotificationIntent(int id) { return StandOutWindow.getShowIntent(this, getClass(), getUniqueId()); } @Override public int getHiddenIcon() { return ResourceTable.Media_ic_menu_info_details; } @Override public String getHiddenNotificationTitle(int id) { return getAppName() + " Hidden"; } @Override public String getHiddenNotificationMessage(int id) { return "Click to restore #" + id; } // return an Intent that restores the MultiWindow @Override public Intent getHiddenNotificationIntent(int id) { return StandOutWindow.getShowIntent(this, getClass(), id); } } ``` #### 版本迭代 - v1.0.0 #### 版权和许可信息 ``` Copyright (C) 2012 Mark Wei Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ```