mindsporeInHand 1.2.7 verson
|
@ -81,3 +81,4 @@ local.properties
|
|||
sdk/build
|
||||
sdk/.cxx
|
||||
app/.cxx
|
||||
/mindsporelibrary/mindspore/
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"agcgw_all": {
|
||||
"CN": "connect-drcn.hispace.hicloud.com",
|
||||
"CN_back": "connect-drcn.dbankcloud.cn",
|
||||
"DE": "connect-dre.hispace.hicloud.com",
|
||||
"DE_back": "connect-dre.dbankcloud.cn",
|
||||
"RU": "connect-drru.hispace.hicloud.com",
|
||||
"RU_back": "connect-drru.dbankcloud.cn",
|
||||
"SG": "connect-dra.hispace.hicloud.com",
|
||||
"SG_back": "connect-dra.dbankcloud.cn"
|
||||
},
|
||||
"client": {
|
||||
"cp_id": "70086000024868540",
|
||||
"product_id": "736430079244810681",
|
||||
"client_id": "557075911736832640",
|
||||
"client_secret": "29E859D6D21E08CB492E2B824423F2AE0C1B22140CF6D2029ED0B82BC74B3A67",
|
||||
"project_id": "736430079244810681",
|
||||
"app_id": "103836135",
|
||||
"api_key": "CgB6e3x9ss3nul/jhX9/4Y54MU0plgs6E1bW5SY8YQnq/uWhQHRxVGTf5Jl9f5NjRpvl0QV3Ft9sPihQ/PSL6RjC",
|
||||
"package_name": "com.mindspore.himindspore"
|
||||
},
|
||||
"configuration_version": "2.0",
|
||||
"appInfos": [{
|
||||
"package_name": "com.mindspore.himindspore",
|
||||
"app_id": "103836135"
|
||||
}]
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.huawei.agconnect'
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.1"
|
||||
|
@ -7,8 +8,8 @@ android {
|
|||
applicationId "com.mindspore.himindspore"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 11
|
||||
versionName "1.2.4"
|
||||
versionCode 14
|
||||
versionName "1.2.7"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
javaCompileOptions {
|
||||
|
@ -74,10 +75,9 @@ dependencies {
|
|||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
|
||||
|
||||
implementation 'pub.devrel:easypermissions:3.0.0'
|
||||
implementation project(':posenet')
|
||||
implementation project(':common')
|
||||
implementation project(':customView')
|
||||
implementation project(':imageObject')
|
||||
implementation project(':styletransfer')
|
||||
implementation project(':segmentation')
|
||||
implementation project(':hms')
|
||||
}
|
||||
|
|
|
@ -19,12 +19,7 @@
|
|||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-keep class cn.sharesdk.**{*;}
|
||||
-keep class com.sina.**{*;}
|
||||
-keep class **.R$* {*;}
|
||||
-keep class **.R{*;}
|
||||
-keep class com.mob.**{*;}
|
||||
-keep class m.framework.**{*;}
|
||||
-dontwarn cn.sharesdk.**
|
||||
-dontwarn com.sina.**
|
||||
-dontwarn com.mob.**
|
||||
|
|
|
@ -16,16 +16,80 @@
|
|||
<application
|
||||
android:name=".base.MyApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@mipmap/ic_launchers"
|
||||
android:label="@string/app_name"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:roundIcon="@mipmap/ic_launchers_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:label">
|
||||
|
||||
<activity
|
||||
android:name=".ui.webview.WebViewUtilsActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.CollegeReferencevideoActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.CollegeBrokensideActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.CollegePerformReasoningActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.CollegeTrainingmodelActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.CollegeForumActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.CollegeFAQActivity"
|
||||
android:hardwareAccelerated="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.CollegeOneHourActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.MeThumbsupActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.MeOfficialwebsiteActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.MeCodeRepositoryActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.webview.MeProblemFeedbackActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.me.MyQRCodeActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.poetry.IntelligentPoetryWritingActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|screenSize"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.poetry.PoetryPosterActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.main.PrivacyPolicyActivity"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.main.MainActivity"
|
||||
android:screenOrientation="portrait"
|
||||
|
@ -41,7 +105,6 @@
|
|||
android:theme="@style/Theme.AppCompat.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
|
|
@ -28,7 +28,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
|||
public class RetrofitHelper {
|
||||
public static final String MS_BASE_HOST = "https://download.mindspore.cn/model_zoo/official/lite/apk/";
|
||||
|
||||
private RetrofitService retrofitService;
|
||||
private final RetrofitService retrofitService;
|
||||
|
||||
|
||||
public RetrofitHelper() {
|
||||
|
|
|
@ -30,7 +30,7 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mindspore.common.config.MSLinkUtils;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mindspore.common.sp.Preferences;
|
||||
import com.mindspore.common.utils.Utils;
|
||||
import com.mindspore.customview.dialog.NoticeDialog;
|
||||
|
@ -140,19 +140,19 @@ public class CollegeFragment extends Fragment implements CollegeItemAdapter.Coll
|
|||
prefs.edit().putBoolean(Preferences.KEY_COLLEGE_CLOUD, true).apply();
|
||||
collegeDataList.get(1).setHasChecked(prefs.getBoolean(Preferences.KEY_COLLEGE_CLOUD, false));
|
||||
collegeItemAdapter.notifyData();
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.COLLEGE_MAIN_CLOUD);
|
||||
ARouter.getInstance().build("/app/CollegeOneHourActivity").navigation();
|
||||
break;
|
||||
case 3:
|
||||
prefs.edit().putBoolean(Preferences.KEY_COLLEGE_FAQ, true).apply();
|
||||
collegeDataList.get(3).setHasChecked(prefs.getBoolean(Preferences.KEY_COLLEGE_FAQ, false));
|
||||
collegeItemAdapter.notifyData();
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.COLLEGE_MAIN_FAQ);
|
||||
ARouter.getInstance().build("/app/CollegeFAQActivity").navigation();
|
||||
break;
|
||||
case 4:
|
||||
prefs.edit().putBoolean(Preferences.KEY_COLLEGE_ASK, true).apply();
|
||||
collegeDataList.get(4).setHasChecked(prefs.getBoolean(Preferences.KEY_COLLEGE_ASK, false));
|
||||
collegeItemAdapter.notifyData();
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.COLLEGE_MAIN_ASK);
|
||||
ARouter.getInstance().build("/app/CollegeForumActivity").navigation();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -167,6 +167,14 @@ public class CollegeFragment extends Fragment implements CollegeItemAdapter.Coll
|
|||
prefs.edit().putBoolean(Preferences.KEY_COLLEGE_QUICK, isHasCheckedTrain && isHasCheckedExecute && isHasCheckedApp && isHasCheckedVideo).apply();
|
||||
collegeDataList.get(2).setHasChecked(prefs.getBoolean(Preferences.KEY_COLLEGE_QUICK, false));
|
||||
collegeItemAdapter.notifyData();
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.COLLEGE_QUICK_WEB_ARRAY[position]);
|
||||
if (position == 0) {
|
||||
ARouter.getInstance().build("/app/CollegeTrainingmodelActivity").navigation();
|
||||
} else if (position == 1) {
|
||||
ARouter.getInstance().build("/app/CollegePerformReasoningActivity").navigation();
|
||||
} else if (position == 2) {
|
||||
ARouter.getInstance().build("/app/CollegeBrokensideActivity").navigation();
|
||||
} else if (position == 3) {
|
||||
ARouter.getInstance().build("/app/CollegeReferencevideoActivity").navigation();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,8 +27,6 @@ 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,9 +68,12 @@ public class VisionFragment extends Fragment implements View.OnClickListener {
|
|||
view.findViewById(R.id.btn_style_transfer).setOnClickListener(this); //onClickStyleTransfer
|
||||
view.findViewById(R.id.btn_segmentation).setOnClickListener(this); //onClickSegmentation
|
||||
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
|
||||
view.findViewById(R.id.btn_text_recognition).setOnClickListener(this); //onClickTextRecognition
|
||||
view.findViewById(R.id.btn_gesture).setOnClickListener(this); //onClickGestureRecognition
|
||||
view.findViewById(R.id.btn_texttranslation).setOnClickListener(this); //onClickTextTranslation
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -87,30 +88,34 @@ public class VisionFragment extends Fragment implements View.OnClickListener {
|
|||
ARouter.getInstance().build("/imageobject/ObjectCameraActivity").navigation();
|
||||
break;
|
||||
case R.id.btn_posenet:
|
||||
ARouter.getInstance().build("/posenet/PosenetMainActivity").navigation();
|
||||
ARouter.getInstance().build("/hms/PosenetMainActivitys").navigation();
|
||||
break;
|
||||
case R.id.btn_style_transfer:
|
||||
ARouter.getInstance().build("/styletransfer/StyleMainActivity").navigation();
|
||||
break;
|
||||
case R.id.btn_segmentation:
|
||||
ARouter.getInstance().build("/segmentation/SegmentationMainActivity").navigation();
|
||||
ARouter.getInstance().build("/hms/PortraitSegmentationActivity").navigation();
|
||||
// ARouter.getInstance().build("/hms/ImageSegmentationLiveAnalyseActivity").navigation();
|
||||
// ARouter.getInstance().build("/hms/ImageSegmentationActivity").navigation();
|
||||
break;
|
||||
case R.id.btn_image:
|
||||
ARouter.getInstance().build("/imageobject/ImageCameraActivity")
|
||||
.withInt("OPEN_TYPE", 1).navigation();
|
||||
break;
|
||||
case R.id.btn_image_garbage:
|
||||
ARouter.getInstance().build("/imageobject/ImageCameraActivity")
|
||||
.withInt("OPEN_TYPE", 2).navigation();
|
||||
ARouter.getInstance().build("/imageobject/ImageCameraActivity").navigation();
|
||||
break;
|
||||
case R.id.btn_scene:
|
||||
ARouter.getInstance().build("/imageobject/ImageCameraActivity")
|
||||
.withInt("OPEN_TYPE", 3).navigation();
|
||||
ARouter.getInstance().build("/hms/SenceDetectionStillAnalyseActivity").navigation();
|
||||
break;
|
||||
case R.id.btn_image_Intelligent_poetry:
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.HELP_INTELLIGENT_POETRY);
|
||||
ARouter.getInstance().build("/app/IntelligentPoetryWritingActivity").navigation();
|
||||
break;
|
||||
case R.id.btn_text_recognition:
|
||||
ARouter.getInstance().build("/hms/TextRecognitionActivity").navigation();
|
||||
break;
|
||||
case R.id.btn_gesture:
|
||||
ARouter.getInstance().build("/hms/StillHandGestureAnalyseActivity").navigation();
|
||||
break;
|
||||
case R.id.btn_texttranslation:
|
||||
ARouter.getInstance().build("/hms/TextTranslationActivity").navigation();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,8 +17,8 @@ package com.mindspore.himindspore.ui.guide;
|
|||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
|
@ -52,7 +52,6 @@ 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";
|
||||
|
@ -70,6 +69,7 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
|
|||
private TextView mTv_protocol;
|
||||
private PopupWindow mPopupW;
|
||||
|
||||
private boolean isLoadindFinish = false;
|
||||
@Override
|
||||
protected void init() {
|
||||
cdvTime = findViewById(R.id.cdv_time);
|
||||
|
@ -80,10 +80,16 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
|
|||
private void initCountDownView() {
|
||||
cdvTime.setTime(3);
|
||||
cdvTime.start();
|
||||
cdvTime.setOnLoadingFinishListener(() -> check());
|
||||
cdvTime.setOnLoadingFinishListener(() -> {
|
||||
cdvTime.stop();
|
||||
isLoadindFinish= true;
|
||||
check();
|
||||
});
|
||||
cdvTime.setOnClickListener(view -> {
|
||||
if (!isLoadindFinish) {
|
||||
cdvTime.stop();
|
||||
check();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -96,7 +102,7 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
|
|||
@AfterPermissionGranted(REQUEST_PERMISSION)
|
||||
private void startPermissionsTask() {
|
||||
if (hasPermissions()) {
|
||||
setHandler();
|
||||
enterMainView();
|
||||
} else {
|
||||
EasyPermissions.requestPermissions(this,
|
||||
this.getResources().getString(R.string.app_need_permission),
|
||||
|
@ -132,7 +138,7 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
|
|||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == AppSettingsDialog.DEFAULT_SETTINGS_REQ_CODE) {
|
||||
setHandler();
|
||||
enterMainView();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,9 +167,6 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
|
|||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private void setHandler() {
|
||||
enterMainView();
|
||||
}
|
||||
|
||||
private void enterMainView() {
|
||||
Intent intent = new Intent();
|
||||
|
|
|
@ -223,7 +223,7 @@ public class MainActivity extends BaseActivity<MainPresenter> implements MainCon
|
|||
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||
progressDialog.setTitle(getResources().getString(R.string.app_is_loading));
|
||||
progressDialog.setMessage(getResources().getString(R.string.app_wait));
|
||||
progressDialog.setProgressNumberFormat("%1d Mb/%2d Mb");
|
||||
// progressDialog.setProgressNumberFormat("%1d Mb/%2d Mb");
|
||||
progressDialog.setProgress(0);
|
||||
progressDialog.show();
|
||||
presenter.downloadApk(getApkPath(), "MindSpore_inhand.apk", new FileDownLoadObserver<File>() {
|
||||
|
@ -240,7 +240,7 @@ public class MainActivity extends BaseActivity<MainPresenter> implements MainCon
|
|||
@Override
|
||||
public void onProgress(final int progress, final long total) {
|
||||
runOnUiThread(() -> {
|
||||
progressDialog.setMax((int) total / 1024 / 1024);
|
||||
// progressDialog.setMax((int) total / 1024 / 1024);
|
||||
progressDialog.setProgress(progress);
|
||||
});
|
||||
|
||||
|
|
|
@ -17,32 +17,55 @@ package com.mindspore.himindspore.ui.main;
|
|||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
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/PrivacyPolicyActivity")
|
||||
public class PrivacyPolicyActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = PrivacyPolicyActivity.class.getSimpleName();
|
||||
|
||||
private WebView mWebView;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
@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());
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mWebView.loadUrl(MSLinkUtils.USER_PRIVACY_RULES);
|
||||
|
||||
}
|
||||
|
|
|
@ -28,10 +28,9 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
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 {
|
||||
|
||||
|
@ -57,6 +56,7 @@ public class MeFragment extends Fragment implements View.OnClickListener {
|
|||
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);
|
||||
view.findViewById(R.id.rl_me_qr_code).setOnClickListener(this);
|
||||
showPackageInfo();
|
||||
}
|
||||
|
||||
|
@ -88,19 +88,22 @@ public class MeFragment extends Fragment implements View.OnClickListener {
|
|||
onClickShare();
|
||||
break;
|
||||
case R.id.rl_me_thumbsup:
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.ME_STAR_URL);
|
||||
ARouter.getInstance().build("/app/MeThumbsupActivity").navigation();
|
||||
break;
|
||||
case R.id.rl_me_official:
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.BASE_URL);
|
||||
ARouter.getInstance().build("/app/MeOfficialwebsiteActivity").navigation();
|
||||
break;
|
||||
case R.id.rl_me_official_code:
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.ME_CODE_URL);
|
||||
ARouter.getInstance().build("/app/MeCodeRepositoryActivity").navigation();
|
||||
break;
|
||||
case R.id.rl_me_qa:
|
||||
Utils.openBrowser(getActivity(), MSLinkUtils.ME_HELP_URL);
|
||||
ARouter.getInstance().build("/app/MeProblemFeedbackActivity").navigation();
|
||||
break;
|
||||
case R.id.me_user_protocol:
|
||||
startActivity(new Intent(getContext(), PrivacyPolicyActivity.class));
|
||||
ARouter.getInstance().build("/app/PrivacyPolicyActivity").navigation();
|
||||
break;
|
||||
case R.id.rl_me_qr_code:
|
||||
ARouter.getInstance().build("/app/MyQRCodeActivity").navigation();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
package com.mindspore.himindspore.ui.me;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mindspore.himindspore.R;
|
||||
|
||||
@Route(path = "/app/MyQRCodeActivity")
|
||||
public class MyQRCodeActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "MyQRCodeActivity";
|
||||
private PopupWindow popupWindow;
|
||||
private View save_and_cancels_image;
|
||||
private RelativeLayout mMy_layout;
|
||||
|
||||
private ImageView mQr_code_image;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_my_qr_code);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
Toolbar mToolbar = findViewById(R.id.segmentation_toolbar);
|
||||
setSupportActionBar(mToolbar);
|
||||
mToolbar.setNavigationOnClickListener(view -> finish());
|
||||
mMy_layout = (RelativeLayout) findViewById(R.id.my_relativelayout);
|
||||
mQr_code_image = findViewById(R.id.img_origin);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
Log.i(TAG, "onCreateOptionsMenu info");
|
||||
getMenuInflater().inflate(R.menu.menu_setting_qr, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
findViewById(R.id.item_more_qr).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
save_and_cancels_image = layoutInflater.inflate(R.layout.save_qr_code_popupwindo, null);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
popupWindow = new PopupWindow(save_and_cancels_image, dm.widthPixels, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
popupWindow.setAnimationStyle(R.style.anims);
|
||||
popupWindow.setFocusable(true);
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setBackgroundDrawable(new BitmapDrawable());
|
||||
backgroundAlpha(0.5f);
|
||||
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
backgroundAlpha(1f);
|
||||
|
||||
}
|
||||
});
|
||||
popupWindow.showAtLocation(mMy_layout, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
|
||||
save_and_cancels_image.findViewById(R.id.my_save_picture).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SaveImageToSysAlbum();
|
||||
}
|
||||
});
|
||||
save_and_cancels_image.findViewById(R.id.my_cancel).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public void backgroundAlpha(float bgAlpha) {
|
||||
WindowManager.LayoutParams lp = getWindow().getAttributes();
|
||||
lp.alpha = bgAlpha;
|
||||
getWindow().setAttributes(lp);
|
||||
}
|
||||
|
||||
private void SaveImageToSysAlbum() {
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
mQr_code_image.setDrawingCacheEnabled(true);
|
||||
mQr_code_image.buildDrawingCache();
|
||||
Bitmap bitmap = Bitmap.createBitmap(mQr_code_image.getDrawingCache());
|
||||
if (bitmap != null) {
|
||||
try {
|
||||
ContentResolver cr = getContentResolver();
|
||||
String url = MediaStore.Images.Media.insertImage(cr, bitmap,
|
||||
String.valueOf(System.currentTimeMillis()), "");
|
||||
Toast.makeText(this.getApplicationContext(), R.string.save_success, Toast.LENGTH_SHORT).show();
|
||||
popupWindow.dismiss();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this.getApplicationContext(), R.string.save_failure, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(this.getApplicationContext(), R.string.save_success, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/**
|
||||
* 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.poetry;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
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/IntelligentPoetryWritingActivity")
|
||||
public class IntelligentPoetryWritingActivity extends AppCompatActivity {
|
||||
|
||||
private WebView mWebView;
|
||||
private ProgressBar progressBar;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_intelligent_poetry_writing);
|
||||
progressBar = findViewById(R.id.progress);
|
||||
initView();
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("JavascriptInterface")
|
||||
private void initView() {
|
||||
findViewById(R.id.w_back).setOnClickListener(v -> finish());
|
||||
mWebView = findViewById(R.id.mWebView);
|
||||
WebSettings wSet = mWebView.getSettings();
|
||||
wSet.setJavaScriptEnabled(true);
|
||||
wSet.setDomStorageEnabled(true);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
// mWebView.loadUrl("http://114.116.235.161/resources/tech/nlp/poetry");
|
||||
mWebView.loadUrl(MSLinkUtils.HELP_INTELLIGENT_POETRY);
|
||||
mWebView.addJavascriptInterface(IntelligentPoetryWritingActivity.this,"android");
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void getGeneratePoetry(final String text){
|
||||
Intent intent = new Intent(IntelligentPoetryWritingActivity.this,PoetryPosterActivity.class);
|
||||
intent.putExtra("POEM",text);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mWebView.removeAllViews();
|
||||
mWebView.destroy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* 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.poetry;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.mindspore.common.utils.ImageUtils;
|
||||
import com.mindspore.himindspore.R;
|
||||
|
||||
public class PoetryPosterActivity extends AppCompatActivity {
|
||||
|
||||
private Button saveBtn, shareBtn;
|
||||
private PoetryView poetryView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_poetry_poster);
|
||||
findViewById(R.id.w_back).setOnClickListener(v -> finish());
|
||||
String poem = getIntent().getStringExtra("POEM");
|
||||
saveBtn = findViewById(R.id.save_btn);
|
||||
shareBtn = findViewById(R.id.share_btn);
|
||||
poetryView = findViewById(R.id.top_layout);
|
||||
|
||||
poetryView.setPoemText(poem);
|
||||
|
||||
saveBtn.setOnClickListener(view -> {
|
||||
Uri imgPath = ImageUtils.saveToAlbum(PoetryPosterActivity.this, poetryView,null,false);
|
||||
if (imgPath != null) {
|
||||
Toast.makeText(PoetryPosterActivity.this, R.string.poem_save_success, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
shareBtn.setOnClickListener(view -> {
|
||||
Uri imgPath = ImageUtils.saveToAlbum(PoetryPosterActivity.this, poetryView,"poemshare",false);
|
||||
Intent share_intent = new Intent();
|
||||
share_intent.setAction(Intent.ACTION_SEND);
|
||||
share_intent.setType("image/*");
|
||||
share_intent.putExtra(Intent.EXTRA_STREAM, imgPath);
|
||||
share_intent = Intent.createChooser(share_intent, getString(R.string.title_share));
|
||||
startActivity(share_intent);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* 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.poetry;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mindspore.himindspore.R;
|
||||
|
||||
public class PoetryView extends RelativeLayout {
|
||||
|
||||
private final TextView poemText;
|
||||
|
||||
public PoetryView(Context context) {
|
||||
this(context,null);
|
||||
}
|
||||
|
||||
public PoetryView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs,0);
|
||||
}
|
||||
|
||||
public PoetryView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
View view = View.inflate(context, R.layout.layout_poem,this);
|
||||
poemText =view.findViewById(R.id.poemContent);
|
||||
}
|
||||
|
||||
public void setPoemText(String content){
|
||||
poemText.setText(content);
|
||||
}
|
||||
|
||||
}
|
|
@ -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 MyButton extends RelativeLayout {
|
||||
|
||||
public MyButton(Context context)
|
||||
{
|
||||
super(context, null);
|
||||
}
|
||||
|
||||
public MyButton(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LayoutInflater.from(context).inflate(R.layout.my_button, this,true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* 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.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 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.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.mindspore.himindspore.R;
|
||||
|
||||
public class WebViewUtilsActivity extends AppCompatActivity {
|
||||
|
||||
private WebView mWebView;
|
||||
private ProgressBar progressBar;
|
||||
private final String mWebViewUtil = "";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_web_view_utils);
|
||||
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.setNavigationOnClickListener(view -> finish());
|
||||
mWebView = findViewById(R.id.mWebView);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mWebView.removeAllViews();
|
||||
mWebView.destroy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:duration="300"
|
||||
android:fromYDelta="100%"
|
||||
android:toXDelta="0">
|
||||
</translate>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:duration="300"
|
||||
android:fromYDelta="0"
|
||||
android:toYDelta="100%">
|
||||
</translate>
|
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 569 B |
After Width: | Height: | Size: 658 KiB |
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="false" >
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="@color/white" />
|
||||
<solid android:color="@color/white" />
|
||||
<!--<corners android:radius="30dip" />-->
|
||||
<corners android:topLeftRadius="20dip"
|
||||
android:topRightRadius="20dip"
|
||||
/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
After Width: | Height: | Size: 6.8 KiB |
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="2dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:centerColor="#E3E3E3"
|
||||
android:endColor="#E6E6E6"
|
||||
android:startColor="#C8C8C8" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="2dp" />
|
||||
<gradient
|
||||
android:centerColor="#4AEA2F"
|
||||
android:endColor="#31CE15"
|
||||
android:startColor="#5FEC46" />
|
||||
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
|
@ -0,0 +1,43 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.CollegeBrokensideActivity">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/brokenside_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/title_college_broken_side"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone" />
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,43 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.CollegeFAQActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/CollegeFAQActivity_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/title_college_faq"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,43 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.CollegeForumActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/CollegeForumActivity_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/title_college_forum"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,43 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.CollegeOneHourActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/OneHour_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/title_college_one_hour"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,43 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.CollegePerformReasoningActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/perform_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/title_college_perform"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,43 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.CollegeReferencevideoActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/referencevideo_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/title_college_video"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,44 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.CollegeTrainingmodelActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/Trainingmodel_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/title_college_training"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layerType="software" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,38 @@
|
|||
<?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"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.poetry.IntelligentPoetryWritingActivity">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="50dp"
|
||||
/>
|
||||
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/progress"
|
||||
/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/w_back"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,44 @@
|
|||
<?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"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
tools:context=".ui.webview.MeCodeRepositoryActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/MeCodeRepositoryActivity_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/me_official_code_title"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,43 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.MeOfficialwebsiteActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/MeOfficialwebsiteActivity_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/me_official_title"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,44 @@
|
|||
<?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"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
tools:context=".ui.webview.MeProblemFeedbackActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/MeProblemFeedbackActivity_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/me_qa_title"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,43 @@
|
|||
<?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"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white"
|
||||
tools:context=".ui.webview.MeThumbsupActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/MeThumbsupActivity_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/me_up_title"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,39 @@
|
|||
<?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:id="@+id/my_relativelayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".ui.me.MyQRCodeActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/segmentation_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/me_my_qr_code"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@+id/segmentation_toolbar"
|
||||
android:background="@color/divider_gray" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_origin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/segmentation_toolbar"
|
||||
android:layout_centerInParent="true"
|
||||
android:padding="50dp"
|
||||
android:src="@mipmap/my_qr_code" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,86 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
tools:context=".ui.poetry.PoetryPosterActivity">
|
||||
|
||||
<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/title_intelligent_poetry"
|
||||
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" />
|
||||
|
||||
<com.mindspore.himindspore.ui.poetry.PoetryView
|
||||
android:id="@+id/top_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/bottom_layout"
|
||||
android:layout_below="@+id/w_view"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="20dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:layout_marginEnd="5dp"
|
||||
android:id="@+id/save_btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/item_bg_blue_rect"
|
||||
android:text="@string/poem_save_poster"
|
||||
android:textColor="@color/main_tab_text_checked"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<Button
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/share_btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:layout_toEndOf="@+id/save_btn"
|
||||
android:background="@drawable/item_bg_blue_rect"
|
||||
android:text="@string/poem_share_poster"
|
||||
android:textColor="@color/main_tab_text_checked"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
|
@ -1,51 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.main.PrivacyPolicyActivity">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/w_linear"
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/brokenside_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
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>
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:title="@string/me_user_agreements"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<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" />
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone" />
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/w_view"
|
||||
android:layout_below="@id/progress"
|
||||
android:layout_marginBottom="5dp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
|
@ -0,0 +1,36 @@
|
|||
<?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"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.webview.WebViewUtilsActivity">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/OneHour_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="@color/white"
|
||||
app:contentInsetLeft="0dp"
|
||||
app:contentInsetStart="0dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:navigationIcon="@drawable/icon_back"
|
||||
app:titleTextColor="@color/black" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:progressDrawable="@drawable/progressbar"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/mWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,6 +1,5 @@
|
|||
<?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">
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
@ -57,7 +58,7 @@
|
|||
<TextView
|
||||
style="@style/MeInfoTextLeftStyle"
|
||||
android:layout_marginStart="20dp"
|
||||
android:drawableStart="@drawable/me_share"
|
||||
app:drawableStartCompat="@drawable/me_share"
|
||||
android:drawablePadding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/me_share_title" />
|
||||
|
@ -71,6 +72,31 @@
|
|||
android:background="@drawable/me_go" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_me_qr_code"
|
||||
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"
|
||||
app:drawableStartCompat="@drawable/me_qr_code"
|
||||
android:drawablePadding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/me_my_qr_code" />
|
||||
|
||||
<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"
|
||||
|
@ -81,7 +107,7 @@
|
|||
<TextView
|
||||
style="@style/MeInfoTextLeftStyle"
|
||||
android:layout_marginStart="20dp"
|
||||
android:drawableStart="@drawable/me_up"
|
||||
app:drawableStartCompat="@drawable/me_up"
|
||||
android:drawablePadding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/me_up_title" />
|
||||
|
@ -105,7 +131,7 @@
|
|||
<TextView
|
||||
style="@style/MeInfoTextLeftStyle"
|
||||
android:layout_marginStart="20dp"
|
||||
android:drawableStart="@drawable/me_official"
|
||||
app:drawableStartCompat="@drawable/me_official"
|
||||
android:drawablePadding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/me_official_title" />
|
||||
|
@ -129,7 +155,7 @@
|
|||
<TextView
|
||||
style="@style/MeInfoTextLeftStyle"
|
||||
android:layout_marginStart="20dp"
|
||||
android:drawableStart="@drawable/me_official_code"
|
||||
app:drawableStartCompat="@drawable/me_official_code"
|
||||
android:drawablePadding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/me_official_code_title" />
|
||||
|
@ -153,7 +179,7 @@
|
|||
<TextView
|
||||
style="@style/MeInfoTextLeftStyle"
|
||||
android:layout_marginStart="20dp"
|
||||
android:drawableStart="@drawable/me_qa"
|
||||
app:drawableStartCompat="@drawable/me_qa"
|
||||
android:drawablePadding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/me_qa_title" />
|
||||
|
@ -177,7 +203,7 @@
|
|||
<TextView
|
||||
style="@style/MeInfoTextLeftStyle"
|
||||
android:layout_marginStart="20dp"
|
||||
android:drawableStart="@drawable/me_version"
|
||||
app:drawableStartCompat="@drawable/me_version"
|
||||
android:drawablePadding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/me_version_title" />
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:orientation="vertical">
|
||||
android:paddingBottom="30dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/title_vertical_line_one"
|
||||
|
@ -52,16 +52,15 @@
|
|||
android:layout_marginStart="18dp"
|
||||
android:layout_marginTop="13dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawableStart="@drawable/btn_test"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:onClick="onClickPhotoDetection"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_object"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_test"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title_vertical_line_one"
|
||||
app:layout_constraintWidth_percent="0.44"
|
||||
|
@ -73,16 +72,15 @@
|
|||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="18dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawableStart="@drawable/btn_video"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:onClick="onClickCameraDetection"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_object_camera"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_video"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_object"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
@ -93,16 +91,15 @@
|
|||
android:layout_height="50dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawableStart="@drawable/btn_posenet"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:onClick="onClickPoseNet"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_pose_net"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_posenet"
|
||||
app:layout_constraintStart_toStartOf="@+id/btn_object"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_object"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
@ -112,16 +109,15 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawableStart="@drawable/btn_style"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:onClick="onClickStyleTransfer"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_style_transfer"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_style"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_posenet"
|
||||
app:layout_constraintEnd_toEndOf="@+id/btn_object_camera"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
@ -133,16 +129,15 @@
|
|||
android:layout_height="50dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawableStart="@drawable/btn_segment"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:onClick="onClickSegmentation"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_segmentation"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_segment"
|
||||
app:layout_constraintStart_toStartOf="@+id/btn_posenet"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_posenet"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
@ -154,60 +149,57 @@
|
|||
android:layout_height="50dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawableStart="@drawable/btn_classification"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:onClick="onClickImage"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_image"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_classification"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_segmentation"
|
||||
app:layout_constraintEnd_toEndOf="@+id/btn_style_transfer"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_image_garbage"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawableStart="@drawable/btn_garbage"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:onClick="onClickGarbage"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_image_garbage"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/btn_segmentation"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_segmentation"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_scene"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawableStart="@drawable/btn_scene"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:onClick="onClickSceneDetection"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_scene"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_image_garbage"
|
||||
app:drawableStartCompat="@drawable/btn_scene"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_gesture"
|
||||
app:layout_constraintEnd_toEndOf="@+id/btn_image"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_gesture"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_gesture_recognition"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_gesture_recognition"
|
||||
app:layout_constraintStart_toStartOf="@+id/btn_segmentation"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_segmentation"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
<View
|
||||
android:id="@+id/title_vertical_line_two"
|
||||
android:layout_width="3dp"
|
||||
|
@ -220,7 +212,7 @@
|
|||
android:gravity="center_vertical"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_image_garbage"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_gesture"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
<TextView
|
||||
|
@ -236,18 +228,17 @@
|
|||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_image_garbage"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_gesture"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
|
||||
<com.mindspore.himindspore.ui.view.LeftImageRightTextButton
|
||||
<com.mindspore.himindspore.ui.view.MyButton
|
||||
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"
|
||||
|
@ -257,6 +248,45 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/title_vertical_line_two"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_text_recognition"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="18dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_text_extraction"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_text_extraction"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_image_Intelligent_poetry"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_texttranslation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:background="@drawable/btn_vision_item"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="4dp"
|
||||
android:text="@string/title_texttranslation"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/text_black"
|
||||
android:textSize="12sp"
|
||||
app:drawableStartCompat="@drawable/btn_text_translation"
|
||||
app:layout_constraintStart_toStartOf="@+id/btn_image_Intelligent_poetry"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btn_image_Intelligent_poetry"
|
||||
app:layout_constraintWidth_percent="0.44" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_intelligent_poter"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/btn_intelligent_poetry"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_poetry"
|
||||
android:layout_toRightOf="@id/image_intelligent_poter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/title_intelligent_poetry"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/text_black"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_toRightOf="@id/text_poetry"
|
||||
android:id="@+id/text_new"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="7sp"
|
||||
android:textColor="@color/text_red"
|
||||
android:text="@string/title_intelligent_poetry_new"
|
||||
android:textStyle="italic"
|
||||
/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/poem_bg"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="20dp"
|
||||
android:id="@+id/poemContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/poem_frame"
|
||||
android:gravity="center"
|
||||
android:padding="60dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/illustrate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="由MindSpore AI技术生成"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/illustrate"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/logo2" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignBottom="@+id/illustrate"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@mipmap/my_qr_code" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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>
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:background="@drawable/item_qrcode"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/my_save_picture"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_save_picture"
|
||||
android:onClick="onClickSave"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
<View
|
||||
android:id="@+id/w_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/divider_gray" />
|
||||
<TextView
|
||||
android:id="@+id/my_cancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_cancel"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 459 KiB |
|
@ -11,16 +11,24 @@
|
|||
<string name="app_wait">"Please wait..."</string>
|
||||
<string name="app_load_fail">"download failed"</string>
|
||||
<string name="app_update_lastest">Upgrade to a new version</string>
|
||||
<string name="app_save_picture">Save Picture</string>
|
||||
<string name="app_cancel">Cancel</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_object">Object Detection(Photo)</string>
|
||||
<string name="title_object_camera">Object Detection(Real-time)</string>
|
||||
<string name="title_pose_net">PoseNet</string>
|
||||
<string name="title_style_transfer">Style Transfer</string>
|
||||
<string name="title_segmentation">Image Segmentation</string>
|
||||
|
||||
<string name="title_segmentation">Portrait Segmentation</string>
|
||||
<string name="title_college_faq">FAQ</string>
|
||||
<string name="title_college_one_hour">One hour experience</string>
|
||||
<string name="title_college_forum">Forum questions</string>
|
||||
<string name="title_college_training">Training model</string>
|
||||
<string name="title_college_perform">Perform reasoning</string>
|
||||
<string name="title_college_broken_side">Broken side application</string>
|
||||
<string name="title_college_video">Reference video</string>
|
||||
<string name="title_source">Code</string>
|
||||
<string name="title_scene">Scene Detection</string>
|
||||
<string name="title_help">FeedBack</string>
|
||||
|
@ -28,7 +36,6 @@
|
|||
<string name="title_version">"Version: "</string>
|
||||
<string name="title_share">Share</string>
|
||||
<string name="title_share_commend">MindSpore掌中宝:A one-stop platform of collaborative learning, demonstrating, and experiencing for AI users.\t</string>
|
||||
|
||||
<string name="main_tab_title_one">Experience</string>
|
||||
<string name="main_tab_title_two">College</string>
|
||||
<string name="main_tab_title_three">Me</string>
|
||||
|
@ -42,6 +49,7 @@
|
|||
|
||||
<string name="me_title">Me</string>
|
||||
<string name="me_share_title">Share</string>
|
||||
<string name="me_my_qr_code">My QR Code</string>
|
||||
<string name="me_up_title">Like</string>
|
||||
<string name="me_qa_title">Feedback</string>
|
||||
<string name="me_agree">agree</string>
|
||||
|
@ -69,7 +77,6 @@
|
|||
<string name="college_ask_title">Ask on forum</string>
|
||||
<string name="college_light_title">~Illuminate your learning trip~</string>
|
||||
<string name="college_adapter_view">View</string>
|
||||
|
||||
<string name="college_dialog_title">Summary</string>
|
||||
<string name="college_dialog_content">\t\t MindSpore is an ALL-Scenario AI Computing Framework developed by Huawei.
|
||||
It takes into account the flexibility of academic research and high performance required by industry.
|
||||
|
@ -82,4 +89,12 @@
|
|||
creating all-inclusive AI applications and building AI Ecology with us.\n
|
||||
</string>
|
||||
<string name="splash_count_down">s</string>
|
||||
<string name="poem_save_share">save and share the picture</string>
|
||||
<string name="poem_save_poster">save the picture</string>
|
||||
<string name="poem_share_poster">share the picture</string>
|
||||
<string name="poem_save_success">save successfully</string>
|
||||
<string name="me_user_agreements">User Agreement and Privacy Policy</string>
|
||||
<string name="save_failure">Save failure</string>
|
||||
|
||||
|
||||
</resources>
|
|
@ -11,15 +11,17 @@
|
|||
<string name="app_wait">"请稍候..."</string>
|
||||
<string name="app_load_fail">"下载失败"</string>
|
||||
<string name="app_update_lastest">"请升级新版本"</string>
|
||||
<string name="app_save_picture">保存图片</string>
|
||||
<string name="app_cancel">取消</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_object">对象检测(图片)</string>
|
||||
<string name="title_object_camera">对象检测(实时)</string>
|
||||
<string name="title_pose_net"> 骨骼检测</string>
|
||||
<string name="title_style_transfer">风格迁移</string>
|
||||
<string name="title_segmentation">图像分割</string>
|
||||
<string name="title_segmentation">人像分割</string>
|
||||
<string name="title_source">代码</string>
|
||||
<string name="title_scene">场景检测</string>
|
||||
<string name="title_help">反馈</string>
|
||||
|
@ -27,11 +29,9 @@
|
|||
<string name="title_version">版本号: </string>
|
||||
<string name="title_share">分享</string>
|
||||
<string name="title_share_commend">MindSpore掌中宝:AI爱好者的一站式协同学习、演示、体验平台\t</string>
|
||||
|
||||
<string name="main_tab_title_one">体验</string>
|
||||
<string name="main_tab_title_two">学院</string>
|
||||
<string name="main_tab_title_three">我的</string>
|
||||
|
||||
<string name="tab_experience_one">视觉图像技术</string>
|
||||
<string name="tab_speech_two">语音语义技术</string>
|
||||
|
||||
|
@ -41,11 +41,19 @@
|
|||
|
||||
<string name="me_title">我的</string>
|
||||
<string name="me_share_title">一键分享</string>
|
||||
<string name="me_my_qr_code">我的二维码</string>
|
||||
<string name="me_up_title">一键点赞</string>
|
||||
<string name="me_qa_title">问题反馈</string>
|
||||
<string name="me_version_title">版本号</string>
|
||||
<string name="me_official_title">官方网站</string>
|
||||
<string name="me_official_code_title">官方代码仓</string>
|
||||
<string name="title_college_faq">FAQ</string>
|
||||
<string name="title_college_one_hour">一小时体验</string>
|
||||
<string name="title_college_forum">论坛提问</string>
|
||||
<string name="title_college_training">训练模型</string>
|
||||
<string name="title_college_perform">执行推理</string>
|
||||
<string name="title_college_broken_side">端侧应用</string>
|
||||
<string name="title_college_video">参考视频</string>
|
||||
<string name="me_agree">同意</string>
|
||||
<string name="me_disagree_and_exit">不同意并退出</string>
|
||||
<string name="me_user_agreement">《用户协议和隐私政策》</string>
|
||||
|
@ -67,12 +75,16 @@
|
|||
<string name="college_ask_title">论坛提问</string>
|
||||
<string name="college_light_title">~点亮您的学习之旅~</string>
|
||||
<string name="college_adapter_view">查看</string>
|
||||
|
||||
<string name="college_dialog_title">简介</string>
|
||||
<string name="college_dialog_content">\t\t\t MindSpore是华为自研的全场景AI计算框架,
|
||||
兼顾学术界研究的灵活性与工业界的高性能要求,支持端边云全场景业务,为开发者带来编程更简单、调试更轻松、性能更卓越、部署更灵活的体验。\n\n
|
||||
\t\t\t MindSpore致力于构筑面向全球的开源社区,持续推动AI软硬件应用开源生态繁荣发展,已于2020年3月28日开源。\n\n
|
||||
\t\t\t 版本在不断迭代更新中,MindSpore也会持续提供更多的学习资源、支持与服务,欢迎各行各业的开发者与伙伴深度参与、贡献智慧,打造无所不及的AI应用,与我们共建AI生态。\n</string>
|
||||
<string name="splash_count_down">秒</string>
|
||||
<string name="poem_save_share">保存分享图片</string>
|
||||
<string name="poem_save_poster">保存图片</string>
|
||||
<string name="poem_share_poster">分享图片</string>
|
||||
<string name="poem_save_success">保存成功</string>
|
||||
<string name="save_failure">保存失败</string>
|
||||
|
||||
</resources>
|
|
@ -10,16 +10,24 @@
|
|||
<string name="app_wait">"请稍候..."</string>
|
||||
<string name="app_load_fail">"下载失败"</string>
|
||||
<string name="app_update_lastest">"请升级新版本"</string>
|
||||
<string name="app_save_picture">保存图片</string>
|
||||
<string name="app_cancel">取消</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_object">Object Detection(Photo)</string>
|
||||
<string name="title_object_camera">Object Detection(Real-time)</string>
|
||||
<string name="title_pose_net">PoseNet</string>
|
||||
<string name="title_style_transfer">Style Transfer</string>
|
||||
<string name="title_segmentation">Image Segmentation</string>
|
||||
|
||||
<string name="title_segmentation">Portrait Segmentation</string>
|
||||
<string name="title_college_faq">FAQ</string>
|
||||
<string name="title_college_one_hour">一小时体验</string>
|
||||
<string name="title_college_forum">论坛提问</string>
|
||||
<string name="title_college_training">训练模型</string>
|
||||
<string name="title_college_perform">执行推理</string>
|
||||
<string name="title_college_broken_side">端侧应用</string>
|
||||
<string name="title_college_video">参考视频</string>
|
||||
<string name="title_source">Code</string>
|
||||
<string name="title_scene">Scene Detection</string>
|
||||
<string name="title_help">FeedBack</string>
|
||||
|
@ -44,6 +52,7 @@
|
|||
<!-- me fragment -->
|
||||
<string name="me_title">我的</string>
|
||||
<string name="me_share_title">一键分享</string>
|
||||
<string name="me_my_qr_code">我的二维码</string>
|
||||
<string name="me_up_title">一键点赞</string>
|
||||
<string name="me_official_title">官方网站</string>
|
||||
<string name="me_official_code_title">官方代码仓</string>
|
||||
|
@ -66,7 +75,6 @@
|
|||
<string name="college_faq_title">FAQ</string>
|
||||
<string name="college_ask_title">论坛提问</string>
|
||||
<string name="college_light_title">~点亮您的学习之旅~</string>
|
||||
|
||||
<string name="college_adapter_view">查看</string>
|
||||
<string name="college_dialog_title">简介</string>
|
||||
<string name="college_dialog_content">\t\t\tMindSpore是华为自研的全场景AI计算框架,
|
||||
|
@ -75,4 +83,10 @@
|
|||
\t\t\t版本在不断迭代更新中,MindSpore也会持续提供更多的学习资源、支持与服务,欢迎各行各业的开发者与伙伴深度参与、贡献智慧,打造无所不及的AI应用,与我们共建AI生态。\n</string>
|
||||
<string name="college_execute_title">" "</string>
|
||||
|
||||
<string name="poem_save_poster">保存图片</string>
|
||||
<string name="poem_share_poster">分享图片</string>
|
||||
<string name="poem_save_success">保存成功</string>
|
||||
<string name="poem_save_share">保存分享图片</string>
|
||||
<string name="save_failure">保存失败</string>
|
||||
|
||||
</resources>
|
|
@ -13,8 +13,10 @@
|
|||
<item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="anims" parent="AppTheme">
|
||||
<item name="android:windowEnterAnimation">@anim/anim_enter</item>
|
||||
<item name="android:windowExitAnimation">@anim/anim_exit</item>
|
||||
</style>
|
||||
|
||||
<!-- Text style "" -->
|
||||
<!-- Add this snippet to styles.xml. -->
|
||||
|
|
|
@ -5,10 +5,12 @@ buildscript {
|
|||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven {url 'https://developer.huawei.com/repo/'}
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:4.0.1"
|
||||
classpath 'com.huawei.agconnect:agcp:1.4.2.300'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +20,7 @@ allprojects {
|
|||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven {url 'https://developer.huawei.com/repo/'}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ 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 API_KEY = "CgB6e3x9ss3nul/jhX9/4Y54MU0plgs6E1bW5SY8YQnq/uWhQHRxVGTf5Jl9f5NjRpvl0QV3Ft9sPihQ/PSL6RjC";
|
||||
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};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
package com.mindspore.common.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ImageUtils {
|
||||
|
||||
private static final String TAG = "BitmapUtils";
|
||||
|
||||
|
||||
private static Bitmap loadBitmapFromView(View v, boolean isNeedCrop) {
|
||||
int w = v.getWidth();
|
||||
int h = v.getHeight();
|
||||
|
||||
Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
|
||||
Canvas c = new Canvas(bmp);
|
||||
v.layout((int) v.getX(), (int) v.getY(),
|
||||
(int) v.getX() + w, (int) v.getY() + h);
|
||||
v.draw(c);
|
||||
return isNeedCrop ? Bitmap.createBitmap(bmp, 0, 0, w / 10 * 9, h / 10 * 9, null, false) : bmp;
|
||||
}
|
||||
|
||||
|
||||
private static Uri sharePic(Context context, Bitmap cachebmp, String child) {
|
||||
final File qrImage = new File(Environment.getExternalStorageDirectory(), child + ".jpg");
|
||||
if (qrImage.exists()) {
|
||||
qrImage.delete();
|
||||
}
|
||||
try {
|
||||
qrImage.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
FileOutputStream fOut = null;
|
||||
try {
|
||||
fOut = new FileOutputStream(qrImage);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (cachebmp == null) {
|
||||
return null;
|
||||
}
|
||||
cachebmp.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
|
||||
try {
|
||||
fOut.flush();
|
||||
fOut.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Uri photoUri = FileProvider.getUriForFile(
|
||||
context, context.getPackageName() + ".fileprovider", qrImage);
|
||||
return photoUri;
|
||||
}
|
||||
|
||||
|
||||
// Save the picture to the system album and refresh it.
|
||||
public static Uri saveToAlbum(Context context, View view, String child, boolean isNeedCrop) {
|
||||
Bitmap cachebmp = loadBitmapFromView(view, isNeedCrop);
|
||||
File file = null;
|
||||
String fileName = TextUtils.isEmpty(child) ? System.currentTimeMillis() + ".jpg" : child + ".jpg";
|
||||
File root = new File(Environment.getExternalStorageDirectory().getAbsoluteFile(), context.getPackageName());
|
||||
File dir = new File(root, "image");
|
||||
if (dir.mkdirs() || dir.isDirectory()) {
|
||||
file = new File(dir, fileName);
|
||||
}
|
||||
FileOutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(file);
|
||||
cachebmp.compress(Bitmap.CompressFormat.JPEG, 100, os);
|
||||
os.flush();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
// Gallery refresh.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
String path = null;
|
||||
try {
|
||||
path = file.getCanonicalPath();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
MediaScannerConnection.scanFile(context, new String[]{path}, null,
|
||||
(path1, uri) -> {
|
||||
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||
mediaScanIntent.setData(uri);
|
||||
context.sendBroadcast(mediaScanIntent);
|
||||
});
|
||||
} else {
|
||||
String relationDir = file.getParent();
|
||||
File file1 = new File(relationDir);
|
||||
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.fromFile(file1.getAbsoluteFile())));
|
||||
}
|
||||
|
||||
Uri photoUri = FileProvider.getUriForFile(
|
||||
context, context.getPackageName() + ".fileprovider", file);
|
||||
return photoUri;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.mindspore.common.utils;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class StringUtils {
|
||||
|
||||
|
||||
public static boolean checkChar(char ch) {
|
||||
return (ch + "").getBytes().length == 1;
|
||||
}
|
||||
|
||||
public static boolean isChinese(String str) {
|
||||
String regEx1 = "[\\u4e00-\\u9fa5]+";
|
||||
String regEx2 = "[\\uFF00-\\uFFEF]+";
|
||||
String regEx3 = "[\\u2E80-\\u2EFF]+";
|
||||
String regEx4 = "[\\u3000-\\u303F]+";
|
||||
String regEx5 = "[\\u31C0-\\u31EF]+";
|
||||
Pattern p1 = Pattern.compile(regEx1);
|
||||
Pattern p2 = Pattern.compile(regEx2);
|
||||
Pattern p3 = Pattern.compile(regEx3);
|
||||
Pattern p4 = Pattern.compile(regEx4);
|
||||
Pattern p5 = Pattern.compile(regEx5);
|
||||
Matcher m1 = p1.matcher(str);
|
||||
Matcher m2 = p2.matcher(str);
|
||||
Matcher m3 = p3.matcher(str);
|
||||
Matcher m4 = p4.matcher(str);
|
||||
Matcher m5 = p5.matcher(str);
|
||||
return m1.find() || m2.find() || m3.find() || m4.find() || m5.find();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/item_more_qr"
|
||||
android:title="more"
|
||||
android:orderInCategory="2"
|
||||
android:icon="@drawable/icon_more"
|
||||
app:showAsAction="always"/>
|
||||
</menu>
|
|
@ -9,7 +9,7 @@
|
|||
<string name="explain_garbage_classification">Garbage classification identifies the garbage category of the object detected by the camera lens.</string>
|
||||
<string name="explain_scene_detection">Scene detection can estimate the category of the target scene.</string>
|
||||
<string name="explain_title">Summary</string>
|
||||
<string name="segmentation_toolbar_title">Image Segmentation</string>
|
||||
<string name="segmentation_toolbar_title">Portrait Segmentation</string>
|
||||
<string name="style_transfer_title">Style Transfer</string>
|
||||
<string name="posenet_activity_title">PoseNet</string>
|
||||
<string name="image_scene_title">Scene Detection</string>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<string name="explain_garbage_classification">垃圾分类可识别出镜头中物体所属的垃圾类别。</string>
|
||||
<string name="explain_scene_detection">场景检测可以判断目标场景的类型。</string>
|
||||
<string name="explain_title">简要说明</string>
|
||||
<string name="segmentation_toolbar_title">图像分割</string>
|
||||
<string name="style_transfer_title">风格迁移</string>
|
||||
<string name="posenet_activity_title">骨骼检测</string>
|
||||
<string name="image_scene_title">场景检测</string>
|
||||
|
@ -17,4 +16,5 @@
|
|||
<string name="image_camera_title">图像分类</string>
|
||||
<string name="object_camery_title">视频检测</string>
|
||||
<string name="activity_photo_title">照片检测</string>
|
||||
<string name="segmentation_toolbar_title">人像分割</string>
|
||||
</resources>
|
|
@ -18,6 +18,6 @@
|
|||
<string name="image_scene_title">场景检测</string>
|
||||
<string name="posenet_activity_title">骨骼检测</string>
|
||||
<string name="style_transfer_title">风格迁移</string>
|
||||
<string name="segmentation_toolbar_title">图像分割</string>
|
||||
<string name="segmentation_toolbar_title">人像分割</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1 @@
|
|||
/build
|
|
@ -0,0 +1,95 @@
|
|||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.1"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
aaptOptions {
|
||||
noCompress "ms"
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
// Or, if you prefer, you can continue to check for errors in release builds,
|
||||
// but continue the build even when errors are found:
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation project(path: ':common')
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||
implementation 'com.alibaba:arouter-api:1.5.1'
|
||||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
|
||||
|
||||
implementation 'com.huawei.hms:ml-computer-vision-segmentation:2.2.0.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-multiclass-model:2.2.0.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-body-model:2.2.0.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-hair-model:2.2.0.300'
|
||||
|
||||
implementation 'com.huawei.hms:ml-computer-vision-ocr:2.0.5.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-ocr-latin-model:2.0.5.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-ocr-jk-model:2.0.5.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-ocr-cn-model:2.0.5.300'
|
||||
|
||||
implementation 'com.huawei.hms:ml-computer-vision-skeleton:2.0.4.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-skeleton-model:2.0.4.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-yoga-model:2.0.4.300'
|
||||
|
||||
implementation 'com.huawei.hms:ml-computer-vision-scenedetection:2.0.3.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-scenedetection-model:2.0.3.300'
|
||||
|
||||
implementation 'com.huawei.hms:ml-computer-vision-handkeypoint:2.1.0.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-handkeypoint-model:2.1.0.300'
|
||||
implementation 'com.huawei.hms:ml-computer-vision-gesture-model:2.1.0.300'
|
||||
|
||||
implementation 'com.huawei.hms:ml-computer-translate:2.2.0.300'
|
||||
implementation 'com.huawei.hms:ml-computer-translate-model:2.2.0.300'
|
||||
implementation 'com.huawei.hms:ml-computer-language-detection:2.2.0.300'
|
||||
implementation 'com.huawei.hms:ml-computer-language-detection-model:2.2.0.300'
|
||||
|
||||
}
|
|
@ -0,0 +1,207 @@
|
|||
beach
|
||||
bluesky
|
||||
sunset
|
||||
food
|
||||
flower
|
||||
greenplant
|
||||
snow
|
||||
night
|
||||
text
|
||||
cat
|
||||
dog
|
||||
fireworks
|
||||
overcast
|
||||
fallen
|
||||
panda
|
||||
car
|
||||
oldbuildings
|
||||
bicycle
|
||||
waterfall
|
||||
playground
|
||||
corridor
|
||||
cabin
|
||||
washroom
|
||||
kitchen
|
||||
bedroom
|
||||
diningroom
|
||||
livingroom
|
||||
skyscraper
|
||||
bridge
|
||||
waterside
|
||||
mountain
|
||||
overlook
|
||||
construction
|
||||
islam
|
||||
european
|
||||
footballfield
|
||||
baseballfield
|
||||
tenniscourt
|
||||
carinside
|
||||
badmintoncourt
|
||||
pingpangcourt
|
||||
swimmingpool
|
||||
alpaca
|
||||
library
|
||||
supermarket
|
||||
restaurant
|
||||
tiger
|
||||
penguin
|
||||
elephant
|
||||
dinosaur
|
||||
watersurface
|
||||
indoorbasketballcourt
|
||||
bowlingalley
|
||||
classroom
|
||||
rabbit
|
||||
rhinoceros
|
||||
camel
|
||||
tortoise
|
||||
leopard
|
||||
giraffe
|
||||
peacock
|
||||
kangaroo
|
||||
lion
|
||||
motorcycle
|
||||
aircraft
|
||||
train
|
||||
ship
|
||||
glasses
|
||||
watch
|
||||
highwheels
|
||||
washingmachine
|
||||
airconditioner
|
||||
camera
|
||||
map
|
||||
keyboard
|
||||
redenvelope
|
||||
fucharacter
|
||||
xicharacter
|
||||
dragondance
|
||||
liondance
|
||||
go
|
||||
teddybear
|
||||
transformer
|
||||
thesmurfs
|
||||
littlepony
|
||||
butterfly
|
||||
ladybug
|
||||
dragonfly
|
||||
billiardroom
|
||||
meetingroom
|
||||
office
|
||||
bar
|
||||
mallcourtyard
|
||||
deer
|
||||
cathedralhall
|
||||
bee
|
||||
helicopter
|
||||
mahjong
|
||||
chess
|
||||
McDonalds
|
||||
ornamentalfish
|
||||
widebuildings
|
||||
|
||||
|
||||
|
||||
沙滩
|
||||
蓝天
|
||||
日出日落
|
||||
美食
|
||||
花朵
|
||||
绿植
|
||||
雪景
|
||||
夜景
|
||||
文字
|
||||
猫
|
||||
狗
|
||||
烟花
|
||||
阴天
|
||||
秋叶
|
||||
熊猫
|
||||
汽车
|
||||
中式建筑
|
||||
自行车
|
||||
瀑布
|
||||
游乐场
|
||||
走廊巷道
|
||||
火车飞机内部
|
||||
卫生间
|
||||
厨房
|
||||
卧室
|
||||
餐厅
|
||||
客厅
|
||||
摩天大楼+塔
|
||||
桥梁
|
||||
海滨/湖滨
|
||||
山峰
|
||||
城市俯瞰
|
||||
工地
|
||||
伊斯兰式建筑
|
||||
欧式建筑
|
||||
足球场
|
||||
棒球场
|
||||
网球场
|
||||
轿车内部
|
||||
羽毛球馆
|
||||
乒乓球馆
|
||||
游泳馆
|
||||
羊驼
|
||||
图书馆
|
||||
超市
|
||||
饭店
|
||||
老虎
|
||||
企鹅
|
||||
大象
|
||||
恐龙
|
||||
水面
|
||||
室内篮球场
|
||||
保龄球馆
|
||||
教室
|
||||
兔子
|
||||
犀牛
|
||||
骆驼
|
||||
乌龟
|
||||
豹子
|
||||
长颈鹿
|
||||
孔雀
|
||||
袋鼠
|
||||
狮子
|
||||
电动车/摩托车
|
||||
飞机
|
||||
火车
|
||||
轮船
|
||||
眼镜
|
||||
手表
|
||||
高跟鞋
|
||||
洗衣机
|
||||
空调
|
||||
相机
|
||||
地图
|
||||
键盘
|
||||
红包
|
||||
福 字
|
||||
囍 字
|
||||
舞龙
|
||||
舞狮
|
||||
围棋
|
||||
泰迪熊
|
||||
京剧脸谱
|
||||
蓝精灵
|
||||
小马宝莉
|
||||
蝴蝶
|
||||
瓢虫
|
||||
蜻蜓
|
||||
桌球房
|
||||
会议室
|
||||
办公室
|
||||
酒吧
|
||||
商场中庭
|
||||
梅花鹿
|
||||
教堂正厅
|
||||
蜜蜂
|
||||
直升机
|
||||
麻将
|
||||
象棋
|
||||
麦当劳
|
||||
观赏鱼
|
||||
广角城楼
|
|
@ -1,14 +1,14 @@
|
|||
package com.mindspore.posenet;
|
||||
package com.mindspore.hms;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
|
@ -21,6 +21,6 @@ public class ExampleInstrumentedTest {
|
|||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.mindspore.posenet", appContext.getPackageName());
|
||||
assertEquals("com.mindspore.hms.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mindspore.hms">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true">
|
||||
<activity
|
||||
android:name=".ImageSegmentation.PortraitSegmentationActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".bonedetection.PosenetMainActivitys"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".bonedetection.LiveSkeletonAnalyseActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".texttranslation.TextTranslationRealTimeActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".gesturerecognition.LiveHandGestureAnalyseActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".texttranslation.TextTranslationActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".gesturerecognition.StillHandGestureAnalyseActivity"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".textrecognition.VideoTextRecognitionActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".scenedetection.SenceDetectionStillAnalyseActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".scenedetection.SenceDetectionLiveAnalyseActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ImageSegmentation.ImageSegmentationActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ImageSegmentation.ImageSegmentationLiveAnalyseActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
<activity
|
||||
android:name=".textrecognition.TextRecognitionActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,59 @@
|
|||
Afrikaans af
|
||||
Arabic ar
|
||||
Bulgarian bg
|
||||
Bengali bn
|
||||
Catalan ca
|
||||
Czech cs
|
||||
Welsh cy
|
||||
Danish da
|
||||
German de
|
||||
Greek el
|
||||
English en
|
||||
Spanish es
|
||||
Estonian et
|
||||
Finnish fi
|
||||
French fr
|
||||
Gujarati gu
|
||||
Hebrew he
|
||||
Hindi hi
|
||||
Croatian hr
|
||||
Hungarian hu
|
||||
Indonesian id
|
||||
Italian it
|
||||
Japanese ja
|
||||
Kannada kn
|
||||
Korean ko
|
||||
Lithuanian lt
|
||||
Macedonian mk
|
||||
Malayalam ml
|
||||
Marathi mr
|
||||
Dutch nl
|
||||
Punjabi pa
|
||||
Polish pl
|
||||
Portuguese pt
|
||||
Romanian ro
|
||||
Russian ru
|
||||
Slovak sk
|
||||
Slovenian sl
|
||||
Somali so
|
||||
Albanian sq
|
||||
Swedish sv
|
||||
Tamil ta
|
||||
Telugu te
|
||||
Thai th
|
||||
Tagalog tl
|
||||
Turkish tr
|
||||
Ukrainian uk
|
||||
Urdu ur
|
||||
Vietnamese vi
|
||||
Chinese zh
|
||||
Malaysian ms
|
||||
Norwegian no
|
||||
Chinese(Traditional) zh-HK
|
||||
Serbian sr
|
||||
Myanmar my
|
||||
Khmer km
|
||||
Persian fa
|
||||
Latvian lv
|
||||
Filipino tl
|
||||
Chinese(Traditional) zh-hk
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.mindspore.imagesegmentation.help;
|
||||
package com.mindspore.hms;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
|
@ -23,13 +23,11 @@ import android.database.Cursor;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.media.ExifInterface;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -39,21 +37,10 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class BitmapUtils {
|
||||
private static final String TAG = "BitmapUtils";
|
||||
|
||||
public static void recycleBitmap(Bitmap... bitmaps) {
|
||||
for (Bitmap bitmap : bitmaps) {
|
||||
if (bitmap != null && !bitmap.isRecycled()) {
|
||||
bitmap.recycle();
|
||||
bitmap = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap getBitmapFormUri(Activity ac, Uri uri) {
|
||||
Bitmap bitmap = null;
|
||||
try {
|
||||
|
@ -116,7 +103,7 @@ public class BitmapUtils {
|
|||
}
|
||||
|
||||
public static File getFileFromMediaUri(Context ac, Uri uri) {
|
||||
if (uri.getScheme().toString().compareTo("content") == 0) {
|
||||
if (uri.getScheme().compareTo("content") == 0) {
|
||||
ContentResolver cr = ac.getContentResolver();
|
||||
Cursor cursor = cr.query(uri, null, null, null, null);
|
||||
if (cursor != null) {
|
||||
|
@ -127,7 +114,7 @@ public class BitmapUtils {
|
|||
return new File(filePath);
|
||||
}
|
||||
}
|
||||
} else if (uri.getScheme().toString().compareTo("file") == 0) {
|
||||
} else if (uri.getScheme().compareTo("file") == 0) {
|
||||
return new File(uri.toString().replace("file://", ""));
|
||||
}
|
||||
return null;
|
||||
|
@ -173,48 +160,22 @@ public class BitmapUtils {
|
|||
return returnBm;
|
||||
}
|
||||
|
||||
public static Bitmap scaleBitmapAndKeepRatio(Bitmap targetBmp, int reqHeightInPixels, int reqWidthInPixels) {
|
||||
if (targetBmp.getHeight() == reqHeightInPixels && targetBmp.getWidth() == reqWidthInPixels) {
|
||||
return targetBmp;
|
||||
}
|
||||
// Scale pictures to screen width.
|
||||
public static Bitmap zoomImage(Bitmap imageBitmap, int targetWidth, int maxHeight) {
|
||||
float scaleFactor =
|
||||
Math.max(
|
||||
(float) imageBitmap.getWidth() / (float) targetWidth,
|
||||
(float) imageBitmap.getHeight() / (float) maxHeight);
|
||||
Bitmap resizedBitmap =
|
||||
Bitmap.createScaledBitmap(
|
||||
imageBitmap,
|
||||
(int) (imageBitmap.getWidth() / scaleFactor),
|
||||
(int) (imageBitmap.getHeight() / scaleFactor),
|
||||
true);
|
||||
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setRectToRect(new RectF(0f, 0f,
|
||||
targetBmp.getWidth(),
|
||||
targetBmp.getHeight()
|
||||
), new RectF(0f, 0f,
|
||||
reqWidthInPixels,
|
||||
reqHeightInPixels
|
||||
), Matrix.ScaleToFit.FILL);
|
||||
|
||||
return Bitmap.createBitmap(
|
||||
targetBmp, 0, 0,
|
||||
targetBmp.getWidth(),
|
||||
targetBmp.getHeight(), matrix, true
|
||||
);
|
||||
return resizedBitmap;
|
||||
}
|
||||
|
||||
public static ByteBuffer bitmapToByteBuffer(Bitmap bitmapIn, int width, int height, float mean, float std) {
|
||||
Bitmap bitmap = scaleBitmapAndKeepRatio(bitmapIn, width, height);
|
||||
ByteBuffer inputImage = ByteBuffer.allocateDirect(1 * width * height * 3 * 4);
|
||||
inputImage.order(ByteOrder.nativeOrder());
|
||||
inputImage.rewind();
|
||||
int[] intValues = new int[width * height];
|
||||
bitmap.getPixels(intValues, 0, width, 0, 0, width, height);
|
||||
int pixel = 0;
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
int value = intValues[pixel++];
|
||||
inputImage.putFloat(((float) (value >> 16 & 255) - mean) / std);
|
||||
inputImage.putFloat(((float) (value >> 8 & 255) - mean) / std);
|
||||
inputImage.putFloat(((float) (value & 255) - mean) / std);
|
||||
}
|
||||
}
|
||||
inputImage.rewind();
|
||||
return inputImage;
|
||||
}
|
||||
|
||||
|
||||
// Save the picture to the system album and refresh it.
|
||||
public static void saveToAlbum(final Context context, Bitmap bitmap) {
|
||||
File file = null;
|
||||
|
@ -255,13 +216,10 @@ public class BitmapUtils {
|
|||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
MediaScannerConnection.scanFile(context, new String[]{path}, null,
|
||||
new MediaScannerConnection.OnScanCompletedListener() {
|
||||
@Override
|
||||
public void onScanCompleted(String path, Uri uri) {
|
||||
(path1, uri) -> {
|
||||
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
|
||||
mediaScanIntent.setData(uri);
|
||||
context.sendBroadcast(mediaScanIntent);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
String relationDir = file.getParent();
|
|
@ -0,0 +1,227 @@
|
|||
/**
|
||||
* 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.hms.ImageSegmentation;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.huawei.hmf.tasks.Task;
|
||||
import com.huawei.hms.mlsdk.MLAnalyzerFactory;
|
||||
import com.huawei.hms.mlsdk.common.MLFrame;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentation;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationAnalyzer;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationScene;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationSetting;
|
||||
import com.mindspore.hms.BitmapUtils;
|
||||
import com.mindspore.hms.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
@Route(path = "/hms/ImageSegmentationActivity")
|
||||
public class ImageSegmentationActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = ImageSegmentationActivity.class.getSimpleName();
|
||||
private static final int RC_CHOOSE_PHOTO = 1;
|
||||
private static final int RC_CHOOSE_CAMERA = 2;
|
||||
|
||||
private ImageView imgPreview, mImageView;
|
||||
private Uri imageUri;
|
||||
|
||||
private Bitmap originBitmap;
|
||||
private MLImageSegmentationAnalyzer analyzer;
|
||||
private Bitmap bitmapFore;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_image_segmentation);
|
||||
createAnalyzer();
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
imgPreview = findViewById(R.id.img_origin);
|
||||
mImageView = findViewById(R.id.image_result);
|
||||
|
||||
Toolbar mToolbar = findViewById(R.id.ImageSegmentation_activity_toolbar);
|
||||
setSupportActionBar(mToolbar);
|
||||
mToolbar.setNavigationOnClickListener(view -> finish());
|
||||
}
|
||||
|
||||
|
||||
private void createAnalyzer() {
|
||||
MLImageSegmentationSetting setting = new MLImageSegmentationSetting.Factory()
|
||||
.setExact(false)
|
||||
.setAnalyzerType(MLImageSegmentationSetting.BODY_SEG)
|
||||
.setScene(MLImageSegmentationScene.ALL)
|
||||
.create();
|
||||
analyzer = MLAnalyzerFactory.getInstance().getImageSegmentationAnalyzer(setting);
|
||||
}
|
||||
|
||||
public void onClickPhoto(View view) {
|
||||
openGallay(RC_CHOOSE_PHOTO);
|
||||
}
|
||||
|
||||
public void onClickCamera(View view) {
|
||||
openCamera();
|
||||
}
|
||||
|
||||
|
||||
public void onClickRealTime(View view) {
|
||||
ARouter.getInstance().build("/hms/ImageSegmentationLiveAnalyseActivity").navigation();
|
||||
}
|
||||
|
||||
private void openGallay(int request) {
|
||||
Intent intent = new Intent(Intent.ACTION_PICK, null);
|
||||
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
|
||||
startActivityForResult(intent, request);
|
||||
}
|
||||
|
||||
public void onClickSave(View view) {
|
||||
if (this.bitmapFore == null) {
|
||||
Log.e(TAG, "null processed image");
|
||||
Toast.makeText(this.getApplicationContext(), R.string.no_pic_neededSave, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
BitmapUtils.saveToAlbum(getApplicationContext(), this.bitmapFore);
|
||||
Toast.makeText(this.getApplicationContext(), R.string.save_success, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void openCamera() {
|
||||
Intent intentToTakePhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
String mTempPhotoPath = Environment.getExternalStorageDirectory() + File.separator + "photo.jpeg";
|
||||
imageUri = FileProvider.getUriForFile(this, getApplicationContext().getPackageName() + ".fileprovider", new File(mTempPhotoPath));
|
||||
intentToTakePhoto.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
|
||||
startActivityForResult(intentToTakePhoto, RC_CHOOSE_CAMERA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (RC_CHOOSE_PHOTO == requestCode) {
|
||||
if (null != data && null != data.getData()) {
|
||||
this.imageUri = data.getData();
|
||||
showOriginImage();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
} else if (RC_CHOOSE_CAMERA == requestCode) {
|
||||
showOriginCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showOriginImage() {
|
||||
try {
|
||||
originBitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(imageUri));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (originBitmap != null) {
|
||||
Glide.with(this).load(originBitmap).into(imgPreview);
|
||||
showSegmentationImage();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
private void showSegmentationImage() {
|
||||
MLFrame frame = new MLFrame.Creator().setBitmap(originBitmap).create();
|
||||
Task<MLImageSegmentation> task = analyzer.asyncAnalyseFrame(frame);
|
||||
task.addOnSuccessListener(segmentation -> {
|
||||
// Processing logic for recognition success.
|
||||
if (segmentation != null) {
|
||||
displaySuccess(segmentation);
|
||||
}
|
||||
}).addOnFailureListener(e -> {
|
||||
displayFailure(e.toString());
|
||||
});
|
||||
}
|
||||
|
||||
private void showOriginCamera() {
|
||||
try {
|
||||
Pair<Integer, Integer> targetedSize = this.getTargetSize();
|
||||
int targetWidth = targetedSize.first;
|
||||
int maxHeight = targetedSize.second;
|
||||
Bitmap bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(imageUri));
|
||||
originBitmap = BitmapUtils.zoomImage(bitmap, targetWidth, maxHeight);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// Determine how much to scale down the image.
|
||||
if (originBitmap != null) {
|
||||
Glide.with(this).load(originBitmap).into(imgPreview);
|
||||
showSegmentationImage();
|
||||
}
|
||||
}
|
||||
|
||||
private Pair<Integer, Integer> getTargetSize() {
|
||||
return new Pair<>(((View) this.imgPreview.getParent()).getWidth(), ((View) this.imgPreview.getParent()).getHeight());
|
||||
}
|
||||
|
||||
|
||||
private void displaySuccess(MLImageSegmentation imageSegmentationResult) {
|
||||
// Draw the portrait with a transparent background.
|
||||
bitmapFore = imageSegmentationResult.getForeground();
|
||||
if (bitmapFore != null) {
|
||||
this.mImageView.setImageBitmap(bitmapFore);
|
||||
} else {
|
||||
this.displayFailure("bitmapFore is null.");
|
||||
}
|
||||
}
|
||||
|
||||
private void displayFailure(String str) {
|
||||
Log.e(TAG, str);
|
||||
Toast.makeText(this, R.string.segmentation_fail, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
stopAnalyzer();
|
||||
}
|
||||
|
||||
private void stopAnalyzer() {
|
||||
if (analyzer != null) {
|
||||
try {
|
||||
analyzer.stop();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,283 @@
|
|||
/**
|
||||
* 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.hms.ImageSegmentation;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.renderscript.RenderScript;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.huawei.hms.mlsdk.MLAnalyzerFactory;
|
||||
import com.huawei.hms.mlsdk.common.LensEngine;
|
||||
import com.huawei.hms.mlsdk.common.MLAnalyzer;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentation;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationAnalyzer;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationScene;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationSetting;
|
||||
import com.mindspore.hms.R;
|
||||
import com.mindspore.hms.camera.GraphicOverlay;
|
||||
import com.mindspore.hms.camera.LensEnginePreview;
|
||||
import com.mindspore.hms.camera.MLSegmentGraphic;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Route(path = "/hms/ImageSegmentationLiveAnalyseActivity")
|
||||
public class ImageSegmentationLiveAnalyseActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
private static final String TAG = ImageSegmentationLiveAnalyseActivity.class.getSimpleName();
|
||||
|
||||
private static final int CAMERA_PERMISSION_CODE = 0;
|
||||
|
||||
private MLImageSegmentationAnalyzer analyzer;
|
||||
|
||||
private LensEngine mLensEngine;
|
||||
|
||||
private LensEnginePreview mPreview;
|
||||
|
||||
private GraphicOverlay mOverlay;
|
||||
|
||||
private int lensType = LensEngine.FRONT_LENS;
|
||||
|
||||
private boolean isFront = true;
|
||||
|
||||
private boolean isPermissionRequested;
|
||||
|
||||
private static final String[] ALL_PERMISSION =
|
||||
new String[]{
|
||||
Manifest.permission.CAMERA,
|
||||
};
|
||||
|
||||
private RenderScript renderScript;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_image_segmentation_live_analyse);
|
||||
Toolbar mToolbar = findViewById(R.id.ImageSegmentation_activity_toolbar);
|
||||
setSupportActionBar(mToolbar);
|
||||
mToolbar.setNavigationOnClickListener(view -> finish());
|
||||
this.mPreview = this.findViewById(R.id.segment_preview);
|
||||
this.mOverlay = this.findViewById(R.id.segment_overlay);
|
||||
this.findViewById(R.id.facingSwitch).setOnClickListener(this);
|
||||
if (savedInstanceState != null) {
|
||||
this.lensType = savedInstanceState.getInt("lensType");
|
||||
}
|
||||
this.createSegmentAnalyzer();
|
||||
// Checking camera permissions.
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
||||
this.createLensEngine();
|
||||
} else {
|
||||
this.checkPermission();
|
||||
}
|
||||
renderScript = RenderScript.create(this);
|
||||
}
|
||||
|
||||
private void createLensEngine() {
|
||||
Context context = this.getApplicationContext();
|
||||
// Create LensEngine.
|
||||
this.mLensEngine = new LensEngine.Creator(context, this.analyzer).setLensType(this.lensType)
|
||||
.applyDisplayDimension(960, 720)
|
||||
.applyFps(25.0f)
|
||||
.enableAutomaticFocus(true)
|
||||
.create();
|
||||
}
|
||||
|
||||
// Permission application callback.
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
boolean hasAllGranted = true;
|
||||
if (requestCode == CAMERA_PERMISSION_CODE) {
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
this.createLensEngine();
|
||||
} else if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
|
||||
hasAllGranted = false;
|
||||
if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[0])) {
|
||||
showWaringDialog();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle savedInstanceState) {
|
||||
savedInstanceState.putInt("lensType", this.lensType);
|
||||
super.onSaveInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
||||
this.createLensEngine();
|
||||
this.startLensEngine();
|
||||
} else {
|
||||
this.checkPermission();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
this.isFront = !this.isFront;
|
||||
if (this.isFront) {
|
||||
this.lensType = LensEngine.FRONT_LENS;
|
||||
} else {
|
||||
this.lensType = LensEngine.BACK_LENS;
|
||||
}
|
||||
if (this.mLensEngine != null) {
|
||||
this.mLensEngine.close();
|
||||
}
|
||||
this.createLensEngine();
|
||||
this.startLensEngine();
|
||||
}
|
||||
|
||||
private void createSegmentAnalyzer() {
|
||||
// Create a segmentation analyzer. You can create an analyzer using the provided customized face detection parameter: MLImageSegmentationSetting
|
||||
MLImageSegmentationSetting setting = new MLImageSegmentationSetting.Factory()
|
||||
.setExact(false)
|
||||
.setScene(MLImageSegmentationScene.FOREGROUND_ONLY)
|
||||
.setAnalyzerType(MLImageSegmentationSetting.BODY_SEG)
|
||||
.create();
|
||||
this.analyzer = MLAnalyzerFactory.getInstance().getImageSegmentationAnalyzer(setting);
|
||||
this.analyzer.setTransactor(new MLAnalyzer.MLTransactor<MLImageSegmentation>() {
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transactResult(MLAnalyzer.Result<MLImageSegmentation> result) {
|
||||
mOverlay.clear();
|
||||
SparseArray<MLImageSegmentation> imageSegmentationResult = result.getAnalyseList();
|
||||
MLSegmentGraphic graphic = new MLSegmentGraphic(ImageSegmentationLiveAnalyseActivity.this, mPreview, mOverlay, imageSegmentationResult.valueAt(0), isFront);
|
||||
//mOverlay.setBackgroundColor(Color.BLUE);
|
||||
mOverlay.add(graphic);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startLensEngine() {
|
||||
if (this.mLensEngine != null) {
|
||||
try {
|
||||
this.mPreview.start(this.mLensEngine, this.mOverlay);
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to start lens engine.", e);
|
||||
this.mLensEngine.release();
|
||||
this.mLensEngine = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
this.mPreview.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
RenderScript.releaseAllContexts();
|
||||
} else {
|
||||
renderScript.finish();
|
||||
}
|
||||
if (this.mLensEngine != null) {
|
||||
this.mLensEngine.release();
|
||||
}
|
||||
if (this.analyzer != null) {
|
||||
try {
|
||||
this.analyzer.stop();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Stop failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check the permissions required by the SDK.
|
||||
private void checkPermission() {
|
||||
if (Build.VERSION.SDK_INT >= 23 && !isPermissionRequested) {
|
||||
isPermissionRequested = true;
|
||||
ArrayList<String> permissionsList = new ArrayList<>();
|
||||
for (String perm : getAllPermission()) {
|
||||
if (PackageManager.PERMISSION_GRANTED != this.checkSelfPermission(perm)) {
|
||||
permissionsList.add(perm);
|
||||
}
|
||||
}
|
||||
|
||||
if (!permissionsList.isEmpty()) {
|
||||
requestPermissions(permissionsList.toArray(new String[0]), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getAllPermission() {
|
||||
return Collections.unmodifiableList(Arrays.asList(ALL_PERMISSION));
|
||||
}
|
||||
|
||||
private void showWaringDialog() {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
|
||||
dialog.setMessage(R.string.app_need_permission)
|
||||
.setPositiveButton(R.string.app_permission_by_hand, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//Guide the user to the setting page for manual authorization.
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", getApplicationContext().getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
startActivity(intent);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
//Instruct the user to perform manual authorization. The permission request fails.
|
||||
finish();
|
||||
}
|
||||
}).setOnCancelListener(dialogInterface);
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
static DialogInterface.OnCancelListener dialogInterface = new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.mindspore.hms.ImageSegmentation;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public interface OnBackgroundImageListener {
|
||||
void onBackImageSelected(int position);
|
||||
|
||||
void onImageAdd(View view);
|
||||
}
|
|
@ -0,0 +1,234 @@
|
|||
package com.mindspore.hms.ImageSegmentation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Matrix;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.huawei.hms.mlsdk.MLAnalyzerFactory;
|
||||
import com.huawei.hms.mlsdk.common.LensEngine;
|
||||
import com.huawei.hms.mlsdk.common.MLAnalyzer;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentation;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationAnalyzer;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationScene;
|
||||
import com.huawei.hms.mlsdk.imgseg.MLImageSegmentationSetting;
|
||||
import com.mindspore.common.utils.ImageUtils;
|
||||
import com.mindspore.hms.ImageSegmentation.overlay.CameraImageGraphic;
|
||||
import com.mindspore.hms.ImageSegmentation.overlay.GraphicOverlay;
|
||||
import com.mindspore.hms.R;
|
||||
import com.mindspore.hms.camera.LensEnginePreview;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Route(path = "/hms/PortraitSegmentationActivity")
|
||||
public class PortraitSegmentationActivity extends AppCompatActivity implements OnBackgroundImageListener {
|
||||
|
||||
private static final int[] IMAGES = {R.drawable.portrait1, R.drawable.portrait2, R.drawable.portrait3, R.drawable.portrait4, R.drawable.portrait5, R.drawable.icon_default};
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
|
||||
private MLImageSegmentationAnalyzer analyzer;
|
||||
private LensEnginePreview mPreview;
|
||||
private GraphicOverlay mOverlay;
|
||||
private LensEngine mLensEngine;
|
||||
|
||||
private int lensType = LensEngine.FRONT_LENS;
|
||||
private boolean isFront = true;
|
||||
|
||||
private ImageView background;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_portrait);
|
||||
|
||||
init();
|
||||
createSegmentAnalyzer();
|
||||
if (savedInstanceState != null) {
|
||||
this.lensType = savedInstanceState.getInt("lensType");
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
Toolbar mToolbar = findViewById(R.id.activity_toolbar);
|
||||
setSupportActionBar(mToolbar);
|
||||
mToolbar.setNavigationOnClickListener(view -> finish());
|
||||
|
||||
recyclerView = findViewById(R.id.recycleView);
|
||||
LinearLayoutManager mHorizontalLinearLayout = new LinearLayoutManager(this, RecyclerView.HORIZONTAL, false);
|
||||
recyclerView.setLayoutManager(mHorizontalLinearLayout);
|
||||
recyclerView.setAdapter(new PortraitSegmentationAdapter(this, IMAGES, this));
|
||||
|
||||
mPreview = findViewById(R.id.preview);
|
||||
mOverlay = findViewById(R.id.graphic);
|
||||
background = findViewById(R.id.background);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle savedInstanceState) {
|
||||
savedInstanceState.putInt("lensType", this.lensType);
|
||||
super.onSaveInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
this.createLensEngine();
|
||||
this.startLensEngine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_setting, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.item_camera) {
|
||||
isFront = !isFront;
|
||||
if (isFront) {
|
||||
lensType = LensEngine.FRONT_LENS;
|
||||
} else {
|
||||
lensType = LensEngine.BACK_LENS;
|
||||
}
|
||||
if (mLensEngine != null) {
|
||||
mLensEngine.close();
|
||||
}
|
||||
createLensEngine();
|
||||
startLensEngine();
|
||||
} else if (itemId == R.id.item_save) {
|
||||
|
||||
mOverlay.setTag("mOverlay");
|
||||
mPreview.setTag("mPreview");
|
||||
Uri imgPath = ImageUtils.saveToAlbum(PortraitSegmentationActivity.this, mPreview,null,true);
|
||||
if (imgPath != null) {
|
||||
Toast.makeText(PortraitSegmentationActivity.this,"保存成功", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void createSegmentAnalyzer() {
|
||||
MLImageSegmentationSetting setting = new MLImageSegmentationSetting.Factory()
|
||||
.setExact(false)
|
||||
.setScene(MLImageSegmentationScene.FOREGROUND_ONLY)
|
||||
.setAnalyzerType(MLImageSegmentationSetting.BODY_SEG)
|
||||
.create();
|
||||
this.analyzer = MLAnalyzerFactory.getInstance().getImageSegmentationAnalyzer(setting);
|
||||
this.analyzer.setTransactor(new MLAnalyzer.MLTransactor<MLImageSegmentation>() {
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transactResult(MLAnalyzer.Result<MLImageSegmentation> result) {
|
||||
SparseArray<MLImageSegmentation> imageSegmentationResult = result.getAnalyseList();
|
||||
Bitmap bitmap = imageSegmentationResult.valueAt(0).getForeground();
|
||||
if (isFront) {
|
||||
bitmap = convert(bitmap);
|
||||
}
|
||||
mOverlay.clear();
|
||||
CameraImageGraphic cameraImageGraphic = new CameraImageGraphic(mOverlay, bitmap);
|
||||
mOverlay.addGraphic(cameraImageGraphic);
|
||||
mOverlay.postInvalidate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void createLensEngine() {
|
||||
Context context = this.getApplicationContext();
|
||||
// Create LensEngine.
|
||||
this.mLensEngine = new LensEngine.Creator(context, this.analyzer)
|
||||
.setLensType(lensType)
|
||||
.applyDisplayDimension(1280, 720)
|
||||
.applyFps(25.0f)
|
||||
.enableAutomaticFocus(true)
|
||||
.create();
|
||||
}
|
||||
|
||||
|
||||
private void startLensEngine() {
|
||||
if (mLensEngine != null) {
|
||||
try {
|
||||
mPreview.start(mLensEngine);
|
||||
} catch (IOException e) {
|
||||
mLensEngine.release();
|
||||
mLensEngine = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Bitmap convert(Bitmap bitmap) {
|
||||
Matrix m = new Matrix();
|
||||
m.setScale(-1, 1);
|
||||
Bitmap reverseBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
|
||||
return reverseBitmap;
|
||||
}
|
||||
|
||||
public void stopPreview() {
|
||||
mPreview.stop();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBackImageSelected(int position) {
|
||||
Glide.with(this).load(IMAGES[position]).into(background);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImageAdd(View view) {
|
||||
openGallay(1000);
|
||||
}
|
||||
|
||||
private void openGallay(int request) {
|
||||
Intent intentToPickPic = new Intent(Intent.ACTION_PICK, null);
|
||||
intentToPickPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
|
||||
startActivityForResult(intentToPickPic, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (1000 == requestCode) {
|
||||
if (null != data && null != data.getData()) {
|
||||
Glide.with(this).load(data.getData()).into(background);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (analyzer != null) {
|
||||
try {
|
||||
analyzer.stop();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
if (mLensEngine != null) {
|
||||
mLensEngine.release();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.mindspore.hms.ImageSegmentation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.mindspore.hms.R;
|
||||
|
||||
public class PortraitSegmentationAdapter extends RecyclerView.Adapter<PortraitSegmentationAdapter.PortraitItemViewHolder> {
|
||||
|
||||
|
||||
private final int[] IMAGES;
|
||||
private final Context context;
|
||||
private final OnBackgroundImageListener mListener;
|
||||
|
||||
public PortraitSegmentationAdapter(Context context, int[] IMAGES, OnBackgroundImageListener mListener) {
|
||||
this.IMAGES = IMAGES;
|
||||
this.context = context;
|
||||
this.mListener = mListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PortraitItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context)
|
||||
.inflate(R.layout.image_item, parent, false);
|
||||
return new PortraitItemViewHolder(view);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull PortraitItemViewHolder holder, int position) {
|
||||
Glide.with(context).
|
||||
load(IMAGES[position]).
|
||||
into(holder.getImageView());
|
||||
|
||||
View view = holder.getMView();
|
||||
view.setTag(IMAGES[position]);
|
||||
view.setOnClickListener(view1 -> {
|
||||
if (mListener != null) {
|
||||
if (IMAGES.length - 1 == position) {
|
||||
mListener.onImageAdd(holder.getImageView());
|
||||
} else {
|
||||
mListener.onBackImageSelected(position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return IMAGES == null ? 0 : IMAGES.length;
|
||||
}
|
||||
|
||||
|
||||
public class PortraitItemViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView imageView;
|
||||
private final View mView;
|
||||
|
||||
public final ImageView getImageView() {
|
||||
return this.imageView;
|
||||
}
|
||||
|
||||
public final void setImageView(ImageView imageView) {
|
||||
this.imageView = imageView;
|
||||
}
|
||||
|
||||
public final View getMView() {
|
||||
return this.mView;
|
||||
}
|
||||
|
||||
public PortraitItemViewHolder(View mView) {
|
||||
super(mView);
|
||||
this.mView = mView;
|
||||
this.imageView = mView.findViewById(R.id.image_view);
|
||||
}
|
||||
}
|
||||
}
|