diff --git a/model_zoo/official/lite/MindSpore_inhand/.gitignore b/model_zoo/official/lite/MindSpore_inhand/.gitignore index 693777911f0..149164da906 100644 --- a/model_zoo/official/lite/MindSpore_inhand/.gitignore +++ b/model_zoo/official/lite/MindSpore_inhand/.gitignore @@ -81,3 +81,4 @@ local.properties sdk/build sdk/.cxx app/.cxx +/mindsporelibrary/mindspore/ diff --git a/model_zoo/official/lite/MindSpore_inhand/app/agconnect-services.json b/model_zoo/official/lite/MindSpore_inhand/app/agconnect-services.json new file mode 100644 index 00000000000..92897b02394 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/agconnect-services.json @@ -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" + }] +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/build.gradle b/model_zoo/official/lite/MindSpore_inhand/app/build.gradle index 0ed6fad1696..2edff3dbc6d 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/build.gradle +++ b/model_zoo/official/lite/MindSpore_inhand/app/build.gradle @@ -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') } diff --git a/model_zoo/official/lite/MindSpore_inhand/app/proguard-rules.pro b/model_zoo/official/lite/MindSpore_inhand/app/proguard-rules.pro index e02524cc5e9..bcc5df412e3 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/proguard-rules.pro +++ b/model_zoo/official/lite/MindSpore_inhand/app/proguard-rules.pro @@ -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.** diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/AndroidManifest.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/AndroidManifest.xml index df044be4908..ab90d15c58c 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/AndroidManifest.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/AndroidManifest.xml @@ -16,16 +16,80 @@ + + + + + + + + + + + + + + + + + android:screenOrientation="portrait" + android:theme="@style/Theme.AppCompat.NoActionBar" /> - diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/net/RetrofitHelper.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/net/RetrofitHelper.java index 1024c816cdf..e74dde6773e 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/net/RetrofitHelper.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/net/RetrofitHelper.java @@ -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() { diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/college/CollegeFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/college/CollegeFragment.java index e58046609c2..c7802c47dbe 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/college/CollegeFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/college/CollegeFragment.java @@ -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(); + } } } \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/experience/VisionFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/experience/VisionFragment.java index 4a807f2c20c..6dcd4911a11 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/experience/VisionFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/experience/VisionFragment.java @@ -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; - } } } \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/guide/SplashActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/guide/SplashActivity.java index 1f152bc3d2e..bfc312c128e 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/guide/SplashActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/guide/SplashActivity.java @@ -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,11 +80,17 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm private void initCountDownView() { cdvTime.setTime(3); cdvTime.start(); - cdvTime.setOnLoadingFinishListener(() -> check()); - cdvTime.setOnClickListener(view -> { + cdvTime.setOnLoadingFinishListener(() -> { cdvTime.stop(); + isLoadindFinish= true; check(); }); + cdvTime.setOnClickListener(view -> { + if (!isLoadindFinish) { + cdvTime.stop(); + check(); + } + }); } @Override @@ -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(); diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/main/MainActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/main/MainActivity.java index d36f6151d96..77231f8fde7 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/main/MainActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/main/MainActivity.java @@ -223,7 +223,7 @@ public class MainActivity extends BaseActivity 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() { @@ -240,7 +240,7 @@ public class MainActivity extends BaseActivity 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); }); diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/main/PrivacyPolicyActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/main/PrivacyPolicyActivity.java index efa5ec0d914..4374f78fe01 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/main/PrivacyPolicyActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/main/PrivacyPolicyActivity.java @@ -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); } diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MeFragment.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MeFragment.java index 011cee02e51..b59c0f25020 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MeFragment.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MeFragment.java @@ -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; } } diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MyQRCodeActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MyQRCodeActivity.java new file mode 100644 index 00000000000..04026f6de85 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MyQRCodeActivity.java @@ -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(); + } + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/IntelligentPoetryWritingActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/IntelligentPoetryWritingActivity.java new file mode 100644 index 00000000000..7c369a1ccac --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/IntelligentPoetryWritingActivity.java @@ -0,0 +1,92 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.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(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/PoetryPosterActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/PoetryPosterActivity.java new file mode 100644 index 00000000000..b65f95987ab --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/PoetryPosterActivity.java @@ -0,0 +1,65 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.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); + }); + } + + +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/PoetryView.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/PoetryView.java new file mode 100644 index 00000000000..8387f7c1d61 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/poetry/PoetryView.java @@ -0,0 +1,52 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.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); + } + +} diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/view/MyButton.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/view/MyButton.java new file mode 100644 index 00000000000..f8ad5563c4b --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/view/MyButton.java @@ -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); + } +} diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeBrokensideActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeBrokensideActivity.java new file mode 100644 index 00000000000..a4428463f88 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeBrokensideActivity.java @@ -0,0 +1,80 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + + +@Route(path = "/app/CollegeBrokensideActivity") +public class CollegeBrokensideActivity extends AppCompatActivity { + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_college_brokenside); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.brokenside_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + WebSettings wSet = mWebView.getSettings(); + wSet.setJavaScriptEnabled(true); + wSet.setDomStorageEnabled(true); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.COLLEGE_QUICK_APP); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeFAQActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeFAQActivity.java new file mode 100644 index 00000000000..5291605a550 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeFAQActivity.java @@ -0,0 +1,81 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/CollegeFAQActivity") +public class CollegeFAQActivity extends AppCompatActivity { + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_college_f_a_q); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.CollegeFAQActivity_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + mWebView.setWebChromeClient(new WebChromeClient()); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.getSettings().setJavaScriptEnabled(true); + mWebView.getSettings().setDomStorageEnabled(true); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.COLLEGE_MAIN_FAQ); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeForumActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeForumActivity.java new file mode 100644 index 00000000000..af162118110 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeForumActivity.java @@ -0,0 +1,81 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/CollegeForumActivity") +public class CollegeForumActivity extends AppCompatActivity { + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_college_forum); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.CollegeForumActivity_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + mWebView.setWebChromeClient(new WebChromeClient()); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.getSettings().setJavaScriptEnabled(true); + mWebView.getSettings().setDomStorageEnabled(true); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.COLLEGE_MAIN_ASK); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeOneHourActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeOneHourActivity.java new file mode 100644 index 00000000000..55760c6b8a6 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeOneHourActivity.java @@ -0,0 +1,81 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/CollegeOneHourActivity") +public class CollegeOneHourActivity extends AppCompatActivity { + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_college_one_hour); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.OneHour_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + mWebView.setWebChromeClient(new WebChromeClient()); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.getSettings().setJavaScriptEnabled(true); + mWebView.getSettings().setDomStorageEnabled(true); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.COLLEGE_MAIN_CLOUD); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegePerformReasoningActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegePerformReasoningActivity.java new file mode 100644 index 00000000000..39fd05233a9 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegePerformReasoningActivity.java @@ -0,0 +1,81 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/CollegePerformReasoningActivity") +public class CollegePerformReasoningActivity extends AppCompatActivity { + private WebView mWebView; + private ProgressBar progressBar; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_college_perform_reasoning); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.perform_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + mWebView.setWebChromeClient(new WebChromeClient()); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.getSettings().setJavaScriptEnabled(true); + mWebView.getSettings().setDomStorageEnabled(true); + mWebView.setWebChromeClient(new WebChromeClient(){ + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if(newProgress==100){ + progressBar.setVisibility(View.GONE); + } + else{ + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.COLLEGE_QUICK_EXECUTE); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeReferencevideoActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeReferencevideoActivity.java new file mode 100644 index 00000000000..ab9c28c7f0b --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeReferencevideoActivity.java @@ -0,0 +1,81 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/CollegeReferencevideoActivity") +public class CollegeReferencevideoActivity extends AppCompatActivity { + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_college_referencevideo); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.referencevideo_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + mWebView.setWebChromeClient(new WebChromeClient()); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.getSettings().setJavaScriptEnabled(true); + mWebView.getSettings().setDomStorageEnabled(true); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.COLLEGE_QUICK_VIDEO); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeTrainingmodelActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeTrainingmodelActivity.java new file mode 100644 index 00000000000..51681631519 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/CollegeTrainingmodelActivity.java @@ -0,0 +1,84 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.CookieManager; +import android.webkit.WebChromeClient; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/CollegeTrainingmodelActivity") +public class CollegeTrainingmodelActivity extends AppCompatActivity { + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_college_trainingmodel); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.Trainingmodel_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + mWebView.setWebChromeClient(new WebChromeClient()); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.getSettings().setJavaScriptEnabled(true); + mWebView.getSettings().setDomStorageEnabled(true); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + CookieManager cookieManager = CookieManager.getInstance(); + cookieManager.setAcceptThirdPartyCookies(mWebView, true); + mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); + } + mWebView.loadUrl(MSLinkUtils.COLLEGE_QUICK_TRAIN); + + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeCodeRepositoryActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeCodeRepositoryActivity.java new file mode 100644 index 00000000000..716c76c1e36 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeCodeRepositoryActivity.java @@ -0,0 +1,80 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/MeCodeRepositoryActivity") +public class MeCodeRepositoryActivity extends AppCompatActivity { + + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_me_code_repository); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.MeCodeRepositoryActivity_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + WebSettings wSet = mWebView.getSettings(); + wSet.setJavaScriptEnabled(true); + wSet.setDomStorageEnabled(true); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.ME_CODE_URL); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeOfficialwebsiteActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeOfficialwebsiteActivity.java new file mode 100644 index 00000000000..bc5777a5f42 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeOfficialwebsiteActivity.java @@ -0,0 +1,82 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/MeOfficialwebsiteActivity") +public class MeOfficialwebsiteActivity extends AppCompatActivity { + + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_me_officialwebsite); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.MeOfficialwebsiteActivity_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + WebSettings wSet = mWebView.getSettings(); + wSet.setJavaScriptEnabled(true); + wSet.setDomStorageEnabled(true); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.BASE_URL); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeProblemFeedbackActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeProblemFeedbackActivity.java new file mode 100644 index 00000000000..bf70ef1e75d --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeProblemFeedbackActivity.java @@ -0,0 +1,82 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/MeProblemFeedbackActivity") +public class MeProblemFeedbackActivity extends AppCompatActivity { + + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_me_problem_feedback); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.MeProblemFeedbackActivity_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + WebSettings wSet = mWebView.getSettings(); + wSet.setJavaScriptEnabled(true); + wSet.setDomStorageEnabled(true); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.ME_HELP_URL); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeThumbsupActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeThumbsupActivity.java new file mode 100644 index 00000000000..9e6724b0137 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/MeThumbsupActivity.java @@ -0,0 +1,82 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mindspore.common.config.MSLinkUtils; +import com.mindspore.himindspore.R; + +@Route(path = "/app/MeThumbsupActivity") +public class MeThumbsupActivity extends AppCompatActivity { + + private WebView mWebView; + private ProgressBar progressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_me_thumbsup); + initView(); + } + + private void initView() { + progressBar = findViewById(R.id.progress); + Toolbar mToolbar = findViewById(R.id.MeThumbsupActivity_toolbar); + mToolbar.setNavigationOnClickListener(view -> finish()); + mWebView = findViewById(R.id.mWebView); + WebSettings wSet = mWebView.getSettings(); + wSet.setJavaScriptEnabled(true); + wSet.setDomStorageEnabled(true); + mWebView.setWebViewClient(new WebViewClient()); + mWebView.setWebChromeClient(new WebChromeClient() { + @Override + public void onProgressChanged(WebView view, int newProgress) { + + + if (newProgress == 100) { + progressBar.setVisibility(View.GONE); + } else { + progressBar.setVisibility(View.VISIBLE); + progressBar.setProgress(newProgress); + } + + } + }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } + mWebView.loadUrl(MSLinkUtils.ME_STAR_URL); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mWebView.removeAllViews(); + mWebView.destroy(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java new file mode 100644 index 00000000000..85988b76c06 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java @@ -0,0 +1,80 @@ +/** + * Copyright 2021 Huawei Technologies Co., Ltd + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.mindspore.himindspore.ui.webview; + +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.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(); + } +} \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/anim/anim_enter.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/anim/anim_enter.xml new file mode 100644 index 00000000000..48fa8af7542 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/anim/anim_enter.xml @@ -0,0 +1,8 @@ + + + + diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/anim/anim_exit.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/anim/anim_exit.xml new file mode 100644 index 00000000000..9a75bbe434d --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/anim/anim_exit.xml @@ -0,0 +1,7 @@ + + + diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_gesture_recognition.png b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_gesture_recognition.png new file mode 100644 index 00000000000..a133dcff955 Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_gesture_recognition.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_text_extraction.png b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_text_extraction.png new file mode 100644 index 00000000000..2a1a302f77a Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_text_extraction.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_text_translation.png b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_text_translation.png new file mode 100644 index 00000000000..20ccd86a5cc Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/btn_text_translation.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/me_qr_code.png b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/me_qr_code.png new file mode 100644 index 00000000000..0ffc0c73e92 Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/me_qr_code.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/poem_bg.png b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/poem_bg.png new file mode 100644 index 00000000000..79f420e11b8 Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable-xxhdpi/poem_bg.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/item_qrcode.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/item_qrcode.xml new file mode 100644 index 00000000000..cde7b10df14 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/item_qrcode.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/poem_frame.9.png b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/poem_frame.9.png new file mode 100644 index 00000000000..1273ae2cc9b Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/poem_frame.9.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/progressbar.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/progressbar.xml new file mode 100644 index 00000000000..9e6500684a8 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/drawable/progressbar.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_brokenside.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_brokenside.xml new file mode 100644 index 00000000000..0e568c607bb --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_brokenside.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_f_a_q.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_f_a_q.xml new file mode 100644 index 00000000000..8940190d1fb --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_f_a_q.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_forum.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_forum.xml new file mode 100644 index 00000000000..94b6ada446a --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_forum.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_one_hour.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_one_hour.xml new file mode 100644 index 00000000000..71ee00ece24 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_one_hour.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_perform_reasoning.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_perform_reasoning.xml new file mode 100644 index 00000000000..0ea808f4080 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_perform_reasoning.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_referencevideo.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_referencevideo.xml new file mode 100644 index 00000000000..3cb0e517320 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_referencevideo.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_trainingmodel.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_trainingmodel.xml new file mode 100644 index 00000000000..df7c67868c0 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_college_trainingmodel.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_intelligent_poetry_writing.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_intelligent_poetry_writing.xml new file mode 100644 index 00000000000..30319abf593 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_intelligent_poetry_writing.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_code_repository.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_code_repository.xml new file mode 100644 index 00000000000..3d6fc56ff06 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_code_repository.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_officialwebsite.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_officialwebsite.xml new file mode 100644 index 00000000000..57ff48e0ef4 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_officialwebsite.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_problem_feedback.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_problem_feedback.xml new file mode 100644 index 00000000000..b2d2403ada8 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_problem_feedback.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_thumbsup.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_thumbsup.xml new file mode 100644 index 00000000000..be40939c828 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_me_thumbsup.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_my_qr_code.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_my_qr_code.xml new file mode 100644 index 00000000000..092684e0293 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_my_qr_code.xml @@ -0,0 +1,39 @@ + + + + + + + + + + \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_poetry_poster.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_poetry_poster.xml new file mode 100644 index 00000000000..1df382145a8 --- /dev/null +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_poetry_poster.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + +