| @@ -7,8 +7,8 @@ android { | |||
| applicationId "com.mindspore.himindspore" | |||
| minSdkVersion 21 | |||
| targetSdkVersion 30 | |||
| versionCode 6 | |||
| versionName "1.1.4" | |||
| versionCode 7 | |||
| versionName "1.2.0" | |||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
| javaCompileOptions { | |||
| @@ -53,24 +53,30 @@ dependencies { | |||
| implementation 'androidx.appcompat:appcompat:1.3.0-alpha02' | |||
| implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | |||
| implementation 'androidx.cardview:cardview:1.0.0' | |||
| implementation 'androidx.legacy:legacy-support-v4:1.0.0' | |||
| implementation 'androidx.preference:preference:1.1.1' | |||
| implementation 'com.google.android.material:material:1.2.1' | |||
| androidTestImplementation 'androidx.test.ext:junit:1.1.2' | |||
| androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | |||
| implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.2' | |||
| implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2' | |||
| implementation 'io.reactivex.rxjava2:rxjava:2.1.1' | |||
| implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' | |||
| implementation 'io.reactivex.rxjava2:rxjava:2.2.20' | |||
| implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' | |||
| implementation 'com.squareup.retrofit2:retrofit:2.9.0' | |||
| implementation 'com.squareup.retrofit2:converter-gson:2.9.0' | |||
| implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0' | |||
| implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0' | |||
| implementation 'org.greenrobot:eventbus:3.0.0' | |||
| implementation 'org.greenrobot:eventbus:3.2.0' | |||
| implementation 'com.alibaba:arouter-api:1.5.1' | |||
| 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') | |||
| @@ -11,7 +11,6 @@ | |||
| <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEM" /> | |||
| <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | |||
| <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> | |||
| <uses-permission android:name="android.permission.INTERNET" /> | |||
| <application | |||
| @@ -22,14 +21,19 @@ | |||
| android:requestLegacyExternalStorage="true" | |||
| android:roundIcon="@mipmap/ic_launcher_round" | |||
| android:supportsRtl="true" | |||
| tools:replace="android:label" | |||
| android:theme="@style/AppTheme"> | |||
| android:theme="@style/AppTheme" | |||
| tools:replace="android:label"> | |||
| <activity | |||
| android:name=".ui.main.MainActivity" | |||
| android:screenOrientation="portrait" | |||
| android:theme="@style/Theme.AppCompat.NoActionBar" /> | |||
| <meta-data | |||
| android:name="com.google.android.actions" | |||
| android:resource="@xml/style_file_paths" /> | |||
| <activity | |||
| android:name=".SplashActivity" | |||
| android:name=".ui.guide.SplashActivity" | |||
| android:screenOrientation="portrait" | |||
| android:theme="@style/Theme.AppCompat.NoActionBar"> | |||
| <intent-filter> | |||
| @@ -43,12 +47,12 @@ | |||
| android:name="androidx.core.content.FileProvider" | |||
| android:authorities="com.mindspore.himindspore.fileprovider" | |||
| android:exported="false" | |||
| tools:replace="android:authorities" | |||
| android:grantUriPermissions="true"> | |||
| android:grantUriPermissions="true" | |||
| tools:replace="android:authorities"> | |||
| <meta-data | |||
| tools:replace="android:resource" | |||
| android:name="android.support.FILE_PROVIDER_PATHS" | |||
| android:resource="@xml/style_file_paths" /> | |||
| android:resource="@xml/style_file_paths" | |||
| tools:replace="android:resource" /> | |||
| </provider> | |||
| </application> | |||
| @@ -1,360 +0,0 @@ | |||
| /** | |||
| * Copyright 2020 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; | |||
| import android.Manifest; | |||
| import android.app.ProgressDialog; | |||
| import android.content.Intent; | |||
| import android.content.pm.PackageInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.net.Uri; | |||
| import android.os.Build; | |||
| import android.os.Environment; | |||
| import android.provider.Settings; | |||
| import android.util.Log; | |||
| import android.view.View; | |||
| import android.widget.TextView; | |||
| import android.widget.Toast; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.appcompat.app.AlertDialog; | |||
| import androidx.core.app.ActivityCompat; | |||
| import androidx.core.content.ContextCompat; | |||
| import androidx.core.content.FileProvider; | |||
| import com.alibaba.android.arouter.facade.annotation.Route; | |||
| import com.alibaba.android.arouter.launcher.ARouter; | |||
| import com.mindspore.himindspore.base.BaseActivity; | |||
| import com.mindspore.himindspore.mvp.MainContract; | |||
| import com.mindspore.himindspore.mvp.MainPresenter; | |||
| import com.mindspore.himindspore.net.FileDownLoadObserver; | |||
| import com.mindspore.himindspore.net.UpdateInfoBean; | |||
| import java.io.File; | |||
| @Route(path = "/himindspore/SplashActivity") | |||
| public class SplashActivity extends BaseActivity<MainPresenter> implements MainContract.View { | |||
| private static final String TAG = "SplashActivity"; | |||
| private static final String[] PERMISSIONS = {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, | |||
| Manifest.permission.READ_PHONE_STATE, Manifest.permission.CAMERA}; | |||
| private static final int REQUEST_PERMISSION = 1; | |||
| private boolean isAllGranted; | |||
| private int now_version; | |||
| private ProgressDialog progressDialog; | |||
| private TextView versionText; | |||
| private static final String CODE_URL = "https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/lite"; | |||
| private static final String HELP_URL = "https://gitee.com/mindspore/mindspore/issues/new?issue%5Bassignee_id%5D=0&issue%5Bmilestone_id%5D=0"; | |||
| private static final String STAR_URL = "https://gitee.com/mindspore/mindspore"; | |||
| private static final String APK_URL = "https://download.mindspore.cn/model_zoo/official/lite/apk/mindmain.html"; | |||
| @Override | |||
| protected void init() { | |||
| presenter = new MainPresenter(this); | |||
| versionText = findViewById(R.id.tv_vision); | |||
| showPackaeInfo(); | |||
| requestPermissions(); | |||
| getUpdateInfo(); | |||
| } | |||
| @Override | |||
| public int getLayout() { | |||
| return R.layout.activity_splash; | |||
| } | |||
| private void showPackaeInfo() { | |||
| try { | |||
| PackageManager packageManager = this.getPackageManager(); | |||
| PackageInfo packageInfo = packageManager.getPackageInfo(this.getPackageName(), 0); | |||
| now_version = packageInfo.versionCode; | |||
| versionText.setText(getString(R.string.title_version) + packageInfo.versionName); | |||
| } catch (PackageManager.NameNotFoundException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| private void requestPermissions() { | |||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |||
| isAllGranted = checkPermissionAllGranted(PERMISSIONS); | |||
| if (!isAllGranted) { | |||
| ActivityCompat.requestPermissions(this, PERMISSIONS, REQUEST_PERMISSION); | |||
| } | |||
| } else { | |||
| isAllGranted = true; | |||
| } | |||
| } | |||
| private boolean checkPermissionAllGranted(String[] permissions) { | |||
| for (String permission : permissions) { | |||
| if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) { | |||
| return false; | |||
| } | |||
| } | |||
| return true; | |||
| } | |||
| /** | |||
| * Authority application result callback | |||
| */ | |||
| @Override | |||
| public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |||
| if (REQUEST_PERMISSION == requestCode) { | |||
| isAllGranted = true; | |||
| for (int grant : grantResults) { | |||
| if (grant != PackageManager.PERMISSION_GRANTED) { | |||
| isAllGranted = false; | |||
| break; | |||
| } | |||
| } | |||
| if (!isAllGranted) { | |||
| openAppDetails(); | |||
| } | |||
| } | |||
| } | |||
| private void openAppDetails() { | |||
| AlertDialog.Builder builder = new AlertDialog.Builder(this); | |||
| builder.setMessage(getResources().getString(R.string.app_need_permission)); | |||
| builder.setPositiveButton(getResources().getString(R.string.app_permission_by_hand), (dialog, which) -> { | |||
| Intent intent = new Intent(); | |||
| intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | |||
| intent.addCategory(Intent.CATEGORY_DEFAULT); | |||
| intent.setData(Uri.parse("package:" + getPackageName())); | |||
| intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
| intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); | |||
| intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); | |||
| startActivity(intent); | |||
| }); | |||
| builder.setNegativeButton(getResources().getString(R.string.cancel), null); | |||
| builder.show(); | |||
| } | |||
| private void getUpdateInfo() { | |||
| presenter.getUpdateInfo(); | |||
| } | |||
| public void onClickImage(View view) { | |||
| if (isAllGranted) { | |||
| ARouter.getInstance().build("/imageobject/ImageCameraActivity") | |||
| .withInt("OPEN_TYPE", 1).navigation(); | |||
| } else { | |||
| requestPermissions(); | |||
| } | |||
| } | |||
| public void onClickGarbage(View view) { | |||
| if (isAllGranted) { | |||
| ARouter.getInstance().build("/imageobject/ImageCameraActivity") | |||
| .withInt("OPEN_TYPE", 2).navigation(); | |||
| } else { | |||
| requestPermissions(); | |||
| } | |||
| } | |||
| public void onClickSceneDetection(View view) { | |||
| if (isAllGranted) { | |||
| ARouter.getInstance().build("/imageobject/ImageCameraActivity") | |||
| .withInt("OPEN_TYPE", 3).navigation(); | |||
| } else { | |||
| requestPermissions(); | |||
| } | |||
| } | |||
| public void onClickPhotoDetection(View view) { | |||
| if (isAllGranted) { | |||
| ARouter.getInstance().build("/imageobject/ObjectPhotoActivity").navigation(); | |||
| } else { | |||
| requestPermissions(); | |||
| } | |||
| } | |||
| public void onClickCameraDetection(View view) { | |||
| if (isAllGranted) { | |||
| ARouter.getInstance().build("/imageobject/ObjectCameraActivity").navigation(); | |||
| } else { | |||
| requestPermissions(); | |||
| } | |||
| } | |||
| public void onClickPoseNet(View view) { | |||
| if (isAllGranted) { | |||
| ARouter.getInstance().build("/posenet/PosenetMainActivity").navigation(this); | |||
| } else { | |||
| requestPermissions(); | |||
| } | |||
| } | |||
| public void onClickStyleTransfer(View view) { | |||
| if (isAllGranted) { | |||
| ARouter.getInstance().build("/styletransfer/StyleMainActivity").navigation(this); | |||
| } else { | |||
| requestPermissions(); | |||
| } | |||
| } | |||
| public void onClickSegmentation(View view) { | |||
| if (isAllGranted) { | |||
| ARouter.getInstance().build("/segmentation/SegmentationMainActivity").navigation(this); | |||
| } else { | |||
| requestPermissions(); | |||
| } | |||
| } | |||
| public void onClickSouceCode(View view) { | |||
| openBrowser(CODE_URL); | |||
| } | |||
| public void onClickHelp(View view) { | |||
| openBrowser(HELP_URL); | |||
| } | |||
| public void onClickStar(View view) { | |||
| openBrowser(STAR_URL); | |||
| } | |||
| public void onClickShare(View view) { | |||
| Intent share_intent = new Intent(); | |||
| share_intent.setAction(Intent.ACTION_SEND); | |||
| share_intent.setType("text/plain"); | |||
| share_intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.title_share)); | |||
| share_intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.title_share_commend) + APK_URL); | |||
| share_intent = Intent.createChooser(share_intent, getString(R.string.title_share)); | |||
| startActivity(share_intent); | |||
| } | |||
| public void openBrowser(String url) { | |||
| Intent intent = new Intent(); | |||
| intent.setAction("android.intent.action.VIEW"); | |||
| Uri uri = Uri.parse(url.trim()); | |||
| intent.setData(uri); | |||
| startActivity(intent); | |||
| } | |||
| @Override | |||
| public void showUpdateResult(UpdateInfoBean bean) { | |||
| showUpdate(bean); | |||
| } | |||
| @Override | |||
| public void showFail(String s) { | |||
| } | |||
| public void downSuccess() { | |||
| if (progressDialog != null && progressDialog.isShowing()) { | |||
| progressDialog.dismiss(); | |||
| } | |||
| AlertDialog.Builder builder = new AlertDialog.Builder(this); | |||
| builder.setIcon(android.R.drawable.ic_dialog_info); | |||
| builder.setTitle(getResources().getString(R.string.app_download_success)); | |||
| builder.setMessage(getResources().getString(R.string.app_need_install)); | |||
| builder.setCancelable(false); | |||
| builder.setPositiveButton(getResources().getString(R.string.confirm), (dialog, which) -> { | |||
| Intent intent = new Intent(Intent.ACTION_VIEW); | |||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | |||
| intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | |||
| Uri contentUri = FileProvider.getUriForFile(SplashActivity.this, "com.mindspore.himindspore.fileprovider", | |||
| new File(getApkPath(), "HiMindSpore.apk")); | |||
| intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); | |||
| } else { | |||
| intent.setDataAndType(Uri.fromFile(new File(getApkPath(), "HiMindSpore.apk")), "application/vnd.android.package-archive"); | |||
| intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
| } | |||
| startActivity(intent); | |||
| }); | |||
| builder.setNegativeButton(getResources().getString(R.string.cancel), (dialog, which) -> { | |||
| }); | |||
| builder.create().show(); | |||
| } | |||
| public void showUpdate(final UpdateInfoBean updateInfo) { | |||
| if (now_version != updateInfo.getVersionCode()) { | |||
| AlertDialog.Builder builder = new AlertDialog.Builder(this); | |||
| builder.setIcon(android.R.drawable.ic_dialog_info); | |||
| builder.setTitle(getResources().getString(R.string.app_update_lastest) + updateInfo.getVersionName()); | |||
| builder.setMessage(updateInfo.getMessage()); | |||
| builder.setCancelable(false); | |||
| builder.setPositiveButton(getResources().getString(R.string.confirm), (dialog, which) -> { | |||
| Log.e(TAG, String.valueOf(Environment.MEDIA_MOUNTED)); | |||
| downFile(); | |||
| }); | |||
| builder.setNegativeButton(getResources().getString(R.string.cancel), (dialog, which) -> { | |||
| }); | |||
| builder.create().show(); | |||
| } | |||
| } | |||
| public void downFile() { | |||
| progressDialog = new ProgressDialog(this); | |||
| 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.setProgress(0); | |||
| progressDialog.show(); | |||
| presenter.downloadApk(getApkPath(), "HiMindSpore.apk", new FileDownLoadObserver<File>() { | |||
| @Override | |||
| public void onDownLoadSuccess(File file) { | |||
| downSuccess(); | |||
| } | |||
| @Override | |||
| public void onDownLoadFail(Throwable throwable) { | |||
| Toast.makeText(SplashActivity.this, getResources().getString(R.string.app_load_fail), Toast.LENGTH_LONG).show(); | |||
| } | |||
| @Override | |||
| public void onProgress(final int progress, final long total) { | |||
| runOnUiThread(new Runnable() { | |||
| @Override | |||
| public void run() { | |||
| progressDialog.setMax((int) total / 1024 / 1024); | |||
| progressDialog.setProgress(progress); | |||
| } | |||
| }); | |||
| } | |||
| }); | |||
| Log.d(TAG, "downFile: "); | |||
| } | |||
| public String getApkPath() { | |||
| String directoryPath = ""; | |||
| if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { | |||
| directoryPath = getExternalFilesDir("apk").getAbsolutePath(); | |||
| } else { | |||
| directoryPath = getFilesDir() + File.separator + "apk"; | |||
| } | |||
| File file = new File(directoryPath); | |||
| if (!file.exists()) { | |||
| file.mkdirs(); | |||
| } | |||
| return directoryPath; | |||
| } | |||
| } | |||
| @@ -15,10 +15,11 @@ | |||
| */ | |||
| package com.mindspore.himindspore.base; | |||
| import android.app.Activity; | |||
| import android.os.Bundle; | |||
| public abstract class BaseActivity<T extends BasePresenter> extends Activity { | |||
| import androidx.appcompat.app.AppCompatActivity; | |||
| public abstract class BaseActivity<T extends BasePresenter> extends AppCompatActivity { | |||
| protected T presenter; | |||
| @@ -19,12 +19,11 @@ import android.app.Application; | |||
| import com.alibaba.android.arouter.BuildConfig; | |||
| import com.alibaba.android.arouter.launcher.ARouter; | |||
| import com.mindspore.common.utils.Utils; | |||
| public class MyApplication extends Application { | |||
| private static final String appKey = "31f0c1ffe8168"; | |||
| private static final String appSecret = "83e393ced2b9f31771fcb81e1b7a049a"; | |||
| @Override | |||
| public void onCreate() { | |||
| @@ -34,5 +33,6 @@ public class MyApplication extends Application { | |||
| ARouter.openDebug(); | |||
| } | |||
| ARouter.init(this); | |||
| Utils.init(this); | |||
| } | |||
| } | |||
| @@ -0,0 +1,46 @@ | |||
| /** | |||
| * 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.bean; | |||
| import com.mindspore.customview.tablayout.listener.CustomTabEntity; | |||
| public class TabEntity implements CustomTabEntity { | |||
| public String title; | |||
| public int selectedIcon; | |||
| public int unSelectedIcon; | |||
| public TabEntity(String title, int selectedIcon, int unSelectedIcon) { | |||
| this.title = title; | |||
| this.selectedIcon = selectedIcon; | |||
| this.unSelectedIcon = unSelectedIcon; | |||
| } | |||
| @Override | |||
| public String getTabTitle() { | |||
| return title; | |||
| } | |||
| @Override | |||
| public int getTabSelectedIcon() { | |||
| return selectedIcon; | |||
| } | |||
| @Override | |||
| public int getTabUnselectedIcon() { | |||
| return unSelectedIcon; | |||
| } | |||
| } | |||
| @@ -0,0 +1,93 @@ | |||
| /** | |||
| * 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.comment; | |||
| import com.mindspore.himindspore.ui.college.CollegeFragment; | |||
| import com.mindspore.himindspore.ui.experience.ExperienceFragment; | |||
| import com.mindspore.himindspore.ui.experience.VisionFragment; | |||
| import com.mindspore.himindspore.ui.me.MeFragment; | |||
| public class FragmentFactory { | |||
| private static FragmentFactory mInstance; | |||
| private ExperienceFragment mExperienceFragment; | |||
| private CollegeFragment mCollegeFragment; | |||
| private MeFragment mMeFragment; | |||
| private VisionFragment mVisionFragment; | |||
| private FragmentFactory() { | |||
| } | |||
| public static FragmentFactory getInstance() { | |||
| if (mInstance == null) { | |||
| synchronized (FragmentFactory.class) { | |||
| if (mInstance == null) { | |||
| mInstance = new FragmentFactory(); | |||
| } | |||
| } | |||
| } | |||
| return mInstance; | |||
| } | |||
| public ExperienceFragment getExperienceFragment() { | |||
| if (mExperienceFragment == null) { | |||
| synchronized (FragmentFactory.class) { | |||
| if (mExperienceFragment == null) { | |||
| mExperienceFragment = new ExperienceFragment(); | |||
| } | |||
| } | |||
| } | |||
| return mExperienceFragment; | |||
| } | |||
| public CollegeFragment getCollegeFragment() { | |||
| if (mCollegeFragment == null) { | |||
| synchronized (FragmentFactory.class) { | |||
| if (mCollegeFragment == null) { | |||
| mCollegeFragment = new CollegeFragment(); | |||
| } | |||
| } | |||
| } | |||
| return mCollegeFragment; | |||
| } | |||
| public MeFragment getMeFragment() { | |||
| if (mMeFragment == null) { | |||
| synchronized (FragmentFactory.class) { | |||
| if (mMeFragment == null) { | |||
| mMeFragment = new MeFragment(); | |||
| } | |||
| } | |||
| } | |||
| return mMeFragment; | |||
| } | |||
| public VisionFragment getVisionFragment() { | |||
| if (mVisionFragment == null) { | |||
| synchronized (FragmentFactory.class) { | |||
| if (mVisionFragment == null) { | |||
| mVisionFragment = new VisionFragment(); | |||
| } | |||
| } | |||
| } | |||
| return mVisionFragment; | |||
| } | |||
| } | |||
| @@ -1,3 +1,18 @@ | |||
| /** | |||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||
| * <p> | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * <p> | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * <p> | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.net; | |||
| import java.io.File; | |||
| @@ -1,3 +1,18 @@ | |||
| /** | |||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||
| * <p> | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * <p> | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * <p> | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.net; | |||
| import java.util.concurrent.TimeUnit; | |||
| @@ -1,3 +1,18 @@ | |||
| /** | |||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||
| * <p> | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * <p> | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * <p> | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.net; | |||
| import io.reactivex.Observable; | |||
| @@ -1,3 +1,18 @@ | |||
| /** | |||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||
| * <p> | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * <p> | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * <p> | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.net; | |||
| public class UpdateInfoBean { | |||
| @@ -0,0 +1,172 @@ | |||
| /** | |||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||
| * <p> | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * <p> | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * <p> | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.ui.college; | |||
| import android.content.Context; | |||
| import android.content.SharedPreferences; | |||
| import android.os.Bundle; | |||
| import android.preference.PreferenceManager; | |||
| import android.view.Gravity; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.annotation.Nullable; | |||
| import androidx.fragment.app.Fragment; | |||
| import androidx.recyclerview.widget.LinearLayoutManager; | |||
| import androidx.recyclerview.widget.RecyclerView; | |||
| import com.mindspore.common.config.MSLinkUtils; | |||
| import com.mindspore.common.sp.Preferences; | |||
| import com.mindspore.common.utils.Utils; | |||
| import com.mindspore.customview.dialog.NoticeDialog; | |||
| import com.mindspore.himindspore.R; | |||
| import com.mindspore.himindspore.ui.college.adapter.CollegeItemAdapter; | |||
| import com.mindspore.himindspore.ui.college.bean.CollegeItemBean; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| public class CollegeFragment extends Fragment implements CollegeItemAdapter.CollegeItemClickListener { | |||
| private RecyclerView collegeRecycleView; | |||
| private CollegeItemAdapter collegeItemAdapter; | |||
| private List<CollegeItemBean> collegeDataList; | |||
| private SharedPreferences prefs; | |||
| public CollegeFragment() { | |||
| // Required empty public constructor | |||
| } | |||
| public static CollegeFragment newInstance() { | |||
| CollegeFragment fragment; | |||
| fragment = new CollegeFragment(); | |||
| return fragment; | |||
| } | |||
| @Override | |||
| public void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| } | |||
| @Override | |||
| public View onCreateView(LayoutInflater inflater, ViewGroup container, | |||
| Bundle savedInstanceState) { | |||
| // Inflate the layout for this fragment | |||
| return inflater.inflate(R.layout.fragment_college, container, false); | |||
| } | |||
| @Override | |||
| public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
| super.onViewCreated(view, savedInstanceState); | |||
| collegeRecycleView = view.findViewById(R.id.recyclerview); | |||
| } | |||
| @Override | |||
| public void onActivityCreated(@Nullable Bundle savedInstanceState) { | |||
| super.onActivityCreated(savedInstanceState); | |||
| collegeItemAdapter = new CollegeItemAdapter(collegeDataList); | |||
| LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); | |||
| collegeRecycleView.setLayoutManager(layoutManager); | |||
| collegeRecycleView.setAdapter(collegeItemAdapter); | |||
| collegeItemAdapter.setCollegeItemClickListener(this); | |||
| } | |||
| @Override | |||
| public void onAttach(@NonNull Context context) { | |||
| super.onAttach(context); | |||
| prefs = PreferenceManager.getDefaultSharedPreferences(Utils.getApp()); | |||
| initData(); | |||
| } | |||
| private void initData() { | |||
| collegeDataList = Arrays.asList( | |||
| new CollegeItemBean(CollegeItemBean.TYPE_LEFT_IMAGE_RIGHT_TEXT, | |||
| R.drawable.college_summary_uncheck, R.drawable.college_summary_checked, | |||
| getString(R.string.college_summary_title), prefs.getBoolean(Preferences.KEY_COLLEGE_SUMMARY, false)), | |||
| new CollegeItemBean(CollegeItemBean.TYPE_LEFT_IMAGE_RIGHT_TEXT, | |||
| R.drawable.college_cloud_uncheck, R.drawable.college_cloud_checked, | |||
| getString(R.string.college_cloud_title), prefs.getBoolean(Preferences.KEY_COLLEGE_CLOUD, false)), | |||
| new CollegeItemBean(CollegeItemBean.TYPE_MIX, | |||
| R.drawable.college_quick_uncheck, R.drawable.college_quick_checked, | |||
| getString(R.string.college_quick_title), prefs.getBoolean(Preferences.KEY_COLLEGE_QUICK, false)), | |||
| new CollegeItemBean(CollegeItemBean.TYPE_LEFT_IMAGE_RIGHT_TEXT, | |||
| R.drawable.college_faq_uncheck, R.drawable.college_faq_checked, | |||
| getString(R.string.college_faq_title), prefs.getBoolean(Preferences.KEY_COLLEGE_FAQ, false)), | |||
| new CollegeItemBean(CollegeItemBean.TYPE_LEFT_IMAGE_RIGHT_TEXT, | |||
| R.drawable.college_ask_uncheck, R.drawable.college_ask_checked, | |||
| getString(R.string.college_ask_title), prefs.getBoolean(Preferences.KEY_COLLEGE_ASK, false)), | |||
| new CollegeItemBean(CollegeItemBean.TYPE_PURE_TEXT, | |||
| -1, -1, getString(R.string.college_light_title), false)); | |||
| } | |||
| private void showSumaryDialog() { | |||
| NoticeDialog noticeDialog = new NoticeDialog(getActivity()); | |||
| noticeDialog.setTitleString(getString(R.string.college_dialog_title)); | |||
| noticeDialog.setContentString(getString(R.string.college_dialog_content)); | |||
| noticeDialog.setGravity(Gravity.START); | |||
| noticeDialog.setShowBottomLogo(true); | |||
| noticeDialog.setYesOnclickListener(() -> { | |||
| noticeDialog.dismiss(); | |||
| }); | |||
| noticeDialog.show(); | |||
| } | |||
| @Override | |||
| public void onCollegeItemClickListener(int position) { | |||
| switch (position) { | |||
| case 0: | |||
| prefs.edit().putBoolean(Preferences.KEY_COLLEGE_SUMMARY, true).apply(); | |||
| collegeDataList.get(0).setHasChecked(prefs.getBoolean(Preferences.KEY_COLLEGE_SUMMARY, false)); | |||
| collegeItemAdapter.notifyData(); | |||
| showSumaryDialog(); | |||
| break; | |||
| case 1: | |||
| 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); | |||
| 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); | |||
| 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); | |||
| break; | |||
| } | |||
| } | |||
| @Override | |||
| public void onCollegeChildItemClickListener(int position) { | |||
| prefs.edit().putBoolean(Preferences.KEY_COLLEGE_QUICK_ARRAY[position], true).apply(); | |||
| boolean isHasCheckedTrain = prefs.getBoolean(Preferences.KEY_COLLEGE_TRAIN, false); | |||
| boolean isHasCheckedExecute = prefs.getBoolean(Preferences.KEY_COLLEGE_EXECUTE, false); | |||
| boolean isHasCheckedApp = prefs.getBoolean(Preferences.KEY_COLLEGE_APP, false); | |||
| boolean isHasCheckedVideo = prefs.getBoolean(Preferences.KEY_COLLEGE_VIDEO, false); | |||
| 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]); | |||
| } | |||
| } | |||
| @@ -0,0 +1,282 @@ | |||
| package com.mindspore.himindspore.ui.college.adapter; | |||
| import android.content.SharedPreferences; | |||
| import android.preference.PreferenceManager; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.ImageView; | |||
| import android.widget.RelativeLayout; | |||
| import android.widget.TextView; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.recyclerview.widget.RecyclerView; | |||
| import com.mindspore.common.sp.Preferences; | |||
| import com.mindspore.common.utils.Utils; | |||
| import com.mindspore.himindspore.R; | |||
| import com.mindspore.himindspore.ui.college.bean.CollegeItemBean; | |||
| import java.util.List; | |||
| public class CollegeItemAdapter extends RecyclerView.Adapter { | |||
| private List<CollegeItemBean> collegeDataList; | |||
| private CollegeItemClickListener collegeItemClickListener; | |||
| private boolean isHasCheckedTrain; | |||
| private boolean isHasCheckedExecute; | |||
| private boolean isHasCheckedApp; | |||
| private boolean isHasCheckedVideo; | |||
| public CollegeItemAdapter(List<CollegeItemBean> collegeDataList) { | |||
| this.collegeDataList = collegeDataList; | |||
| notifyData(); | |||
| } | |||
| public void setCollegeItemClickListener(CollegeItemClickListener collegeItemClickListener) { | |||
| this.collegeItemClickListener = collegeItemClickListener; | |||
| } | |||
| public void notifyData() { | |||
| SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Utils.getApp()); | |||
| this.isHasCheckedTrain = prefs.getBoolean(Preferences.KEY_COLLEGE_TRAIN, false); | |||
| this.isHasCheckedExecute = prefs.getBoolean(Preferences.KEY_COLLEGE_EXECUTE, false); | |||
| this.isHasCheckedApp = prefs.getBoolean(Preferences.KEY_COLLEGE_APP, false); | |||
| this.isHasCheckedVideo = prefs.getBoolean(Preferences.KEY_COLLEGE_VIDEO, false); | |||
| notifyDataSetChanged(); | |||
| } | |||
| @NonNull | |||
| @Override | |||
| public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
| View view; | |||
| if (CollegeItemBean.TYPE_LEFT_IMAGE_RIGHT_TEXT == viewType) { | |||
| view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_college_left_image_right_text, parent, false); | |||
| return new LeftImageViewHolder(view); | |||
| } else if (CollegeItemBean.TYPE_MIX == viewType) { | |||
| view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_college_mix, parent, false); | |||
| return new MixViewHolder(view); | |||
| } else if (CollegeItemBean.TYPE_PURE_TEXT == viewType) { | |||
| view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_college_pure_text, parent, false); | |||
| return new PureTextViewHolder(view); | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public int getItemViewType(int position) { | |||
| return collegeDataList.get(position).getItemType(); | |||
| } | |||
| @Override | |||
| public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | |||
| if (holder instanceof LeftImageViewHolder) { | |||
| bindLeftImageViewHolder((LeftImageViewHolder) holder, position); | |||
| } else if (holder instanceof MixViewHolder) { | |||
| bindMixViewHolder((MixViewHolder) holder, position); | |||
| } else { | |||
| ((PureTextViewHolder) holder).title.setText(collegeDataList.get(position).getTitle()); | |||
| } | |||
| } | |||
| private void bindLeftImageViewHolder(LeftImageViewHolder holder, int position) { | |||
| CollegeItemBean bean = collegeDataList.get(position); | |||
| boolean isHasChecked = bean.isHasChecked(); | |||
| holder.title.setText(bean.getTitle()); | |||
| if (isHasChecked) { | |||
| holder.icon.setImageResource(bean.getImagechecked()); | |||
| if (position == collegeDataList.size() - 2) { | |||
| holder.dot.setVisibility(View.GONE); | |||
| holder.lineView.setVisibility(View.GONE); | |||
| } else { | |||
| holder.dot.setVisibility(View.VISIBLE); | |||
| holder.lineView.setVisibility(View.VISIBLE); | |||
| holder.lineView.setBackgroundColor(Utils.getApp().getResources().getColor(R.color.btn_small_checked)); | |||
| } | |||
| } else { | |||
| holder.icon.setImageResource(bean.getImageUncheck()); | |||
| holder.dot.setVisibility(View.GONE); | |||
| if (position == collegeDataList.size() - 2) { | |||
| holder.lineView.setVisibility(View.GONE); | |||
| } else { | |||
| holder.lineView.setVisibility(View.VISIBLE); | |||
| holder.lineView.setBackgroundColor(Utils.getApp().getResources().getColor(R.color.default_gray)); | |||
| } | |||
| } | |||
| holder.itemView.setOnClickListener(view -> { | |||
| if (collegeItemClickListener != null) { | |||
| collegeItemClickListener.onCollegeItemClickListener(position); | |||
| } | |||
| }); | |||
| } | |||
| private void bindMixViewHolder(MixViewHolder holder, int position) { | |||
| CollegeItemBean bean = collegeDataList.get(position); | |||
| boolean isHasChecked = bean.isHasChecked(); | |||
| holder.title.setText(bean.getTitle()); | |||
| if (isHasChecked) { | |||
| holder.icon.setImageResource(bean.getImagechecked()); | |||
| holder.dot.setVisibility(View.VISIBLE); | |||
| holder.lineView.setBackgroundColor(Utils.getApp().getResources().getColor(R.color.btn_small_checked)); | |||
| } else { | |||
| holder.icon.setImageResource(bean.getImageUncheck()); | |||
| holder.dot.setVisibility(View.INVISIBLE); | |||
| holder.lineView.setBackgroundColor(Utils.getApp().getResources().getColor(R.color.default_gray)); | |||
| } | |||
| if (isHasCheckedTrain) { | |||
| holder.trainLayout.setBackgroundResource(R.drawable.item_bg_blue_rect); | |||
| holder.iconTrain.setImageResource(R.drawable.college_train_checked); | |||
| holder.textTrain.setTextColor(Utils.getApp().getResources().getColor(R.color.btn_small_checked)); | |||
| } else { | |||
| holder.trainLayout.setBackgroundResource(R.drawable.item_bg_gray_rect); | |||
| holder.iconTrain.setImageResource(R.drawable.college_train_uncheck); | |||
| holder.textTrain.setTextColor(Utils.getApp().getResources().getColor(R.color.text_black)); | |||
| } | |||
| holder.trainLayout.setOnClickListener(view -> { | |||
| if (collegeItemClickListener != null) { | |||
| collegeItemClickListener.onCollegeChildItemClickListener(0); | |||
| } | |||
| }); | |||
| if (isHasCheckedExecute) { | |||
| holder.executeLayout.setBackgroundResource(R.drawable.item_bg_blue_rect); | |||
| holder.iconExecute.setImageResource(R.drawable.college_execute_checked); | |||
| holder.textExecute.setTextColor(Utils.getApp().getResources().getColor(R.color.btn_small_checked)); | |||
| } else { | |||
| holder.executeLayout.setBackgroundResource(R.drawable.item_bg_gray_rect); | |||
| holder.iconExecute.setImageResource(R.drawable.college_execute_uncheck); | |||
| holder.textExecute.setTextColor(Utils.getApp().getResources().getColor(R.color.text_black)); | |||
| } | |||
| holder.executeLayout.setOnClickListener(view -> { | |||
| if (collegeItemClickListener != null) { | |||
| collegeItemClickListener.onCollegeChildItemClickListener(1); | |||
| } | |||
| }); | |||
| if (isHasCheckedApp) { | |||
| holder.appLayout.setBackgroundResource(R.drawable.item_bg_blue_rect); | |||
| holder.iconApp.setImageResource(R.drawable.college_app_checked); | |||
| holder.textApp.setTextColor(Utils.getApp().getResources().getColor(R.color.btn_small_checked)); | |||
| } else { | |||
| holder.appLayout.setBackgroundResource(R.drawable.item_bg_gray_rect); | |||
| holder.iconApp.setImageResource(R.drawable.college_app_uncheck); | |||
| holder.textApp.setTextColor(Utils.getApp().getResources().getColor(R.color.text_black)); | |||
| } | |||
| holder.appLayout.setOnClickListener(view -> { | |||
| if (collegeItemClickListener != null) { | |||
| collegeItemClickListener.onCollegeChildItemClickListener(2); | |||
| } | |||
| }); | |||
| if (isHasCheckedVideo) { | |||
| holder.videoLayout.setBackgroundResource(R.drawable.item_bg_blue_rect); | |||
| holder.iconVideo.setImageResource(R.drawable.college_video_checked); | |||
| holder.textVideo.setTextColor(Utils.getApp().getResources().getColor(R.color.btn_small_checked)); | |||
| } else { | |||
| holder.videoLayout.setBackgroundResource(R.drawable.item_bg_gray_rect); | |||
| holder.iconVideo.setImageResource(R.drawable.college_video_uncheck); | |||
| holder.textVideo.setTextColor(Utils.getApp().getResources().getColor(R.color.text_black)); | |||
| } | |||
| holder.videoLayout.setOnClickListener(view -> { | |||
| if (collegeItemClickListener != null) { | |||
| collegeItemClickListener.onCollegeChildItemClickListener(3); | |||
| } | |||
| }); | |||
| } | |||
| @Override | |||
| public int getItemCount() { | |||
| return collegeDataList.size(); | |||
| } | |||
| private class LeftImageViewHolder extends RecyclerView.ViewHolder { | |||
| private ImageView icon; | |||
| private TextView title; | |||
| private ImageView dot; | |||
| private View lineView; | |||
| public LeftImageViewHolder(@NonNull View itemView) { | |||
| super(itemView); | |||
| icon = itemView.findViewById(R.id.icon_left); | |||
| title = itemView.findViewById(R.id.tv_title); | |||
| dot = itemView.findViewById(R.id.bottom_dot); | |||
| lineView = itemView.findViewById(R.id.line_view); | |||
| } | |||
| } | |||
| private class MixViewHolder extends RecyclerView.ViewHolder { | |||
| private ImageView icon; | |||
| private TextView title; | |||
| private ImageView dot; | |||
| private View lineView; | |||
| private RelativeLayout trainLayout; | |||
| private ImageView iconTrain; | |||
| private TextView textTrain; | |||
| private RelativeLayout executeLayout; | |||
| private ImageView iconExecute; | |||
| private TextView textExecute; | |||
| private RelativeLayout appLayout; | |||
| private ImageView iconApp; | |||
| private TextView textApp; | |||
| private RelativeLayout videoLayout; | |||
| private ImageView iconVideo; | |||
| private TextView textVideo; | |||
| public MixViewHolder(@NonNull View itemView) { | |||
| super(itemView); | |||
| icon = itemView.findViewById(R.id.icon_left); | |||
| title = itemView.findViewById(R.id.tv_title); | |||
| dot = itemView.findViewById(R.id.bottom_dot); | |||
| lineView = itemView.findViewById(R.id.line_view); | |||
| trainLayout = itemView.findViewById(R.id.rl_train); | |||
| iconTrain = itemView.findViewById(R.id.icon_train); | |||
| textTrain = itemView.findViewById(R.id.tv_train); | |||
| executeLayout = itemView.findViewById(R.id.rl_execute); | |||
| iconExecute = itemView.findViewById(R.id.icon_execute); | |||
| textExecute = itemView.findViewById(R.id.tv_execute); | |||
| appLayout = itemView.findViewById(R.id.rl_app); | |||
| iconApp = itemView.findViewById(R.id.icon_app); | |||
| textApp = itemView.findViewById(R.id.tv_app); | |||
| videoLayout = itemView.findViewById(R.id.rl_video); | |||
| iconVideo = itemView.findViewById(R.id.icon_video); | |||
| textVideo = itemView.findViewById(R.id.tv_video); | |||
| } | |||
| } | |||
| private class PureTextViewHolder extends RecyclerView.ViewHolder { | |||
| private TextView title; | |||
| public PureTextViewHolder(@NonNull View itemView) { | |||
| super(itemView); | |||
| title = itemView.findViewById(R.id.tv_title); | |||
| } | |||
| } | |||
| @Override | |||
| public long getItemId(int position) { | |||
| return super.getItemId(position); | |||
| } | |||
| public interface CollegeItemClickListener { | |||
| void onCollegeItemClickListener(int position); | |||
| void onCollegeChildItemClickListener(int position); | |||
| } | |||
| } | |||
| @@ -0,0 +1,61 @@ | |||
| /** | |||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||
| * <p> | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * <p> | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * <p> | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.ui.college.bean; | |||
| public class CollegeItemBean { | |||
| private int itemType; | |||
| private int imageUncheck; | |||
| private int imagechecked; | |||
| private String title; | |||
| private boolean isHasChecked; | |||
| public static final int TYPE_LEFT_IMAGE_RIGHT_TEXT = 1; | |||
| public static final int TYPE_MIX = 2; | |||
| public static final int TYPE_PURE_TEXT = 3; | |||
| public CollegeItemBean(int itemType, int imageUncheck,int imagechecked, String title,boolean isHasChecked) { | |||
| this.itemType = itemType; | |||
| this.imageUncheck = imageUncheck; | |||
| this.imagechecked = imagechecked; | |||
| this.title = title; | |||
| this.isHasChecked = isHasChecked; | |||
| } | |||
| public int getItemType() { | |||
| return itemType; | |||
| } | |||
| public int getImageUncheck() { | |||
| return imageUncheck; | |||
| } | |||
| public int getImagechecked() { | |||
| return imagechecked; | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public boolean isHasChecked() { | |||
| return isHasChecked; | |||
| } | |||
| public CollegeItemBean setHasChecked(boolean hasChecked) { | |||
| isHasChecked = hasChecked; | |||
| return this; | |||
| } | |||
| } | |||
| @@ -0,0 +1,79 @@ | |||
| /** | |||
| * 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.experience; | |||
| import android.os.Bundle; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.annotation.Nullable; | |||
| import androidx.fragment.app.Fragment; | |||
| import androidx.viewpager.widget.ViewPager; | |||
| import com.google.android.material.tabs.TabLayout; | |||
| import com.mindspore.common.base.adapter.BasePagerAdapter; | |||
| import com.mindspore.himindspore.R; | |||
| import com.mindspore.himindspore.comment.FragmentFactory; | |||
| import java.util.ArrayList; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| public class ExperienceFragment extends Fragment { | |||
| private TabLayout tabLayout; | |||
| private ViewPager vpContent; | |||
| @Override | |||
| public void onCreate(@Nullable Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| } | |||
| @Nullable | |||
| @Override | |||
| public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | |||
| return inflater.inflate(R.layout.fragment_experience, container, false); | |||
| } | |||
| @Override | |||
| public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
| super.onViewCreated(view, savedInstanceState); | |||
| tabLayout = view.findViewById(R.id.tab_layout); | |||
| vpContent = view.findViewById(R.id.vp_content); | |||
| } | |||
| @Override | |||
| public void onActivityCreated(@Nullable Bundle savedInstanceState) { | |||
| super.onActivityCreated(savedInstanceState); | |||
| initData(); | |||
| } | |||
| public void initData() { | |||
| List<Fragment> fragmentList = new ArrayList<>(); | |||
| String[] categoryName = this.getResources().getStringArray(R.array.tab_experience); | |||
| fragmentList.add(FragmentFactory.getInstance().getVisionFragment()); | |||
| BasePagerAdapter adapter = new BasePagerAdapter(getChildFragmentManager(), fragmentList, Arrays.asList(categoryName)); | |||
| vpContent.setAdapter(adapter); | |||
| tabLayout.setupWithViewPager(vpContent); | |||
| tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); | |||
| vpContent.setOffscreenPageLimit(categoryName.length); | |||
| } | |||
| } | |||
| @@ -0,0 +1,110 @@ | |||
| /** | |||
| * 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.experience; | |||
| import android.annotation.SuppressLint; | |||
| import android.os.Bundle; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.annotation.Nullable; | |||
| import androidx.fragment.app.Fragment; | |||
| import com.alibaba.android.arouter.facade.annotation.Route; | |||
| import com.alibaba.android.arouter.launcher.ARouter; | |||
| import com.mindspore.himindspore.R; | |||
| /** | |||
| * A simple {@link Fragment} subclass. | |||
| * Use the {@link VisionFragment#newInstance} factory method to | |||
| * create an instance of this fragment. | |||
| */ | |||
| @Route(path = "/app/VisionFragment") | |||
| public class VisionFragment extends Fragment implements View.OnClickListener { | |||
| public VisionFragment() { | |||
| // Required empty public constructor | |||
| } | |||
| public static VisionFragment newInstance(String param1, String param2) { | |||
| VisionFragment fragment = new VisionFragment(); | |||
| return fragment; | |||
| } | |||
| @Override | |||
| public void onCreate(Bundle savedInstanceState) { | |||
| super.onCreate(savedInstanceState); | |||
| } | |||
| @Override | |||
| public View onCreateView(LayoutInflater inflater, ViewGroup container, | |||
| Bundle savedInstanceState) { | |||
| // Inflate the layout for this fragment | |||
| return inflater.inflate(R.layout.fragment_vision, container, false); | |||
| } | |||
| @Override | |||
| public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
| super.onViewCreated(view, savedInstanceState); | |||
| view.findViewById(R.id.btn_object).setOnClickListener(this); //onClickPhotoDetection | |||
| view.findViewById(R.id.btn_object_camera).setOnClickListener(this); //onClickCameraDetection | |||
| view.findViewById(R.id.btn_posenet).setOnClickListener(this); //onClickPoseNet | |||
| 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 | |||
| } | |||
| @SuppressLint("NonConstantResourceId") | |||
| @Override | |||
| public void onClick(View view) { | |||
| switch (view.getId()) { | |||
| case R.id.btn_object: | |||
| ARouter.getInstance().build("/imageobject/ObjectPhotoActivity").navigation(); | |||
| break; | |||
| case R.id.btn_object_camera: | |||
| ARouter.getInstance().build("/imageobject/ObjectCameraActivity").navigation(); | |||
| break; | |||
| case R.id.btn_posenet: | |||
| ARouter.getInstance().build("/posenet/PosenetMainActivity").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(); | |||
| 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(); | |||
| break; | |||
| case R.id.btn_scene: | |||
| ARouter.getInstance().build("/imageobject/ImageCameraActivity") | |||
| .withInt("OPEN_TYPE", 3).navigation(); | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,173 @@ | |||
| /** | |||
| * Copyright 2020 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.guide; | |||
| import android.Manifest; | |||
| import android.content.Intent; | |||
| import android.net.Uri; | |||
| import android.os.Handler; | |||
| import android.provider.Settings; | |||
| import android.util.Log; | |||
| import android.view.KeyEvent; | |||
| import android.view.View; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.appcompat.app.AlertDialog; | |||
| import com.mindspore.customview.countdown.CountDownView; | |||
| import com.mindspore.himindspore.R; | |||
| import com.mindspore.himindspore.base.BaseActivity; | |||
| import com.mindspore.himindspore.ui.main.MainActivity; | |||
| import java.util.List; | |||
| 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"; | |||
| private static final String[] PERMISSIONS = {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, | |||
| Manifest.permission.READ_PHONE_STATE, Manifest.permission.CAMERA}; | |||
| private static final int REQUEST_PERMISSION = 1; | |||
| private CountDownView cdvTime; | |||
| @Override | |||
| protected void init() { | |||
| cdvTime = findViewById(R.id.cdv_time); | |||
| initCountDownView(); | |||
| } | |||
| private void initCountDownView() { | |||
| cdvTime.setTime(3); | |||
| cdvTime.start(); | |||
| cdvTime.setOnLoadingFinishListener(new CountDownView.OnLoadingFinishListener() { | |||
| @Override | |||
| public void finish() { | |||
| Log.e("AAA","setOnLoadingFinishListener"); | |||
| startPermissionsTask(); | |||
| } | |||
| }); | |||
| cdvTime.setOnClickListener(view -> { | |||
| Log.e("AAA","setOnClickListener"); | |||
| cdvTime.stop(); | |||
| startPermissionsTask(); | |||
| }); | |||
| } | |||
| @Override | |||
| public int getLayout() { | |||
| return R.layout.activity_splash; | |||
| } | |||
| @AfterPermissionGranted(REQUEST_PERMISSION) | |||
| private void startPermissionsTask() { | |||
| if (hasPermissions()) { | |||
| setHandler(); | |||
| } else { | |||
| EasyPermissions.requestPermissions(this, | |||
| this.getResources().getString(R.string.app_need_permission), | |||
| REQUEST_PERMISSION, PERMISSIONS); | |||
| } | |||
| } | |||
| private boolean hasPermissions() { | |||
| return EasyPermissions.hasPermissions(this, PERMISSIONS); | |||
| } | |||
| @Override | |||
| public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |||
| super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |||
| EasyPermissions.onRequestPermissionsResult(requestCode, | |||
| permissions, grantResults, SplashActivity.this); | |||
| } | |||
| @Override | |||
| public void onPermissionsGranted(int requestCode, List<String> perms) { | |||
| } | |||
| @Override | |||
| public void onPermissionsDenied(int requestCode, List<String> perms) { | |||
| if (EasyPermissions.somePermissionPermanentlyDenied(SplashActivity.this, perms)) { | |||
| openAppDetails(); | |||
| } | |||
| } | |||
| @Override | |||
| public void onActivityResult(int requestCode, int resultCode, Intent data) { | |||
| super.onActivityResult(requestCode, resultCode, data); | |||
| if (requestCode == AppSettingsDialog.DEFAULT_SETTINGS_REQ_CODE) { | |||
| setHandler(); | |||
| } | |||
| } | |||
| private void openAppDetails() { | |||
| AlertDialog.Builder builder = new AlertDialog.Builder(this); | |||
| builder.setMessage(getResources().getString(R.string.app_need_permission)); | |||
| builder.setPositiveButton(getResources().getString(R.string.app_permission_by_hand), (dialog, which) -> { | |||
| Intent intent = new Intent(); | |||
| intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | |||
| intent.addCategory(Intent.CATEGORY_DEFAULT); | |||
| intent.setData(Uri.parse("package:" + getPackageName())); | |||
| intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
| intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); | |||
| intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); | |||
| startActivity(intent); | |||
| }); | |||
| builder.setNegativeButton(getResources().getString(R.string.cancel), null); | |||
| builder.show(); | |||
| } | |||
| @Override | |||
| public boolean onKeyDown(int keyCode, KeyEvent event) { | |||
| if (keyCode == KeyEvent.KEYCODE_BACK) { | |||
| return true; | |||
| } | |||
| return super.onKeyDown(keyCode, event); | |||
| } | |||
| private void setHandler() { | |||
| // new Handler().postDelayed(() -> { | |||
| // enterMainView(); | |||
| // }, 3000); | |||
| enterMainView(); | |||
| } | |||
| private void enterMainView() { | |||
| Log.e("AAA","enterMainView"); | |||
| Intent intent = new Intent(); | |||
| intent.setClass(SplashActivity.this, MainActivity.class); | |||
| startActivity(intent); | |||
| finish(); | |||
| } | |||
| @Override | |||
| protected void onDestroy() { | |||
| super.onDestroy(); | |||
| if (cdvTime != null && cdvTime.isShown()) { | |||
| cdvTime.stop(); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,234 @@ | |||
| /** | |||
| * Copyright 2021 Huawei Technologies Co., Ltd | |||
| * <p> | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| * You may obtain a copy of the License at | |||
| * <p> | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * <p> | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.ui.main; | |||
| import android.app.AlertDialog; | |||
| import android.app.ProgressDialog; | |||
| import android.content.Intent; | |||
| import android.content.pm.PackageInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.net.Uri; | |||
| import android.os.Build; | |||
| import android.os.Environment; | |||
| import android.util.Log; | |||
| import android.widget.Toast; | |||
| import androidx.core.content.FileProvider; | |||
| import androidx.fragment.app.Fragment; | |||
| import androidx.viewpager.widget.ViewPager; | |||
| import com.mindspore.common.base.adapter.BasePagerAdapter; | |||
| import com.mindspore.customview.dialog.UpdateDialog; | |||
| import com.mindspore.customview.tablayout.CommonTabLayout; | |||
| import com.mindspore.customview.tablayout.listener.CustomTabEntity; | |||
| import com.mindspore.customview.tablayout.listener.OnTabSelectListener; | |||
| import com.mindspore.himindspore.R; | |||
| import com.mindspore.himindspore.base.BaseActivity; | |||
| import com.mindspore.himindspore.comment.FragmentFactory; | |||
| import com.mindspore.himindspore.net.FileDownLoadObserver; | |||
| import com.mindspore.himindspore.net.UpdateInfoBean; | |||
| import java.io.File; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| public class MainActivity extends BaseActivity<MainPresenter> implements MainContract.View { | |||
| private static final String TAG = "MainActivity"; | |||
| private ViewPager mVpHome; | |||
| private CommonTabLayout mCtlTable; | |||
| private int now_version; | |||
| private ProgressDialog progressDialog; | |||
| @Override | |||
| protected void init() { | |||
| presenter = new MainPresenter(this); | |||
| mVpHome = findViewById(R.id.vp_home); | |||
| mCtlTable = findViewById(R.id.ctl_table); | |||
| showPackaeInfo(); | |||
| initTabLayout(); | |||
| initViewPager(); | |||
| getUpdateInfo(); | |||
| } | |||
| @Override | |||
| public int getLayout() { | |||
| return R.layout.activity_main; | |||
| } | |||
| private void showPackaeInfo() { | |||
| try { | |||
| PackageManager packageManager = this.getPackageManager(); | |||
| PackageInfo packageInfo = packageManager.getPackageInfo(this.getPackageName(), 0); | |||
| now_version = packageInfo.versionCode; | |||
| } catch (PackageManager.NameNotFoundException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| private void initTabLayout() { | |||
| ArrayList<CustomTabEntity> mTabEntities = presenter.getTabEntity(); | |||
| mCtlTable.setTabData(mTabEntities); | |||
| mCtlTable.setOnTabSelectListener(new OnTabSelectListener() { | |||
| @Override | |||
| public void onTabSelect(int position) { | |||
| mVpHome.setCurrentItem(position); | |||
| } | |||
| @Override | |||
| public void onTabReselect(int position) { | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 初始化ViewPager数据 | |||
| */ | |||
| private void initViewPager() { | |||
| List<Fragment> fragments = new ArrayList<>(); | |||
| fragments.add(FragmentFactory.getInstance().getExperienceFragment()); | |||
| fragments.add(FragmentFactory.getInstance().getCollegeFragment()); | |||
| fragments.add(FragmentFactory.getInstance().getMeFragment()); | |||
| BasePagerAdapter adapter = new BasePagerAdapter(getSupportFragmentManager(), fragments); | |||
| mVpHome.setAdapter(adapter); | |||
| mVpHome.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { | |||
| @Override | |||
| public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
| } | |||
| @Override | |||
| public void onPageSelected(int position) { | |||
| if (position >= 0) { | |||
| mCtlTable.setCurrentTab(position); | |||
| } | |||
| } | |||
| @Override | |||
| public void onPageScrollStateChanged(int state) { | |||
| } | |||
| }); | |||
| mVpHome.setOffscreenPageLimit(3); | |||
| mVpHome.setCurrentItem(0); | |||
| } | |||
| private void getUpdateInfo() { | |||
| presenter.getUpdateInfo(); | |||
| } | |||
| @Override | |||
| public void showUpdateResult(UpdateInfoBean bean) { | |||
| showUpdate(bean); | |||
| } | |||
| @Override | |||
| public void showFail(String s) { | |||
| } | |||
| public void downSuccess() { | |||
| if (progressDialog != null && progressDialog.isShowing()) { | |||
| progressDialog.dismiss(); | |||
| } | |||
| AlertDialog.Builder builder = new AlertDialog.Builder(this); | |||
| builder.setIcon(android.R.drawable.ic_dialog_info); | |||
| builder.setTitle(getResources().getString(R.string.app_download_success)); | |||
| builder.setMessage(getResources().getString(R.string.app_need_install)); | |||
| builder.setCancelable(false); | |||
| builder.setPositiveButton(getResources().getString(R.string.confirm), (dialog, which) -> { | |||
| Intent intent = new Intent(Intent.ACTION_VIEW); | |||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | |||
| intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | |||
| Uri contentUri = FileProvider.getUriForFile(MainActivity.this, "com.mindspore.himindspore.fileprovider", | |||
| new File(getApkPath(), "HiMindSpore.apk")); | |||
| intent.setDataAndType(contentUri, "application/vnd.android.package-archive"); | |||
| } else { | |||
| intent.setDataAndType(Uri.fromFile(new File(getApkPath(), "HiMindSpore.apk")), "application/vnd.android.package-archive"); | |||
| intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
| } | |||
| startActivity(intent); | |||
| }); | |||
| builder.setNegativeButton(getResources().getString(R.string.cancel), (dialog, which) -> { | |||
| }); | |||
| builder.create().show(); | |||
| } | |||
| public void showUpdate(final UpdateInfoBean updateInfo) { | |||
| if (now_version != updateInfo.getVersionCode()) { | |||
| UpdateDialog updateDialog= new UpdateDialog(this); | |||
| updateDialog.setTitleString(getResources().getString(R.string.app_update_lastest) + updateInfo.getVersionName()); | |||
| updateDialog.setContentString(updateInfo.getMessage()); | |||
| updateDialog.setYesOnclickListener(() -> downFile()); | |||
| updateDialog.setNoOnclickListener(() -> updateDialog.dismiss()); | |||
| updateDialog.show(); | |||
| } | |||
| } | |||
| public void downFile() { | |||
| progressDialog = new ProgressDialog(this); | |||
| 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.setProgress(0); | |||
| progressDialog.show(); | |||
| presenter.downloadApk(getApkPath(), "HiMindSpore.apk", new FileDownLoadObserver<File>() { | |||
| @Override | |||
| public void onDownLoadSuccess(File file) { | |||
| downSuccess(); | |||
| } | |||
| @Override | |||
| public void onDownLoadFail(Throwable throwable) { | |||
| Toast.makeText(MainActivity.this, getResources().getString(R.string.app_load_fail), Toast.LENGTH_LONG).show(); | |||
| } | |||
| @Override | |||
| public void onProgress(final int progress, final long total) { | |||
| runOnUiThread(new Runnable() { | |||
| @Override | |||
| public void run() { | |||
| progressDialog.setMax((int) total / 1024 / 1024); | |||
| progressDialog.setProgress(progress); | |||
| } | |||
| }); | |||
| } | |||
| }); | |||
| Log.d(TAG, "downFile: "); | |||
| } | |||
| public String getApkPath() { | |||
| String directoryPath = ""; | |||
| if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { | |||
| directoryPath = getExternalFilesDir("apk").getAbsolutePath(); | |||
| } else { | |||
| directoryPath = getFilesDir() + File.separator + "apk"; | |||
| } | |||
| File file = new File(directoryPath); | |||
| if (!file.exists()) { | |||
| file.mkdirs(); | |||
| } | |||
| return directoryPath; | |||
| } | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /** | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * 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. | |||
| @@ -13,25 +13,31 @@ | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.mvp; | |||
| package com.mindspore.himindspore.ui.main; | |||
| import com.mindspore.customview.tablayout.listener.CustomTabEntity; | |||
| import com.mindspore.himindspore.net.FileDownLoadObserver; | |||
| import com.mindspore.himindspore.net.UpdateInfoBean; | |||
| import java.io.File; | |||
| import java.util.ArrayList; | |||
| public interface MainContract { | |||
| interface View { | |||
| interface View { | |||
| void showUpdateResult(UpdateInfoBean object); | |||
| void showFail(String s); | |||
| } | |||
| interface Presenter { | |||
| interface Presenter { | |||
| ArrayList<CustomTabEntity> getTabEntity(); | |||
| void getUpdateInfo(); | |||
| void downloadApk(String destDir, String fileName, FileDownLoadObserver<File> fileDownLoadObserver); | |||
| } | |||
| } | |||
| @@ -1,6 +1,5 @@ | |||
| package com.mindspore.himindspore.mvp; | |||
| /** | |||
| * Copyright 2020 Huawei Technologies Co., Ltd | |||
| * 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. | |||
| @@ -14,49 +13,72 @@ package com.mindspore.himindspore.mvp; | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| */ | |||
| package com.mindspore.himindspore.ui.main; | |||
| import android.content.res.TypedArray; | |||
| import android.util.Log; | |||
| import com.mindspore.himindspore.SplashActivity; | |||
| import com.mindspore.common.utils.Utils; | |||
| import com.mindspore.customview.tablayout.listener.CustomTabEntity; | |||
| import com.mindspore.himindspore.R; | |||
| import com.mindspore.himindspore.base.BasePresenter; | |||
| import com.mindspore.himindspore.bean.TabEntity; | |||
| import com.mindspore.himindspore.net.FileDownLoadObserver; | |||
| import com.mindspore.himindspore.net.RetrofitHelper; | |||
| import com.mindspore.himindspore.net.UpdateInfoBean; | |||
| import java.io.File; | |||
| import java.util.ArrayList; | |||
| import io.reactivex.android.schedulers.AndroidSchedulers; | |||
| import io.reactivex.annotations.NonNull; | |||
| import io.reactivex.functions.Function; | |||
| import io.reactivex.schedulers.Schedulers; | |||
| import okhttp3.ResponseBody; | |||
| import retrofit2.Call; | |||
| import retrofit2.Callback; | |||
| import retrofit2.Response; | |||
| public class MainPresenter extends BasePresenter<SplashActivity> implements MainContract.Presenter { | |||
| public class MainPresenter extends BasePresenter<MainActivity> implements MainContract.Presenter { | |||
| private static final String TAG = "MainPresenter"; | |||
| private MainContract.View mView; | |||
| private RetrofitHelper retrofitHelper; | |||
| public MainPresenter(SplashActivity mainActivity) { | |||
| this.view = mainActivity; | |||
| public MainPresenter(MainContract.View androidView) { | |||
| this.mView = androidView; | |||
| retrofitHelper = new RetrofitHelper(); | |||
| } | |||
| @Override | |||
| public ArrayList<CustomTabEntity> getTabEntity() { | |||
| ArrayList<CustomTabEntity> mTabEntities = new ArrayList<>(); | |||
| TypedArray mIconUnSelectIds = Utils.getApp().getResources().obtainTypedArray(R.array.main_tab_un_select); | |||
| TypedArray mIconSelectIds = Utils.getApp().getResources().obtainTypedArray(R.array.main_tab_select); | |||
| String[] mainTitles = Utils.getApp().getResources().getStringArray(R.array.main_tab_title); | |||
| for (int i = 0; i < mainTitles.length; i++) { | |||
| int unSelectId = mIconUnSelectIds.getResourceId(i, R.drawable.experience_uncheck); | |||
| int selectId = mIconSelectIds.getResourceId(i, R.drawable.experience_checked); | |||
| mTabEntities.add(new TabEntity(mainTitles[i],selectId , unSelectId)); | |||
| } | |||
| mIconUnSelectIds.recycle(); | |||
| mIconSelectIds.recycle(); | |||
| return mTabEntities; | |||
| } | |||
| @Override | |||
| public void getUpdateInfo() { | |||
| retrofitHelper.getUpdateInfo().enqueue(new Callback<UpdateInfoBean>() { | |||
| @Override | |||
| public void onResponse(Call<UpdateInfoBean> call, Response<UpdateInfoBean> response) { | |||
| Log.i(TAG, "onResponse" + response.toString()); | |||
| view.showUpdateResult(response.body()); | |||
| mView.showUpdateResult(response.body()); | |||
| } | |||
| @Override | |||
| public void onFailure(Call<UpdateInfoBean> call, Throwable t) { | |||
| Log.e(TAG, "onFailure>>>" + t.toString()); | |||
| view.showFail(call.toString()); | |||
| mView.showFail(call.toString()); | |||
| } | |||
| }); | |||
| } | |||
| @@ -67,14 +89,8 @@ public class MainPresenter extends BasePresenter<SplashActivity> implements Main | |||
| .subscribeOn(Schedulers.io()) | |||
| .observeOn(Schedulers.io()) | |||
| .observeOn(Schedulers.computation()) | |||
| .map(new Function<ResponseBody, File>() { | |||
| @Override | |||
| public File apply(@NonNull ResponseBody responseBody) throws Exception { | |||
| return fileDownLoadObserver.saveFile(responseBody, destDir, fileName); | |||
| } | |||
| }) | |||
| .map(responseBody -> fileDownLoadObserver.saveFile(responseBody, destDir, fileName)) | |||
| .observeOn(AndroidSchedulers.mainThread()) | |||
| .subscribe(fileDownLoadObserver); | |||
| } | |||
| } | |||
| @@ -0,0 +1,102 @@ | |||
| /** | |||
| * 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.me; | |||
| import android.content.Intent; | |||
| import android.content.pm.PackageInfo; | |||
| import android.content.pm.PackageManager; | |||
| import android.os.Bundle; | |||
| import android.view.LayoutInflater; | |||
| import android.view.View; | |||
| import android.view.ViewGroup; | |||
| import android.widget.TextView; | |||
| import androidx.annotation.NonNull; | |||
| import androidx.annotation.Nullable; | |||
| import androidx.fragment.app.Fragment; | |||
| import com.mindspore.common.config.MSLinkUtils; | |||
| import com.mindspore.common.utils.Utils; | |||
| import com.mindspore.himindspore.R; | |||
| public class MeFragment extends Fragment implements View.OnClickListener { | |||
| private final String TAG = "MeFragment"; | |||
| private TextView versionText; | |||
| @Override | |||
| public View onCreateView( | |||
| @NonNull LayoutInflater inflater, @Nullable ViewGroup container, | |||
| @Nullable Bundle savedInstanceState) { | |||
| View view = inflater.inflate(R.layout.fragment_me, container, false); | |||
| return view; | |||
| } | |||
| @Override | |||
| public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
| super.onViewCreated(view, savedInstanceState); | |||
| versionText = view.findViewById(R.id.me_vision); | |||
| view.findViewById(R.id.rl_me_share).setOnClickListener(this); | |||
| view.findViewById(R.id.rl_me_thumbsup).setOnClickListener(this); | |||
| view.findViewById(R.id.rl_me_official).setOnClickListener(this); | |||
| view.findViewById(R.id.rl_me_official_code).setOnClickListener(this); | |||
| view.findViewById(R.id.rl_me_qa).setOnClickListener(this); | |||
| view.findViewById(R.id.rl_me_version).setOnClickListener(this); | |||
| showPackageInfo(); | |||
| } | |||
| public void onClickShare() { | |||
| Intent share_intent = new Intent(); | |||
| share_intent.setAction(Intent.ACTION_SEND); | |||
| share_intent.setType("text/plain"); | |||
| share_intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.title_share)); | |||
| share_intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.title_share_commend) + MSLinkUtils.ME_APK_URL); | |||
| share_intent = Intent.createChooser(share_intent, getString(R.string.title_share)); | |||
| startActivity(share_intent); | |||
| } | |||
| private void showPackageInfo() { | |||
| try { | |||
| PackageManager packageManager = this.getActivity().getPackageManager(); | |||
| PackageInfo packageInfo = packageManager | |||
| .getPackageInfo(this.getActivity().getPackageName(), 0); | |||
| versionText.setText("V" + packageInfo.versionName); | |||
| } catch (PackageManager.NameNotFoundException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| @Override | |||
| public void onClick(View view) { | |||
| switch (view.getId()) { | |||
| case R.id.rl_me_share: | |||
| onClickShare(); | |||
| break; | |||
| case R.id.rl_me_thumbsup: | |||
| Utils.openBrowser(getActivity(), MSLinkUtils.ME_STAR_URL); | |||
| break; | |||
| case R.id.rl_me_official: | |||
| Utils.openBrowser(getActivity(), MSLinkUtils.BASE_URL); | |||
| break; | |||
| case R.id.rl_me_official_code: | |||
| Utils.openBrowser(getActivity(), MSLinkUtils.ME_CODE_URL); | |||
| break; | |||
| case R.id.rl_me_qa: | |||
| Utils.openBrowser(getActivity(), MSLinkUtils.ME_HELP_URL); | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,11 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:shape="oval"> | |||
| <stroke | |||
| android:width="4dp" | |||
| android:color="#335c99f4" /> | |||
| <solid android:color="#5c99f4" /> | |||
| <size | |||
| android:width="10dp" | |||
| android:height="10dp" /> | |||
| </shape> | |||
| @@ -0,0 +1,19 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <item android:state_pressed="true"> | |||
| <shape android:shape="rectangle"> | |||
| <padding android:bottom="5dp" android:left="26dp" android:right="26dp" android:top="5dp" /> | |||
| <stroke android:width="2dp" android:color="@color/white" /> | |||
| <solid android:color="@color/gray_light_btn" /> | |||
| <corners android:radius="30dip" /> | |||
| </shape> | |||
| </item> | |||
| <item android:state_pressed="false" > | |||
| <shape android:shape="rectangle"> | |||
| <padding android:bottom="5dp" android:left="26dp" android:right="26dp" android:top="5dp" /> | |||
| <stroke android:width="2dp" android:color="@color/white" /> | |||
| <solid android:color="@color/transparent" /> | |||
| <corners android:radius="30dip" /> | |||
| </shape> | |||
| </item> | |||
| </selector> | |||
| @@ -0,0 +1,19 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <item android:state_pressed="true"> | |||
| <shape android:shape="rectangle"> | |||
| <!-- <padding android:bottom="5dp" android:left="26dp" android:right="26dp" android:top="5dp" />--> | |||
| <stroke android:width="1dp" android:color="@color/gray_btn" /> | |||
| <solid android:color="@color/gray_light" /> | |||
| <corners android:radius="3dp" /> | |||
| </shape> | |||
| </item> | |||
| <item android:state_pressed="false"> | |||
| <shape android:shape="rectangle"> | |||
| <!-- <padding android:bottom="5dp" android:left="26dp" android:right="26dp" android:top="5dp" />--> | |||
| <stroke android:width="1dp" android:color="@color/gray_btn" /> | |||
| <solid android:color="@color/transparent" /> | |||
| <corners android:radius="5dip" /> | |||
| </shape> | |||
| </item> | |||
| </selector> | |||
| @@ -0,0 +1,7 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:shape="rectangle"> | |||
| <stroke android:width="1dp" android:color="#6189ff" /> | |||
| <corners android:radius="10dp" /> | |||
| <solid android:color="#ffffff" /> | |||
| </shape> | |||
| @@ -0,0 +1,7 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:shape="rectangle"> | |||
| <stroke android:width="1dp" android:color="#e6e6e6" /> | |||
| <corners android:radius="9dp" /> | |||
| <solid android:color="#ffffff" /> | |||
| </shape> | |||
| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:shape="rectangle"> | |||
| <size android:height="1dp"/> | |||
| <solid android:color="@color/gray_light_btn"/> | |||
| </shape> | |||
| @@ -0,0 +1,35 @@ | |||
| <?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" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:orientation="vertical"> | |||
| <androidx.viewpager.widget.ViewPager | |||
| android:id="@+id/vp_home" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:layout_weight="1" | |||
| android:background="@color/white" /> | |||
| <View | |||
| android:layout_width="match_parent" | |||
| android:layout_height="1px" | |||
| android:background="@color/divider_gray" /> | |||
| <com.mindspore.customview.tablayout.CommonTabLayout | |||
| android:id="@+id/ctl_table" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="50dp" | |||
| android:background="@color/white" | |||
| app:tl_iconHeight="23dp" | |||
| app:tl_iconWidth="23dp" | |||
| app:tl_indicator_color="#2C97DE" | |||
| app:tl_indicator_height="0dp" | |||
| app:tl_textSelectColor="@color/main_tab_text_checked" | |||
| app:tl_textUnselectColor="@color/main_tab_text_uncheck" | |||
| app:tl_textsize="12sp" | |||
| app:tl_underline_color="#DDDDDD" | |||
| app:tl_underline_height="1dp" /> | |||
| </LinearLayout> | |||
| @@ -4,261 +4,67 @@ | |||
| xmlns:tools="http://schemas.android.com/tools" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:background="@color/colorPrimary" | |||
| tools:context=".SplashActivity"> | |||
| android:background="@color/white" | |||
| tools:context=".ui.guide.SplashActivity"> | |||
| <ImageView | |||
| android:id="@+id/shareImg" | |||
| android:layout_width="25dp" | |||
| android:layout_height="25dp" | |||
| android:layout_margin="20dp" | |||
| android:onClick="onClickShare" | |||
| android:src="@drawable/share" | |||
| android:id="@+id/image_logo" | |||
| android:layout_width="160dp" | |||
| android:layout_height="90dp" | |||
| android:layout_marginTop="190dp" | |||
| android:scaleType="fitXY" | |||
| android:src="@drawable/logo_splash" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| <TextView | |||
| android:id="@+id/title" | |||
| android:layout_width="0dp" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginTop="50dp" | |||
| android:drawableTop="@drawable/logo" | |||
| android:layout_marginTop="33dp" | |||
| android:gravity="center_horizontal" | |||
| android:maxLines="1" | |||
| android:maxLines="2" | |||
| android:text="@string/app_name" | |||
| android:textColor="@color/white" | |||
| android:textSize="36sp" | |||
| android:textColor="@color/text_black" | |||
| android:textSize="24sp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintHorizontal_bias="0.0" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| app:layout_constraintTop_toBottomOf="@+id/image_logo" /> | |||
| <TextView | |||
| android:id="@+id/tv_vision" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginBottom="20dp" | |||
| android:textColor="@color/white" | |||
| android:textSize="20sp" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| android:layout_marginTop="16dp" | |||
| android:gravity="center" | |||
| android:paddingStart="20dp" | |||
| android:paddingEnd="20dp" | |||
| android:text="@string/title_splash_welcome" | |||
| android:textColor="@color/text_gray" | |||
| android:textSize="14sp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| tools:text="Version 1.0.0" /> | |||
| <ScrollView | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| app:layout_constraintBottom_toTopOf="@+id/tv_vision" | |||
| app:layout_constraintTop_toBottomOf="@+id/title"> | |||
| <androidx.constraintlayout.widget.ConstraintLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:layout_marginTop="30dp" | |||
| android:layout_marginBottom="30dp" | |||
| android:orientation="vertical"> | |||
| <Button | |||
| android:id="@+id/btn_object" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:layout_marginStart="20dp" | |||
| android:layout_marginTop="16dp" | |||
| android:background="@color/gray_btn" | |||
| android:drawableStart="@drawable/btn_text" | |||
| android:drawablePadding="5dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickPhotoDetection" | |||
| android:paddingLeft="4dp" | |||
| android:text="@string/title_object" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintWidth_percent="0.43" /> | |||
| <Button | |||
| android:layout_marginEnd="20dp" | |||
| android:id="@+id/btn_object_camera" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:background="@color/gray_btn" | |||
| android:drawableStart="@drawable/btn_object" | |||
| android:drawablePadding="5dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickCameraDetection" | |||
| android:paddingLeft="4dp" | |||
| android:text="@string/title_object_camera" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/btn_object" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintWidth_percent="0.43" /> | |||
| <Button | |||
| android:id="@+id/btn_posenet" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:layout_marginTop="16dp" | |||
| android:background="@color/gray_btn" | |||
| android:drawableStart="@drawable/btn_audio" | |||
| android:drawablePadding="5dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickPoseNet" | |||
| android:paddingLeft="4dp" | |||
| android:text="@string/title_pose_net" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintStart_toStartOf="@+id/btn_object" | |||
| app:layout_constraintTop_toBottomOf="@+id/btn_object" | |||
| app:layout_constraintWidth_percent="0.43" /> | |||
| <Button | |||
| android:id="@+id/btn_style_transfer" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:background="@color/gray_btn" | |||
| android:drawableStart="@drawable/btn_commend" | |||
| android:drawablePadding="5dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickStyleTransfer" | |||
| android:paddingLeft="4dp" | |||
| android:text="@string/title_style_transfer" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/btn_posenet" | |||
| app:layout_constraintEnd_toEndOf="@+id/btn_object_camera" | |||
| app:layout_constraintWidth_percent="0.43" /> | |||
| <Button | |||
| android:id="@+id/btn_segmentation" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:layout_marginTop="16dp" | |||
| android:background="@color/gray_btn" | |||
| android:drawableStart="@drawable/btn_image" | |||
| android:drawablePadding="5dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickSegmentation" | |||
| android:paddingLeft="4dp" | |||
| android:text="@string/title_segmentation" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintStart_toStartOf="@+id/btn_posenet" | |||
| app:layout_constraintTop_toBottomOf="@+id/btn_posenet" | |||
| app:layout_constraintWidth_percent="0.43" /> | |||
| app:layout_constraintTop_toBottomOf="@+id/title" /> | |||
| <Button | |||
| android:id="@+id/btn_image" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:layout_marginTop="30dp" | |||
| android:background="@color/gray_btn" | |||
| android:drawableStart="@drawable/btn_image" | |||
| android:drawablePadding="5dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickImage" | |||
| android:paddingStart="4dp" | |||
| android:text="@string/title_image" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/btn_segmentation" | |||
| app:layout_constraintEnd_toEndOf="@+id/btn_style_transfer" | |||
| app:layout_constraintWidth_percent="0.43" /> | |||
| <Button | |||
| android:id="@+id/btn_image_garbage" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:layout_marginTop="16dp" | |||
| android:background="@color/gray_btn" | |||
| android:drawableStart="@drawable/btn_other" | |||
| android:drawablePadding="5dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickGarbage" | |||
| android:paddingLeft="4dp" | |||
| android:text="@string/title_image_garbage" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintStart_toStartOf="@+id/btn_segmentation" | |||
| app:layout_constraintTop_toBottomOf="@+id/btn_segmentation" | |||
| app:layout_constraintWidth_percent="0.43" /> | |||
| <Button | |||
| android:id="@+id/btn_scene" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:background="@color/gray_btn" | |||
| android:drawableStart="@drawable/btn_code" | |||
| android:drawablePadding="5dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickSceneDetection" | |||
| android:paddingLeft="4dp" | |||
| android:text="@string/title_scene" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/btn_image_garbage" | |||
| app:layout_constraintEnd_toEndOf="@+id/btn_image" | |||
| app:layout_constraintWidth_percent="0.43" /> | |||
| <Button | |||
| android:id="@+id/btn_source" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:layout_marginTop="16dp" | |||
| android:background="@color/gray_light_btn" | |||
| android:drawableStart="@drawable/btn_code" | |||
| android:drawablePadding="8dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickSouceCode" | |||
| android:paddingStart="10dp" | |||
| android:text="@string/title_source" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintStart_toStartOf="@+id/btn_image_garbage" | |||
| app:layout_constraintTop_toBottomOf="@+id/btn_image_garbage" | |||
| app:layout_constraintWidth_percent="0.28" /> | |||
| <Button | |||
| android:id="@+id/btn_star" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:layout_marginStart="10dp" | |||
| android:background="@color/gray_light_btn" | |||
| android:drawableStart="@drawable/btn_commend" | |||
| android:drawablePadding="8dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickStar" | |||
| android:paddingStart="10dp" | |||
| android:text="@string/title_star" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/btn_source" | |||
| app:layout_constraintEnd_toEndOf="@+id/btn_scene" | |||
| app:layout_constraintWidth_percent="0.28" /> | |||
| <Button | |||
| android:id="@+id/btn_help" | |||
| android:layout_width="0dp" | |||
| android:layout_height="48dp" | |||
| android:layout_marginTop="16dp" | |||
| android:background="@color/gray_light_btn" | |||
| android:drawableStart="@drawable/btn_help" | |||
| android:drawablePadding="8dp" | |||
| android:gravity="left|center_vertical" | |||
| android:onClick="onClickHelp" | |||
| android:paddingStart="10dp" | |||
| android:text="@string/title_help" | |||
| android:textAllCaps="false" | |||
| android:textSize="12sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/btn_source" | |||
| app:layout_constraintEnd_toStartOf="@+id/btn_star" | |||
| app:layout_constraintStart_toEndOf="@+id/btn_source" | |||
| app:layout_constraintWidth_percent="0.28" /> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| </ScrollView> | |||
| <com.mindspore.customview.countdown.CountDownView | |||
| android:id="@+id/cdv_time" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="end" | |||
| android:layout_marginTop="40dp" | |||
| android:layout_marginEnd="20dp" | |||
| app:cd_animator_time="3" | |||
| app:cd_animator_time_unit="@string/splash_count_down" | |||
| app:cd_arc_color="@color/btn_small_checked" | |||
| app:cd_arc_width="2dp" | |||
| app:cd_bg_color="@color/gray_light" | |||
| app:cd_circle_radius="20dp" | |||
| app:cd_location="top" | |||
| app:cd_retreat_type="forward" | |||
| app:cd_text_color="@color/black" | |||
| app:cd_text_size="12sp" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| @@ -0,0 +1,70 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <androidx.constraintlayout.widget.ConstraintLayout 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="100dp"> | |||
| <ImageView | |||
| android:id="@+id/icon_left" | |||
| android:layout_width="45dp" | |||
| android:layout_height="45dp" | |||
| android:layout_marginStart="20dp" | |||
| android:src="@drawable/college_summary_checked" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| <TextView | |||
| android:id="@+id/tv_title" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginStart="20dp" | |||
| android:gravity="center" | |||
| android:textColor="@color/black" | |||
| android:textSize="13sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/icon_left" | |||
| app:layout_constraintStart_toEndOf="@+id/icon_left" | |||
| app:layout_constraintTop_toTopOf="@+id/icon_left" | |||
| tools:text="MindSpore简介" /> | |||
| <ImageView | |||
| android:id="@+id/img_arrow" | |||
| android:layout_width="6dp" | |||
| android:layout_height="12dp" | |||
| android:layout_marginEnd="20dp" | |||
| android:background="@drawable/me_go" | |||
| app:layout_constraintBottom_toBottomOf="@+id/icon_left" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintTop_toTopOf="@+id/icon_left" /> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginEnd="8dp" | |||
| android:text="@string/college_adapter_view" | |||
| android:textColor="@color/main_tab_text_checked" | |||
| android:textSize="12sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/icon_left" | |||
| app:layout_constraintEnd_toStartOf="@+id/img_arrow" | |||
| app:layout_constraintTop_toTopOf="@+id/icon_left" /> | |||
| <View | |||
| android:id="@+id/line_view" | |||
| android:layout_width="1dp" | |||
| android:layout_height="0dp" | |||
| android:layout_marginStart="22dp" | |||
| android:background="@color/btn_small_checked" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toStartOf="@+id/icon_left" | |||
| app:layout_constraintTop_toBottomOf="@+id/icon_left" /> | |||
| <ImageView | |||
| android:id="@+id/bottom_dot" | |||
| android:layout_width="10dp" | |||
| android:layout_height="10dp" | |||
| android:layout_marginStart="17dp" | |||
| android:src="@drawable/blue_dot" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toStartOf="@+id/icon_left" | |||
| app:layout_constraintTop_toBottomOf="@+id/icon_left" /> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| @@ -0,0 +1,172 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <androidx.constraintlayout.widget.ConstraintLayout 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="150dp"> | |||
| <ImageView | |||
| android:id="@+id/icon_left" | |||
| android:layout_width="45dp" | |||
| android:layout_height="45dp" | |||
| android:layout_marginStart="20dp" | |||
| android:src="@drawable/college_summary_checked" | |||
| app:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintTop_toTopOf="parent" /> | |||
| <TextView | |||
| android:id="@+id/tv_title" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_marginStart="20dp" | |||
| android:gravity="center" | |||
| android:textColor="@color/black" | |||
| android:textSize="13sp" | |||
| app:layout_constraintBottom_toBottomOf="@+id/icon_left" | |||
| app:layout_constraintStart_toEndOf="@+id/icon_left" | |||
| app:layout_constraintTop_toTopOf="@+id/icon_left" | |||
| tools:text="MindSpore简介" /> | |||
| <View | |||
| android:id="@+id/line_view" | |||
| android:layout_width="1dp" | |||
| android:layout_height="0dp" | |||
| android:layout_marginStart="22dp" | |||
| android:background="@color/btn_small_checked" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toStartOf="@+id/icon_left" | |||
| app:layout_constraintTop_toBottomOf="@+id/icon_left" /> | |||
| <ImageView | |||
| android:id="@+id/bottom_dot" | |||
| android:layout_width="10dp" | |||
| android:layout_height="10dp" | |||
| android:layout_marginStart="17dp" | |||
| android:src="@drawable/blue_dot" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toStartOf="@+id/icon_left" | |||
| app:layout_constraintTop_toBottomOf="@+id/icon_left" /> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_train" | |||
| android:layout_width="55dp" | |||
| android:layout_height="60dp" | |||
| android:background="@drawable/item_bg_gray_rect" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toEndOf="@+id/icon_left" | |||
| app:layout_constraintTop_toBottomOf="@+id/icon_left"> | |||
| <ImageView | |||
| android:id="@+id/icon_train" | |||
| android:layout_width="20dp" | |||
| android:layout_height="20dp" | |||
| android:layout_centerHorizontal="true" | |||
| android:layout_marginTop="13dp" | |||
| android:layout_marginBottom="9dp" | |||
| android:scaleType="fitXY" | |||
| android:src="@drawable/college_train_uncheck" /> | |||
| <TextView | |||
| android:id="@+id/tv_train" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_below="@+id/icon_train" | |||
| android:layout_centerHorizontal="true" | |||
| android:gravity="center" | |||
| android:text="@string/college_train_title" | |||
| android:textSize="9sp" /> | |||
| </RelativeLayout> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_execute" | |||
| android:layout_width="55dp" | |||
| android:layout_height="60dp" | |||
| android:layout_marginStart="15dp" | |||
| android:background="@drawable/item_bg_gray_rect" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toEndOf="@+id/rl_train" | |||
| app:layout_constraintTop_toBottomOf="@+id/icon_left"> | |||
| <ImageView | |||
| android:id="@+id/icon_execute" | |||
| android:layout_width="20dp" | |||
| android:layout_height="20dp" | |||
| android:layout_centerHorizontal="true" | |||
| android:layout_marginTop="13dp" | |||
| android:layout_marginBottom="9dp" | |||
| android:scaleType="fitXY" | |||
| android:src="@drawable/college_execute_uncheck" /> | |||
| <TextView | |||
| android:id="@+id/tv_execute" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_below="@+id/icon_execute" | |||
| android:layout_centerHorizontal="true" | |||
| android:gravity="center" | |||
| android:text="@string/college_execute_title" | |||
| android:textSize="9sp" /> | |||
| </RelativeLayout> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_app" | |||
| android:layout_width="55dp" | |||
| android:layout_height="60dp" | |||
| android:layout_marginStart="15dp" | |||
| android:background="@drawable/item_bg_gray_rect" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toEndOf="@+id/rl_execute" | |||
| app:layout_constraintTop_toBottomOf="@+id/icon_left"> | |||
| <ImageView | |||
| android:id="@+id/icon_app" | |||
| android:layout_width="20dp" | |||
| android:layout_height="20dp" | |||
| android:layout_centerHorizontal="true" | |||
| android:layout_marginTop="13dp" | |||
| android:layout_marginBottom="9dp" | |||
| android:scaleType="fitXY" | |||
| android:src="@drawable/college_app_uncheck" /> | |||
| <TextView | |||
| android:id="@+id/tv_app" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_below="@+id/icon_app" | |||
| android:layout_centerHorizontal="true" | |||
| android:gravity="center" | |||
| android:text="@string/college_app_title" | |||
| android:textSize="9sp" /> | |||
| </RelativeLayout> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_video" | |||
| android:layout_width="55dp" | |||
| android:layout_height="60dp" | |||
| android:layout_marginStart="15dp" | |||
| android:background="@drawable/item_bg_gray_rect" | |||
| app:layout_constraintBottom_toBottomOf="parent" | |||
| app:layout_constraintStart_toEndOf="@+id/rl_app" | |||
| app:layout_constraintTop_toBottomOf="@+id/icon_left"> | |||
| <ImageView | |||
| android:id="@+id/icon_video" | |||
| android:layout_width="20dp" | |||
| android:layout_height="20dp" | |||
| android:layout_centerHorizontal="true" | |||
| android:layout_marginTop="13dp" | |||
| android:layout_marginBottom="9dp" | |||
| android:scaleType="fitXY" | |||
| android:src="@drawable/college_video_uncheck" /> | |||
| <TextView | |||
| android:id="@+id/tv_video" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_below="@+id/icon_video" | |||
| android:layout_centerHorizontal="true" | |||
| android:gravity="center" | |||
| android:text="@string/college_video_title" | |||
| android:textSize="9sp" /> | |||
| </RelativeLayout> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| @@ -0,0 +1,17 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal"> | |||
| <TextView | |||
| android:id="@+id/tv_title" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="center" | |||
| android:gravity="center" | |||
| android:text="@string/college_light_title" | |||
| android:textColor="#999999" | |||
| android:textSize="12sp" /> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,29 @@ | |||
| <?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"> | |||
| <TextView | |||
| android:textStyle="bold" | |||
| android:background="@drawable/bg_title_blue" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="?attr/actionBarSize" | |||
| android:layout_gravity="center" | |||
| android:gravity="center" | |||
| android:text="@string/main_tab_title_two" | |||
| android:textColor="@color/white" | |||
| android:textSize="17sp" /> | |||
| <View android:layout_width="match_parent" | |||
| android:layout_height="1dp" | |||
| android:background="@color/divider_gray"/> | |||
| <androidx.recyclerview.widget.RecyclerView | |||
| android:paddingTop="30dp" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:id="@+id/recyclerview"/> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,77 @@ | |||
| <?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" | |||
| android:theme="@style/ThemeOverlay.MindSpore.FullscreenContainer" | |||
| tools:context=".ui.experience.ExperienceFragment"> | |||
| <LinearLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="160dp" | |||
| android:background="@drawable/experience_head" | |||
| android:orientation="vertical"> | |||
| <TextView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="center" | |||
| android:layout_marginTop="40dp" | |||
| android:text="@string/experience_head_title" | |||
| android:textColor="@color/white" | |||
| android:textSize="24sp" | |||
| android:textStyle="bold" /> | |||
| <TextView | |||
| android:gravity="center" | |||
| android:paddingStart="20dp" | |||
| android:paddingEnd="20dp" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="center" | |||
| android:layout_marginTop="22dp" | |||
| android:text="@string/experience_head_subtitle" | |||
| android:textColor="@color/white" | |||
| android:textSize="13sp" /> | |||
| <Button | |||
| android:visibility="gone" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_gravity="center" | |||
| android:layout_marginTop="20dp" | |||
| android:background="@drawable/btn_head_experience" | |||
| android:text="@string/experience_head_button" | |||
| android:textColor="@color/white" | |||
| android:textSize="18sp" /> | |||
| </LinearLayout> | |||
| <com.google.android.material.tabs.TabLayout | |||
| android:id="@+id/tab_layout" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="50dp" | |||
| android:background="@color/white" | |||
| app:tabBackground="@color/transparent" | |||
| app:tabGravity="fill" | |||
| app:tabIndicatorFullWidth="false" | |||
| app:tabMaxWidth="0dp" | |||
| app:tabIndicatorHeight="2dp" | |||
| app:tabIndicator="@color/black" | |||
| app:tabRippleColor="@color/transparent" | |||
| app:tabSelectedTextColor="@color/black" | |||
| app:tabIndicatorColor="@color/main_tab_text_checked" | |||
| app:tabTextColor="@color/black"> | |||
| </com.google.android.material.tabs.TabLayout> | |||
| <androidx.viewpager.widget.ViewPager | |||
| android:id="@+id/vp_content" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:background="#fff2f4f5" /> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,172 @@ | |||
| <?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"> | |||
| <TextView | |||
| android:textStyle="bold" | |||
| android:background="@drawable/bg_title_blue" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="?attr/actionBarSize" | |||
| android:layout_gravity="center" | |||
| android:gravity="center" | |||
| android:text="@string/me_title" | |||
| android:textColor="@color/white" | |||
| android:textSize="17sp" /> | |||
| <View | |||
| android:layout_width="match_parent" | |||
| android:layout_height="1dp" | |||
| android:background="@color/divider_gray" /> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_me_share" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:clickable="true" | |||
| android:paddingTop="29dp" | |||
| android:paddingBottom="29dp"> | |||
| <TextView | |||
| style="@style/MeInfoTextLeftStyle" | |||
| android:layout_marginStart="20dp" | |||
| android:drawableStart="@drawable/me_share" | |||
| android:drawablePadding="15dp" | |||
| android:gravity="center_vertical" | |||
| android:text="@string/me_share_title" /> | |||
| <ImageView | |||
| android:layout_width="6dp" | |||
| android:layout_height="12dp" | |||
| android:layout_alignParentEnd="true" | |||
| android:layout_centerVertical="true" | |||
| android:layout_marginEnd="20dp" | |||
| android:background="@drawable/me_go" /> | |||
| </RelativeLayout> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_me_thumbsup" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:paddingTop="29dp" | |||
| android:paddingBottom="29dp"> | |||
| <TextView | |||
| style="@style/MeInfoTextLeftStyle" | |||
| android:layout_marginStart="20dp" | |||
| android:drawableStart="@drawable/me_up" | |||
| android:drawablePadding="15dp" | |||
| android:gravity="center_vertical" | |||
| android:text="@string/me_up_title" /> | |||
| <ImageView | |||
| android:layout_width="6dp" | |||
| android:layout_height="12dp" | |||
| android:layout_alignParentEnd="true" | |||
| android:layout_centerVertical="true" | |||
| android:layout_marginEnd="20dp" | |||
| android:background="@drawable/me_go" /> | |||
| </RelativeLayout> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_me_official" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:paddingTop="29dp" | |||
| android:paddingBottom="29dp"> | |||
| <TextView | |||
| style="@style/MeInfoTextLeftStyle" | |||
| android:layout_marginStart="20dp" | |||
| android:drawableStart="@drawable/me_official" | |||
| android:drawablePadding="15dp" | |||
| android:gravity="center_vertical" | |||
| android:text="@string/me_official_title" /> | |||
| <ImageView | |||
| android:layout_width="6dp" | |||
| android:layout_height="12dp" | |||
| android:layout_alignParentEnd="true" | |||
| android:layout_centerVertical="true" | |||
| android:layout_marginEnd="20dp" | |||
| android:background="@drawable/me_go" /> | |||
| </RelativeLayout> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_me_official_code" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:paddingTop="29dp" | |||
| android:paddingBottom="29dp"> | |||
| <TextView | |||
| style="@style/MeInfoTextLeftStyle" | |||
| android:layout_marginStart="20dp" | |||
| android:drawableStart="@drawable/me_official_code" | |||
| android:drawablePadding="15dp" | |||
| android:gravity="center_vertical" | |||
| android:text="@string/me_official_code_title" /> | |||
| <ImageView | |||
| android:layout_width="6dp" | |||
| android:layout_height="12dp" | |||
| android:layout_alignParentEnd="true" | |||
| android:layout_centerVertical="true" | |||
| android:layout_marginEnd="20dp" | |||
| android:background="@drawable/me_go" /> | |||
| </RelativeLayout> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_me_qa" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:paddingTop="29dp" | |||
| android:paddingBottom="29dp"> | |||
| <TextView | |||
| style="@style/MeInfoTextLeftStyle" | |||
| android:layout_marginStart="20dp" | |||
| android:drawableStart="@drawable/me_qa" | |||
| android:drawablePadding="15dp" | |||
| android:gravity="center_vertical" | |||
| android:text="@string/me_qa_title" /> | |||
| <ImageView | |||
| android:layout_width="6dp" | |||
| android:layout_height="12dp" | |||
| android:layout_alignParentEnd="true" | |||
| android:layout_centerVertical="true" | |||
| android:layout_marginEnd="20dp" | |||
| android:background="@drawable/me_go" /> | |||
| </RelativeLayout> | |||
| <RelativeLayout | |||
| android:id="@+id/rl_me_version" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:paddingTop="29dp" | |||
| android:paddingBottom="29dp"> | |||
| <TextView | |||
| style="@style/MeInfoTextLeftStyle" | |||
| android:layout_marginStart="20dp" | |||
| android:drawableStart="@drawable/me_version" | |||
| android:drawablePadding="15dp" | |||
| android:gravity="center_vertical" | |||
| android:text="@string/me_version_title" /> | |||
| <TextView | |||
| android:id="@+id/me_vision" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:layout_alignParentEnd="true" | |||
| android:layout_centerVertical="true" | |||
| android:layout_marginEnd="20dp" | |||
| android:textColor="@color/main_tab_text_uncheck" | |||
| android:textSize="13sp" | |||
| tools:text="v2.10.0" /> | |||
| </RelativeLayout> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,186 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <androidx.constraintlayout.widget.ConstraintLayout 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/colorPrimary"> | |||
| <ScrollView | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| > | |||
| <androidx.constraintlayout.widget.ConstraintLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| android:layout_marginTop="30dp" | |||
| android:layout_marginBottom="30dp" | |||
| android:orientation="vertical"> | |||
| <Button | |||
| android:id="@+id/btn_object" | |||
| android:layout_width="0dp" | |||
| android:layout_height="50dp" | |||
| android:layout_marginStart="18dp" | |||
| android:layout_marginTop="17dp" | |||
| 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:layout_constraintStart_toStartOf="parent" | |||
| app:layout_constraintWidth_percent="0.44" | |||
| tools:ignore="MissingConstraints" /> | |||
| <Button | |||
| android:id="@+id/btn_object_camera" | |||
| android:layout_width="0dp" | |||
| 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:layout_constraintBottom_toBottomOf="@+id/btn_object" | |||
| app:layout_constraintEnd_toEndOf="parent" | |||
| app:layout_constraintWidth_percent="0.44" /> | |||
| <Button | |||
| android:id="@+id/btn_posenet" | |||
| android:layout_width="0dp" | |||
| 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:layout_constraintStart_toStartOf="@+id/btn_object" | |||
| app:layout_constraintTop_toBottomOf="@+id/btn_object" | |||
| app:layout_constraintWidth_percent="0.44" /> | |||
| <Button | |||
| android:id="@+id/btn_style_transfer" | |||
| 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:layout_constraintBottom_toBottomOf="@+id/btn_posenet" | |||
| app:layout_constraintEnd_toEndOf="@+id/btn_object_camera" | |||
| app:layout_constraintWidth_percent="0.44" /> | |||
| <Button | |||
| android:id="@+id/btn_segmentation" | |||
| android:layout_width="0dp" | |||
| 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:layout_constraintStart_toStartOf="@+id/btn_posenet" | |||
| app:layout_constraintTop_toBottomOf="@+id/btn_posenet" | |||
| app:layout_constraintWidth_percent="0.44" /> | |||
| <Button | |||
| android:id="@+id/btn_image" | |||
| android:layout_width="0dp" | |||
| 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: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:layout_constraintEnd_toEndOf="@+id/btn_image" | |||
| app:layout_constraintWidth_percent="0.44" /> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| </ScrollView> | |||
| </androidx.constraintlayout.widget.ConstraintLayout> | |||
| @@ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string name="app_name">MindSpore</string> | |||
| <string name="app_name">MindSpore掌中宝</string> | |||
| <string name="app_need_permission">"MindSpore needs to access the "camera" and "external storage", please go to "application information -> permissions" to grant!"</string> | |||
| <string name="app_permission_by_hand"> "Go to manual authorization"</string> | |||
| <string name="cancel">"Cancel"</string> | |||
| @@ -9,8 +9,8 @@ | |||
| <string name="app_need_install"> "Whether to install"</string> | |||
| <string name="app_is_loading"> "downloading"</string> | |||
| <string name="app_wait">"Please wait..."</string> | |||
| <string name="app_load_fail"> "download failed"</string> | |||
| <string name="app_update_lastest"> "Please upgrade to a new version"</string> | |||
| <string name="app_load_fail">"download failed"</string> | |||
| <string name="app_update_lastest">Upgrade to a new version</string> | |||
| <string name="title_image">Image Classification</string> | |||
| <string name="title_image_garbage">Garbage Classification</string> | |||
| <string name="title_object">Photo Detection</string> | |||
| @@ -25,6 +25,50 @@ | |||
| <string name="title_star">Star</string> | |||
| <string name="title_version">"Version: "</string> | |||
| <string name="title_share">Share</string> | |||
| <string name="title_share_commend">MindSpore APP:A one-stop collaborative learning, demonstration, and experience platform for beginners\t</string> | |||
| <string name="title_share_commend">MindSpore掌中宝:A one-stop collaborative learning, demonstration, and experience platform for beginners\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> | |||
| <string name="tab_experience_one">Computer Vision</string> | |||
| <string name="experience_head_title">Experience Center</string> | |||
| <string name="experience_head_subtitle">Invite you to explore a new generation of ALL-Scenario AI Computing Framework</string> | |||
| <string name="experience_head_button">cooperation</string> | |||
| <string name="me_title">Me</string> | |||
| <string name="me_share_title">Share</string> | |||
| <string name="me_up_title">Like</string> | |||
| <string name="me_qa_title">Feedback</string> | |||
| <string name="me_version_title">Version</string> | |||
| <string name="me_official_title">Official Website</string> | |||
| <string name="me_official_code_title">Official Code</string> | |||
| <string name="title_splash_welcome">A one-stop collaborative learning, demonstration, and experience platform for beginners</string> | |||
| <string name="college_summary_title">MindSpore Summary</string> | |||
| <string name="college_cloud_title">A One-Hour Trip to MindSpore</string> | |||
| <string name="college_quick_title">Quick Start</string> | |||
| <string name="college_train_title">Train</string> | |||
| <string name="college_execute_title">Inference</string> | |||
| <string name="college_app_title">Applications</string> | |||
| <string name="college_video_title">Video</string> | |||
| <string name="college_faq_title">FAQ</string> | |||
| <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. | |||
| Including device, edge, and cloud, MindSpore supports all-scenario business, bringing easier programming, | |||
| easier debugging, better performance and more flexible deployment methods to all developers.\n\n | |||
| \t\t MindSpore is committed to building an open source community facing the world, | |||
| and continues to promote the prosperity of the open source ecosystem for both software and hardware AI applications. It was opened on March 28, 2020.\n\n | |||
| \t\t As the version continues to be updated, MindSpore will also provide more learning resources, | |||
| support and services. Developers and partners from all walks of life are welcome to deeply participate and contribute wisdom, | |||
| creating all-inclusive AI applications and building AI Ecology with us.\n | |||
| </string> | |||
| <string name="splash_count_down">s</string> | |||
| </resources> | |||
| @@ -0,0 +1,7 @@ | |||
| <resources> | |||
| <style name="ThemeOverlay.MindSpore.FullscreenContainer" parent=""> | |||
| <item name="fullscreenBackgroundColor">@color/light_blue_900</item> | |||
| <item name="fullscreenTextColor">@color/light_blue_A400</item> | |||
| </style> | |||
| </resources> | |||
| @@ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <string name="app_name">MindSpore</string> | |||
| <string name="app_name">MindSpore掌中宝</string> | |||
| <string name="app_need_permission">"MindSpore需要访问 “相机" 和 “外部存储器",请到 “应用信息 -> 权限" 中授予!"</string> | |||
| <string name="app_permission_by_hand">"去手动授权"</string> | |||
| <string name="cancel">"取消"</string> | |||
| @@ -24,5 +24,44 @@ | |||
| <string name="title_star">打星</string> | |||
| <string name="title_version">版本号: </string> | |||
| <string name="title_share">分享</string> | |||
| <string name="title_share_commend">MindSpore APP:初学者的一站式协同学习、演示、体验平台\t</string> | |||
| <string name="title_share_commend">MindSpore掌中宝:初学者的一站式协同学习、演示、体验平台\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="experience_head_title">体验中心</string> | |||
| <string name="experience_head_subtitle">新一代全场景AI计算框架,邀您马上体验</string> | |||
| <string name="experience_head_button">合作咨询</string> | |||
| <string name="me_title">我的</string> | |||
| <string name="me_share_title">一键分享</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_splash_welcome">初学者的一站式协同学习、演示、体验平台</string> | |||
| <string name="college_summary_title">MindSpore简介</string> | |||
| <string name="college_cloud_title">1小时体验端云协同全流程开发</string> | |||
| <string name="college_quick_title">快速入门</string> | |||
| <string name="college_train_title">训练模型</string> | |||
| <string name="college_execute_title">执行推理</string> | |||
| <string name="college_app_title">端侧应用</string> | |||
| <string name="college_video_title">参考视频</string> | |||
| <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\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> | |||
| </resources> | |||
| @@ -0,0 +1,35 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <integer-array name="main_tab_un_select"> | |||
| <item name="tab_experience">@drawable/experience_uncheck</item> | |||
| <item name="tab_find">@drawable/college_uncheck</item> | |||
| <item name="tab_me">@drawable/me_uncheck</item> | |||
| </integer-array> | |||
| <integer-array name="main_tab_select"> | |||
| <item name="tab_experience">@drawable/experience_checked</item> | |||
| <item name="tab_college">@drawable/college_checked</item> | |||
| <item name="tab_me">@drawable/me_checked</item> | |||
| </integer-array> | |||
| <string-array name="main_tab_title"> | |||
| <item>@string/main_tab_title_one</item> | |||
| <item>@string/main_tab_title_two</item> | |||
| <item>@string/main_tab_title_three</item> | |||
| </string-array> | |||
| <string-array name="tab_experience"> | |||
| <item>@string/tab_experience_one</item> | |||
| <item>Reply to all</item> | |||
| </string-array> | |||
| <!-- Reply Preference --> | |||
| <string-array name="reply_entries"> | |||
| <item>Reply</item> | |||
| <item>Reply to all</item> | |||
| </string-array> | |||
| <string-array name="reply_values"> | |||
| <item>reply</item> | |||
| <item>reply_all</item> | |||
| </string-array> | |||
| </resources> | |||
| @@ -0,0 +1,6 @@ | |||
| <resources> | |||
| <declare-styleable name="FullscreenAttrs"> | |||
| <attr name="fullscreenBackgroundColor" format="color" /> | |||
| <attr name="fullscreenTextColor" format="color" /> | |||
| </declare-styleable> | |||
| </resources> | |||
| @@ -1,21 +1,34 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <color name="colorPrimary">#303030</color> | |||
| <color name="colorPrimaryDark">#3700B3</color> | |||
| <color name="colorAccent">#03DAC5</color> | |||
| <resources xmlns:tools="http://schemas.android.com/tools"> | |||
| <color name="colorPrimary">#ffffff</color> | |||
| <color name="colorPrimaryDark">#ffffff</color> | |||
| <color name="colorAccent">#ffffff</color> | |||
| <color name="mindspore_semi_transparent">#66000000</color> | |||
| <color name="transparent">#00000000</color> | |||
| <color name="white">#ffffff</color> | |||
| <color name="black">#000000</color> | |||
| <color name="gray">#A69D9D</color> | |||
| <color name="gray_btn">#424242</color> | |||
| <color name="gray_btn">#e6e6e6</color> | |||
| <color name="gray_light_btn">#6C6B6B</color> | |||
| <color name="gray_light">#Eff3ff</color> | |||
| <color name="text_black">#333333</color> | |||
| <color name="text_gray">#666666</color> | |||
| <color name="text_blue">#6DA7FF</color> | |||
| <color name="text_yellow">#F8E71C</color> | |||
| <color name="text_orange">#FF844D</color> | |||
| <color name="text_green">#66B50A</color> | |||
| <color name="divider_gray">#dbdbdb</color> | |||
| <color name="main_tab_text_checked">#6189ff</color> | |||
| <color name="main_tab_text_uncheck">#666666</color> | |||
| <color name="light_blue_600">#FF039BE5</color> | |||
| <color name="light_blue_900">#FF01579B</color> | |||
| <color name="light_blue_A200">#FF40C4FF</color> | |||
| <color name="light_blue_A400">#FF00B0FF</color> | |||
| <color name="black_overlay">#66000000</color> | |||
| <color name="blackText4">#66000000</color> | |||
| </resources> | |||
| @@ -1,5 +1,5 @@ | |||
| <resources> | |||
| <string name="app_name">MindSpore</string> | |||
| <string name="app_name">MindSpore掌中宝</string> | |||
| <string name="app_need_permission">"MindSpore需要访问 “相机” 和 “外部存储器”,请到 “应用信息 -> 权限” 中授予!"</string> | |||
| <string name="app_permission_by_hand">"去手动授权"</string> | |||
| <string name="cancel">"取消"</string> | |||
| @@ -24,6 +24,46 @@ | |||
| <string name="title_star">Star</string> | |||
| <string name="title_version">Version: </string> | |||
| <string name="title_share">Share</string> | |||
| <string name="title_share_commend">MindSpore APP:初学者的一站式协同学习、演示、体验平台\t</string> | |||
| <string name="title_share_commend">MindSpore掌中宝:初学者的一站式协同学习、演示、体验平台\t</string> | |||
| <string name="title_splash_welcome">初学者的一站式协同学习、演示、体验平台</string> | |||
| <string name="splash_count_down">秒</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="experience_head_title">体验中心</string> | |||
| <string name="experience_head_subtitle">新一代全场景AI计算框架,邀您马上体验</string> | |||
| <string name="experience_head_button">合作咨询</string> | |||
| <!-- me fragment --> | |||
| <string name="me_title">我的</string> | |||
| <string name="me_share_title">一键分享</string> | |||
| <string name="me_up_title">一键点赞</string> | |||
| <string name="me_official_title">官方网站</string> | |||
| <string name="me_official_code_title">官方代码仓</string> | |||
| <string name="me_qa_title">问题反馈</string> | |||
| <string name="me_version_title">版本号</string> | |||
| <string name="college_summary_title">MindSpore简介</string> | |||
| <string name="college_cloud_title">1小时体验端云协同全流程开发</string> | |||
| <string name="college_quick_title">快速入门</string> | |||
| <string name="college_train_title">训练模型</string> | |||
| <string name="college_app_title">端侧应用</string> | |||
| <string name="college_video_title">参考视频</string> | |||
| <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计算框架, | |||
| 兼顾学术界研究的灵活性与工业界的高性能要求,支持端边云全场景业务,为开发者带来编程更简单、调试更轻松、性能更卓越、部署更灵活的体验。\n\n | |||
| \t\t\tMindSpore致力于构筑面向全球的开源社区,持续推动AI软硬件应用开源生态繁荣发展,已于2020年3月28日开源。\n\n | |||
| \t\t\t版本在不断迭代更新中,MindSpore也会持续提供更多的学习资源、支持与服务,欢迎各行各业的开发者与伙伴深度参与、贡献智慧,打造无所不及的AI应用,与我们共建AI生态。\n</string> | |||
| <string name="college_execute_title">" "</string> | |||
| </resources> | |||
| @@ -1,3 +1,4 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <resources> | |||
| <!-- Base application theme. --> | |||
| <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |||
| @@ -7,5 +8,22 @@ | |||
| <item name="colorAccent">@color/colorAccent</item> | |||
| </style> | |||
| <style name="Widget.AppTheme.ButtonBar.Fullscreen" parent=""> | |||
| <item name="android:background">@color/black_overlay</item> | |||
| <item name="android:buttonBarStyle">?android:attr/buttonBarStyle</item> | |||
| </style> | |||
| <!-- Text style "" --> | |||
| <!-- Add this snippet to styles.xml. --> | |||
| <style name="MeInfoTextLeftStyle"> | |||
| <item name="android:layout_width">wrap_content</item> | |||
| <item name="android:layout_height">wrap_content</item> | |||
| <item name="android:layout_centerVertical">true</item> | |||
| <item name="android:textSize">16sp</item> | |||
| <item name="android:textColor">@color/text_black</item> | |||
| </style> | |||
| </resources> | |||
| @@ -0,0 +1,16 @@ | |||
| <resources> | |||
| <style name="ThemeOverlay.MindSpore.FullscreenContainer" parent=""> | |||
| <item name="fullscreenBackgroundColor">@color/light_blue_600</item> | |||
| <item name="fullscreenTextColor">@color/light_blue_A200</item> | |||
| </style> | |||
| <style name="MyAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert"> | |||
| <!-- Used for the buttons --> | |||
| <item name="colorAccent">@color/colorAccent</item> | |||
| <!-- Used for the title and text --> | |||
| <!-- <item name="android:textColorPrimary">@color/colorAccent</item>--> | |||
| <!-- Used for the background --> | |||
| <!-- <item name="android:background">@color/white</item>--> | |||
| </style> | |||
| </resources> | |||
| @@ -0,0 +1,37 @@ | |||
| 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" | |||
| consumerProguardFiles "consumer-rules.pro" | |||
| } | |||
| buildTypes { | |||
| release { | |||
| minifyEnabled false | |||
| proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |||
| } | |||
| } | |||
| compileOptions { | |||
| sourceCompatibility JavaVersion.VERSION_1_8 | |||
| targetCompatibility JavaVersion.VERSION_1_8 | |||
| } | |||
| } | |||
| dependencies { | |||
| implementation 'androidx.appcompat:appcompat:1.2.0' | |||
| implementation 'com.google.android.material:material:1.2.1' | |||
| androidTestImplementation 'androidx.test.ext:junit:1.1.2' | |||
| androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| # Add project specific ProGuard rules here. | |||
| # You can control the set of applied configuration files using the | |||
| # proguardFiles setting in build.gradle. | |||
| # | |||
| # For more details, see | |||
| # http://developer.android.com/guide/developing/tools/proguard.html | |||
| # If your project uses WebView with JS, uncomment the following | |||
| # and specify the fully qualified class name to the JavaScript interface | |||
| # class: | |||
| #-keepclassmembers class fqcn.of.javascript.interface.for.webview { | |||
| # public *; | |||
| #} | |||
| # Uncomment this to preserve the line number information for | |||
| # debugging stack traces. | |||
| #-keepattributes SourceFile,LineNumberTable | |||
| # If you keep the line number information, uncomment this to | |||
| # hide the original source file name. | |||
| #-renamesourcefileattribute SourceFile | |||
| @@ -0,0 +1,26 @@ | |||
| package com.mindspore.common; | |||
| import android.content.Context; | |||
| 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.*; | |||
| /** | |||
| * Instrumented test, which will execute on an Android device. | |||
| * | |||
| * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | |||
| */ | |||
| @RunWith(AndroidJUnit4.class) | |||
| public class ExampleInstrumentedTest { | |||
| @Test | |||
| public void useAppContext() { | |||
| // Context of the app under test. | |||
| Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | |||
| assertEquals("com.mindspore.common.test", appContext.getPackageName()); | |||
| } | |||
| } | |||
| @@ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |||
| package="com.mindspore.common"> | |||
| </manifest> | |||
| @@ -0,0 +1,71 @@ | |||
| package com.mindspore.common.base.adapter; | |||
| import android.view.ViewGroup; | |||
| import androidx.fragment.app.Fragment; | |||
| import androidx.fragment.app.FragmentManager; | |||
| import androidx.fragment.app.FragmentPagerAdapter; | |||
| import java.util.List; | |||
| public class BasePagerAdapter extends FragmentPagerAdapter { | |||
| private List<?> mFragment; | |||
| private List<String> mTitleList; | |||
| /** | |||
| * 普通,主页使用 | |||
| */ | |||
| public BasePagerAdapter(FragmentManager fm, List<?> mFragment) { | |||
| super(fm); | |||
| this.mFragment = mFragment; | |||
| } | |||
| /** | |||
| * 接收首页传递的标题 | |||
| */ | |||
| public BasePagerAdapter(FragmentManager fm, List<?> mFragment, List<String> mTitleList) { | |||
| super(fm); | |||
| this.mFragment = mFragment; | |||
| this.mTitleList = mTitleList; | |||
| } | |||
| @Override | |||
| public Fragment getItem(int position) { | |||
| return (Fragment) mFragment.get(position); | |||
| } | |||
| @Override | |||
| public int getCount() { | |||
| return mFragment==null ? 0 : mFragment.size(); | |||
| } | |||
| @Override | |||
| public void destroyItem(ViewGroup container, int position, Object object) { | |||
| super.destroyItem(container, position, object); | |||
| } | |||
| /** | |||
| * 首页显示title,每日推荐等.. | |||
| * 若有问题,移到对应单独页面 | |||
| */ | |||
| @Override | |||
| public CharSequence getPageTitle(int position) { | |||
| if (mTitleList != null) { | |||
| return mTitleList.get(position); | |||
| } else { | |||
| return ""; | |||
| } | |||
| } | |||
| public void addFragmentList(List<?> fragment) { | |||
| this.mFragment.clear(); | |||
| this.mFragment = null; | |||
| this.mFragment = fragment; | |||
| notifyDataSetChanged(); | |||
| } | |||
| } | |||
| @@ -0,0 +1,24 @@ | |||
| package com.mindspore.common.base.grid; | |||
| import android.graphics.Rect; | |||
| import android.view.View; | |||
| import androidx.recyclerview.widget.RecyclerView; | |||
| public class MSGridSpacingItemDecoration extends RecyclerView.ItemDecoration { | |||
| private final int space; | |||
| public MSGridSpacingItemDecoration( int space) { | |||
| this.space = space; | |||
| } | |||
| @Override | |||
| public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { | |||
| outRect.left = space; | |||
| outRect.bottom = space; | |||
| if (parent.getChildLayoutPosition(view) % 4 == 0) { | |||
| outRect.left = 0; | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| package com.mindspore.common.config; | |||
| public class MSLinkUtils { | |||
| public static final String BASE_URL = "https://www.mindspore.cn"; | |||
| public static final String BASE_DOC_URL = BASE_URL + "/doc/note/zh-CN/master"; | |||
| public static final String HELP_IMAGE_CLASSIFICATION = BASE_DOC_URL + "/image_classification_lite.html"; | |||
| public static final String HELP_PHOTO_DETECTION = BASE_DOC_URL + "/object_detection_lite.html"; | |||
| public static final String HELP_CAMERA_DETECTION = BASE_DOC_URL + "/object_detection_lite.html"; | |||
| public static final String HELP_POSENET_LITE = BASE_DOC_URL + "/posenet_lite.html"; | |||
| public static final String HELP_STYLE_TRANSFER = BASE_DOC_URL + "/style_transfer_lite.html"; | |||
| public static final String HELP_IMAGE_SEGMENTATION = BASE_DOC_URL + "/image_segmentation_lite.html"; | |||
| public static final String HELP_SCENE_DETECTION = BASE_DOC_URL + "/scene_detection_lite.html"; | |||
| public static final String COLLEGE_MAIN_CLOUD = BASE_URL + "/news/newschildren?id=354"; | |||
| public static final String COLLEGE_QUICK_TRAIN = BASE_URL + "/tutorial/training/zh-CN/master/quick_start/quick_start.html"; | |||
| public static final String COLLEGE_QUICK_EXECUTE = BASE_URL + "/tutorial/inference/zh-CN/master/multi_platform_inference.html"; | |||
| public static final String COLLEGE_QUICK_APP = BASE_URL + "/tutorial/lite/zh-CN/master/quick_start/quick_start.html"; | |||
| public static final String COLLEGE_QUICK_VIDEO = BASE_URL + "/tutorial/training/zh-CN/master/quick_start/quick_video.html"; | |||
| public static final String COLLEGE_MAIN_FAQ = BASE_URL + "/doc/faq/zh-CN/master/index.html"; | |||
| public static final String COLLEGE_MAIN_ASK = "https://bbs.huaweicloud.com/forum/forum-1076-1.html"; | |||
| public static final String[] COLLEGE_QUICK_WEB_ARRAY = new String[]{COLLEGE_QUICK_TRAIN, COLLEGE_QUICK_EXECUTE, COLLEGE_QUICK_APP, COLLEGE_QUICK_VIDEO}; | |||
| public static final String ME_APK_URL = "https://download.mindspore.cn/model_zoo/official/lite/apk/mindmain.html"; | |||
| public static final String ME_HELP_URL = "https://gitee.com/mindspore/mindspore/issues/new?issue%5Bassignee_id%5D=0&issue%5Bmilestone_id%5D=0"; | |||
| public static final String ME_CODE_URL = "https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/lite"; | |||
| public static final String ME_STAR_URL = "https://gitee.com/mindspore/mindspore"; | |||
| } | |||