詹子聪 5 gadi atpakaļ
vecāks
revīzija
fc889ee8d8

+ 5 - 0
app/src/main/AndroidManifest.xml

@@ -80,6 +80,11 @@
             android:name=".ui.home.tool.weather.WeatherActivity"
             android:screenOrientation="portrait"
             android:theme="@style/TextInputStyle" />
+
+        <activity
+            android:name=".ui.home.tool.yiji.YijiActivity"
+            android:screenOrientation="portrait"
+            android:theme="@style/TextInputStyle" />
     </application>
 
 </manifest>

+ 9 - 1
app/src/main/java/com/itant/shibei/ui/home/tool/ToolFragment.java

@@ -11,6 +11,7 @@ import com.itant.shibei.common.ConstantUrl;
 import com.itant.shibei.manager.UserInfoManager;
 import com.itant.shibei.ui.home.tool.json.JsonActivity;
 import com.itant.shibei.ui.home.tool.weather.WeatherActivity;
+import com.itant.shibei.ui.home.tool.yiji.YijiActivity;
 import com.itant.shibei.ui.mine.login.LoginActivity;
 import com.miekir.common.utils.ActivityTool;
 import com.miekir.common.utils.ToastTool;
@@ -68,7 +69,14 @@ public class ToolFragment extends BaseMVPFragment implements View.OnClickListene
                 break;
 
             case R.id.fl_yiji:
-                // 宜忌信息
+                // 宜忌信息 todo
+                startActivity(new Intent(getActivity(), YijiActivity.class));
+//                if (UserInfoManager.getInstance().isLogin()) {
+//                    startActivity(new Intent(getActivity(), YijiActivity.class));
+//                } else {
+//                    ToastTool.showShort("请先登录");
+//                    startActivity(new Intent(getActivity(), LoginActivity.class));
+//                }
                 break;
             default:
                 break;

+ 8 - 8
app/src/main/java/com/itant/shibei/ui/home/tool/weather/WeatherActivity.java

@@ -6,7 +6,6 @@ import android.view.View;
 import android.widget.EditText;
 import android.widget.TextView;
 
-import com.itant.shibei.BuildConfig;
 import com.itant.shibei.R;
 import com.itant.shibei.base.BaseBeiActivity;
 import com.itant.shibei.bean.BeiUser;
@@ -38,18 +37,19 @@ public class WeatherActivity extends BaseBeiActivity implements View.OnClickList
         mUser = UserInfoManager.getInstance().getBeiUser();
         setTitle("日期天气API");
 
-        tv_weather_url = findViewById(R.id.tv_weather_url);
-        tv_weather_url.setText(String.format(FORMAT_URL, BuildConfig.BASE_URL));
+        // todo
+        tv_weather_url = findViewById(R.id.tv_yiji_url);
+//        tv_weather_url.setText(String.format(FORMAT_URL, BuildConfig.BASE_URL));
         tv_header_email = findViewById(R.id.tv_header_email);
-        tv_header_email.setText(String.format(FORMAT_EMAIL, mUser.email));
+//        tv_header_email.setText(String.format(FORMAT_EMAIL, mUser.email));
         tv_header_token = findViewById(R.id.tv_header_token);
-        tv_header_token.setText(String.format(FORMAT_TOKEN, mUser.token));
+//        tv_header_token.setText(String.format(FORMAT_TOKEN, mUser.token));
 
-        findViewById(R.id.fl_weather_url).setOnClickListener(this);
+        findViewById(R.id.fl_yiji_url).setOnClickListener(this);
         findViewById(R.id.fl_header_email).setOnClickListener(this);
         findViewById(R.id.fl_header_token).setOnClickListener(this);
 
