智能写诗与引导页用户隐私

This commit is contained in:
hukang 2021-03-10 16:28:17 +08:00 committed by hukang hwx963878
parent e2ad028194
commit 08c93e3196
61 changed files with 1165 additions and 284 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId "com.mindspore.himindspore"
minSdkVersion 21
targetSdkVersion 30
versionCode 10
versionName "1.2.3"
versionCode 11
versionName "1.2.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {

View File

@ -23,6 +23,9 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:label">
<activity
android:name=".ui.main.PrivacyPolicyActivity"
android:screenOrientation="portrait"></activity>
<activity
android:name=".ui.main.MainActivity"
android:screenOrientation="portrait"

View File

@ -0,0 +1,365 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MindSpore掌中宝用户协议</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="renderer" content="webkit"/>
<meta name="viewport"
content="width=device-width, height=device-height, initial-scale=1,maximum-scale=1,user-scalable=no"/>
<style>
html {
box-sizing: border-box;
font-family: "Arial", "PingFang SC", "Microsoft YaHei";
}
*,
*::before,
*:after {
box-sizing: inherit;
}
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
form,
fieldset,
input,
textarea,
p,
blockquote,
th,
td {
margin: 0;
padding: 0;
}
ol,
ul {
list-style: none;
margin-top: 20px;
margin-bottom: 20px;
}
#privacy {
padding: 20px;
}
.title {
font-size: 16px;
text-align: center;
margin-bottom: 20px;
margin-top: 24px;
font-weight: bold;
color: #333333;
}
h2 {
font-size: 16px;
margin-bottom: 20px;
margin-top: 24px;
color: #333333;
}
p {
font-size: 14px;
line-height: 1.5;
margin-bottom: 10px;
}
ul>li {
text-indent:0em;
line-height: 1.5;
margin-bottom: 10px;
font-size: 14px;
}
ul>li>ul>li {
text-indent: 2em;
}
ul>li>ul {
margin-top:10px
}
.list-style-block {
list-style: none;
}
.key-note {
font-weight: 700;
}
.row_spacing {
margin-top: 20px;
margin-bottom: 20px;
}
.li_row_linehigt {
margin-bottom: 20px;
text-indent: 2em;
}
.li_row_linehigta {
margin-top: 20px;
text-indent: 2em;
}
.first-line-indent{
text-indent: 2em;
}
.no-first-line-indent{
text-indent: 0em;
}
a:link {
color: #6189ff;
text-decoration: none;
}
a:visited{
color: #6189ff;
text-decoration: none;
}
a:active{
color: #6189ff;
text-decoration: none;
}
</style>
</head>
<body id="privacy" class="zh-CN">
<div class="title">MindSpore掌中宝用户协议</div>
<div class="description">
<p class="first-line-indent">
欢迎申请使用MindSpore开源社区开发者提供的MindSpore掌中宝软件以下简称“本软件”。您以下或简称“用户”在使用MindSpore开源社区开发者提供的各项服务以下简称“本服务”之前请您务必审慎阅读、充分理解并选择接受或不接受本服务协议以下简称“本协议”各条款内容包括但不限于免除或者限制MindSpore开源社区开发者责任的条款。未成年人应在法定监护人陪同下阅读。除非您接受本协议所有条款否则您无权注册、登录或使用本协议所涉相关服务。您的注册、登录、使用等行为将视为对本协议的接受并同意接受本协议各项条款的约束。本协议可由MindSpore开源社区开发者随时更新更新后的协议条款一旦公布即代替旧协议条款恕不再另行通知用户可在本软件查阅最新版协议条款。在MindSpore开源社区开发者修改本协议条款后如果用户不接受修改后的条款请立即停止使用MindSpore开源社区开发者提供的服务用户继续使用MindSpore开源社区开发者提供的服务将被视为已接受了修改后的协议。</p>
<P>本协议内容同时包括MindSpore开源社区开发者可能不断发布的关于本服务的相关协议、业务规则等内容。上述内容一经正式发布即为本协议不可分割的组成部分用户同样应当遵守。</P>
</div>
<div class="content">
<h2>一、内容</h2>
<p>
本软件所包含的所有文字、图标、用户界面、可视界面、图片、商标、标识、声音、音乐、美术作品及计算机编码合称为“内容”包括但不限于该等内容的设计、结构、选择、协调、表达、界面外观及排序等均属MindSpore开源社区开发者或其他权利人所有且受著作权法、专利法、商标法以及各类其他知识产权法的保护。</p>
<p>
除本用户协议明确规定外未经MindSpore开源社区开发者及/或其他权利人事先明确书面同意,您不得为出版或发行或为任何其他商业目的以任何方式将本软件的任何部分及任何内容复制、再制、重印、上传、发布、公开展示、编码、翻译、传输或散布至任何其他终端、网站或其他媒介。</p>
<p>您同意授予MindSpore开源社区开发者非排他性、不可转让、免费的权利在合理商业使用范围内使用上述所有数据。</p>
<h2>二、软件的获取</h2>
<p>
您可以从得到MindSpore开源社区开发者授权的第三方获取本软件如果您从未经MindSpore开源社区开发者授权的第三方获取本软件或与本软件名称相同的安装程序MindSpore开源社区开发者无法保证该软件能够正常使用并对因此给您造成的损失不予负责。</p>
<h2>三、软件的安装与卸载</h2>
<p>MindSpore开源社区开发者可能为不同的终端设备开发了不同的软件版本您应当根据实际情况选择下载合适的版本进行安装。</p>
<p>
下载安装程序后您需要按照该程序提示的步骤正确安装。为提供更加优质、安全的服务在本软件安装时MindSpore开源社区开发者可能推荐您安装其他软件您可以选择安装或不安装。如果您不再需要使用本软件或者需要安装新版软件可以自行卸载。</p>
<h2>四、软件的更新</h2>
<p>为了改善用户体验、完善服务内容MindSpore开源社区开发者将不断努力开发新的服务并为您不时提供软件更新这些更新可能会采取软件替换、修改、功能强化、版本升级等形式</p>
<p>
为了保证本软件及服务的安全性和功能的一致性MindSpore开源社区开发者有权不经向您特别通知而对软件进行更新或者对软件的部分功能效果进行改变或限制。本软件新版本发布后旧版本的软件可能无法使用。MindSpore开源社区开发者不保证旧版本软件继续可用及相应的客户服务请您随时核对并下载最新版本。</p>
<h2>五、用户个人信息保护</h2>
<p>
保护用户个人信息是MindSpore开源社区开发者的一项基本原则MindSpore开源社区开发者将会采取合理的措施保护用户的个人信息。除法律法规规定的情形外未经用户许可MindSpore开源社区开发者不会向第三方公开、透露用户个人信息。MindSpore开源社区开发者对相关信息采用专业加密存储与传输方式保障用户个人信息的安全。具体内容请查看MindSpore掌中宝隐私政策。</p>
<p>用户行为规范</p>
<p>用户在使用本软件时,必须遵守中华人民共和国相关法律法规及相关国际公约的规定,用户应同意将不会利用本服务进行任何违法或不正当的活动,包括但不限于下列行为:</p>
<ul>
<li class="no-first-line-indent">
(1) 用户不得上载、展示、张贴、传播或以其它方式传送含有下列内容之一的信息:
<ul>
<li>1) 违反中华人民共和国宪法确定的基本原则的;</li>
<li>2) 危害国家安全,泄露国家秘密,颠覆国家政权,破坏国家统一的;</li>
<li>3) 损害国家荣誉和利益的;</li>
<li>4) 煽动民族仇恨、民族歧视、破坏民族团结的;</li>
<li>5) 破坏国家宗教政策,宣扬邪教和封建迷信的;</li>
<li>6) 散布谣言,扰乱社会秩序,破坏社会稳定的;</li>
<li>7) 散布淫秽、色情、赌博、暴力、凶杀、恐怖或者教唆犯罪的;</li>
<li>8) 侮辱或者诽谤他人,侵害他人合法权益的;</li>
<li>9) 含有虚假、有害、胁迫、侵害他人隐私、骚扰、侵害、中伤、粗俗、猥亵、或其它道德上令人反感的内容;</li>
<li>10) 以非法民间组织名义活动的;</li>
<li>11) 不符合应当遵守法律法规、社会主义制度、国家利益、公民合法利益、公众秩序、社会道德风尚和信息真实性等“七条底线”要求的;</li>
<li>12) 含有中国法律、法规、规章、条例以及任何具有法律效力之规范所限制或禁止的其它内容的;</li>
</ul>
</li>
<li class="no-first-line-indent">
(2)用户不得利用“ ID”或本服务制作、上载、复制、发布、传播如下干扰本软件正常运营以及侵犯其他用户或第三方合法权益的内容
<ul>
<li>1) 含有任何性或性暗示的;</li>
<li>2) 含有辱骂、恐吓、威胁内容的;</li>
<li>3) 含有骚扰、垃圾广告、恶意信息、诱骗信息的;</li>
<li>4) 涉及他人隐私、个人信息或资料的;</li>
<li>5) 侵害他人一般人格权、名誉权、肖像权、知识产权、商业秘密等合法权利的内容;</li>
<li>6) 含有其他干扰本软件正常运营和侵犯其他用户或第三方合法权益内容的信息。</li>
</ul>
</li>
<li class="no-first-line-indent">
(3) 用户不得为任何非法目的而使用软件,不利用本软件从事以下活动:
<ul>
<li>1) 未经允许,进入计算机信息网络或者使用计算机信息网络资源的;</li>
<li>2) 未经允许,对计算机信息网络功能进行删除、修改或者增加的;</li>
<li>3) 未经允许,对进入计算机信息网络中存储、处理或者传输的数据和应用程序进行删除、修改或者增加的;</li>
<li>4) 故意制作、传播计算机病毒等破坏性程序的;</li>
<li>5) 其他危害计算机信息网络安全的行为。</li>
</ul>
</li>
<li class="no-first-line-indent">
(4) 用户不得利用本软件从事进行如下行为:
<ul>
<li>1) 提交、发布虚假信息,或盗用他人头像或资料,冒充、利用他人名义;</li>
<li>2) 强制、诱导其他用户关注、点击链接页面或分享信息;></li>
<li>3) 虚构事实、隐瞒真相以误导、欺骗他人的;</li>
<li>4) 侵害他人名誉权、肖像权、知识产权、商业秘密等合法权利的;</li>
<li>5) 未经MindSpore开源社区开发者书面许可利用MindSpore掌中宝任何功能进行推广或互相推广的</li>
<li>6) 制作、发布与以上行为相关的方法、工具,或对此类方法、工具进行运营或传播,无论这些行为是否为商业目的;</li>
<li>7) 其它违反法律法规规定、侵犯其他用户合法权益、干扰本软件正常运营的行为。</li>
</ul>
</li>
<li>(5)
用户违反本协议或相关的服务条款的规定导致或产生的任何第三方主张的任何索赔、要求或损失包括但不限于为解决争议因此产生的律师费、诉讼费您同意赔偿MindSpore开源社区开发者与合作公司、关联公司上述费用并使之免受损害。对此MindSpore开源社区开发者有权视用户的行为性质采取包括但不限于删除用户发布信息内容、暂停使用许可、终止服务、限制使用、回收
ID、追究法律责任等措施对恶意注册 ID 或利用 ID进行违法活动捣乱、骚扰、欺骗其他用户以及其他违反本协议的行为MindSpore开源社区开发者有权回收其帐号。同时MindSpore开源社区开发者会视司法部门的要求协助调查。
</li>
<li>(6)
用户须对自己在使用本软件过程中的行为承担法律责任自行对传送信息的真实性、合法性、无害性、准确性、有效性等全权负责。用户承担法律责任的形式包括但不限于对受到侵害者进行赔偿以及在本软件首先承担了因用户行为导致的行政处罚或侵权损害赔偿责任后MindSpore开源社区开发者会对用户进行追偿。
</li>
</ul>
<h2>六.用户注意事项</h2>
<p>您理解并同意:为了向您提供有效的服务,本软件会利用您终端设备的处理器和带宽等资源。本软件使用过程中可能产生数据流量的费用,用户需自行向运营商了解相关资费信息,并自行承担相关费用</p>
<p>
您理解并同意MindSpore开源社区开发者将会尽其商业上的合理努力保障您在本软件及服务中的数据存储安全但是MindSpore开源社区开发者并不能就此提供完全保证包括但不限于以下情形</p>
<ul>
<li class="first-line-indent">1) MindSpore开源社区开发者不对您在本软件及服务中相关数据的删除或储存失败负责</li>
<li class="first-line-indent">2)
MindSpore开源社区开发者有权根据实际情况自行决定单个用户在本软件及服务中数据的最长储存期限并在服务器上为其分配数据最大存储空间等。您可根据自己的需要自行备份本软件及服务中的相关数据
</li>
<li class="first-line-indent">3)
如果您停止使用本软件及服务或服务被终止或取消MindSpore开源社区开发者可以从服务器上永久地删除您的数据。服务停止、终止或取消后MindSpore开源社区开发者没有义务向您返还任何数据。
</li>
</ul>
<p>用户在使用本软件及服务时须自行承担如下来自MindSpore开源社区开发者不可掌控的风险内容包括但不限于</p>
<ul>
<li class="first-line-indent">1) 由于不可抗拒因素可能引起的个人信息丢失、泄漏等风险;</li>
<li class="first-line-indent">2) 用户必须选择与所安装终端设备相匹配的软件版本,否则,由于软件与终端设备型号不相匹配所导致的任何问题或损害,均由用户自行承担;</li>
<li class="first-line-indent">3) 用户在使用本软件访问第三方网站时,因第三方网站及相关内容所可能导致的风险,由用户自行承担;</li>
<li class="first-line-indent">4) 由于无线网络信号不稳定、无线网络带宽小等原因所引起的MindSpore掌中宝登录失败、资料同步不完整、页面打开速度慢等风险。</li>
</ul>
<p>
您理解并同意,本软件同大多数互联网软件一样,可能会受多种因素影响,包括但不限于用户原因、网络服务质量、社会环境等;也可能会受各种安全问题的侵扰,包括但不限于他人非法利用用户资料,进行现实中的骚扰;用户下载安装的其他软件或访问的其他网站中可能含有病毒、木马程序或其他恶意程序,威胁您的终端设备信息和数据安全,继而影响本软件的正常使用等。因此,您应加强信息安全及个人信息的保护意识,注意密码保护,以免遭受损失。</p>
<h2>七、免责声明</h2>
<p>
MindSpore开源社区开发者会致力于向您提供安全、稳定的优质服务。但是MindSpore开源社区开发者不承诺本软件的任何内容、服务或功能无任何错误或不中断或者您对本软件的使用将产生特定结果。本软件及其内容是基于“现状”且“可获得”而提供。本软件提供的所有信息可不经通知而变更。MindSpore开源社区开发者不作任何明示或默示保证包括任何正确性、非侵权、适销性及适用性的保证。对于任何与您对本软件和/或MindSpore开源社区开发者服务的使用有关的任何第三方的作为、不作为和行为MindSpore开源社区开发者不承担责任。如果对本软件或任何内容有任何不满意您可以停止使用本软件或任何该内容。</p>
<p>
上述免责声明适用于因任何不履行、错误、疏忽、中断、删除、缺陷、操作或传输迟延、病毒、通信线路故障、失窃或破坏或未经授权、篡改或使用(无论是违约、侵权、过失或任何其他诉因)而造成的任何损害、责任或伤害。</p>
<p>
MindSpore开源社区开发者保留在任何时候不经通知进行以下任何行为的权利1基于任何原因修改中止或终止本软件或其任何部分的运行或访问2修改或变更本软件或其任何部分及适用政策或条款以及3在进行任何定期或非定期维护、错误纠正或其他变更所必需时中断本软件或其任何部分的运行。</p>
<h2>八、违反本用户协议</h2>
<p>
您理解并同意:为了向您提供有效的服务,本软件会利用您终端设备的处理器和带宽等资源。本软件使用过程中可能产生数据流量的费用,用户需自行向运营商了解相关资费信息,并自行承担相关费用。</p>
<p>
您同意MindSpore开源社区开发者可自行决定且无需提前通知因下列原因终止您访问本软件的权限包括但不限于1应政府部门和司法机关的要求2本软件或本软件提供的任何服务的中止或重大修改
3不可预期的技术问题。</p>
<p>
若因您违反本用户协议致使MindSpore开源社区开发者对您提起法律诉讼除法律授予MindSpore开源社区开发者的任何其他救济外MindSpore开源社区开发者有权从您处获得且您同意支付所有合理的律师费及该等诉讼费用。您同意因对本使用协议的任何违反导致MindSpore开源社区开发者终止您使用本软件的权限MindSpore开源社区开发者概不对您或任何第三方承担责任。</p>
<h2>九、知识产权</h2>
<p>
本软件的一切著作权、商标权、专利权、商业秘密等知识产权,以及本软件包含的任何文字、图表、音频、视频或软件(包括但不限于软件中包含的图表、动画、音频、视频、界面设计、版面框架、数据和程序、代码、文档)等信息或材料均受著作权法、商标法、专利法或其它法律法规、国际条约的保护,未经相关权利人书面同意,用户不得以任何方式实施、使用或转让该等知识产权、信息或材料。</p>
<p>本协议未授予用户使用MindSpore开源社区开发者任何商标、服务标记、标识、域名和其他显著品牌特征的权利。</p>
<p>
除本协议明确允许的以外用户不得以任何形式或任何方式对MindSpore开源社区开发者服务部分或全部内容进行修改、出租、租赁、出借、出售、分发、复制、创作衍生品或用于任何商业用途。</p>
<p>
用户在MindSpore开源社区开发者发布的信息不得侵犯任何第三人的知识产权未经相关权利人之事先书面同意用户不得以任何方式上传、发布、修改、传播或复制任何受著作权保护的材料、商标或属于其他人的专有信息。</p>
<p>
若您认为您的知识产权或其他合法权益被侵犯请与MindSpore开源社区开发者联系<a href="mailto:contact@mindspore.cn">contact@mindspore.cn</a>
</p>
<h2>十、争议解决</h2>
<p>
本用户协议及您与MindSpore开源社区开发者的关系适用于中华人民共和国大陆地区法律但不包括其冲突法规范。您和MindSpore开源社区开发者同意服从MindSpore开源社区开发者所在地法院的司法管辖。</p>
<h2>十一、其他</h2>
<p>若本协议的任何条款被享有合法管辖权的法院裁定为无效或不可执行,则该等条款应在最低必要范围内予以限制或排除,并以最能体现本用户协议意图的新条款予以替换,以使本用户协议继续完全有效。</p>
<p>
本用户协议构成您与MindSpore开源社区开发者之间与您使用本软件相关的整体协议并在此取代及取消您与MindSpore开源社区开发者之间先前存在的与该等使用相关的任何书面或口头协议或理解。</p>
<p>本协议的任何条款无论因何种原因无效或不具可执行性,其余条款仍有效,对双方具有约束力。</p>
<h2></h2>
<p></p>
<p></p>
</div>
<div class="title">MindSpore掌中宝隐私协议</div>
<div class="description">
<P>
MindSpore掌中宝APP会在您使用我们的移动应用程序时收集关于您的信息。MindSpore掌中宝APP由MindSpore开源社区开发者运营并且本隐私声明“本声明”适用于本应用下文简称“MindSpore掌中宝”“我们”或“本软件”收集和使用的信息。在您下载、安装或使用MindSpore掌中宝软件附随的第三方软件前请仔细阅读该第三方软件的隐私声明。</P>
<p class="key-note">
请注意是否在您的私人终端上安装或使用本应用完全出于您的自愿通过在下方选择“同意”或者通过下载、安装、使用MindSpore掌中宝软件表明您已经充分理解并同意本隐私声明的所有条款。否则请选择“拒绝”并停止任何下载、安装和使用行为。</p>
<p class="row_spacing">通过阅读本隐私声明,我们希望您明白以下内容:</p>
<ul>
<li>1. 本应用收集和处理哪些信息</li>
<li>2. 本应用如何使用这些信息</li>
<li>3. 本应用是否会披露您的个人信息</li>
<li>4. 本应用如何保护您的个人信息</li>
<li>5. 本应用如何留存您的个人信息</li>
<li>6. 如何查看和更新您的个人信息</li>
<li>7. 本声明的更新</li>
<li>8. 联系信息</li>
</ul>
</div>
<div class="content">
<h2>1. 本应用收集和处理哪些信息</h2>
<p class="row_spacing">1.1 您向我们提交的信息</p>
<p>我们收集您直接向我们提供的信息或以其他方式与我们沟通时提供的信息。该信息可能包括账号、Email地址等信息。</p>
<p class="row_spacing">1.2 设备信息</p>
<p>
本软件可以收集关于您移动设备的信息包括硬件型号、操作系统版本、唯一设备标识符Mac地址设备移动网络信息(含IP地址)软件版本内存容量UUID等信息以便向您提供与MindSpore掌中宝软件有关的软件更新、产品支持和其它服务。</p>
<p class="row_spacing">1.3 为了使用特定服务而由您主动提交的数据</p>
<p>当您使用MindSpore掌中宝时本应用会获取您所发送的信息包括但不限于您输入的内容选择添加的视频、图片、音频、文档等附件以便接收方可以收到您的信息。</p>
<h2>2. 本应用如何使用这些信息</h2>
<p>MindSpore掌中宝收集信息的主要目的是为您提供安全、流畅、有效和定制化的使用体验。MindSpore掌中宝在实现以下目的所必要的范围内使用收集的信息和数据</p>
<ul class="list-style-block">
<li class="li_row_linehigta">1)为您提供应用服务、客户支持和故障排除服务;</li>
<li class="first-line-indent">2)通知您关于服务更新和故障的信息;</li>
<li class="li_row_linehigt">3)提高用户体验和改善服务质量。</li>
</ul>
<h2>3. 本应用是否会披露您的个人信息</h2>
<p>除非由于适用法律的规定否则在未经您明确许可的情况下MindSpore掌中宝不会向开源社区外的第三方出售、出租、交易或以其它方式转让您的任何个人数据。</p>
<p></p>
<h2>4. 本应用如何保护您的个人信息</h2>
<p>
本应用重视个人数据的安全。我们采用适当的物理、管理和技术保障措施来保护您的个人数据不被未经授权访问、披露、使用、修改、损坏或丢失。例如,我们会部署访问控制机制,确保只有授权人员才可访问个人数据;以及我们会举办安全和隐私保护培训课程,加强员工对于保护个人数据重要性的认识。我们将会在达成本政策所述目的所需的期限内保留您的个人数据,除非需要延长保留期或受到法律的允许。
我们会尽力保护您的个人数据,但是请注意任何安全措施都无法做到无懈可击。</p>
<h2>5. 本应用如何留存您的个人信息</h2>
<p>MindSpore掌中宝将在必要的时间内保留您的信息以便满足本《隐私声明》规定的所有目的。</p>
<h2>6. 如何查看和更新您的个人信息</h2>
<p>您应确保提交的所有个人数据都准确无误。本应用会尽力维护个人数据的准确和完整,并及时更新这些数据。</p>
<p>
当适用的法律要求的情况下,您可能(1)有权访问我们持有的关于您的特定的个人数据;(2)要求我们更新或更正您的不准确的个人数据;(3)拒绝我们使用您的个人数据;以及(4)要求我们删除您的个人数据。如果您想行使相关的权利,请发送邮件至
<a href="mailto:contact@mindspore.cn">contact@mindspore.cn</a>
通知我们。为保障安全,您可能需要提供书面请求。如果我们有合理依据认为这些请求存在欺骗性、无法实行或损害他人隐私权,我们则会拒绝处理请求。
</p>
<h2>7. 本隐私声明的更新</h2>
<p>本应用可能会不定期修改、更新本隐私声明,如果涉及重大变更届时我们会提供显著的通知,尽可能通过可行的渠道和方法,将变更通知您。我们鼓励您随时访问本隐私声明来了解最新的变化。</p>
<h2>8. 联系信息</h2>
<p>如果您对本政策有任何疑问或意见,您可以通过以下方式联系我们,邮箱:<a
href="mailto:contact@mindspore.cn">contact@mindspore.cn</a></p>
</div>
</body>
</html>

