詹子聪 5 роки тому
батько
коміт
0853eaf912

+ 41 - 14
app/src/main/java/com/miekir/eden/ui/home/about/AboutFragment.java

@@ -33,11 +33,15 @@ public class AboutFragment extends BaseMVPFragment implements View.OnClickListen
     private TextView tv_title;
     private LinearLayout ll_desc;
     private TextView tv_active;
+    private TextView tv_coupon;
     private View ll_about;
 
     @InjectPresenter
     UpgradePresenter upgradePresenter;
 
+    private String mRealZfb;
+    private String mAdLink;
+
     @Override
     protected void onViewInit() {
         TITLE_FORMAT = StringTool.getString(R.string.about_title);
@@ -45,6 +49,7 @@ public class AboutFragment extends BaseMVPFragment implements View.OnClickListen
         tv_title = rootView.findViewById(R.id.tv_title);
         ll_desc = rootView.findViewById(R.id.ll_desc);
         tv_active = rootView.findViewById(R.id.tv_active);
+        tv_coupon = rootView.findViewById(R.id.tv_coupon);
         ll_about = rootView.findViewById(R.id.ll_about);
         TextView tv_email = rootView.findViewById(R.id.tv_email);
         tv_email.setText(EdenManager.getInstance().getBeiUser().email);
@@ -54,6 +59,35 @@ public class AboutFragment extends BaseMVPFragment implements View.OnClickListen
         rootView.findViewById(R.id.tv_more).setOnClickListener(this);
         rootView.findViewById(R.id.tv_active).setOnClickListener(this);
         rootView.findViewById(R.id.ll_email).setOnClickListener(this);
+        rootView.findViewById(R.id.tv_coupon).setOnClickListener(this);
+
+        initZfb();
+    }
+
+    private void initZfb() {
+        String zfb = EdenManager.getInstance().getSystemBean().zfb;
+        if (TextUtils.isEmpty(zfb)) {
+            ToastTool.showShort(StringTool.getString(R.string.about_upgrade_not_available));
+            return;
+        }
+        int index = zfb.indexOf(";");
+        if (index == -1) {
+            mRealZfb = zfb;
+        } else {
+            mRealZfb = zfb.substring(0, index);
+        }
+
+        if (index == -1 || (index+1) == zfb.length()) {
+            mAdLink = null;
+        } else {
+            mAdLink = zfb.substring(index+1);
+        }
+
+        if (TextUtils.isEmpty(mAdLink)) {
+            tv_coupon.setVisibility(View.GONE);
+        } else {
+            tv_coupon.setVisibility(View.VISIBLE);
+        }
     }
 
 
@@ -107,25 +141,18 @@ public class AboutFragment extends BaseMVPFragment implements View.OnClickListen
 
             case R.id.tv_active:
                 // 立即激活
-                String zfb = EdenManager.getInstance().getSystemBean().zfb;
-                if (TextUtils.isEmpty(zfb)) {
-                    ToastTool.showShort(StringTool.getString(R.string.about_upgrade_not_available));
-                    return;
-                }
-                int index = zfb.indexOf(";");
-                String realZfb;
-                if (index == -1) {
-                    realZfb = zfb;
-                } else {
-                    realZfb = zfb.substring(0, index);
-                }
-                if (TextUtils.isEmpty(realZfb)) {
+
+                if (TextUtils.isEmpty(mRealZfb)) {
                     ToastTool.showShort(StringTool.getString(R.string.about_upgrade_not_available));
                     return;
                 }
                 SystemTool.copyText(getActivity(), EdenManager.getInstance().getBeiUser().email);
                 ToastTool.showLong(StringTool.getString(R.string.about_active_copy_account));
-                ActivityTool.openUrl(getActivity(), realZfb);
+                ActivityTool.openUrl(getActivity(), mRealZfb);
+                break;
+
+            case R.id.tv_coupon:
+                ActivityTool.openUrl(getActivity(), mAdLink);
                 break;
 
             case R.id.tv_more:

+ 13 - 0
app/src/main/res/layout/fragment_about.xml

@@ -140,6 +140,19 @@
             android:textStyle="bold"
             android:background="?attr/selectableItemBackground"/>
 
+        <TextView
+            android:id="@+id/tv_coupon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/margin_default"
+            android:layout_marginEnd="@dimen/margin_default"
+            android:layout_marginTop="@dimen/margin_default"
+            android:text="@string/about_coupon"
+            android:textColor="@color/green_logo"
+            android:textSize="@dimen/text_normal_s"
+            android:textStyle="bold"
+            android:background="?attr/selectableItemBackground"
+            android:visibility="gone"/>
 
         <TextView
             android:id="@+id/tv_more"

+ 1 - 0
app/src/main/res/values-zh-rCN/strings.xml

@@ -110,4 +110,5 @@
     <string name="login_attention">注意:本应用仅对非中国地区开放</string>
     <string name="login_area_not_support">暂不支持当前地区</string>
     <string name="menu_retry">重试</string>
+    <string name="about_coupon">领美食券</string>
 </resources>

+ 4 - 3
app/src/main/res/values/strings.xml

@@ -91,10 +91,10 @@
     <string name="about_attention">Tips: VIP is long-term effective, pay once, enjoy forever.</string>
     <string name="about_description">Click following button to upgrade to VIP, and paste your account to the remarks(Very important) when you pay, then restart Eden to check in some minutes.</string>
     <string name="about_current_account">Current account:</string>
-    <string name="about_upgrade_now">Upgrade Now</string>
-    <string name="about_check_new">Check version</string>
+    <string name="about_upgrade_now">Get VIP Now</string>
+    <string name="about_check_new">Check Version</string>
     <string name="about_feedback">Feedback</string>
-    <string name="about_privacy">Privacy permissions &amp; Service items</string>
+    <string name="about_privacy">Privacy permissions &amp; Service Items</string>
     <string name="menu_finish">FINISH</string>
     <string name="mine_ali_go">Ali Go</string>
     <string name="mine_confirm_aligo">Sure to proceed?</string>
@@ -110,4 +110,5 @@
     <string name="login_attention">Only open to non-Chinese regions</string>
     <string name="login_area_not_support">Current region is not supported</string>
     <string name="menu_retry">Retry</string>
+    <string name="about_coupon">Get Food Coupon</string>
 </resources>