-        EditText et_weather = findViewById(R.id.et_weather);
+        EditText et_weather = findViewById(R.id.et_yiji);
         et_weather.setText("{\n" +
                 "  \"temperatureLow\": 28.5,\n" +
                 "  \"temperatureHigh\": 30.5,\n" +
@@ -63,7 +63,7 @@ public class WeatherActivity extends BaseBeiActivity implements View.OnClickList
     @Override
     public void onClick(View v) {
         switch (v.getId()) {
-            case R.id.fl_weather_url:
+            case R.id.fl_yiji_url:
                 // 复制GET链接URL
                 if (SystemTool.copyText(getApplicationContext(), tv_weather_url.getText().toString())) {
                     ToastTool.showShort("复制成功");

+ 98 - 0
app/src/main/java/com/itant/shibei/ui/home/tool/yiji/YijiActivity.java

@@ -0,0 +1,98 @@
+package com.itant.shibei.ui.home.tool.yiji;
+
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TextView;
+
+import com.itant.shibei.R;
+import com.itant.shibei.base.BaseBeiActivity;
+import com.itant.shibei.bean.BeiUser;
+import com.itant.shibei.manager.UserInfoManager;
+import com.itant.shibei.tool.SystemTool;
+import com.miekir.common.utils.ToastTool;
+
+/**
+ * 黄历界面
+ */
+public class YijiActivity extends BaseBeiActivity implements View.OnClickListener {
+    private static final String FORMAT_URL = "%s/shibei/weather";
+    private static final String FORMAT_EMAIL = "\"email\":\"%s\"";
+    private static final String FORMAT_TOKEN = "\"token\":\"%s\"";
+
+    private BeiUser mUser;
+
+    private TextView tv_yiji_url;
+    private TextView tv_header_email;
+    private TextView tv_header_token;
+
+    @Override
+    public int getLayoutID() {
+        return R.layout.activity_yiji;
+    }
+
+    @Override
+    public void initViews(Bundle savedInstanceState) {
+        mUser = UserInfoManager.getInstance().getBeiUser();
+        setTitle("宜忌API");
+
+        // todo
+        tv_yiji_url = findViewById(R.id.tv_yiji_url);
+//        tv_yiji_url.setText(String.format(FORMAT_URL, BuildConfig.BASE_URL));
+        tv_header_email = findViewById(R.id.tv_header_email);
+//        tv_header_email.setText(String.format(FORMAT_EMAIL, mUser.email));
+        tv_header_token = findViewById(R.id.tv_header_token);
+//        tv_header_token.setText(String.format(FORMAT_TOKEN, mUser.token));
+
+        findViewById(R.id.fl_yiji_url).setOnClickListener(this);
+        findViewById(R.id.fl_header_email).setOnClickListener(this);
+        findViewById(R.id.fl_header_token).setOnClickListener(this);
+
+        EditText et_yiji = findViewById(R.id.et_yiji);
+        et_yiji.setText("{\n" +
+                "  \"newDate\": \"2020-08-14\",\n" +
+                "  \"animalYear\": \"鼠年\",\n" +
+                "  \"oldYear\": \"二〇二〇年\",\n" +
+                "  \"oldMonthDay\": \"六月廿五\",\n" +
+                "  \"hsYear\": \"庚子年\",\n" +
+                "  \"hsMonth\": \"甲申月\",\n" +
+                "  \"hsDay\": \"己丑日\",\n" +
+                "  \"yi\": \"结婚、领证、动土、安床\",\n" +
+                "  \"ji\": \"搬家、装修、开业\"\n" +
+                "}");
+    }
+
+    @Override
+    public void onClick(View v) {
+        switch (v.getId()) {
+            case R.id.fl_yiji_url:
+                // 复制GET链接URL
+                if (SystemTool.copyText(getApplicationContext(), tv_yiji_url.getText().toString())) {
+                    ToastTool.showShort("复制成功");
+                } else {
+                    ToastTool.showShort("复制失败");
+                }
+                break;
+
+            case R.id.fl_header_email:
+                // 复制header参数email
+                if (SystemTool.copyText(getApplicationContext(), tv_header_email.getText().toString())) {
+                    ToastTool.showShort("复制成功");
+                } else {
+                    ToastTool.showShort("复制失败");
+                }
+                break;
+            case R.id.fl_header_token:
+                // 复制header参数token
+                if (SystemTool.copyText(getApplicationContext(), tv_header_token.getText().toString())) {
+                    ToastTool.showShort("复制成功");
+                } else {
+                    ToastTool.showShort("复制失败");
+                }
+                break;
+            default:
+                break;
+        }
+    }
+}

+ 3 - 3
app/src/main/res/layout/activity_weather.xml

@@ -12,7 +12,7 @@
 
 
     <FrameLayout
-        android:id="@+id/fl_weather_url"
+        android:id="@+id/fl_yiji_url"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@color/white"
@@ -38,7 +38,7 @@
                 android:textStyle="bold"/>
 
             <TextView
-                android:id="@+id/tv_weather_url"
+                android:id="@+id/tv_yiji_url"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginTop="@dimen/margin_sss"
@@ -147,7 +147,7 @@
         android:text="返回示例:"/>
 
     <EditText
-        android:id="@+id/et_weather"
+        android:id="@+id/et_yiji"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:gravity="start"

+ 165 - 0
app/src/main/res/layout/activity_yiji.xml

@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/ll_search"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@color/white"
+    android:focusable="true"
+    android:focusableInTouchMode="true"
+    android:orientation="vertical">
+
+    <include layout="@layout/view_toolbar" />
+
+
+    <FrameLayout
+        android:id="@+id/fl_yiji_url"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:foreground="?attr/selectableItemBackground">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:minHeight="@dimen/height_tab_bar"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/activity_horizontal_margin"
+            android:paddingTop="@dimen/margin_s"
+            android:paddingEnd="@dimen/activity_horizontal_margin"
+            android:paddingBottom="@dimen/margin_s">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="GET请求链接(点击复制)"
+                android:textColor="@color/black_text_comfortable"
+                android:textSize="@dimen/text_normal_p"
+                android:textStyle="bold"/>
+
+            <TextView
+                android:id="@+id/tv_yiji_url"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/margin_sss"
+                android:textColor="@color/gray_text_s"
+                android:textSize="@dimen/text_normal_s"
+                android:maxLines="2"
+                android:ellipsize="end"/>
+        </LinearLayout>
+    </FrameLayout>
+
+
+    <include layout="@layout/view_divider_common" />
+
+    <FrameLayout
+        android:id="@+id/fl_header_email"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:foreground="?attr/selectableItemBackground">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:minHeight="@dimen/height_tab_bar"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/activity_horizontal_margin"
+            android:paddingTop="@dimen/margin_s"
+            android:paddingEnd="@dimen/activity_horizontal_margin"
+            android:paddingBottom="@dimen/margin_s">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="Header参数1(点击复制)"
+                android:textColor="@color/black_text_comfortable"
+                android:textSize="@dimen/text_normal_p"
+                android:textStyle="bold"/>
+
+            <TextView
+                android:id="@+id/tv_header_email"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/margin_sss"
+                android:textColor="@color/gray_text_s"
+                android:textSize="@dimen/text_normal_s"
+                android:maxLines="2"
+                android:ellipsize="end"/>
+        </LinearLayout>
+    </FrameLayout>
+
+
+    <include layout="@layout/view_divider_common" />
+
+    <FrameLayout
+        android:id="@+id/fl_header_token"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:foreground="?attr/selectableItemBackground">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:minHeight="@dimen/height_tab_bar"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/activity_horizontal_margin"
+            android:paddingTop="@dimen/margin_s"
+            android:paddingEnd="@dimen/activity_horizontal_margin"
+            android:paddingBottom="@dimen/margin_s">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="Header参数2(点击复制)"
+                android:textColor="@color/black_text_comfortable"
+                android:textSize="@dimen/text_normal_p"
+                android:textStyle="bold"/>
+
+            <TextView
+                android:id="@+id/tv_header_token"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/margin_sss"
+                android:textColor="@color/gray_text_s"
+                android:textSize="@dimen/text_normal_s"
+                android:maxLines="2"
+                android:ellipsize="end"/>
+        </LinearLayout>
+    </FrameLayout>
+
+    <include layout="@layout/view_divider_common" />
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:paddingStart="@dimen/margin_default"
+        android:paddingEnd="@dimen/margin_default"
+        android:paddingTop="@dimen/margin_ss"
+        android:paddingBottom="@dimen/margin_ss"
+        android:layout_marginTop="@dimen/margin_sss"
+        android:textColor="@color/black_droid_text"
+        android:textStyle="bold"
+        android:textSize="@dimen/text_normal_s"
+        android:text="返回示例:"/>
+
+    <EditText
+        android:id="@+id/et_yiji"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="start"
+        android:background="@color/white"
+        android:textIsSelectable="true"
+        android:paddingStart="@dimen/margin_default"
+        android:paddingEnd="@dimen/margin_default"
+        android:paddingTop="@dimen/margin_ss"
+        android:paddingBottom="@dimen/margin_ss"
+        android:textSize="@dimen/text_normal_p"
+        android:textColor="@color/black_text_comfortable"
+        android:textColorHint="@color/gray_text_hint"
+        android:editable="false"
+        android:text=""/>
+</LinearLayout>