View File

@ -32,8 +32,6 @@ public class FragmentFactory {
private FragmentFactory() {
}
public static FragmentFactory getInstance() {
if (mInstance == null) {
synchronized (FragmentFactory.class) {
@ -45,7 +43,6 @@ public class FragmentFactory {
return mInstance;
}
public ExperienceFragment getExperienceFragment() {
if (mExperienceFragment == null) {
synchronized (FragmentFactory.class) {
@ -57,7 +54,6 @@ public class FragmentFactory {
return mExperienceFragment;
}
public CollegeFragment getCollegeFragment() {
if (mCollegeFragment == null) {
synchronized (FragmentFactory.class) {

View File

@ -1,3 +1,18 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mindspore.himindspore.ui.college.adapter;
import android.content.SharedPreferences;

View File

@ -25,7 +25,6 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.mindspore.common.base.adapter.BasePagerAdapter;
import com.mindspore.himindspore.R;
import com.mindspore.himindspore.comment.FragmentFactory;
@ -37,7 +36,6 @@ import java.util.List;
public class ExperienceFragment extends Fragment {
private TabLayout tabLayout;
private ViewPager vpContent;
@Override
@ -54,7 +52,6 @@ public class ExperienceFragment extends Fragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
tabLayout = view.findViewById(R.id.tab_layout);
vpContent = view.findViewById(R.id.vp_content);
}
@ -72,8 +69,6 @@ public class ExperienceFragment extends Fragment {
BasePagerAdapter adapter = new BasePagerAdapter(getChildFragmentManager(), fragmentList, Arrays.asList(categoryName));
vpContent.setAdapter(adapter);
tabLayout.setupWithViewPager(vpContent);
tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
vpContent.setOffscreenPageLimit(categoryName.length);
}
}

View File

@ -27,6 +27,8 @@ import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mindspore.common.config.MSLinkUtils;
import com.mindspore.common.utils.Utils;
import com.mindspore.himindspore.R;
/**
@ -70,6 +72,7 @@ public class VisionFragment extends Fragment implements View.OnClickListener {
view.findViewById(R.id.btn_image).setOnClickListener(this); //onClickImage
view.findViewById(R.id.btn_image_garbage).setOnClickListener(this); //onClickGarbage
view.findViewById(R.id.btn_scene).setOnClickListener(this); //onClickSceneDetection
view.findViewById(R.id.btn_image_Intelligent_poetry).setOnClickListener(this); //onClickIntelligentPoetry
}
@ -104,6 +107,9 @@ public class VisionFragment extends Fragment implements View.OnClickListener {
ARouter.getInstance().build("/imageobject/ImageCameraActivity")
.withInt("OPEN_TYPE", 3).navigation();
break;
case R.id.btn_image_Intelligent_poetry:
Utils.openBrowser(getActivity(), MSLinkUtils.HELP_INTELLIGENT_POETRY);
break;
}
}

View File

@ -17,20 +17,34 @@ package com.mindspore.himindspore.ui.guide;
import android.Manifest;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.net.Uri;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.util.Log;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import com.mindspore.common.sp.Preferences;
import com.mindspore.common.utils.Utils;
import com.mindspore.customview.countdown.CountDownView;
import com.mindspore.himindspore.R;
import com.mindspore.himindspore.base.BaseActivity;
import com.mindspore.himindspore.ui.main.MainActivity;
import com.mindspore.himindspore.ui.main.PrivacyPolicyActivity;
import java.util.List;
@ -38,6 +52,7 @@ import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.AppSettingsDialog;
import pub.devrel.easypermissions.EasyPermissions;
public class SplashActivity extends BaseActivity implements EasyPermissions.PermissionCallbacks {
private static final String TAG = "SplashActivity";
@ -46,21 +61,29 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
Manifest.permission.READ_PHONE_STATE, Manifest.permission.CAMERA};
private static final int REQUEST_PERMISSION = 1;
private SharedPreferences prefs;
private CountDownView cdvTime;
private boolean isCheckPrivacy = false;
private View mContentView;
private TextView mTv_protocol;
private PopupWindow mPopupW;
@Override
protected void init() {
cdvTime = findViewById(R.id.cdv_time);
prefs = PreferenceManager.getDefaultSharedPreferences(Utils.getApp());
initCountDownView();
}
private void initCountDownView() {
cdvTime.setTime(3);
cdvTime.start();
cdvTime.setOnLoadingFinishListener(() -> startPermissionsTask());
cdvTime.setOnLoadingFinishListener(() -> check());
cdvTime.setOnClickListener(view -> {
cdvTime.stop();
startPermissionsTask();
check();
});
}
@ -149,6 +172,84 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
finish();
}
private void check() {
isCheckPrivacy = prefs.getBoolean(Preferences.KEY_PRIVACY, false);
if (!isCheckPrivacy) {
showPrivacy();
} else {
startPermissionsTask();
}
}
/**
* 显示用户协议和隐私政策
*/
private void showPrivacy() {
mContentView = LayoutInflater.from(SplashActivity.this).inflate(R.layout.popup_user,
null, false);
mPopupW = new PopupWindow(mContentView, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, false);
mPopupW.showAtLocation(getWindow().getDecorView(), Gravity.CENTER, 0, 0);
mPopupW.setContentView(mContentView);
mPopupW.setTouchable(true);
mPopupW.setOutsideTouchable(false);
mPopupW.showAsDropDown(mContentView, 0, 0);
backgroundAlpha(0.4f);
mTv_protocol = mContentView.findViewById(R.id.tv_protocol);
mTv_protocol.setText(getClickableSpan());
mTv_protocol.setMovementMethod(LinkMovementMethod.getInstance());
mTv_protocol.setHighlightColor(Color.TRANSPARENT);
mContentView.findViewById(R.id.pop_agree).setOnClickListener(v -> {
prefs.edit().putBoolean(Preferences.KEY_PRIVACY, true).apply();
mPopupW.dismiss();
startPermissionsTask();
});
mContentView.findViewById(R.id.pop_Disagree).setOnClickListener(v -> {
prefs.edit().putBoolean(Preferences.KEY_PRIVACY, false).apply();
System.exit(0);
});
}
private void backgroundAlpha(float f) {
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.alpha = f;
getWindow().setAttributes(lp);
}
private CharSequence getClickableSpan() {
View.OnClickListener l = v -> {
startActivity(new Intent(SplashActivity.this, PrivacyPolicyActivity.class));
};
String User_Agreement = getResources().getString(R.string.me_privacy);
SpannableString spanableInfo = new SpannableString(User_Agreement);
String protocol = getResources().getString(R.string.me_user_agreement);
int start = User_Agreement.indexOf(protocol);
int end = start + protocol.length();
spanableInfo.setSpan(new Clickable(l), start, end, Spanned.SPAN_MARK_MARK);
return spanableInfo;
}
class Clickable extends ClickableSpan implements View.OnClickListener {
private final View.OnClickListener mListener;
public Clickable(View.OnClickListener l) {
mListener = l;
}
@Override
public void onClick(View v) {
mListener.onClick(v);
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(getResources().getColor(R.color.main_tab_text_checked));
ds.setUnderlineText(false);
}
}
@Override
protected void onDestroy() {
@ -156,5 +257,9 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
if (cdvTime != null && cdvTime.isShown()) {
cdvTime.stop();
}
if (mPopupW != null && mPopupW.isShowing()) {
mPopupW.dismiss();
mPopupW = null;
}
}
}

View File

@ -15,7 +15,6 @@
*/
package com.mindspore.himindspore.ui.main;
import com.mindspore.customview.tablayout.listener.CustomTabEntity;
import com.mindspore.himindspore.net.FileDownLoadObserver;
import com.mindspore.himindspore.net.UpdateInfoBean;

View File

@ -0,0 +1,56 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mindspore.himindspore.ui.main;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.appcompat.app.AppCompatActivity;
import com.mindspore.common.config.MSLinkUtils;
import com.mindspore.himindspore.R;
public class PrivacyPolicyActivity extends AppCompatActivity {
private static final String TAG = PrivacyPolicyActivity.class.getSimpleName();
private WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_privacy_policy);
initView();
}
private void initView() {
findViewById(R.id.w_back).setOnClickListener(v -> finish());
mWebView = findViewById(R.id.mWebView);
WebSettings wSet = mWebView.getSettings();
wSet.setJavaScriptEnabled(true);
mWebView.loadUrl(MSLinkUtils.USER_PRIVACY_RULES);
}
@Override
protected void onDestroy() {
super.onDestroy();
mWebView.removeAllViews();
mWebView.destroy();
}
}

View File

@ -31,6 +31,7 @@ import androidx.fragment.app.Fragment;
import com.mindspore.common.config.MSLinkUtils;
import com.mindspore.common.utils.Utils;
import com.mindspore.himindspore.R;
import com.mindspore.himindspore.ui.main.PrivacyPolicyActivity;
public class MeFragment extends Fragment implements View.OnClickListener {
@ -55,6 +56,7 @@ public class MeFragment extends Fragment implements View.OnClickListener {
view.findViewById(R.id.rl_me_official_code).setOnClickListener(this);
view.findViewById(R.id.rl_me_qa).setOnClickListener(this);
view.findViewById(R.id.rl_me_version).setOnClickListener(this);
view.findViewById(R.id.me_user_protocol).setOnClickListener(this);
showPackageInfo();
}
@ -97,6 +99,9 @@ public class MeFragment extends Fragment implements View.OnClickListener {
case R.id.rl_me_qa:
Utils.openBrowser(getActivity(), MSLinkUtils.ME_HELP_URL);
break;
case R.id.me_user_protocol:
startActivity(new Intent(getContext(), PrivacyPolicyActivity.class));
break;
}
}
}

View File

@ -0,0 +1,22 @@
package com.mindspore.himindspore.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import androidx.annotation.Nullable;
import com.mindspore.himindspore.R;
public class LeftImageRightTextButton extends RelativeLayout {
public LeftImageRightTextButton(Context context)
{
super(context, null);
}
public LeftImageRightTextButton(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.btn_left_iamge_right_text, this,true);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="16dp" />
<solid android:color="#6189ff" />
</shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#e1e1e1" />
<corners android:radius="16dp" />
<solid android:color="#ffffff" />
</shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#e1e1e1" />
<corners android:radius="6dp" />
<solid android:color="#ffffff" />
</shape>

View File

@ -1,23 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.viewpager.widget.ViewPager
android:id="@+id/vp_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/white" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_gray" />
<com.mindspore.customview.tablayout.CommonTabLayout
android:layout_alignParentBottom="true"
android:id="@+id/ctl_table"
android:layout_width="match_parent"
android:layout_height="50dp"
@ -32,4 +22,22 @@
app:tl_underline_color="#DDDDDD"
app:tl_underline_height="1dp" />
</LinearLayout>
<View
android:id="@+id/lineView"
android:layout_above="@+id/ctl_table"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_gray" />
<androidx.viewpager.widget.ViewPager
android:layout_above="@+id/lineView"
android:id="@+id/vp_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" />
</RelativeLayout>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.PrivacyPolicyActivity">
<RelativeLayout
android:id="@+id/w_linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal">
<ImageView
android:id="@+id/w_back"
android:layout_width="50dp"
android:layout_height="18dp"
android:layout_marginTop="16dp"
android:src="@drawable/back" />
<TextView
android:id="@+id/w_title"
android:layout_width="match_parent"
android:layout_height="54dp"
android:gravity="center"
android:text="@string/me_user_agreements"
android:textColor="@color/text_black"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<View
android:id="@+id/w_view"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/w_linear"
android:background="@color/divider_gray" />
<WebView
android:id="@+id/mWebView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/w_view"
android:layout_marginBottom="5dp" />
</RelativeLayout>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:src="@drawable/btn_intelligent_poetry" />
<TextView
android:id="@+id/text_poetry"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/btn"
android:gravity="center_vertical"
android:text="@string/title_intelligent_poetry"
android:textColor="@color/text_black"
android:textSize="12sp" />
<TextView
android:id="@+id/text_new"
android:layout_width="18dp"
android:layout_height="36dp"
android:layout_marginLeft="3dp"
android:layout_toRightOf="@id/text_poetry"
android:gravity="center_vertical"
android:text="@string/title_intelligent_poetry_new"
android:textColor="@color/text_red"
android:textSize="7sp"
android:textStyle="italic" />
</RelativeLayout>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -9,7 +8,6 @@
android:theme="@style/ThemeOverlay.MindSpore.FullscreenContainer"
tools:context=".ui.experience.ExperienceFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="160dp"
@ -27,19 +25,18 @@
android:textStyle="bold" />
<TextView
android:gravity="center"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="22dp"
android:gravity="center"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:text="@string/experience_head_subtitle"
android:textColor="@color/white"
android:textSize="13sp" />
<Button
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -47,26 +44,10 @@
android:background="@drawable/btn_head_experience"
android:text="@string/experience_head_button"
android:textColor="@color/white"
android:textSize="18sp" />
android:textSize="18sp"
android:visibility="gone" />
</LinearLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
app:tabBackground="@color/transparent"
app:tabGravity="fill"
app:tabIndicatorFullWidth="false"
app:tabMaxWidth="0dp"
app:tabIndicatorHeight="2dp"
app:tabIndicator="@color/black"
app:tabRippleColor="@color/transparent"
app:tabSelectedTextColor="@color/black"
app:tabIndicatorColor="@color/main_tab_text_checked"
app:tabTextColor="@color/black">
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/vp_content"

View File

@ -1,172 +1,203 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<TextView
android:textStyle="bold"
android:background="@drawable/bg_title_blue"
android:id="@+id/title_me"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"
android:layout_gravity="center"
android:background="@drawable/bg_title_blue"
android:gravity="center"
android:text="@string/me_title"
android:textColor="@color/white"
android:textSize="17sp" />
android:textSize="17sp"
android:textStyle="bold" />
<View
android:id="@+id/title_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/title_me"
android:background="@color/divider_gray" />
<RelativeLayout
android:id="@+id/rl_me_share"
<TextView
android:layout_margin="20dp"
android:layout_alignParentBottom="true"
android:id="@+id/me_user_protocol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:paddingTop="29dp"
android:paddingBottom="29dp">
android:gravity="center_horizontal"
android:text="@string/me_user_agreement"
android:textColor="@color/main_tab_text_checked"
android:textSize="11sp" />
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_share"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_share_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_thumbsup"
<ScrollView
android:layout_above="@+id/me_user_protocol"
android:layout_below="@+id/title_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
android:layout_height="wrap_content">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_up"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_up_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_official"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_official"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_official_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_official_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_official_code"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_official_code_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_qa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_qa"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_qa_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_version"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_version_title" />
<TextView
android:id="@+id/me_vision"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:textColor="@color/main_tab_text_uncheck"
android:textSize="13sp"
tools:text="v2.10.0" />
</RelativeLayout>
</LinearLayout>
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_me_share"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_share"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_share_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_thumbsup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_up"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_up_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_official"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_official"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_official_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_official_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_official_code"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_official_code_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_qa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_qa"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_qa_title" />
<ImageView
android:layout_width="6dp"
android:layout_height="12dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:background="@drawable/me_go" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_me_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="29dp"
android:paddingBottom="29dp">
<TextView
style="@style/MeInfoTextLeftStyle"
android:layout_marginStart="20dp"
android:drawableStart="@drawable/me_version"
android:drawablePadding="15dp"
android:gravity="center_vertical"
android:text="@string/me_version_title" />
<TextView
android:id="@+id/me_vision"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:textColor="@color/main_tab_text_uncheck"
android:textSize="13sp"
tools:text="v2.10.0" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

View File

@ -9,21 +9,48 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
tools:ignore="MissingConstraints">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp"
android:paddingTop="30dp"
android:paddingBottom="30dp"
android:orientation="vertical">
<View
android:id="@+id/title_vertical_line_one"
android:layout_width="3dp"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginStart="18dp"
android:layout_marginBottom="3dp"
android:background="@color/main_tab_text_checked"
app:layout_constraintBottom_toBottomOf="@id/title_vision"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent="0.44" />
<TextView
android:id="@+id/title_vision"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="16dp"
android:gravity="center_vertical"
android:text="@string/tab_experience_one"
android:textColor="@color/text_black"
android:textSize="13sp"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
tools:ignore="MissingConstraints" />
<Button
android:id="@+id/btn_object"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginStart="18dp"
android:layout_marginTop="17dp"
android:layout_marginTop="13dp"
android:background="@drawable/btn_vision_item"
android:drawableStart="@drawable/btn_test"
android:drawablePadding="5dp"
@ -36,6 +63,7 @@
android:textColor="@color/text_black"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_vertical_line_one"
app:layout_constraintWidth_percent="0.44"
tools:ignore="MissingConstraints" />
@ -180,6 +208,55 @@
app:layout_constraintEnd_toEndOf="@+id/btn_image"
app:layout_constraintWidth_percent="0.44" />
<View
android:id="@+id/title_vertical_line_two"
android:layout_width="3dp"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginStart="18dp"
android:layout_marginTop="23dp"
android:layout_marginEnd="14dp"
android:background="@color/main_tab_text_checked"
android:gravity="center_vertical"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_image_garbage"
app:layout_constraintWidth_percent="0.44" />
<TextView
android:id="@+id/title_voice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="28dp"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:text="@string/tab_speech_two"
android:textColor="@color/text_black"
android:textSize="13sp"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_image_garbage"
app:layout_constraintWidth_percent="0.44" />
<com.mindspore.himindspore.ui.view.LeftImageRightTextButton
android:id="@+id/btn_image_Intelligent_poetry"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginTop="13dp"
android:background="@drawable/btn_vision_item"
android:maxLines="1"
android:onClick="onClickIntelligentPoetry"
android:paddingStart="4dp"
android:text="@string/title_intelligent_poetry"
android:textAllCaps="false"
android:textColor="@color/text_black"
android:textSize="12sp"
app:layout_constraintStart_toStartOf="@+id/title_vertical_line_two"
app:layout_constraintTop_toBottomOf="@+id/title_vertical_line_two"
app:layout_constraintWidth_percent="0.44" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginTop="85dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="106dp"
android:background="@drawable/user_protocol_white"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="27dp"
android:gravity="center"
android:text="@string/me_user_agreements"
android:textColor="@color/text_black"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_protocol"
android:layout_width="252dp"
android:layout_height="wrap_content"
android:layout_below="@id/textView"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:lineSpacingExtra="10dp"
android:text="@string/me_privacy"
android:textColor="@color/text_gray"
android:textSize="12sp" />
<Button
android:id="@+id/pop_agree"
android:layout_width="255dp"
android:layout_height="33dp"
android:layout_below="@id/tv_protocol"
android:layout_centerHorizontal="true"
android:layout_marginTop="64dp"
android:background="@drawable/user_protocol_blue"
android:text="@string/me_agree"
android:textColor="@color/white"
android:textSize="13sp" />
<Button
android:id="@+id/pop_Disagree"
android:layout_width="255dp"
android:layout_height="33dp"
android:layout_below="@id/pop_agree"
android:layout_centerHorizontal="true"
android:layout_marginTop="13dp"
android:layout_marginBottom="34dp"
android:background="@drawable/user_protocol_no"
android:text="@string/me_disagree_and_exit"
android:textAllCaps="false"
android:textColor="@color/text_light_gray" />
</RelativeLayout>

View File

@ -13,6 +13,8 @@
<string name="app_update_lastest">Upgrade to a new version</string>
<string name="title_image">Image Classification</string>
<string name="title_image_garbage">Garbage Classification</string>
<string name="title_intelligent_poetry">Intelligent poetry</string>
<string name="title_intelligent_poetry_new">NEW</string>
<string name="title_object">Photo Detection</string>
<string name="title_object_camera">Camera Detection</string>
<string name="title_pose_net">PoseNet</string>
@ -32,6 +34,7 @@
<string name="main_tab_title_three">Me</string>
<string name="tab_experience_one">Computer Vision</string>
<string name="tab_speech_two">Speech Semantic Technology</string>
<string name="experience_head_title">Experience Center</string>
<string name="experience_head_subtitle">Invite you to explore a new generation of ALL-Scenario AI Computing Framework</string>
@ -41,12 +44,20 @@
<string name="me_share_title">Share</string>
<string name="me_up_title">Like</string>
<string name="me_qa_title">Feedback</string>
<string name="me_agree">agree</string>
<string name="me_disagree_and_exit">Disagree and Exit</string>
<string name="me_user_agreement">User Agreement and Privacy Policy</string>
<string name="me_privacy">User Agreement and Privacy Policy MindSpore_inhand APP respects and protects the personal privacy of all users.
In order to provide you with more accurate and personalized services, we will use and disclose your personal information in accordance with
the "User Agreement and Privacy Policy". Besides, we will treat this information with a high degree of diligence and prudence. Except as
otherwise provided in this privacy policy, we will not disclose or provide this information to third parties without your permissions.
We will update this privacy policy from time to time. When you agree to our service use agreement, you are deemed to have agreed to
the entire content of this privacy policy. This privacy policy is an integral part of our service use agreement.</string>
<string name="me_version_title">Version</string>
<string name="me_official_title">Official Website</string>
<string name="me_official_code_title">Official Code</string>
<string name="title_splash_welcome">A one-stop platform of collaborative learning, demonstrating, and experiencing for AI users.</string>
<string name="college_summary_title">MindSpore Summary</string>
<string name="college_cloud_title">A One-Hour Trip to MindSpore</string>
<string name="college_quick_title">Quick Start</string>

View File

@ -13,6 +13,8 @@
<string name="app_update_lastest">"请升级新版本"</string>
<string name="title_image">图像分类</string>
<string name="title_image_garbage">垃圾分类</string>
<string name="title_intelligent_poetry">智能写诗</string>
<string name="title_intelligent_poetry_new">NEW</string>
<string name="title_object">照片检测</string>
<string name="title_object_camera">视频检测</string>
<string name="title_pose_net"> 骨骼检测</string>
@ -31,6 +33,7 @@
<string name="main_tab_title_three">我的</string>
<string name="tab_experience_one">视觉图像技术</string>
<string name="tab_speech_two">语音语义技术</string>
<string name="experience_head_title">体验中心</string>
<string name="experience_head_subtitle">新一代全场景AI计算框架邀您马上体验</string>
@ -43,6 +46,14 @@
<string name="me_version_title">版本号</string>
<string name="me_official_title">官方网站</string>
<string name="me_official_code_title">官方代码仓</string>
<string name="me_agree">同意</string>
<string name="me_disagree_and_exit">不同意并退出</string>
<string name="me_user_agreement">《用户协议和隐私政策》</string>
<string name="me_user_agreements">用户协议和隐私政策</string>
<string name="me_privacy">MindSpore 掌中宝尊重并保护所有使用服务用户的个人隐私权。为了给你提供更准确、更有个性化的服务,我们会按照
《用户协议和隐私政策》规定使用和披露您的个人信息。但我们将以高度的勤勉、审慎义务对待这些信息。除本隐私政策另有规定外,在未征得您实
现许可的情况下,我们不会将这些信息对外披露或向第三方提供。我们会不时更新本隐私政策。您在同意我们服务使用协议之时,即视为您
已经同意本隐私政策全部内容。本隐私政策属于我们服务使用协议不可分割的一部分。</string>
<string name="title_splash_welcome">AI爱好者的一站式协同学习、演示、体验平台</string>
<string name="college_summary_title">MindSpore简介</string>

View File

@ -15,11 +15,13 @@
<color name="gray_light">#Eff3ff</color>
<color name="text_black">#333333</color>
<color name="text_light_gray">#999999</color>
<color name="text_gray">#666666</color>
<color name="text_blue">#6DA7FF</color>
<color name="text_yellow">#F8E71C</color>
<color name="text_orange">#FF844D</color>
<color name="text_green">#66B50A</color>
<color name="text_red">#e60012</color>
<color name="divider_gray">#dbdbdb</color>
<color name="main_tab_text_checked">#6189ff</color>

View File

@ -12,6 +12,8 @@
<string name="app_update_lastest">"请升级新版本"</string>
<string name="title_image">Image Classification</string>
<string name="title_image_garbage">Garbage Classification</string>
<string name="title_intelligent_poetry">Intelligent poetry</string>
<string name="title_intelligent_poetry_new">NEW</string>
<string name="title_object">Photo Detection</string>
<string name="title_object_camera">Camera Detection</string>
<string name="title_pose_net">PoseNet</string>
@ -26,7 +28,6 @@
<string name="title_share">Share</string>
<string name="title_share_commend">MindSpore掌中宝AI爱好者的一站式协同学习、演示、体验平台\t</string>
<string name="title_splash_welcome">AI爱好者的一站式协同学习、演示、体验平台</string>
<string name="splash_count_down"></string>
<string name="main_tab_title_one">体验</string>
@ -34,6 +35,7 @@
<string name="main_tab_title_three">我的</string>
<string name="tab_experience_one">视觉图像技术</string>
<string name="tab_speech_two">语音语义技术</string>
<string name="experience_head_title">体验中心</string>
<string name="experience_head_subtitle">新一代全场景AI计算框架邀您马上体验</string>
@ -47,7 +49,14 @@
<string name="me_official_code_title">官方代码仓</string>
<string name="me_qa_title">问题反馈</string>
<string name="me_version_title">版本号</string>
<string name="me_agree">同意</string>
<string name="me_disagree_and_exit">不同意并退出</string>
<string name="me_user_agreement">《用户协议和隐私政策》</string>
<string name="me_user_agreements">用户协议和隐私政策</string>
<string name="me_privacy">MindSpore 掌中宝尊重并保护所有使用服务用户的个人隐私权。为了给你提供更准确、更有个
性化的服务,我们会按照《用户协议和隐私政策》规定使用和披露您的个人信息。但我们将以高度的勤勉、审慎义务对待这些信息。除本隐私
政策另有规定外,在未征得您实现许可的情况下,我们不会将这些信息对外披露或向第三方提供。我们会不时更新本隐私政策。您在同意我们
服务使用协议之时,即视为您已经同意本隐私政策全部内容。本隐私政策属于我们服务使用协议不可分割的一部分。</string>
<string name="college_summary_title">MindSpore简介</string>
<string name="college_cloud_title">1小时体验端云协同全流程开发</string>
<string name="college_quick_title">快速入门</string>

View File

@ -11,7 +11,8 @@ public class MSLinkUtils {
public static final String HELP_STYLE_TRANSFER = BASE_DOC_URL + "/style_transfer_lite.html";
public static final String HELP_IMAGE_SEGMENTATION = BASE_DOC_URL + "/image_segmentation_lite.html";
public static final String HELP_SCENE_DETECTION = BASE_DOC_URL + "/scene_detection_lite.html";
public static final String HELP_INTELLIGENT_POETRY = BASE_URL + "/resources/tech/nlp/poetry";
public static final String USER_PRIVACY_RULES = "file:///android_asset/privacy.html";
public static final String COLLEGE_MAIN_CLOUD = BASE_URL + "/news/newschildren?id=354";
public static final String COLLEGE_QUICK_TRAIN = BASE_URL + "/tutorial/training/zh-CN/master/quick_start/quick_start.html";
public static final String COLLEGE_QUICK_EXECUTE = BASE_URL + "/tutorial/inference/zh-CN/master/multi_platform_inference.html";

View File

@ -11,6 +11,6 @@ public final class Preferences {
public static final String KEY_COLLEGE_VIDEO = "preferences_college_video";
public static final String KEY_COLLEGE_FAQ = "preferences_college_faq";
public static final String KEY_COLLEGE_ASK = "preferences_college_ask";
public static final String KEY_PRIVACY = "preferences_privacy";
public static final String[] KEY_COLLEGE_QUICK_ARRAY = new String[]{KEY_COLLEGE_TRAIN,KEY_COLLEGE_EXECUTE,KEY_COLLEGE_APP,KEY_COLLEGE_VIDEO};
}

View File

@ -1,3 +1,18 @@
/**
* Copyright 2021 Huawei Technologies Co., Ltd
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mindspore.common.utils;
import android.annotation.SuppressLint;
@ -63,28 +78,17 @@ public final class Utils {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* 初始化工具类
*
* @param app 应用
*/
public static void init(@NonNull final Application app) {
Utils.sApplication = app;
app.registerActivityLifecycleCallbacks(mCallbacks);
}
/**
* 获取 Application
*
* @return Application
*/
public static Application getApp() {
if (sApplication != null) return sApplication;
throw new NullPointerException("u should init first");
}
private static void setTopActivityWeakRef(final Activity activity) {
// if (activity.getClass() == PermissionUtils.PermissionActivity.class) return;
if (sTopActivityWeakRef == null || !activity.equals(sTopActivityWeakRef.get())) {
sTopActivityWeakRef = new WeakReference<>(activity);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -85,6 +85,9 @@ task unzipMindSporeIncludeAAR(type: Copy, dependsOn: ['cleanUnusedmindsporeFiles
}
task cleanUnusedmindsporeAARFiles(type: Delete, dependsOn: ['unzipMindSporeIncludeAAR']) {
delete fileTree("${targetMindSporeInclude}").matching {
include "*.zip"
}
delete fileTree("${cleantargetMindSporeIncludeAAR}").matching {
include "*.zip"
}
@ -111,7 +114,6 @@ if (file("src/main/assets/model/ssd.ms").exists()) {
downloadObjectModelFile.enabled = false
}
if (file("../mindsporelibrary/mindspore/mindspore-lite/1.1.0/mindspore-lite-1.1.0.aar").exists()) {
downloadMindSporeLibrary.enabled = false
unzipMindSporeIncludeAAR.enabled = false

View File

@ -1 +0,0 @@
1c36bc7ad1bf853eb66b0de0e55d654686cfbd561330b77c5e276e3b25aac489

View File

@ -1 +0,0 @@
eb0fb42da07cf8ca1a9a10b875947b44551437f1e7e38e619b63d79f2dc5b6cc5719d9df10453f9fe4761e43c792e5b4743f6a027afb77c3b9a7bce89f24c6d0

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>mindspore</groupId>
<artifactId>mindspore-lite</artifactId>
<version>1.1.0</version>
<packaging>aar</packaging>
</project>

View File

@ -1 +0,0 @@
13e4282b21b135a67e2738249d2e4d71f052775c6e3476ecca105a741ee78166

View File

@ -1 +0,0 @@
7afa5b3644e9e7e1a5aec4f408b226f12f071753948aaa1b5b0c0ef9c40140b23746f67394482dd234e60e4d65d6fe78ce8bdfb6fa17123c00ee4c111fb52554

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>mindspore</groupId>
<artifactId>mindspore-lite</artifactId>
<versioning>
<latest>1.1.0</latest>
<release>1.1.0</release>
<versions>
<version>1.1.0</version>
</versions>
<lastUpdated>20201231091127</lastUpdated>
</versioning>
</metadata>

View File

@ -1 +0,0 @@
e4bcfe7bfd97501268e5f320249e9d1733fdbb5f35d05b71e18f864bb3574aca

View File

@ -1 +0,0 @@
0acb59f056fbf9d989dd7543b7d2961d7ffd5f9c58bb651c9b23226455f9a226a73ddccff021ff00d6ef071f5a20a26e99f2b5e40d201d309c878c3a40884e62

View File

@ -46,6 +46,7 @@ import android.view.Surface;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -73,7 +74,7 @@ import static com.mindspore.posenet.Posenet.BodyPart.RIGHT_WRIST;
/**
* A simple {@link Fragment} subclass.
* create an instance of this fragment.
* create an instance of this fragment.g
*/
public class PoseNetFragment extends Fragment {
@ -101,6 +102,7 @@ public class PoseNetFragment extends Fragment {
private CaptureRequest previewRequest;
private Semaphore cameraOpenCloseLock = new Semaphore(1);//使用信号量 Semaphore 进行多线程任务调度
private boolean flashSupported;
private boolean isPreBackgroundThreadPause;
/**
* Model input shape for images.
@ -128,7 +130,6 @@ public class PoseNetFragment extends Fragment {
@Override
public void onDisconnected(@NonNull CameraDevice cameraDevice) {
cameraOpenCloseLock.release();
cameraDevice.close();
closeCamera();
PoseNetFragment.this.cameraDevice = null;
}
@ -194,8 +195,8 @@ public class PoseNetFragment extends Fragment {
}
public void onPause() {
this.closeCamera();
this.stopBackgroundThread();
this.closeCamera();
super.onPause();
}
@ -236,6 +237,7 @@ public class PoseNetFragment extends Fragment {
}
private void closeCamera() {
Log.e("AAA", "closeCamera");
try {
cameraOpenCloseLock.acquire();
if (captureSession != null) {
@ -261,6 +263,8 @@ public class PoseNetFragment extends Fragment {
* Starts a background thread and its [Handler].
*/
private void startBackgroundThread() {
Log.e("AAA", "startBackgroundThread");
backgroundThread = new HandlerThread("imageAvailableListener");
backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper());
@ -270,21 +274,19 @@ public class PoseNetFragment extends Fragment {
* Stops the background thread and its [Handler].
*/
private void stopBackgroundThread() {
Log.e("AAA", "stopBackgroundThread");
isPreBackgroundThreadPause = true;
backgroundThread.quitSafely();
try {
backgroundThread.join();
backgroundThread = null;
backgroundHandler = null;
} catch (InterruptedException e) {
e.printStackTrace();
}
backgroundThread.interrupt();
backgroundThread = null;
backgroundHandler = null;
}
private final ImageReader.OnImageAvailableListener imageAvailableListener = new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable(ImageReader imageReader) {
if (imageReader != null) {
Image image = imageReader.acquireLatestImage();
private final ImageReader.OnImageAvailableListener imageAvailableListener = (ImageReader mImageReader) -> {
if (backgroundHandler != null && backgroundThread != null && !isPreBackgroundThreadPause) {
if (mImageReader != null) {
Image image = mImageReader.acquireLatestImage();
if (image == null || image.getPlanes() == null) {
return;
}
@ -317,6 +319,7 @@ public class PoseNetFragment extends Fragment {
}
};
/**
* Creates a new [CameraCaptureSession] for camera preview.
*/
@ -505,8 +508,21 @@ public class PoseNetFragment extends Fragment {
Bitmap scaledBitmap = Bitmap.createScaledBitmap(croppedBitmap, MODEL_WIDTH, MODEL_HEIGHT, true);
// Perform inference.
Posenet.Person person = posenet.estimateSinglePose(scaledBitmap);
Canvas canvas = surfaceView.getHolder().lockCanvas();
draw(canvas, person, scaledBitmap);
if (null == person) {
isPreBackgroundThreadPause = true;
Toast.makeText(getActivity(), R.string.posenet_exit, Toast.LENGTH_LONG).show();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().finish();
}
});
} else {
isPreBackgroundThreadPause = false;
Canvas canvas = surfaceView.getHolder().lockCanvas();
draw(canvas, person, scaledBitmap);
}
}

View File

@ -201,6 +201,10 @@ public class Posenet {
float[][][][] heatmaps = runConv2Dfor27();
float[][][][] offsets = runConv2Dfor28();
if (heatmaps == null || offsets ==null){
return null;
}
int height = ((Object[]) heatmaps[0]).length; //9
int width = ((Object[]) heatmaps[0][0]).length; //9
int numKeypoints = heatmaps[0][0][0].length; //17
@ -271,6 +275,10 @@ public class Posenet {
float[] heatmaps_results = heatmaps_tensors.getFloatData();
int[] heatmapsShape = heatmaps_tensors.getShape(); //1, 9, 9 ,17
if (heatmapsShape[0] < 0 || heatmapsShape[1] < 0 || heatmapsShape[2] < 0 || heatmapsShape[3] < 0) {
return null;
}
float[][][][] heatmaps = new float[heatmapsShape[0]][][][];
for (int x = 0; x < heatmapsShape[0]; x++) { // heatmapsShape[0] =1
float[][][] arrayThree = new float[heatmapsShape[1]][][];
@ -301,6 +309,9 @@ public class Posenet {
float[] offsets_results = offsets_tensors.getFloatData();
int[] offsetsShapes = offsets_tensors.getShape();
if (offsetsShapes[0] < 0 || offsetsShapes[1] < 0 || offsetsShapes[2] < 0 || offsetsShapes[3] < 0) {
return null;
}
float[][][][] offsets = new float[offsetsShapes[0]][][][];
for (int x = 0; x < offsetsShapes[0]; x++) {
float[][][] offsets_arrayThree = new float[offsetsShapes[1]][][];

View File

@ -2,4 +2,5 @@
<resources>
<string name="posenet_score">Score:</string>
<string name="posenet_time">Inference Time:</string>
<string name="posenet_exit">This training model is not supported by this device</string>
</resources>

View File

@ -2,4 +2,5 @@
<resources>
<string name="posenet_score">得分:</string>
<string name="posenet_time">推理时间:</string>
<string name="posenet_exit">该设备不支持此训练模型</string>
</resources>

View File

@ -1,4 +1,5 @@
<resources>
<string name="posenet_score">得分:</string>
<string name="posenet_time">Inference Time:</string>
<string name="posenet_exit">该设备不支持此训练模型</string>
</resources>

View File

@ -25,7 +25,9 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="265dp">
android:layout_height="265dp"
android:background="@color/gray_btn"
>
<ImageView
android:id="@+id/img_origin"
@ -40,7 +42,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="@drawable/icon_add"
android:drawableTop="@drawable/icon_style"
android:drawablePadding="10dp"
android:gravity="center"
android:text="@string/title_choose_image"

View File

@ -6,7 +6,7 @@
<string name="toast_original">Please select an original picture first</string>
<string name="toast_model_run">Previous Model still running</string>
<string name="title_choose_image">Choose an Image</string>
<string name="title_choose_image">Please click a picture below or choose a photo from your album</string>
<string name="btn_photo">PHOTO</string>
<string name="btn_camera">CAMERA</string>
<string name="btn_recovery">RECOVERY</string>

View File

@ -6,7 +6,7 @@
<string name="toast_original">请先选择原始图片</string>
<string name="toast_model_run">先前的模型仍在运行</string>
<string name="title_choose_image">选择图</string>
<string name="title_choose_image">点击下方图片或相机选择照</string>
<string name="btn_photo">图片</string>
<string name="btn_camera">相机</string>
<string name="btn_recovery">恢复</string>

View File

@ -5,7 +5,7 @@
<string name="toast_original">Please select an original picture first</string>
<string name="toast_model_run">Previous Model still running</string>
<string name="title_choose_image">Choose an Image</string>
<string name="title_choose_image">Please click a picture below or choose a photo from your album</string>
<string name="btn_photo">PHOTO</string>
<string name="btn_camera">CAMERA</string>
<string name="btn_recovery">RECOVERY</string>

View File

@ -25,7 +25,9 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="265dp">
android:layout_height="265dp"
android:background="@color/gray_btn"
>
<ImageView
android:id="@+id/img_origin"
@ -40,7 +42,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="@drawable/icon_add"
android:drawableTop="@drawable/icon_style"
android:drawablePadding="10dp"
android:gravity="center"
android:text="@string/title_choose_image"
@ -61,7 +63,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:layout_marginTop="14dp"
>
<Button
android:layout_width="0dp"

View File

@ -7,7 +7,7 @@
<string name="toast_original">Please select an original picture first</string>
<string name="toast_model_run">Previous Model still running</string>
<string name="title_choose_image">Choose an Image</string>
<string name="title_choose_image">Please click a picture below or choose a photo from your album</string>
<string name="btn_photo">PHOTO</string>
<string name="btn_camera">CAMERA</string>
<string name="btn_recovery">RECOVERY</string>

View File

@ -6,7 +6,7 @@
<string name="toast_original">请先选择原始图片</string>
<string name="toast_model_run">先前的模型仍在运行</string>
<string name="title_choose_image">选择图</string>
<string name="title_choose_image">点击下方图片或相机选择照</string>
<string name="btn_photo">图片</string>
<string name="btn_camera">相机</string>
<string name="btn_recovery">恢复</string>

View File

@ -6,7 +6,7 @@
<string name="toast_original">Please select an original picture first</string>
<string name="toast_model_run">Previous Model still running</string>
<string name="title_choose_image">Choose an Image</string>
<string name="title_choose_image">Please click a picture below or choose a photo from your album</string>
<string name="btn_photo">PHOTO</string>
<string name="btn_camera">CAMERA</string>
<string name="btn_recovery">RECOVERY</string>