Explorar o código

界面与逻辑

詹子聪 %!s(int64=5) %!d(string=hai) anos
pai
achega
099118392e

+ 1 - 0
app/src/main/java/com/itant/shibei/bean/JsonBean.java

@@ -8,6 +8,7 @@ package com.itant.shibei.bean;
  * Description: json
  */
 public class JsonBean {
+    public long id;
     public String email;
     public String json;
 }

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

@@ -7,9 +7,11 @@ import android.view.View;
 import androidx.annotation.Nullable;
 
 import com.itant.shibei.R;
+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.mine.login.LoginActivity;
+import com.miekir.common.utils.ActivityTool;
 import com.miekir.common.utils.ToastTool;
 import com.miekir.mvp.view.BaseMVPFragment;
 
@@ -17,7 +19,6 @@ import com.miekir.mvp.view.BaseMVPFragment;
  * @author Miekir
  * @date 2020/6/18 16:48
  * Description: 工具界面
- *
  */
 public class ToolFragment extends BaseMVPFragment implements View.OnClickListener {
 
@@ -26,6 +27,8 @@ public class ToolFragment extends BaseMVPFragment implements View.OnClickListene
         super.onCreateViewFinished(savedInstanceState);
 
         rootView.findViewById(R.id.fl_get_json).setOnClickListener(this);
+        rootView.findViewById(R.id.fl_pc_template).setOnClickListener(this);
+        rootView.findViewById(R.id.fl_weather).setOnClickListener(this);
     }
 
     @Override
@@ -36,6 +39,11 @@ public class ToolFragment extends BaseMVPFragment implements View.OnClickListene
     @Override
     public void onClick(View v) {
         switch (v.getId()) {
+
+            case R.id.fl_pc_template:
+                // 跳转京东模板
+                ActivityTool.openUrl(getActivity(), ConstantUrl.URL_JD_TEMPLATE_COMPUTER);
+                break;
             case R.id.fl_get_json:
                 if (UserInfoManager.getInstance().isLogin()) {
                     startActivity(new Intent(getActivity(), JsonActivity.class));
@@ -44,6 +52,15 @@ public class ToolFragment extends BaseMVPFragment implements View.OnClickListene
                     startActivity(new Intent(getActivity(), LoginActivity.class));
                 }
                 break;
+
+            case R.id.fl_weather:
+                if (UserInfoManager.getInstance().isLogin()) {
+                    // todo 跳转天气API使用说明界面
+                } else {
+                    ToastTool.showShort("请先登录");
+                    startActivity(new Intent(getActivity(), LoginActivity.class));
+                }
+                break;
             default:
                 break;
         }

+ 2 - 1
app/src/main/res/layout/activity_json.xml

@@ -65,7 +65,8 @@
         android:textAllCaps="false"
         android:textColor="@color/black_text_comfortable"
         android:textColorHint="@color/gray_text_hint"
-        android:textSize="@dimen/text_normal_p" />
+        android:textSize="@dimen/text_normal_p"
+        android:maxLength="2048"/>
 
     <include layout="@layout/view_divider_common" />
 

+ 2 - 1
app/src/main/res/layout/activity_search.xml

@@ -26,7 +26,8 @@
         android:textSize="@dimen/text_normal_p"
         android:hint="请输入关键字或链接"
         android:textColor="@color/black_text_comfortable"
-        android:textColorHint="@color/gray_text_hint"/>
+        android:textColorHint="@color/gray_text_hint"
+        android:maxLength="1024"/>
     <include layout="@layout/view_divider_common"/>
 
     <android.widget.Button

+ 74 - 0
app/src/main/res/layout/fragment_tool.xml

@@ -18,6 +18,44 @@
 
     <include layout="@layout/view_divider_common" />
 
+    <FrameLayout
+        android:id="@+id/fl_pc_template"
+        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:minHeight="@dimen/height_tab_bar"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/activity_horizontal_margin"
+            android:paddingEnd="@dimen/activity_horizontal_margin"
+            android:paddingTop="@dimen/margin_s"
+            android:paddingBottom="@dimen/margin_s"
+            android:gravity="center_vertical">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="PC装机模板"
+                android:textSize="@dimen/text_sub_title"
+                android:textColor="@color/black_text_comfortable"
+                android:textStyle="bold"/>
+
+            <TextView
+                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:text="DIY主机,根据需求选择电脑装机配件"/>
+        </LinearLayout>
+    </FrameLayout>
+
+    <include layout="@layout/view_divider_common" />
+
     <FrameLayout
         android:id="@+id/fl_get_json"
         android:layout_width="match_parent"
@@ -55,4 +93,40 @@
     </FrameLayout>
 
     <include layout="@layout/view_divider_common" />
+
+    <FrameLayout
+        android:id="@+id/fl_weather"
+        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:minHeight="@dimen/height_tab_bar"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/activity_horizontal_margin"
+            android:paddingEnd="@dimen/activity_horizontal_margin"
+            android:paddingTop="@dimen/margin_s"
+            android:paddingBottom="@dimen/margin_s"
+            android:gravity="center_vertical">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="日期天气API(限时免费)"
+                android:textSize="@dimen/text_sub_title"
+                android:textColor="@color/black_text_comfortable"
+                android:textStyle="bold"/>
+
+            <TextView
+                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:text="返回当天日期、天气、宜忌信息"/>
+        </LinearLayout>
+    </FrameLayout>
 </LinearLayout>