- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - - -@Route(path = "/app/CollegeBrokensideActivity") -public class CollegeBrokensideActivity extends AppCompatActivity { - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_college_brokenside); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.brokenside_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - WebSettings wSet = mWebView.getSettings(); - wSet.setJavaScriptEnabled(true); - wSet.setDomStorageEnabled(true); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.COLLEGE_QUICK_APP); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeFAQActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeFAQActivity.java deleted file mode 100644 index 5291605a55..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeFAQActivity.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/CollegeFAQActivity") -public class CollegeFAQActivity extends AppCompatActivity { - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_college_f_a_q); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.CollegeFAQActivity_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - mWebView.setWebChromeClient(new WebChromeClient()); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.getSettings().setJavaScriptEnabled(true); - mWebView.getSettings().setDomStorageEnabled(true); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - - - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.COLLEGE_MAIN_FAQ); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeForumActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeForumActivity.java deleted file mode 100644 index af16211811..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeForumActivity.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/CollegeForumActivity") -public class CollegeForumActivity extends AppCompatActivity { - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_college_forum); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.CollegeForumActivity_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - mWebView.setWebChromeClient(new WebChromeClient()); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.getSettings().setJavaScriptEnabled(true); - mWebView.getSettings().setDomStorageEnabled(true); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - - - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.COLLEGE_MAIN_ASK); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeOneHourActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeOneHourActivity.java deleted file mode 100644 index 55760c6b8a..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeOneHourActivity.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/CollegeOneHourActivity") -public class CollegeOneHourActivity extends AppCompatActivity { - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_college_one_hour); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.OneHour_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - mWebView.setWebChromeClient(new WebChromeClient()); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.getSettings().setJavaScriptEnabled(true); - mWebView.getSettings().setDomStorageEnabled(true); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - - - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.COLLEGE_MAIN_CLOUD); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegePerformReasoningActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegePerformReasoningActivity.java deleted file mode 100644 index 39fd05233a..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegePerformReasoningActivity.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/CollegePerformReasoningActivity") -public class CollegePerformReasoningActivity extends AppCompatActivity { - private WebView mWebView; - private ProgressBar progressBar; - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_college_perform_reasoning); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.perform_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - mWebView.setWebChromeClient(new WebChromeClient()); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.getSettings().setJavaScriptEnabled(true); - mWebView.getSettings().setDomStorageEnabled(true); - mWebView.setWebChromeClient(new WebChromeClient(){ - @Override - public void onProgressChanged(WebView view, int newProgress) { - - - if(newProgress==100){ - progressBar.setVisibility(View.GONE); - } - else{ - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.COLLEGE_QUICK_EXECUTE); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeReferencevideoActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeReferencevideoActivity.java deleted file mode 100644 index ab9c28c7f0..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeReferencevideoActivity.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/CollegeReferencevideoActivity") -public class CollegeReferencevideoActivity extends AppCompatActivity { - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_college_referencevideo); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.referencevideo_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - mWebView.setWebChromeClient(new WebChromeClient()); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.getSettings().setJavaScriptEnabled(true); - mWebView.getSettings().setDomStorageEnabled(true); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - - - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.COLLEGE_QUICK_VIDEO); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeTrainingmodelActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeTrainingmodelActivity.java deleted file mode 100644 index 5168163151..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeTrainingmodelActivity.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.CookieManager; -import android.webkit.WebChromeClient; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/CollegeTrainingmodelActivity") -public class CollegeTrainingmodelActivity extends AppCompatActivity { - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_college_trainingmodel); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.Trainingmodel_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - mWebView.setWebChromeClient(new WebChromeClient()); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.getSettings().setJavaScriptEnabled(true); - mWebView.getSettings().setDomStorageEnabled(true); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - - - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - CookieManager cookieManager = CookieManager.getInstance(); - cookieManager.setAcceptThirdPartyCookies(mWebView, true); - mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); - } - mWebView.loadUrl(MSLinkUtils.COLLEGE_QUICK_TRAIN); - - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeCodeRepositoryActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeCodeRepositoryActivity.java deleted file mode 100644 index 716c76c1e3..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeCodeRepositoryActivity.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/MeCodeRepositoryActivity") -public class MeCodeRepositoryActivity extends AppCompatActivity { - - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_me_code_repository); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.MeCodeRepositoryActivity_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - WebSettings wSet = mWebView.getSettings(); - wSet.setJavaScriptEnabled(true); - wSet.setDomStorageEnabled(true); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.ME_CODE_URL); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeOfficialwebsiteActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeOfficialwebsiteActivity.java deleted file mode 100644 index bc5777a5f4..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeOfficialwebsiteActivity.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/MeOfficialwebsiteActivity") -public class MeOfficialwebsiteActivity extends AppCompatActivity { - - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_me_officialwebsite); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.MeOfficialwebsiteActivity_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - WebSettings wSet = mWebView.getSettings(); - wSet.setJavaScriptEnabled(true); - wSet.setDomStorageEnabled(true); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - - - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.BASE_URL); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeProblemFeedbackActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeProblemFeedbackActivity.java deleted file mode 100644 index bf70ef1e75..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeProblemFeedbackActivity.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview; - -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; -import android.widget.ProgressBar; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.himindspore.R; - -@Route(path = "/app/MeProblemFeedbackActivity") -public class MeProblemFeedbackActivity extends AppCompatActivity { - - private WebView mWebView; - private ProgressBar progressBar; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_me_problem_feedback); - initView(); - } - - private void initView() { - progressBar = findViewById(R.id.progress); - Toolbar mToolbar = findViewById(R.id.MeProblemFeedbackActivity_toolbar); - mToolbar.setNavigationOnClickListener(view -> finish()); - mWebView = findViewById(R.id.mWebView); - WebSettings wSet = mWebView.getSettings(); - wSet.setJavaScriptEnabled(true); - wSet.setDomStorageEnabled(true); - mWebView.setWebViewClient(new WebViewClient()); - mWebView.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int newProgress) { - - - if (newProgress == 100) { - progressBar.setVisibility(View.GONE); - } else { - progressBar.setVisibility(View.VISIBLE); - progressBar.setProgress(newProgress); - } - - } - }); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } - mWebView.loadUrl(MSLinkUtils.ME_HELP_URL); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - mWebView.removeAllViews(); - mWebView.destroy(); - } -} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeThumbsupActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeThumbsupActivity.java deleted file mode 100644 index 9e6724b013..0000000000 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeThumbsupActivity.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2021 Huawei Technologies Co., Ltd - *
- * 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 - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * 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.webview;
-
-import android.os.Build;
-import android.os.Bundle;
-import android.view.View;
-import android.webkit.WebChromeClient;
-import android.webkit.WebSettings;
-import android.webkit.WebView;
-import android.webkit.WebViewClient;
-import android.widget.ProgressBar;
-
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.widget.Toolbar;
-
-import com.alibaba.android.arouter.facade.annotation.Route;
-import com.mindspore.common.config.MSLinkUtils;
-import com.mindspore.himindspore.R;
-
-@Route(path = "/app/MeThumbsupActivity")
-public class MeThumbsupActivity extends AppCompatActivity {
-
- private WebView mWebView;
- private ProgressBar progressBar;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_me_thumbsup);
- initView();
- }
-
- private void initView() {
- progressBar = findViewById(R.id.progress);
- Toolbar mToolbar = findViewById(R.id.MeThumbsupActivity_toolbar);
- mToolbar.setNavigationOnClickListener(view -> finish());
- mWebView = findViewById(R.id.mWebView);
- WebSettings wSet = mWebView.getSettings();
- wSet.setJavaScriptEnabled(true);
- wSet.setDomStorageEnabled(true);
- mWebView.setWebViewClient(new WebViewClient());
- mWebView.setWebChromeClient(new WebChromeClient() {
- @Override
- public void onProgressChanged(WebView view, int newProgress) {
-
-
- if (newProgress == 100) {
- progressBar.setVisibility(View.GONE);
- } else {
- progressBar.setVisibility(View.VISIBLE);
- progressBar.setProgress(newProgress);
- }
-
- }
- });
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
- }
- mWebView.loadUrl(MSLinkUtils.ME_STAR_URL);
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- mWebView.removeAllViews();
- mWebView.destroy();
- }
-}
\ No newline at end of file
diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java
index 85988b76c0..42a33cff9e 100644
--- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java
+++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java
@@ -27,40 +27,39 @@ import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
+import com.mindspore.common.config.MSLinkUtils;
import com.mindspore.himindspore.R;
public class WebViewUtilsActivity extends AppCompatActivity {
private WebView mWebView;
private ProgressBar progressBar;
- private final String mWebViewUtil = "";
+ private Toolbar mToolbar;
+ private String mWebViewUrl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view_utils);
+ mWebViewUrl = getIntent().getStringExtra("WebView");
initView();
}
private void initView() {
- String mMeThumbsup = getIntent().getStringExtra("MeThumbsup");
- String mMeOfficial = getIntent().getStringExtra("MeOfficial");
- String mMeCodeRepository = getIntent().getStringExtra("MeCodeRepository");
- String mMeProblemFeedback = getIntent().getStringExtra("MeProblemFeedback");
progressBar = findViewById(R.id.progress);
- Toolbar mToolbar = findViewById(R.id.OneHour_toolbar);
+ mToolbar = findViewById(R.id.mWebView_toolbar);
mToolbar.setNavigationOnClickListener(view -> finish());
mWebView = findViewById(R.id.mWebView);
mWebView.setWebViewClient(new WebViewClient());
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
- mWebView.setWebChromeClient(new WebChromeClient(){
+ mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
- if(newProgress==100){
+
+ if (newProgress == 100) {
progressBar.setVisibility(View.GONE);
- }
- else{
+ } else {
progressBar.setVisibility(View.VISIBLE);
progressBar.setProgress(newProgress);
}
@@ -69,6 +68,52 @@ public class WebViewUtilsActivity extends AppCompatActivity {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
+ showWebViewTitle(mWebViewUrl);
+ mWebView.loadUrl(mWebViewUrl);
+ }
+
+ private void showWebViewTitle(String mWebViewUrl) {
+ switch (mWebViewUrl) {
+ case MSLinkUtils.ME_STAR_URL:
+ mToolbar.setTitle(R.string.me_up_title);
+ break;
+ case MSLinkUtils.BASE_URL:
+ mToolbar.setTitle(R.string.me_official_title);
+ break;
+ case MSLinkUtils.ME_CODE_URL:
+ mToolbar.setTitle(R.string.me_official_code_title);
+ break;
+ case MSLinkUtils.ME_HELP_URL:
+ mToolbar.setTitle(R.string.me_qa_title);
+ break;
+ case MSLinkUtils.COLLEGE_QUICK_APP:
+ mToolbar.setTitle(R.string.title_college_broken_side);
+ break;
+ case MSLinkUtils.COLLEGE_MAIN_FAQ:
+ mToolbar.setTitle(R.string.title_college_faq);
+ break;
+ case MSLinkUtils.COLLEGE_MAIN_ASK:
+ mToolbar.setTitle(R.string.title_college_forum);
+ break;
+ case MSLinkUtils.COLLEGE_MAIN_CLOUD:
+ mToolbar.setTitle(R.string.title_college_one_hour);
+ break;
+ case MSLinkUtils.COLLEGE_QUICK_EXECUTE:
+ mToolbar.setTitle(R.string.title_college_perform);
+ break;
+ case MSLinkUtils.COLLEGE_QUICK_VIDEO:
+ mToolbar.setTitle(R.string.title_college_video);
+ break;
+ case MSLinkUtils.COLLEGE_QUICK_TRAIN:
+ mToolbar.setTitle(R.string.title_college_training);
+ break;
+ case MSLinkUtils.USER_PRIVACY_RULES:
+ mToolbar.setTitle(R.string.me_user_agreements);
+ break;
+ default:
+ mToolbar.setTitle(R.string.me_official_title);
+ break;
+ }
}
@Override
diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_web_view_utils.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_web_view_utils.xml
index 756e1cb6c7..c3a818b8ab 100644
--- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_web_view_utils.xml
+++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_web_view_utils.xml
@@ -9,7 +9,7 @@
tools:context=".ui.webview.WebViewUtilsActivity">
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.base.adapter;
-
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
@@ -9,24 +23,17 @@ import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;
-
-
public class BasePagerAdapter extends FragmentPagerAdapter {
private List> mFragment;
private List
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.base.grid;
import android.graphics.Rect;
diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/base/BaseActivity.java b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/base/mvp/BaseActivity.java
similarity index 83%
rename from model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/base/BaseActivity.java
rename to model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/base/mvp/BaseActivity.java
index a068addda6..dc1fce9b84 100644
--- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/base/BaseActivity.java
+++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/base/mvp/BaseActivity.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2020 Huawei Technologies Co., Ltd
+ * Copyright 2021 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.mindspore.himindspore.base;
+package com.mindspore.common.base.mvp;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
-public abstract class BaseActivity
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.base.mvp;
+
+public abstract class BaseActivityPresenter
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.base.mvp;
+
+import androidx.fragment.app.Fragment;
+
+public class BaseFragment
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.mindspore.himindspore.base;
+package com.mindspore.common.base.mvp;
+
+public class BaseFragmentPresenter
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.sp;
public final class Preferences {
diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/DisplayUtil.java b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/DisplayUtil.java
index 0ff999ef1c..26e80e4878 100644
--- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/DisplayUtil.java
+++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/DisplayUtil.java
@@ -1,3 +1,18 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.content.Context;
diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/ImageUtils.java b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/ImageUtils.java
index 6cb77f7453..dde01694a9 100644
--- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/ImageUtils.java
+++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/ImageUtils.java
@@ -1,3 +1,18 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.content.Context;
diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/StringUtils.java b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/StringUtils.java
index 40a6c8c767..fcef2cdbfd 100644
--- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/StringUtils.java
+++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/StringUtils.java
@@ -1,3 +1,18 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 java.util.regex.Matcher;
diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/values-en/strings.xml b/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/values-en/strings.xml
index 9fdb2dcd0a..2efc1c12cd 100644
--- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/values-en/strings.xml
+++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/values-en/strings.xml
@@ -17,4 +17,6 @@
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.algorithm;
+
+public class ModelDataBean {
+ // RightElbow cos, RightWrist cos, LeftElbow cos, LeftWrist cos, LeftKnee cos, LeftAnkle cos
+ private int id;
+ private double sinRightElbow;
+ private double sinRightWrist;
+ private double sinLeftElbow;
+ private double sinLeftWrist;
+ private double sinLeftKnee;
+ private double sinLeftAnkle;
+
+ private int rightElbowXY;
+ private int rightWristXY;
+ private int leftElbowXY;
+ private int leftWristXY;
+ private int leftKneeXY;
+ private int leftAnkleXY;
+
+ public int getRightElbowXY() {
+ return rightElbowXY;
+ }
+
+ public ModelDataBean setRightElbowXY(int rightElbowXY) {
+ this.rightElbowXY = rightElbowXY;
+ return this;
+ }
+
+ public int getRightWristXY() {
+ return rightWristXY;
+ }
+
+ public ModelDataBean setRightWristXY(int rightWristXY) {
+ this.rightWristXY = rightWristXY;
+ return this;
+ }
+
+ public int getLeftElbowXY() {
+ return leftElbowXY;
+ }
+
+ public ModelDataBean setLeftElbowXY(int leftElbowXY) {
+ this.leftElbowXY = leftElbowXY;
+ return this;
+ }
+
+ public int getLeftWristXY() {
+ return leftWristXY;
+ }
+
+ public ModelDataBean setLeftWristXY(int leftWristXY) {
+ this.leftWristXY = leftWristXY;
+ return this;
+ }
+
+ public int getLeftKneeXY() {
+ return leftKneeXY;
+ }
+
+ public ModelDataBean setLeftKneeXY(int leftKneeXY) {
+ this.leftKneeXY = leftKneeXY;
+ return this;
+ }
+
+ public int getLeftAnkleXY() {
+ return leftAnkleXY;
+ }
+
+ public ModelDataBean setLeftAnkleXY(int leftAnkleXY) {
+ this.leftAnkleXY = leftAnkleXY;
+ return this;
+ }
+
+ public ModelDataBean() {
+ }
+
+ public double getSinRightElbow() {
+ return sinRightElbow;
+ }
+
+ public ModelDataBean setSinRightElbow(double sinRightElbow) {
+ this.sinRightElbow = sinRightElbow;
+ return this;
+ }
+
+ public double getSinRightWrist() {
+ return sinRightWrist;
+ }
+
+ public ModelDataBean setSinRightWrist(double sinRightWrist) {
+ this.sinRightWrist = sinRightWrist;
+ return this;
+ }
+
+ public double getSinLeftElbow() {
+ return sinLeftElbow;
+ }
+
+ public ModelDataBean setSinLeftElbow(double sinLeftElbow) {
+ this.sinLeftElbow = sinLeftElbow;
+ return this;
+ }
+
+ public double getSinLeftWrist() {
+ return sinLeftWrist;
+ }
+
+ public ModelDataBean setSinLeftWrist(double sinLeftWrist) {
+ this.sinLeftWrist = sinLeftWrist;
+ return this;
+ }
+
+ public double getSinLeftKnee() {
+ return sinLeftKnee;
+ }
+
+ public ModelDataBean setSinLeftKnee(double sinLeftKnee) {
+ this.sinLeftKnee = sinLeftKnee;
+ return this;
+ }
+
+ public double getSinLeftAnkle() {
+ return sinLeftAnkle;
+ }
+
+ public ModelDataBean setSinLeftAnkle(double sinLeftAnkle) {
+ this.sinLeftAnkle = sinLeftAnkle;
+ return this;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public ModelDataBean setId(int id) {
+ this.id = id;
+ return this;
+ }
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/algorithm/ModelDataUtils.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/algorithm/ModelDataUtils.java
new file mode 100644
index 0000000000..0375c13219
--- /dev/null
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/algorithm/ModelDataUtils.java
@@ -0,0 +1,349 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.algorithm;
+
+import android.util.Log;
+
+import com.huawei.hms.mlsdk.skeleton.MLSkeleton;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.huawei.hms.mlsdk.skeleton.MLJoint.TYPE_LEFT_ANKLE;
+import static com.huawei.hms.mlsdk.skeleton.MLJoint.TYPE_LEFT_ELBOW;
+import static com.huawei.hms.mlsdk.skeleton.MLJoint.TYPE_LEFT_KNEE;
+import static com.huawei.hms.mlsdk.skeleton.MLJoint.TYPE_LEFT_WRIST;
+import static com.huawei.hms.mlsdk.skeleton.MLJoint.TYPE_NECK;
+import static com.huawei.hms.mlsdk.skeleton.MLJoint.TYPE_RIGHT_ELBOW;
+import static com.huawei.hms.mlsdk.skeleton.MLJoint.TYPE_RIGHT_WRIST;
+
+public class ModelDataUtils {
+ public static final int NO_POINT = -2;
+ public static final int NO_ACT = -1;
+
+ private static final String TAG = ModelDataUtils.class.getSimpleName();
+ private static final double[] MODEL_DATA_ARRAY = new double[]{
+ 1, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 2, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 3, -0.447213595, -0.447213595, 0.5, -0.447213595, -0.948683298, -0.707106781,
+ 4, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 5, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 6, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 7, -0.447213595, -0.447213595, -0.196116135, -0.447213595, -0.948683298, -0.707106781,
+ 8, -0.447213595, -0.447213595, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 9, -0.447213595, -0.707106781, -0.196116135, -0.447213595, -0.948683298, -0.707106781,
+ 10, -0.447213595, -0.707106781, 0.5, 0.5, -0.948683298, -0.707106781,
+ 11, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 12, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 13, -0.707106781, -0.707106781, 0.5, -1, -1, -0.948683298,
+ 14, -0.707106781, -0.707106781, 0.5, -0.707106781, -1, -0.948683298,
+ 15, -0.707106781, -0.447213595, 0.5, -1, -1, -0.948683298,
+ 16, -0.707106781, -0.447213595, 0.5, -0.707106781, -1, -0.948683298,
+ 17, -0.707106781, -0.447213595, 0.5, -0.707106781, -1, -0.948683298,
+ 18, -0.447213595, -0.447213595, -0.707106781, -0.707106781, -0.948683298, -0.707106781,
+ 19, -0.707106781, -0.707106781, -0.894427191, -1, -0.948683298, -0.832050294,
+ 20, -0.447213595, -0.707106781, -0.707106781, -0.447213595, -0.948683298, -0.948683298,
+ 21, -0.447213595, -0.707106781, -0.196116135, -0.447213595, -0.948683298, -0.707106781,
+ 22, -0.316227766, -0.316227766, -0.371390676, -0.447213595, -0.948683298, -0.6,
+ 23, -0.447213595, -0.447213595, -0.196116135, -0.447213595, -0.948683298, -0.948683298,
+ 24, -0.447213595, -0.707106781, -0.316227766, -1, -1, -0.832050294,
+ 25, -0.447213595, -0.707106781, -0.316227766, -1, -1, -0.832050294,
+ 26, -1, -1, -1, 0.5, -0.948683298, -0.948683298,
+ 27, -1, -1, -1, -0.894427191, -0.948683298, -0.948683298,
+ 28, -0.447213595, -0.447213595, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 29, -0.447213595, -0.707106781, -0.196116135, -0.447213595, -0.948683298, -0.707106781,
+ 30, -0.447213595, 0.624695048, -0.196116135, 0.9701425, -0.948683298, -0.707106781,
+ 31, -0.447213595, 0.514495755, -0.196116135, 0.948683298, -0.948683298, -0.707106781,
+ 32, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 33, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 34, -0.447213595, -0.707106781, -0.196116135, -0.316227766, -0.948683298, -0.707106781,
+ 35, -0.447213595, 0.554700196, -0.196116135, 0.948683298, -0.948683298, -0.707106781,
+ 36, -0.447213595, -0.707106781, -0.196116135, -0.447213595, -0.948683298, -0.948683298,
+ 37, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 38, -0.447213595, -0.316227766, -0.196116135, -0.316227766, -0.948683298, -0.707106781,
+ 39, -0.447213595, -0.554700196, -0.196116135, -0.316227766, -0.948683298, -0.707106781,
+ 40, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 41, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 42, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 43, -0.447213595, -0.707106781, -0.196116135, -0.447213595, -0.948683298, -0.707106781,
+ 44, -0.447213595, -0.447213595, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 45, -0.447213595, -0.707106781, -0.196116135, -0.554700196, -0.948683298, -0.707106781,
+ 46, -0.447213595, -0.447213595, -0.196116135, -0.894427191, -0.948683298, -0.707106781,
+ 47, -0.447213595, -0.554700196, -0.196116135, -0.894427191, -0.948683298, -0.707106781,
+ 48, -0.707106781, -0.447213595, -0.447213595, -0.707106781, -0.948683298, -0.894427191,
+ 49, -0.447213595, -0.447213595, -0.447213595, -0.707106781, -0.948683298, -0.948683298,
+ 50, -0.447213595, -0.447213595, -0.447213595, -0.707106781, -0.948683298, -0.948683298,
+ 51, -0.447213595, -0.707106781, -0.447213595, -0.707106781, -0.948683298, -0.948683298,
+ 52, -0.447213595, -0.447213595, -0.447213595, -0.894427191, -0.948683298, -1,
+ 53, -0.447213595, -0.447213595, 0.707106781, -0.447213595, -0.948683298, -0.707106781,
+ 54, -0.707106781, -0.707106781, 0.5, -0.707106781, -0.948683298, -0.832050294,
+ 55, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 56, -0.447213595, -0.707106781, -0.196116135, -0.447213595, -0.948683298, -0.707106781,
+ 57, -0.316227766, -0.447213595, -0.316227766, -0.316227766, -0.948683298, -0.6,
+ 58, -0.316227766, -0.447213595, -0.316227766, -0.316227766, -0.948683298, -0.707106781,
+ 59, -0.447213595, -0.707106781, -0.242535625, -0.707106781, -0.948683298, -0.707106781,
+ 60, -0.447213595, -0.707106781, -0.242535625, -0.707106781, -0.948683298, -0.707106781,
+ 61, -0.447213595, -0.707106781, -0.242535625, -0.707106781, -0.948683298, -0.832050294,
+ 62, -0.447213595, -0.707106781, -0.242535625, -0.894427191, -0.948683298, -0.832050294,
+ 63, -0.447213595, -0.707106781, -0.242535625, -0.894427191, -0.948683298, -0.707106781,
+ 64, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 65, -0.447213595, -0.447213595, -0.196116135, -0.447213595, -0.948683298, -0.707106781,
+ 66, -0.316227766, -0.316227766, -0.371390676, -0.447213595, -0.948683298, -0.6,
+ 67, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 68, -0.447213595, -0.707106781, -0.196116135, -0.707106781, -0.948683298, -0.707106781,
+ 69, -0.447213595, -0.707106781, -0.196116135, -0.447213595, -0.948683298, -0.707106781,
+ 70, -0.447213595, -0.447213595, -0.196116135, -0.707106781, -0.948683298, -0.707106781};
+
+ private static final float NO_POINT_SCALE = 0.4f;
+ private static final float NO_ACT_SCALE = 0.4f;
+
+ public static List
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.global;
+
+import android.os.Environment;
+
+public class Constants {
+ public static String VIDEO_NAME = "danceVideo2.mp4";
+ public static final int VIDEO_LENGTH = 41282333;
+ public static String VIDEO_PATH = Environment.getExternalStorageDirectory().getPath() + "/" + Environment.DIRECTORY_DOWNLOADS + "/";
+ public static String BITMAP_PATH = VIDEO_PATH + "bitmap";
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/global/Variables.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/global/Variables.java
new file mode 100644
index 0000000000..e7c22544b9
--- /dev/null
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/global/Variables.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.global;
+
+public class Variables {
+ public static boolean hasVideo = false;
+ public static long downloadId = -1;
+ public static int score = 0;
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/present/video/MyVideoView.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/present/video/MyVideoView.java
new file mode 100644
index 0000000000..7a6327c774
--- /dev/null
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/present/video/MyVideoView.java
@@ -0,0 +1,116 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.present.video;
+
+import android.content.Context;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.widget.MediaController;
+import android.widget.TextView;
+import android.widget.VideoView;
+
+import com.mindspore.dance.R;
+import com.mindspore.dance.task.GoneViewTask;
+
+import java.util.Formatter;
+import java.util.Locale;
+
+public class MyVideoView extends VideoView {
+ private static final String TAG = MyVideoView.class.getSimpleName();
+ private MediaController mediaController;
+ private Context mContext;
+ private TextView mCountdownView;
+
+ public MyVideoView(Context context) {
+ super(context);
+ mContext = context;
+ mediaController = new MediaController(context);
+ this.setMediaController(mediaController);
+ initMediaController();
+ }
+
+ public void setCountdownView(TextView countdownView) {
+ mCountdownView = countdownView;
+
+ }
+
+ private void initMediaController() {
+ mediaController.setEnabled(false);
+ }
+
+ @Override
+ public void pause() {
+ super.pause();
+ Log.d(TAG, "pause");
+ }
+
+ @Override
+ public void resume() {
+ super.resume();
+ Log.d(TAG, "resume");
+ }
+
+ @Override
+ public void start() {
+ super.start();
+ Log.d(TAG, "start");
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ Log.d(TAG, "onTouchEvent");
+ int remainingTime = this.getDuration() - this.getCurrentPosition();
+ String timeStr = stringForTime(remainingTime);
+ if (mCountdownView != null) {
+ if (mCountdownView.getVisibility() == GONE) {
+ mCountdownView.setText(getContext().getString(R.string.countdown) + timeStr);
+ mCountdownView.setVisibility(VISIBLE);
+ new Thread(new GoneViewTask(mCountdownView)).start();
+ } else {
+ mCountdownView.setVisibility(GONE);
+ }
+ }
+ return false;
+ }
+
+ private String stringForTime(int timeMs) {
+ if (timeMs < 0) {
+ return "00:00";
+ }
+ StringBuilder mFormatBuilder = new StringBuilder();
+ Formatter mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
+ int totalSeconds = timeMs / 1000;
+
+ int seconds = totalSeconds % 60;
+ int minutes = (totalSeconds / 60) % 60;
+ int hours = totalSeconds / 3600;
+
+ mFormatBuilder.setLength(0);
+ if (hours > 0) {
+ return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
+ } else {
+ return mFormatter.format("%02d:%02d", minutes, seconds).toString();
+ }
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ return false;
+ }
+
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/task/GoneViewTask.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/task/GoneViewTask.java
new file mode 100644
index 0000000000..bd396e79c6
--- /dev/null
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/task/GoneViewTask.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.task;
+
+import android.os.Handler;
+import android.os.Looper;
+import android.view.View;
+
+public class GoneViewTask implements Runnable {
+ private View mView;
+
+ public GoneViewTask(View view) {
+ this.mView = view;
+ }
+
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ Handler mainHandler = new Handler(Looper.getMainLooper());
+ mainHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ if (mView != null && mView.getVisibility() != View.GONE) {
+ mView.setVisibility(View.GONE);
+ }
+ }
+ });
+ }
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/task/SampleTask.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/task/SampleTask.java
new file mode 100644
index 0000000000..24edd675c3
--- /dev/null
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/task/SampleTask.java
@@ -0,0 +1,134 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.task;
+
+import android.graphics.Bitmap;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+
+import androidx.camera.view.PreviewView;
+
+import com.huawei.hmf.tasks.OnFailureListener;
+import com.huawei.hmf.tasks.Task;
+import com.huawei.hms.mlsdk.common.MLFrame;
+import com.huawei.hms.mlsdk.skeleton.MLSkeleton;
+import com.huawei.hms.mlsdk.skeleton.MLSkeletonAnalyzer;
+import com.huawei.hms.mlsdk.skeleton.MLSkeletonAnalyzerFactory;
+import com.mindspore.dance.algorithm.ModelDataBean;
+import com.mindspore.dance.algorithm.ModelDataUtils;
+import com.mindspore.dance.global.Variables;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SampleTask implements Runnable {
+ private static final String TAG = SampleTask.class.getSimpleName();
+ private PreviewView previewView;
+ private MLSkeletonAnalyzer analyzer;
+ private List
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.util;
+
+import android.Manifest;
+import android.app.Activity;
+import android.content.pm.PackageManager;
+import android.graphics.Rect;
+import android.util.Log;
+import android.view.Display;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+
+import androidx.annotation.MainThread;
+import androidx.core.app.ActivityCompat;
+
+import com.mindspore.dance.global.Constants;
+import com.mindspore.dance.global.Variables;
+
+import java.io.File;
+
+public class Tools {
+ private static String TAG = Tools.class.getSimpleName();
+ public static int WIDTH_INDEX = 0;
+ public static int HEIGHT_INDEX = 1;
+ public static final int TYPE_VIDEO_VIEW = 0;
+ public static final int TYPE_CAMERA_VIEW = 1;
+
+ /**
+ * Get the download status, get the width and height of a view, (There is a problem, you may get {0,0})
+ *
+ * @param view
+ * @return int[2] int[0] = view.width; int[1] = view.height;
+ */
+ public static int[] getWH(View view) {
+ int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
+ int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
+
+ view.measure(w, h);
+ int width = view.getMeasuredWidth();
+ int height = view.getMeasuredHeight();
+ Log.d(TAG, "rootLayout width:" + width + ", height:" + height);
+ int[] a = {width, height};
+ return a;
+ }
+
+ /**
+ * Get the width and height of an activity (including the status bar)
+ *
+ * @return int[2] int[0] = width; int[1] = height;
+ */
+ public static int[] getActivityWH(Activity activity) {
+ Display display = activity.getWindowManager().getDefaultDisplay();
+ Log.d(TAG, "Activity width:" + display.getWidth() + ", height:" + display.getHeight());
+ int[] a = {display.getWidth(), display.getHeight()};
+ return a;
+ }
+
+ /**
+ * Get the visual area of a view
+ *
+ * @param view
+ * @return int[2] int[0] = width; int[1] = height;
+ */
+ public static int[] getRect(View view) {
+ Rect rectangle = new Rect();
+ view.getWindowVisibleDisplayFrame(rectangle);
+ Log.d(TAG, "getRect parentView width:" + rectangle.width() + ", height:" + rectangle.height());
+ int[] a = {rectangle.width(), rectangle.height()};
+ return a;
+ }
+
+ /**
+ * Adding childView to parentView must be done in the main thread.
+ *
+ * @param parentView Parent container
+ * @param childView Control to add
+ * @param widthRatio Control width / parent container width
+ * @param highRatio Control height / parent container height
+ * if leftMarginRatio = -1; the horizontal center; topMarginRatio = -1 Indicates vertical center
+ * @param topMarginRatio Control top margin / parent container height
+ * @param leftMarginRatio Control left margin / parent container width
+ */
+ @MainThread
+ public static void addView(ViewGroup parentView, View childView, float widthRatio, float highRatio,
+ float topMarginRatio, float leftMarginRatio) {
+ int[] parentMeasure = Tools.getRect(parentView);
+ int width = (int) (parentMeasure[0] * widthRatio);
+ int high = (int) (parentMeasure[1] * highRatio);
+ int left = leftMarginRatio == -1 ? (parentMeasure[0] - width) / 2
+ : (int) (parentMeasure[0] * leftMarginRatio);
+ int top = topMarginRatio == -1 ? (parentMeasure[1] - high) / 2
+ : (int) (parentMeasure[1] * topMarginRatio);
+ Log.d(TAG, "addView width:" + width + ", height:" + high + ", left:" + left + ", top:" + top);
+ FrameLayout.LayoutParams fLayoutParams = new FrameLayout.LayoutParams(width, high);
+ fLayoutParams.setMargins(left, top, 0, 0);
+
+ childView.setLayoutParams(fLayoutParams);
+ parentView.addView(childView);
+ }
+
+ /**
+ * Adding childView to parentView must be done in the main thread.
+ *
+ * @param parentView Parent container
+ * @param childView Control to add
+ * @param widthRatio Control width / parent container width
+ * @param highRatio Control height / parent container height
+ * @param widthHighRatio Control width / control height
+ * if leftMarginRatio = -1; the horizontal center; topMarginRatio = -1 Indicates vertical center
+ * @param topMarginRatio Control top margin / parent container height
+ * @param leftMarginRatio Control left margin / parent container width
+ * @param type Control is video 0 , a camera 1
+ */
+ @MainThread
+ public static void addViewFixedScale(ViewGroup parentView, View childView, float widthRatio,
+ float highRatio, float widthHighRatio,
+ float topMarginRatio, float leftMarginRatio, int type) {
+ if (widthHighRatio == 0) {
+ return;
+ }
+ int[] parentMeasure = Tools.getRect(parentView);
+ int width = (int) (parentMeasure[0] * widthRatio);
+ int highBorder = (int) (parentMeasure[1] * highRatio);
+ int high = (int) ((float) width / widthHighRatio);
+ int left = leftMarginRatio == -1 ? (parentMeasure[0] - width) / 2
+ : (int) (parentMeasure[0] * leftMarginRatio);
+ int top = topMarginRatio == -1 ? (parentMeasure[1] - high) / 2
+ : (int) (parentMeasure[1] * topMarginRatio);
+ Log.d(TAG, "addViewFixedScale width:" + width + ", height:" + high + ", highBorder:" + highBorder + ", left:" + left + ", top:" + top);
+ FrameLayout.LayoutParams fLayoutParams = new FrameLayout.LayoutParams(width, high);
+ int adjustment = 0;
+ if (high != highBorder) {
+ switch (type) {
+ case Tools.TYPE_VIDEO_VIEW:
+ adjustment = (highBorder - high) / 2;
+ break;
+ case Tools.TYPE_CAMERA_VIEW:
+ adjustment = (highBorder - high);
+ break;
+ default:
+ Log.e(TAG, "type is invalid. don't adjust.");
+ }
+ }
+ Log.e(TAG, "addViewFixedScale adjustment." + adjustment);
+ fLayoutParams.setMargins(left, top + adjustment, 0, 0);
+
+ childView.setLayoutParams(fLayoutParams);
+ parentView.addView(childView);
+ }
+
+ public static boolean checkDiskHasVideo() {
+ File f = new File(Constants.VIDEO_PATH + Constants.VIDEO_NAME);
+ if (f.exists() && f.length() == Constants.VIDEO_LENGTH) {
+ Variables.hasVideo = true;
+ } else {
+ Variables.hasVideo = false;
+ }
+ return Variables.hasVideo;
+ }
+
+ private static final int REQUEST_EXTERNAL_STORAGE = 1;
+ private static final int REQUEST_CAMERA = 1;
+ private static String[] PERMISSIONS_STORAGE = {
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE
+ };
+
+ private static String[] PERMISSIONS_CAMERA = {
+ Manifest.permission.CAMERA
+ };
+
+ public static void verifyStoragePermissions(Activity activity) {
+ // Check if we have write permission
+ int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ if (permission != PackageManager.PERMISSION_GRANTED) {
+ // We don't have permission so prompt the user
+ ActivityCompat.requestPermissions(activity, PERMISSIONS_STORAGE, REQUEST_EXTERNAL_STORAGE);
+ }
+ }
+
+ public static void verifyCameraPermissions(Activity activity) {
+ // Check if we have write permission
+ int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.CAMERA);
+ if (permission != PackageManager.PERMISSION_GRANTED) {
+ // We don't have permission so prompt the user
+ ActivityCompat.requestPermissions(activity, PERMISSIONS_CAMERA, REQUEST_CAMERA);
+ }
+ }
+
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/texttranslation/TextTranslationRealTimeActivity.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/DanceActivity.java
similarity index 52%
rename from model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/texttranslation/TextTranslationRealTimeActivity.java
rename to model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/DanceActivity.java
index 8b098e35e8..e2d6c15f6f 100644
--- a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/texttranslation/TextTranslationRealTimeActivity.java
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/DanceActivity.java
@@ -13,35 +13,39 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.mindspore.hms.texttranslation;
+package com.mindspore.dance.view;
+
+import android.annotation.SuppressLint;
import android.os.Bundle;
+import android.view.Window;
+import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.widget.Toolbar;
import com.alibaba.android.arouter.facade.annotation.Route;
-import com.mindspore.hms.R;
-import com.mindspore.hms.camera.GraphicOverlay;
-import com.mindspore.hms.camera.LensEnginePreview;
-
-@Route(path = "/hms/TextTranslationRealTimeActivity")
-public class TextTranslationRealTimeActivity extends AppCompatActivity {
-
- private LensEnginePreview mPreview;
+import com.mindspore.dance.R;
- private GraphicOverlay mOverlay;
+@Route(path = "/dance/DanceMainActivity")
+public class DanceActivity extends AppCompatActivity {
+ @SuppressLint("InvalidWakeLockTag")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_text_translation_real_time);
- init();
- }
- private void init(){
- Toolbar mToolbar = findViewById(R.id.TextVideo_activity_toolbar);
- mToolbar.setNavigationOnClickListener(view -> finish());
- this.mPreview = this.findViewById(R.id.scene_preview);
- this.mOverlay = this.findViewById(R.id.scene_overlay);
+
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
+
+ this.requestWindowFeature(Window.FEATURE_NO_TITLE);
+
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+ setContentView(R.layout.activity_dance);
+
+
}
-}
\ No newline at end of file
+
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/fragment/PrepareFragment.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/fragment/PrepareFragment.java
new file mode 100644
index 0000000000..58b92d60e7
--- /dev/null
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/fragment/PrepareFragment.java
@@ -0,0 +1,207 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.view.fragment;
+
+import android.Manifest;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.MediaController;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.core.app.ActivityCompat;
+import androidx.navigation.fragment.NavHostFragment;
+
+import com.mindspore.common.base.mvp.BaseFragment;
+import com.mindspore.common.net.FileDownLoadObserver;
+import com.mindspore.dance.R;
+import com.mindspore.dance.global.Constants;
+import com.mindspore.dance.global.Variables;
+import com.mindspore.dance.present.video.MyVideoView;
+import com.mindspore.dance.util.Tools;
+import com.mindspore.dance.view.mvp.PrepareContract;
+import com.mindspore.dance.view.mvp.PreparePresenter;
+
+import java.io.File;
+
+import static com.mindspore.common.utils.Utils.getApp;
+
+public class PrepareFragment extends BaseFragment
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.view.fragment;
+
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.navigation.fragment.NavHostFragment;
+
+import com.mindspore.common.utils.ImageUtils;
+import com.mindspore.dance.R;
+import com.mindspore.dance.algorithm.ModelDataUtils;
+import com.mindspore.dance.global.Variables;
+
+
+public class ResultFragment extends Fragment {
+
+ private String comment;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_result, container, false);
+ }
+
+ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ TextView textFirstView = view.findViewById(R.id.get_score);
+ String score = level(Variables.score);
+ textFirstView.setText(score);
+
+ TextView textSecondView = view.findViewById(R.id.get_comment);
+ if (Variables.score >= 0 && Variables.score <= 100) {
+ textSecondView.setText(comment);
+ } else {
+ textSecondView.setVisibility(View.GONE);
+ }
+ view.findViewById(R.id.play_again).setOnClickListener(view1 ->
+ NavHostFragment.findNavController(ResultFragment.this)
+ .navigate(R.id.action_ResultFragment_to_PrepareFragment));
+
+ view.findViewById(R.id.save).setOnClickListener(view12 -> {
+ Uri imgPath = ImageUtils.saveToAlbum(getActivity(), view, null, false);
+ if (imgPath != null) {
+ Toast.makeText(getActivity(), R.string.image_save_success, Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(getActivity(), R.string.image_save_failed, Toast.LENGTH_SHORT).show();
+ }
+ });
+ view.findViewById(R.id.back).setOnClickListener(view12 -> {
+ getActivity().finish();
+ });
+ }
+
+ private String level(int score) {
+ if (score == ModelDataUtils.NO_ACT) {
+ return getContext().getString(R.string.get_score_level0);
+ } else if (score == ModelDataUtils.NO_POINT) {
+ return getContext().getString(R.string.get_score_level8);
+ } else if (50 <= score && score < 60) {
+ comment = getContext().getString(R.string.get_score_level1);
+ } else if (60 <= score && score < 70) {
+ comment = getContext().getString(R.string.get_score_level2);
+ } else if (70 <= score && score < 80) {
+ comment = getContext().getString(R.string.get_score_level3);
+ } else if (80 <= score && score < 90) {
+ comment = getContext().getString(R.string.get_score_level4);
+ } else if (90 <= score && score < 95) {
+ comment = getContext().getString(R.string.get_score_level5);
+ } else if (95 <= score && score < 100) {
+ comment = getContext().getString(R.string.get_score_level6);
+ } else if (score == 100) {
+ comment = getContext().getString(R.string.get_score_level7);
+ } else {
+ comment = "";
+ }
+ return getContext().getString(R.string.get_score) + score;
+ }
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/fragment/RunFragment.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/fragment/RunFragment.java
new file mode 100644
index 0000000000..9484b06e28
--- /dev/null
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/view/fragment/RunFragment.java
@@ -0,0 +1,230 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.view.fragment;
+
+import android.annotation.SuppressLint;
+import android.media.MediaPlayer;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.MediaController;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
+import androidx.camera.camera2.Camera2Config;
+import androidx.camera.core.Camera;
+import androidx.camera.core.CameraSelector;
+import androidx.camera.core.CameraXConfig;
+import androidx.camera.core.Preview;
+import androidx.camera.lifecycle.ProcessCameraProvider;
+import androidx.camera.view.PreviewView;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.LifecycleOwner;
+import androidx.navigation.fragment.NavHostFragment;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import com.mindspore.dance.R;
+import com.mindspore.dance.global.Constants;
+import com.mindspore.dance.present.video.MyVideoView;
+import com.mindspore.dance.task.SampleTask;
+import com.mindspore.dance.util.Tools;
+
+import java.util.concurrent.ExecutionException;
+
+public class RunFragment extends Fragment {
+ private final String TAG = RunFragment.class.getSimpleName();
+ private FrameLayout root;
+ private MyVideoView videoView;
+ private PreviewView cameraView;
+ private ListenableFuture
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.view.mvp;
+
+import com.mindspore.common.net.FileDownLoadObserver;
+
+import java.io.File;
+
+public interface PrepareContract {
+
+ interface View {
+ }
+
+ interface Presenter {
+ void downloadDanceVideo(FileDownLoadObserver
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.dance.view.mvp;
+
+import com.mindspore.common.base.mvp.BaseFragmentPresenter;
+import com.mindspore.common.net.FileDownLoadObserver;
+import com.mindspore.common.net.RetrofitHelper;
+import com.mindspore.dance.global.Constants;
+import com.mindspore.dance.view.fragment.PrepareFragment;
+
+import java.io.File;
+
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+public class PreparePresenter extends BaseFragmentPresenter> bitmapsSkeleton;
+ private List
>();
+ modelDataBeanList = new ArrayList
> task = analyzer.asyncAnalyseFrame(frame);
+ task.addOnSuccessListener(results -> {
+ // check successful
+ if (results.size() > 0) {
+ Log.d(TAG, "onSuccess " + "skeleton:" + results.get(0));
+ modelDataBeanList.add(ModelDataUtils.hmsData2ModelData(results.get(0)));
+ } else {
+ Log.w(TAG, "onSuccess, but no have skeleton in bitmap.");
+ modelDataBeanList.add(null);
+ }
+ }).addOnFailureListener(new OnFailureListener() {
+ @Override
+ public void onFailure(Exception e) {
+ // check failed.
+ Log.d(TAG, "onFailure sample:" + num);
+ }
+ });
+ } catch (IllegalArgumentException e) {
+ Log.d(TAG, "getBitmap," + e.getMessage());
+ } catch (IllegalStateException e) {
+ Log.d(TAG, "getBitmap," + e.getMessage());
+ }
+ });
+ }
+
+ private void sample() {
+ Log.d(TAG, "sample:" + num);
+ if (previewView != null) {
+ getBitmap();
+ }
+ num++;
+ }
+}
diff --git a/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/util/Tools.java b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/util/Tools.java
new file mode 100644
index 0000000000..e2e49a4ebb
--- /dev/null
+++ b/model_zoo/official/lite/MindSpore_inhand/dance/src/main/java/com/mindspore/dance/util/Tools.java
@@ -0,0 +1,206 @@
+/**
+ * Copyright 2021 Huawei Technologies Co., Ltd
+ *