diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MyQRCodeActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MyQRCodeActivity.java index a3151b726a67cc4517eea576bbd12458f3d8a46f..fba5ba0779873ef393e9b9ea7033911812d5d098 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MyQRCodeActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/me/MyQRCodeActivity.java @@ -8,11 +8,8 @@ import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.util.DisplayMetrics; -import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; @@ -23,7 +20,7 @@ import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.alibaba.android.arouter.facade.annotation.Route; -import com.mindspore.common.utils.AppTitleUtils; +import com.mindspore.customview.titlebar.AppTitleView; import com.mindspore.himindspore.R; @Route(path = "/app/MyQRCodeActivity") @@ -35,7 +32,7 @@ public class MyQRCodeActivity extends AppCompatActivity { private RelativeLayout mMy_layout; private ImageView mQr_code_image; - private AppTitleUtils appTitle; + private AppTitleView appTitle; @Override protected void onCreate(Bundle savedInstanceState) { @@ -46,14 +43,14 @@ public class MyQRCodeActivity extends AppCompatActivity { private void init() { appTitle = findViewById(R.id.segmentation_toolbar); - appTitle.setNavigationOnClickListener(view -> finish()); + mMy_layout = (RelativeLayout) findViewById(R.id.my_relativelayout); mQr_code_image = findViewById(R.id.img_origin); setOnClickMore(); } private void setOnClickMore(){ - appTitle.setTitleRightThree(new View.OnClickListener() { + appTitle.setTitleRightThreeOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java index c7adabfa333923ca9ccfc7255cbd2059fe0ecb80..bec5133cf5ffb406138dc44faeb09b30a0d574de 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/java/com/mindspore/himindspore/ui/webview/WebViewUtilsActivity.java @@ -21,25 +21,21 @@ import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; -import android.webkit.WebViewClient; import android.widget.ProgressBar; -import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.common.utils.AppTitleUtils; +import com.mindspore.customview.titlebar.AppTitleView; import com.mindspore.himindspore.R; public class WebViewUtilsActivity extends AppCompatActivity { private WebView mWebView; private ProgressBar progressBar; - private AppTitleUtils appTitle; + private AppTitleView appTitle; private String mWebViewUrl; private int ProgressBar = 100; - private TextView titleName; @Override protected void onCreate(Bundle savedInstanceState) { @@ -52,7 +48,6 @@ public class WebViewUtilsActivity extends AppCompatActivity { private void initView() { progressBar = findViewById(R.id.progress); appTitle = findViewById(R.id.mWebView_toolbar); - appTitle.setNavigationOnClickListener(view -> finish()); mWebView = findViewById(R.id.mWebView); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); @@ -78,46 +73,46 @@ public class WebViewUtilsActivity extends AppCompatActivity { private void showWebViewTitle(String mWebViewUrl) { switch (mWebViewUrl) { case MSLinkUtils.ME_STAR_URL: - appTitle.setTitleText(R.string.me_up_title); + appTitle.setTitleTextName(R.string.me_up_title); break; case MSLinkUtils.BASE_URL: - appTitle.setTitleText(R.string.me_official_title); + appTitle.setTitleTextName(R.string.me_official_title); break; case MSLinkUtils.ME_CODE_URL: - appTitle.setTitleText(R.string.me_official_code_title); + appTitle.setTitleTextName(R.string.me_official_code_title); break; case MSLinkUtils.ME_HELP_URL: - appTitle.setTitleText(R.string.me_qa_title); + appTitle.setTitleTextName(R.string.me_qa_title); break; case MSLinkUtils.COLLEGE_QUICK_APP: - appTitle.setTitleText(R.string.title_college_broken_side); + appTitle.setTitleTextName(R.string.title_college_broken_side); break; case MSLinkUtils.COLLEGE_MAIN_FAQ: - appTitle.setTitleText(R.string.title_college_faq); + appTitle.setTitleTextName(R.string.title_college_faq); break; case MSLinkUtils.COLLEGE_MAIN_ASK: - appTitle.setTitleText(R.string.title_college_forum); + appTitle.setTitleTextName(R.string.title_college_forum); break; case MSLinkUtils.COLLEGE_MAIN_GATE: - appTitle.setTitleText(R.string.college_quick_title); + appTitle.setTitleTextName(R.string.college_quick_title); break; case MSLinkUtils.COLLEGE_MAIN_CLOUD: - appTitle.setTitleText(R.string.title_college_one_hour); + appTitle.setTitleTextName(R.string.title_college_one_hour); break; case MSLinkUtils.COLLEGE_QUICK_EXECUTE: - appTitle.setTitleText(R.string.title_college_perform); + appTitle.setTitleTextName(R.string.title_college_perform); break; case MSLinkUtils.COLLEGE_QUICK_VIDEO: - appTitle.setTitleText(R.string.title_college_video); + appTitle.setTitleTextName(R.string.title_college_video); break; case MSLinkUtils.COLLEGE_QUICK_TRAIN: - appTitle.setTitleText(R.string.title_college_training); + appTitle.setTitleTextName(R.string.title_college_training); break; case MSLinkUtils.USER_PRIVACY_RULES: - appTitle.setTitleText(R.string.me_user_agreements); + appTitle.setTitleTextName(R.string.me_user_agreements); break; default: - appTitle.setTitleText(R.string.me_official_title); + appTitle.setTitleTextName(R.string.me_official_title); break; } } diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_intelligent_poetry_writing.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_intelligent_poetry_writing.xml index 372ffb279f45456115b83a1058d5b268ef360ed1..f4f0dba02d1f7c4fcd4fdbece2f177603be92776 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_intelligent_poetry_writing.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_intelligent_poetry_writing.xml @@ -25,10 +25,11 @@ + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="15dp" + android:layout_marginStart="15dp" + android:src="@drawable/icon_back" /> \ No newline at end of file diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_my_qr_code.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_my_qr_code.xml index 3e055bd663b0b2c9dc9becef1debe58f77fa4a68..28a04f76d5538853ea4aa1c0b6f77251e02599dc 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_my_qr_code.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_my_qr_code.xml @@ -10,11 +10,11 @@ tools:context=".ui.me.MyQRCodeActivity" tools:ignore="ResAuto"> - diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_splash.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_splash.xml index fdef25c9875491a8734c515d3cf8e7ecd0c3b398..cb6a6e9b2c445f5bc0d69168ee0b303e20eacfd2 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_splash.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/activity_splash.xml @@ -40,8 +40,8 @@ android:layout_height="wrap_content" android:layout_marginTop="23dp" android:gravity="center" - android:paddingStart="25dp" - android:paddingEnd="25dp" + android:paddingStart="20dp" + android:paddingEnd="20dp" android:text="@string/title_splash_welcome" android:textColor="@color/text_gray" android:textSize="16sp" diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/webview_layout.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/webview_layout.xml index ad48d0c7d59417d7804c7029d221440e84bfed1b..a9468371957e5b3ee6c82704051c42f224ddb7dd 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/webview_layout.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/layout/webview_layout.xml @@ -10,11 +10,11 @@ tools:context=".ui.webview.WebViewUtilsActivity" tools:ignore="ResAuto"> - + title:iconLeftBack="@drawable/icon_back" /> Official Website Official Code - One stop collaborative learning, demonstration and experience platform for beginners. + A one-stop platform of collaborative learning, demonstrating, and experiencing for AI users. MindSpore CV application NLP application diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values-zh/strings.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values-zh/strings.xml index 0d64b3a32c94afcc99e62311c1141cba9861eedd..f35aa36e4d3efeb05a62456654a61a84c59eec6c 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values-zh/strings.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values-zh/strings.xml @@ -65,7 +65,7 @@ 《用户协议和隐私政策》规定使用和披露您的个人信息。但我们将以高度的勤勉、审慎义务对待这些信息。除本隐私政策另有规定外,在未征得您实 现许可的情况下,我们不会将这些信息对外披露或向第三方提供。我们会不时更新本隐私政策。您在同意我们服务使用协议之时,即视为您 已经同意本隐私政策全部内容。本隐私政策属于我们服务使用协议不可分割的一部分。 - 初学者的一站式协同学习、演示、体验平台 + AI爱好者的一站式协同学习、演示、体验平台 MindSpore MindSpore简介 diff --git a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values/strings.xml b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values/strings.xml index 26dd83f4529cfb6f32659f8f8b1ba2727df77442..f627a4fed064e2daf021a06aa1ce54a912fa844c 100644 --- a/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values/strings.xml +++ b/model_zoo/official/lite/MindSpore_inhand/app/src/main/res/values/strings.xml @@ -35,7 +35,7 @@ Version: Share MindSpore掌中宝:AI爱好者的一站式协同学习、演示、体验平台\t - 初学者的一站式协同学习、演示、体验平台 + AI爱好者的一站式协同学习、演示、体验平台 MindSpore CV类应用 NLP类应用 diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/config/MSLinkUtils.java b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/config/MSLinkUtils.java index 0941d37080abfcd2ad0e8c288623a4a8ae6db9fd..4e7436e01155bafdea19a5468950066dbdc22eee 100644 --- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/config/MSLinkUtils.java +++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/config/MSLinkUtils.java @@ -28,5 +28,4 @@ public class MSLinkUtils { 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"; public static final String INTENT_WEB_VIEW = "WebView"; - public static final String INTENT_MORE_APP = "MoreApplication"; } diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/values/attrs.xml b/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/values/attrs.xml index 2ef36ea177cd633e00ca4583079649d8b5f34dc8..f11f7450a82fb155e3cc0a5f90a9a53af9653885 100644 --- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/values/attrs.xml +++ b/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/values/attrs.xml @@ -1,9 +1,3 @@ - - - - - - - + diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/AppTitleUtils.java b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/java/com/mindspore/customview/titlebar/AppTitleView.java similarity index 37% rename from model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/AppTitleUtils.java rename to model_zoo/official/lite/MindSpore_inhand/customView/src/main/java/com/mindspore/customview/titlebar/AppTitleView.java index 9e685f09bb7d4cd9c82b15fb99240f3c4d11a8f0..028265b98068b9c260f2b5a73cd5be3f97433d47 100644 --- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/java/com/mindspore/common/utils/AppTitleUtils.java +++ b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/java/com/mindspore/customview/titlebar/AppTitleView.java @@ -1,87 +1,135 @@ -package com.mindspore.common.utils; +package com.mindspore.customview.titlebar; import android.app.Activity; import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -import com.mindspore.common.R; +import androidx.annotation.Nullable; -import retrofit2.http.HEAD; +import com.mindspore.customview.R; -public class AppTitleUtils extends LinearLayout { +public class AppTitleView extends LinearLayout { + private final String TAG = AppTitleView.class.getSimpleName(); + private Activity activity; private CharSequence nameTitle; - private Drawable iconLeftBlack, iconRightOne, iconRightTwo, iconRightThree; + private Drawable iconLeftBack, iconRightOne, iconRightTwo, iconRightThree; private LinearLayout layout; - private ImageView titleBlack, titleRightOne, titleRightTwo, titleRightThree; - private View titleLine; + private ImageView titleBack, titleRightOne, titleRightTwo, titleRightThree; private TextView titleName; + public AppTitleView(Context context) { + this(context, null); + } + + public AppTitleView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public AppTitleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + if (context instanceof Activity) { + this.activity = (Activity) context; + } + TypedArray ToolbarTile = context.obtainStyledAttributes(attrs, R.styleable.AppToolbarTitle); + nameTitle = ToolbarTile.getText(R.styleable.AppToolbarTitle_nameTitle); + iconLeftBack = ToolbarTile.getDrawable(R.styleable.AppToolbarTitle_iconLeftBack); + iconRightOne = ToolbarTile.getDrawable(R.styleable.AppToolbarTitle_iconRightOne); + iconRightTwo = ToolbarTile.getDrawable(R.styleable.AppToolbarTitle_iconRightTwo); + iconRightThree = ToolbarTile.getDrawable(R.styleable.AppToolbarTitle_iconRightThree); + ToolbarTile.recycle(); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + layout = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.title_layout_util, this, true); + titleName = layout.findViewById(R.id.title_name); + titleBack = layout.findViewById(R.id.title_back); + titleRightOne = layout.findViewById(R.id.icon_right_one); + titleRightTwo = layout.findViewById(R.id.icon_right_two); + titleRightThree = layout.findViewById(R.id.icon_right_three); + titleName.setText(nameTitle); + titleBack.setImageDrawable(iconLeftBack); + titleRightOne.setImageDrawable(iconRightOne); + titleRightTwo.setImageDrawable(iconRightTwo); + titleRightThree.setImageDrawable(iconRightThree); + titleBack.setOnClickListener(view -> { + if (activity != null) { + activity.finish(); + } else { + Log.e(TAG, "activity null"); + } + }); + } + public void setNavigationOnClickListener(OnClickListener onClickListener) { - titleBlack.setOnClickListener(onClickListener); + titleBack.setOnClickListener(onClickListener); } - public void setTitleRightOne(OnClickListener onClickListener) { + public void setTitleRightOneOnClickListener(OnClickListener onClickListener) { titleRightOne.setOnClickListener(onClickListener); } - public void setTitleRightTwo(OnClickListener onClickListener) { + public void setTitleRightTwoOnClickListener(OnClickListener onClickListener) { titleRightTwo.setOnClickListener(onClickListener); } - public void setTitleRightThree(OnClickListener onClickListener) { + public void setTitleRightThreeOnClickListener(OnClickListener onClickListener) { titleRightThree.setOnClickListener(onClickListener); } - public void setTitleText(int tileTextId) { - titleName.setText((int) tileTextId); + public void setTitleTextName(int titleTextId) { + titleName.setText((int) titleTextId); } - public void setTitleText(String tileText) { - titleName.setText(tileText); + public void setTitleTextName(String titleText) { + titleName.setText(titleText); } - public AppTitleUtils(Context context) { - super(context); + public void setTitleRightOneVisibility(boolean oneVisibility) { + if (oneVisibility) { + titleRightOne.setVisibility(VISIBLE); + } else { + titleRightOne.setVisibility(GONE); + } } - public AppTitleUtils(Context context, AttributeSet attrs) { - super(context, attrs); - TypedArray ToolbarTile = context.obtainStyledAttributes(attrs, R.styleable.AppToolbarTile); - - nameTitle = ToolbarTile.getText(R.styleable.AppToolbarTile_nameTitle); - iconLeftBlack = ToolbarTile.getDrawable(R.styleable.AppToolbarTile_iconLeftBlack); - iconRightOne = ToolbarTile.getDrawable(R.styleable.AppToolbarTile_iconRightOne); - iconRightTwo = ToolbarTile.getDrawable(R.styleable.AppToolbarTile_iconRightTwo); - iconRightThree = ToolbarTile.getDrawable(R.styleable.AppToolbarTile_iconRightThree); - ToolbarTile.recycle(); + public void setTitleRightTwoVisibility(boolean twoVisibility) { + if (twoVisibility) { + titleRightTwo.setVisibility(VISIBLE); + } else { + titleRightTwo.setVisibility(GONE); + } } - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - layout = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.title_layout_utils, this, true); + public void setTitleRightThreeVisibility(boolean threeVisibility) { + if (threeVisibility) { + titleRightThree.setVisibility(VISIBLE); + } else { + titleRightThree.setVisibility(GONE); + } + } - titleName = layout.findViewById(R.id.title_name); - titleBlack = layout.findViewById(R.id.title_black); - titleRightOne = layout.findViewById(R.id.icon_right_one); - titleRightTwo = layout.findViewById(R.id.icon_right_two); - titleRightThree = layout.findViewById(R.id.icon_right_three); - titleLine = layout.findViewById(R.id.title_line); + public void setTitleOneImage(int drawable) { + titleRightOne.setImageResource(drawable); + } - titleName.setText(nameTitle); - titleBlack.setImageDrawable(iconLeftBlack); - titleRightOne.setImageDrawable(iconRightOne); - titleRightTwo.setImageDrawable(iconRightTwo); - titleRightThree.setImageDrawable(iconRightThree); + public void setTitleTwoImage(int drawable) { + titleRightTwo.setImageResource(drawable); + } + public void setTitleThreeImage(int drawable) { + titleRightThree.setImageResource(drawable); } + } diff --git a/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xhdpi/icon_back.png b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xhdpi/icon_back.png new file mode 100644 index 0000000000000000000000000000000000000000..9b06d341ed951cf24a996d2b629c3d58b73e6144 Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xhdpi/icon_back.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_camera.png b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_camera.png new file mode 100644 index 0000000000000000000000000000000000000000..9c15c1eaae6ee554786c662b8730f815898b73bc Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_camera.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_help.png b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_help.png new file mode 100644 index 0000000000000000000000000000000000000000..4b00c727562d1ced87f5a5111ff34934849a8782 Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_help.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_more.png b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_more.png new file mode 100644 index 0000000000000000000000000000000000000000..ebca2f858e1e20f03697bc763ac638af6d90fcdd Binary files /dev/null and b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/drawable-xxhdpi/icon_more.png differ diff --git a/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/layout/title_layout_utils.xml b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/layout/title_layout_util.xml similarity index 96% rename from model_zoo/official/lite/MindSpore_inhand/common/src/main/res/layout/title_layout_utils.xml rename to model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/layout/title_layout_util.xml index 7fc1bd17fce9ae026b731f1ed272903eb429fc3b..e01ec311d15e6b930b4d359aefa984e475e8944f 100644 --- a/model_zoo/official/lite/MindSpore_inhand/common/src/main/res/layout/title_layout_utils.xml +++ b/model_zoo/official/lite/MindSpore_inhand/customView/src/main/res/layout/title_layout_util.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - tools:context=".utils.AppTitleUtils"> + tools:context=".titlebar.AppTitleView"> + + + + + + + + diff --git a/model_zoo/official/lite/MindSpore_inhand/hms/build.gradle b/model_zoo/official/lite/MindSpore_inhand/hms/build.gradle index c60c4ed6d8a4ea1c99db1358103febbf3ce80558..13f857acbf61bc3a57cb2d4a6c588d2674f96aa6 100644 --- a/model_zoo/official/lite/MindSpore_inhand/hms/build.gradle +++ b/model_zoo/official/lite/MindSpore_inhand/hms/build.gradle @@ -58,6 +58,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.3.0-alpha02' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation project(path: ':common') + implementation project(path: ':customView') testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' diff --git a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/gesturerecognition/StillHandGestureAnalyseActivity.java b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/gesturerecognition/StillHandGestureAnalyseActivity.java index bc271e6e783981148c977a8defa6c757477643cc..b025eaef8f59e211251914bc83a0a05388e54a73 100644 --- a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/gesturerecognition/StillHandGestureAnalyseActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/gesturerecognition/StillHandGestureAnalyseActivity.java @@ -42,8 +42,8 @@ import com.huawei.hms.mlsdk.gesture.MLGestureAnalyzer; import com.huawei.hms.mlsdk.gesture.MLGestureAnalyzerFactory; import com.huawei.hms.mlsdk.gesture.MLGestureAnalyzerSetting; import com.mindspore.common.config.StorageUtils; -import com.mindspore.common.utils.AppTitleUtils; import com.mindspore.common.utils.BitmapUtils; +import com.mindspore.customview.titlebar.AppTitleView; import com.mindspore.hms.R; import com.mindspore.hms.camera.GraphicOverlay; import com.mindspore.hms.camera.HandGestureGraphic; @@ -73,7 +73,6 @@ public class StillHandGestureAnalyseActivity extends AppCompatActivity { private boolean isLandScape; private MLGestureAnalyzer mAnalyzer; private MLFrame frame; - private AppTitleUtils appTitle; @Override protected void onCreate(Bundle savedInstanceState) { @@ -86,8 +85,6 @@ public class StillHandGestureAnalyseActivity extends AppCompatActivity { mGraphicOverlay = findViewById(R.id.skeleton_previewOverlay); imgPreview = findViewById(R.id.img_origin); textOriginImage = findViewById(R.id.tv_image); - appTitle = findViewById(R.id.activity_toolbar); - appTitle.setNavigationOnClickListener(view -> finish()); } public void onClickPhoto(View view) { diff --git a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/textrecognition/TextRecognitionActivity.java b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/textrecognition/TextRecognitionActivity.java index 4375d43052a96b05a206e5fa1fc3861212e84c44..5e0d3afffaa2af04d6e039a194b2317d25f46066 100644 --- a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/textrecognition/TextRecognitionActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/textrecognition/TextRecognitionActivity.java @@ -47,7 +47,7 @@ import com.huawei.hms.mlsdk.text.MLLocalTextSetting; import com.huawei.hms.mlsdk.text.MLText; import com.huawei.hms.mlsdk.text.MLTextAnalyzer; import com.mindspore.common.config.StorageUtils; -import com.mindspore.common.utils.AppTitleUtils; +import com.mindspore.customview.titlebar.AppTitleView; import com.mindspore.common.utils.BitmapUtils; import com.mindspore.hms.R; @@ -78,7 +78,6 @@ public class TextRecognitionActivity extends AppCompatActivity { private Integer maxWidthOfImage; private Integer maxHeightOfImage; private boolean isLandScape; - private AppTitleUtils appTitle; @Override protected void onCreate(Bundle savedInstanceState) { @@ -98,9 +97,6 @@ public class TextRecognitionActivity extends AppCompatActivity { analyzer = MLAnalyzerFactory.getInstance().getLocalTextAnalyzer(setting); imgPreview = findViewById(R.id.img_origin); textOriginImage = findViewById(R.id.tv_image); - appTitle = findViewById(R.id.segmentation_toolbar); - appTitle.setNavigationOnClickListener(view -> finish()); - } public void onClickPhoto(View view) { diff --git a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/texttranslation/TextTranslationActivity.java b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/texttranslation/TextTranslationActivity.java index fd559f83e9567b8653c290caf7734803ddd66dea..56ee0a6f67541954e01158394c554748e59f75da 100644 --- a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/texttranslation/TextTranslationActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/java/com/mindspore/hms/texttranslation/TextTranslationActivity.java @@ -54,7 +54,6 @@ import com.huawei.hms.mlsdk.translate.cloud.MLRemoteTranslateSetting; import com.huawei.hms.mlsdk.translate.cloud.MLRemoteTranslator; import com.mindspore.common.config.StorageUtils; import com.mindspore.common.sp.Preferences; -import com.mindspore.common.utils.AppTitleUtils; import com.mindspore.common.utils.BitmapUtils; import com.mindspore.common.utils.StringUtils; import com.mindspore.hms.R; @@ -101,8 +100,6 @@ public class TextTranslationActivity extends AppCompatActivity { } private void init() { - AppTitleUtils appTitle = findViewById(R.id.text_online_activity_toolbar); - appTitle.setNavigationOnClickListener(view -> finish()); mEditText = findViewById(R.id.text_edit); mEditText.setMovementMethod(ScrollingMovementMethod.getInstance()); mTextView = findViewById(R.id.text_view); diff --git a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/res/layout/activity_gesture_recognition.xml b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/res/layout/activity_gesture_recognition.xml index 11c9e814268770e393210451e7aa20aa73486cfb..0d6f34d27afece42922bbae102ce6422e5ef67c8 100644 --- a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/res/layout/activity_gesture_recognition.xml +++ b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/res/layout/activity_gesture_recognition.xml @@ -9,11 +9,11 @@ tools:context=".gesturerecognition.StillHandGestureAnalyseActivity" tools:ignore="ResAuto"> - diff --git a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/res/layout/activity_text_recognition.xml b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/res/layout/activity_text_recognition.xml index 26dc7c1d5ca60e76d3327eabd510a759177eb07f..cc25c0d751f499ae965c9faa45cea61f8b53b476 100644 --- a/model_zoo/official/lite/MindSpore_inhand/hms/src/main/res/layout/activity_text_recognition.xml +++ b/model_zoo/official/lite/MindSpore_inhand/hms/src/main/res/layout/activity_text_recognition.xml @@ -10,11 +10,11 @@ tools:context=".textrecognition.TextRecognitionActivity" tools:ignore="ResAuto"> - - finish()); - appTitle.setTitleRightTwo(view -> { + appTitle.setTitleRightTwoOnClickListener(view -> { showHelpDialog(); }); - appTitle.setTitleRightThree(view -> { + appTitle.setTitleRightThreeOnClickListener(view -> { Utils.openBrowser(this, MSLinkUtils.HELP_IMAGE_CLASSIFICATION); }); } diff --git a/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/java/com/mindspore/imageobject/objectdetection/ui/ObjectCameraActivity.java b/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/java/com/mindspore/imageobject/objectdetection/ui/ObjectCameraActivity.java index 89208a57c49d453c0bbcccffeab5749138075a65..fc5d00067b7ab613b7d2420edc23b404dddba24d 100644 --- a/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/java/com/mindspore/imageobject/objectdetection/ui/ObjectCameraActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/java/com/mindspore/imageobject/objectdetection/ui/ObjectCameraActivity.java @@ -19,16 +19,12 @@ import android.graphics.Bitmap; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.Toolbar; import com.alibaba.android.arouter.facade.annotation.Route; import com.mindspore.common.config.MSLinkUtils; -import com.mindspore.common.utils.AppTitleUtils; +import com.mindspore.customview.titlebar.AppTitleView; import com.mindspore.common.utils.Utils; import com.mindspore.customview.dialog.NoticeDialog; import com.mindspore.imageobject.R; @@ -62,7 +58,7 @@ public class ObjectCameraActivity extends AppCompatActivity implements CameraPre private NoticeDialog noticeDialog; - private AppTitleUtils appTitle; + private AppTitleView appTitle; @Override protected void onCreate(Bundle savedInstanceState) { @@ -88,11 +84,10 @@ public class ObjectCameraActivity extends AppCompatActivity implements CameraPre Log.i(TAG, "init ObjectPhotoActivity info"); appTitle = findViewById(R.id.object_camera_toolbar); - appTitle.setNavigationOnClickListener(view -> finish()); - appTitle.setTitleRightTwo(view -> { + appTitle.setTitleRightTwoOnClickListener(view -> { showHelpDialog(); }); - appTitle.setTitleRightThree(view -> { + appTitle.setTitleRightThreeOnClickListener(view -> { Utils.openBrowser(this, MSLinkUtils.HELP_IMAGE_CLASSIFICATION); }); } diff --git a/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/res/layout/activity_image_camera.xml b/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/res/layout/activity_image_camera.xml index 572eb96fcf92a1e049509fd61fd773f1b2b8cf6c..b6094cfc496a4e660223cbc928f824b1cf73c8cf 100644 --- a/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/res/layout/activity_image_camera.xml +++ b/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/res/layout/activity_image_camera.xml @@ -15,13 +15,13 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - diff --git a/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/res/layout/activity_object_camera.xml b/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/res/layout/activity_object_camera.xml index 34dd7b81dbe028908142a34cebf8ff57288286b8..d4efa72190ce163d6e83ac834ffa3f9e17f0447e 100644 --- a/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/res/layout/activity_object_camera.xml +++ b/model_zoo/official/lite/MindSpore_inhand/imageObject/src/main/res/layout/activity_object_camera.xml @@ -9,13 +9,13 @@ tools:context="com.mindspore.imageobject.objectdetection.ui.ObjectCameraActivity" tools:ignore="ResAuto"> - diff --git a/model_zoo/official/lite/MindSpore_inhand/modelcamera/build.gradle b/model_zoo/official/lite/MindSpore_inhand/modelcamera/build.gradle index cfb9d97ccb4356f06bc237c7e47ca716ef85efc9..c43c359b953dc3ce8fc23e4adad487c8683c2016 100644 --- a/model_zoo/official/lite/MindSpore_inhand/modelcamera/build.gradle +++ b/model_zoo/official/lite/MindSpore_inhand/modelcamera/build.gradle @@ -55,6 +55,7 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' implementation project(path: ':common') + implementation project(path: ':customView') implementation project(':mindsporelibrary') implementation 'com.alibaba:arouter-api:1.5.1' diff --git a/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/java/com/mindspore/modelcamera/ui/CameraResultActivity.java b/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/java/com/mindspore/modelcamera/ui/CameraResultActivity.java index 271caae2413c511e1c946244c889c080c0afb91c..55f55140d4b371496d6aeb88e127b88ff25c3aa5 100644 --- a/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/java/com/mindspore/modelcamera/ui/CameraResultActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/java/com/mindspore/modelcamera/ui/CameraResultActivity.java @@ -35,7 +35,6 @@ import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; -import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -43,8 +42,6 @@ import com.bumptech.glide.Glide; import com.huawei.hms.mlsdk.face.MLFace; import com.huawei.hms.mlsdk.skeleton.MLSkeleton; import com.mindspore.common.base.mvp.BaseActivity; -import com.mindspore.common.sp.Preferences; -import com.mindspore.common.utils.AppTitleUtils; import com.mindspore.common.utils.ImageUtils; import com.mindspore.common.utils.Utils; import com.mindspore.modelcamera.R; @@ -55,9 +52,8 @@ import com.mindspore.modelcamera.common.CameraConstants; import com.mindspore.modelcamera.ui.adapter.ImageCameraAdapter; import com.mindspore.modelcamera.ui.mvp.CameraResultContract; import com.mindspore.modelcamera.ui.mvp.CameraResultPresenter; - +import com.mindspore.customview.titlebar.AppTitleView; import java.util.List; - import static com.mindspore.modelcamera.common.CameraConstants.TRANS_MODEL; import static com.mindspore.modelcamera.common.CameraConstants.TRANS_ORIGIN; import static com.mindspore.modelcamera.common.CameraConstants.TRANS_SELECT; @@ -77,8 +73,7 @@ public class CameraResultActivity extends BaseActivity im private PopupWindow mPopupW; private View mContentView; private TextView mTv_protocol; - private AppTitleUtils appTitle; - private TextView titleName; + private AppTitleView appTitle; @Override public int getLayout() { return R.layout.activity_camera_result; @@ -91,9 +86,8 @@ public class CameraResultActivity extends BaseActivity im model = getIntent().getIntExtra(TRANS_MODEL, 0); appTitle = findViewById(R.id.camera_toolbar); - titleName = appTitle.findViewById(R.id.title_name); - appTitle.setTitleText(CameraConstants.CAMERA_MODEL[model]); - appTitle.setNavigationOnClickListener(view -> finish()); + appTitle.setTitleTextName(CameraConstants.CAMERA_MODEL[model]); + preImage = findViewById(R.id.preIamge); cancleLayout = findViewById(R.id.cancleLayout); diff --git a/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/java/com/mindspore/modelcamera/ui/MainCameraActivity.java b/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/java/com/mindspore/modelcamera/ui/MainCameraActivity.java index 08c82dba2b25ab11033e8c02335d33f5507af60b..de460b948f1ab5c1c59c02dddf3c73ca521401dc 100644 --- a/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/java/com/mindspore/modelcamera/ui/MainCameraActivity.java +++ b/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/java/com/mindspore/modelcamera/ui/MainCameraActivity.java @@ -43,7 +43,7 @@ import com.alibaba.android.arouter.launcher.ARouter; import com.bumptech.glide.Glide; import com.google.android.material.tabs.TabLayout; import com.mindspore.common.base.adapter.BasePagerAdapter; -import com.mindspore.common.utils.AppTitleUtils; +import com.mindspore.customview.titlebar.AppTitleView; import com.mindspore.modelcamera.R; import com.mindspore.modelcamera.camera.ICameraPreviewSaveListener; import com.mindspore.modelcamera.common.CameraConstants; @@ -68,7 +68,7 @@ public class MainCameraActivity extends AppCompatActivity implements ICameraPrev int model; private int lensType = CameraSelector.LENS_FACING_BACK; - private AppTitleUtils appTitle; + private AppTitleView appTitle; private ViewPager viewPager; private TabLayout mTabLayout; private List mTabEntities; @@ -108,9 +108,7 @@ public class MainCameraActivity extends AppCompatActivity implements ICameraPrev private void init() { appTitle = findViewById(R.id.camera_toolbar); - appTitle.setNavigationOnClickListener(view -> finish()); - appTitle.setTitleText(CameraConstants.CAMERA_MODEL[model]); - + appTitle.setTitleTextName(CameraConstants.CAMERA_MODEL[model]); viewPager = findViewById(R.id.viewPager); mTabLayout = findViewById(R.id.tab_layout); initTabLayout(); @@ -176,7 +174,7 @@ public class MainCameraActivity extends AppCompatActivity implements ICameraPrev public void onTabSelected(TabLayout.Tab tab) { Log.d(TAG, "onTabSelected: " + tab.getPosition()); model = tab.getPosition(); - appTitle.setTitleText(CameraConstants.CAMERA_MODEL[model]); + appTitle.setTitleTextName(CameraConstants.CAMERA_MODEL[model]); viewPager.setCurrentItem(tab.getPosition(), true); recoverItem(); View view = tab.getCustomView(); diff --git a/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/res/layout/activity_camera_result.xml b/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/res/layout/activity_camera_result.xml index 0a85853f2a770abcb2e9685fc76af00e261872c9..2608abc74fb976cd0bc3e8c54416d2bf78589008 100644 --- a/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/res/layout/activity_camera_result.xml +++ b/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/res/layout/activity_camera_result.xml @@ -10,11 +10,11 @@ tools:context=".ui.CameraResultActivity" tools:ignore="ResAuto"> - diff --git a/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/res/layout/activity_main_camera.xml b/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/res/layout/activity_main_camera.xml index e53a8c545a73ea2c39eee6a4d8f61b38dde6cb02..005257f72a57969d0b8b578ee4dd8abc946198df 100644 --- a/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/res/layout/activity_main_camera.xml +++ b/model_zoo/official/lite/MindSpore_inhand/modelcamera/src/main/res/layout/activity_main_camera.xml @@ -10,11 +10,11 @@ tools:context=".ui.MainCameraActivity" tools:ignore="ResAuto"> -