Просмотр исходного кода

界面优化,添加本地webview

詹子聪 5 лет назад
Родитель
Сommit
8ea9a8ff67

+ 3 - 0
app/src/main/assets/clock/clock_local.html

@@ -0,0 +1,3 @@
+<html>
+<script charset="Shift_JIS" src="file:///android_asset/clock/honehone_clock_tr.js"></script>
+<html>

+ 6 - 0
app/src/main/assets/clock/clock_local_web.html

@@ -0,0 +1,6 @@
+<html>
+<script charset="Shift_JIS" src="./honehone_clock_tr.js"></script>
+</p>
+</p>
+<script charset="Shift_JIS" src="./honehone_clock_wh.js"></script>
+<html>

+ 3 - 0
app/src/main/assets/clock/clock_online.html

@@ -0,0 +1,3 @@
+<html>
+<script charset="Shift_JIS" src="http://chabudai.sakura.ne.jp/blogparts/honehoneclock/honehone_clock_tr.js"></script>
+<html>

+ 11 - 0
app/src/main/assets/clock/code_snippet.txt

@@ -0,0 +1,11 @@
+WebView  wv_clock = findViewById(R.id.wv_clock);
+WebSettings webSettings = wv_clock.getSettings();
+wv_clock.getSettings().setJavaScriptEnabled(true);
+// 设置可以访问文件
+webSettings.setAllowFileAccess(true);
+webSettings.setAllowFileAccessFromFileURLs(true);
+webSettings.setAllowContentAccess(true);
+webSettings.setDomStorageEnabled(true);
+wv_clock.getSettings().setAllowFileAccessFromFileURLs(true);
+//js与android调用
+wv_clock.loadUrl("file:///android_asset/clock/clock_local.html");

+ 29 - 0
app/src/main/assets/clock/honehone_clock_tr.js

@@ -0,0 +1,29 @@
+/******************************************************************************
+	初期設定
+******************************************************************************/
+var swfUrl = "file:///android_asset/clock/honehone_clock_tr.swf";
+
+var swfTitle = "honehoneclock";
+
+// 実行
+LoadBlogParts();
+
+/******************************************************************************
+	入力		なし
+	出力		document.writeによるHTML出力
+******************************************************************************/
+function LoadBlogParts(){
+	var sUrl = swfUrl;
+	
+	var sHtml = "";
+	sHtml += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="160" height="70" id="' + swfTitle + '" align="middle">';
+	sHtml += '<param name="allowScriptAccess" value="always" />';
+	sHtml += '<param name="movie" value="' + sUrl + '" />';
+	sHtml += '<param name="quality" value="high" />';
+	sHtml += '<param name="bgcolor" value="#ffffffff" />';
+	sHtml += '<param name="wmode" value="transparent" />';
+	sHtml += '<embed wmode="transparent" src="' + sUrl + '" quality="high" bgcolor="#ffffffff" width="160" height="70" name="' + swfTitle + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
+	sHtml += '</object>';
+	
+	document.write(sHtml);
+}

BIN
app/src/main/assets/clock/honehone_clock_tr.swf


+ 29 - 0
app/src/main/assets/clock/honehone_clock_wh.js

@@ -0,0 +1,29 @@
+/******************************************************************************
+	初期設定
+******************************************************************************/
+var swfUrl = "./honehone_clock_wh.swf";
+
+var swfTitle = "honehoneclock";
+
+// 実行
+LoadBlogParts();
+
+/******************************************************************************
+	入力		なし
+	出力		document.writeによるHTML出力
+******************************************************************************/
+function LoadBlogParts(){
+	var sUrl = swfUrl;
+	
+	var sHtml = "";
+	sHtml += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="160" height="70" id="' + swfTitle + '" align="middle">';
+	sHtml += '<param name="allowScriptAccess" value="always" />';
+	sHtml += '<param name="movie" value="' + sUrl + '" />';
+	sHtml += '<param name="quality" value="high" />';
+	sHtml += '<param name="bgcolor" value="#ffffff" />';
+	sHtml += '<param name="wmode" value="transparent" />';
+	sHtml += '<embed wmode="transparent" src="' + sUrl + '" quality="high" bgcolor="#ffffff" width="160" height="70" name="' + swfTitle + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
+	sHtml += '</object>';
+	
+	document.write(sHtml);
+}

BIN
app/src/main/assets/clock/honehone_clock_wh.swf


+ 1 - 0
app/src/main/java/com/itant/shibei/common/ConstantString.java

@@ -12,4 +12,5 @@ public interface ConstantString {
     String SALES_PER_MONTH = "月销 %s";
     String GOOD_COMMENT = "%s%%";
     String MONEY_GAME = "¥%s";
+    String WELCOME_HELLO = "%s好,%s";
 }

+ 51 - 0
app/src/main/java/com/itant/shibei/tool/TimeTool.java

@@ -0,0 +1,51 @@
+package com.itant.shibei.tool;
+
+import java.util.Calendar;
+
+/**
+ * Copyright (C), 2019-2020, Genlot
+ *
+ * @author 詹子聪
+ * @date 2020/7/24 9:15
+ * Description: 时间相关工具类
+ */
+public class TimeTool {
+    /**
+     *
+     * @return 返回当前是上午、中午、下午
+     */
+    public static String getCurrentTimePeriod() {
+        Calendar cal=Calendar.getInstance();
+        int hour = cal.get(Calendar.HOUR_OF_DAY);
+
+        if (hour >= 3 && hour < 6) {
+            return "凌晨";
+        }
+
+        if (hour >= 6 && hour < 8) {
+            return "早上";
+        }
+
+        if (hour >= 8 && hour < 11) {
+            return "上午";
+        }
+
+        if (hour >= 11 && hour < 13) {
+            return "中午";
+        }
+
+        if (hour >= 13 && hour < 17) {
+            return "下午";
+        }
+
+        if (hour >= 17 && hour < 19) {
+            return "傍晚";
+        }
+
+        if (hour >= 19 && hour < 23) {
+            return "晚上";
+        }
+
+        return "深夜";
+    }
+}

+ 15 - 3
app/src/main/java/com/itant/shibei/ui/mine/MineActivity.java

@@ -3,10 +3,13 @@ package com.itant.shibei.ui.mine;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
+import android.widget.TextView;
 
 import com.itant.shibei.R;
 import com.itant.shibei.base.BaseShiBeiActivity;
+import com.itant.shibei.common.ConstantString;
 import com.itant.shibei.tool.SystemTool;
+import com.itant.shibei.tool.TimeTool;
 import com.itant.shibei.ui.mine.login.LoginActivity;
 import com.itant.shibei.ui.mine.login.UserInfoManager;
 import com.miekir.common.utils.ViewTool;
@@ -15,7 +18,7 @@ public class MineActivity extends BaseShiBeiActivity implements View.OnClickList
 
     @Override
     public void onClick(View v) {
-        switch (v.getId()) {
+switch (v.getId()) {
             case R.id.ll_about:
                 startActivity(new Intent(this, AboutActivity.class));
                 break;
@@ -35,7 +38,7 @@ public class MineActivity extends BaseShiBeiActivity implements View.OnClickList
 
             default:
                 break;
-        }
+}
     }
 
     @Override
@@ -45,7 +48,16 @@ public class MineActivity extends BaseShiBeiActivity implements View.OnClickList
 
     @Override
     public void initViews(Bundle savedInstanceState) {
-        setTitle("我的");
+        setTitle(String.format(ConstantString.WELCOME_HELLO, TimeTool.getCurrentTimePeriod(), "主人"));
+        TextView tv_hello = findViewById(R.id.tv_hello);
+        //tv_hello.setText(String.format(ConstantString.WELCOME_HELLO, TimeTool.getCurrentTimePeriod(), "主人"));
+
+
+
+
+
+
+
         ViewTool.setOnClickListener(this, new int[]{R.id.ll_about, R.id.ll_user, R.id.ll_feedback}, this);
     }
 }

+ 20 - 75
app/src/main/res/layout/activity_mine.xml

@@ -9,6 +9,19 @@
 
     <include layout="@layout/view_toolbar"/>
 
+    <TextView
+        android:id="@+id/tv_hello"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textStyle="bold"
+        android:textSize="@dimen/size_hello"
+        android:textColor="@color/black_standard"
+        android:paddingStart="@dimen/activity_horizontal_margin"
+        android:paddingEnd="@dimen/activity_horizontal_margin"
+        android:layout_marginTop="@dimen/width_indicator"
+        android:layout_marginBottom="@dimen/width_indicator"
+        android:visibility="gone"/>
+
     <LinearLayout
         android:id="@+id/ll_user"
         android:layout_width="match_parent"
@@ -17,7 +30,8 @@
         android:orientation="horizontal"
         android:paddingStart="@dimen/activity_horizontal_margin"
         android:paddingEnd="@dimen/activity_horizontal_margin"
-        android:background="?attr/selectableItemBackground">
+        android:background="?attr/selectableItemBackground"
+        android:layout_marginTop="@dimen/width_indicator">
 
         <RelativeLayout
             android:layout_width="@dimen/size_icon_big"
@@ -43,92 +57,23 @@
             <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="未登录"
+                android:text="¥88.88"
+                android:textSize="@dimen/size_hello"
                 android:textColor="@color/black_theme"
                 android:textStyle="bold" />
 
             <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="未绑定收款支付宝"
-                android:textColor="@color/black_theme" />
+                android:text="提现支付宝:13684998852"
+                android:textSize="@dimen/text_normal_s"
+                android:textColor="@color/black_text_hint" />
         </LinearLayout>
     </LinearLayout>
 
     <include layout="@layout/view_divider_common" />
 
 
-    <!--我的钱包-->
-    <!--<LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/height_tab_bar"
-        android:gravity="center_vertical"
-        android:orientation="horizontal"
-        android:paddingStart="@dimen/activity_horizontal_margin"
-        android:paddingEnd="@dimen/activity_horizontal_margin"
-        android:background="?attr/selectableItemBackground">
-
-        <ImageView
-            android:layout_width="@dimen/size_icon_big"
-            android:layout_height="@dimen/size_icon"
-            android:src="@drawable/ic_mine_money" />
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/activity_horizontal_margin_s"
-            android:text="钱包"
-            android:textColor="@color/black_text" />
-    </LinearLayout>-->
-
-
-    <!--我的订单-->
-    <!--<LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/height_tab_bar"
-        android:gravity="center_vertical"
-        android:orientation="horizontal"
-        android:paddingStart="@dimen/activity_horizontal_margin"
-        android:paddingEnd="@dimen/activity_horizontal_margin">
-
-        <ImageView
-            android:layout_width="@dimen/size_icon_big"
-            android:layout_height="@dimen/size_icon"
-            android:src="@drawable/ic_mine_mall" />
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/activity_horizontal_margin_s"
-            android:text="订单"
-            android:textColor="@color/black_text" />
-
-    </LinearLayout>
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/height_tab_bar"
-        android:gravity="center_vertical"
-        android:orientation="horizontal"
-        android:paddingStart="@dimen/activity_horizontal_margin"
-        android:paddingEnd="@dimen/activity_horizontal_margin">
-
-        <ImageView
-            android:layout_width="@dimen/size_icon_big"
-            android:layout_height="@dimen/size_icon"
-            android:src="@drawable/ic_mine_star" />
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="@dimen/activity_horizontal_margin_s"
-            android:text="关注"
-            android:textColor="@color/black_text" />
-
-    </LinearLayout>
-
-    <include layout="@layout/view_divider_common"/>-->
-
     <LinearLayout
         android:id="@+id/ll_feedback"
         android:layout_width="match_parent"

+ 171 - 0
app/src/main/res/layout/backup_activity_register.xml

@@ -0,0 +1,171 @@
+<?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:background="@color/colorPrimary"
+    android:fitsSystemWindows="true"
+    android:orientation="vertical"
+    android:focusable="true"
+    android:focusableInTouchMode="true">
+    <!--启用深色模式之后,需要使用fitsSystemWindows来不让布局上滑-->
+
+    <include layout="@layout/view_toolbar" />
+    <!--阴影效果android:background="?android:attr/listDivider"-->
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/margin_default"
+        android:layout_marginStart="@dimen/margin_default"
+        android:layout_marginEnd="@dimen/margin_default">
+        <com.google.android.material.textfield.TextInputLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="请输入邮箱"
+            app:boxBackgroundMode="outline"
+            app:boxCornerRadiusBottomEnd="4dp"
+            app:boxCornerRadiusBottomStart="4dp"
+            app:boxCornerRadiusTopEnd="4dp"
+            app:boxCornerRadiusTopStart="4dp"
+            app:boxStrokeWidth="@dimen/width_stroke"
+            app:boxStrokeWidthFocused="@dimen/width_stroke"
+            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+            <com.google.android.material.textfield.TextInputEditText
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingEnd="90dp"
+                android:textSize="@dimen/text_normal_s"
+                android:inputType="textEmailAddress"
+                android:maxLength="50"/>
+        </com.google.android.material.textfield.TextInputLayout>
+
+        <!--去除按钮阴影style="?android:attr/borderlessButtonStyle"-->
+        <!--用android.widget.Button代替Button就不会有Material风格了,当前style下Button的background无效-->
+        <android.widget.Button
+            android:layout_width="@dimen/size_image_big"
+            android:minWidth="0dp"
+            android:layout_height="match_parent"
+            android:textColor="@color/white"
+            android:minHeight="0dp"
+            android:paddingTop="@dimen/margin_ss"
+            android:layout_marginTop="9dp"
+            android:layout_marginBottom="@dimen/margin_ss"
+            android:paddingBottom="@dimen/margin_ss"
+            android:layout_marginStart="@dimen/margin_ss"
+            android:layout_marginEnd="@dimen/margin_ss"
+            android:paddingStart="@dimen/margin_ss"
+            android:paddingEnd="@dimen/margin_ss"
+            android:textSize="@dimen/text_s"
+            android:text="验证码"
+            android:elevation="0dp"
+            style="?android:attr/borderlessButtonStyle"
+            android:background="@drawable/selector_btn"
+            android:layout_gravity="end"/>
+    </FrameLayout>
+
+
+    <com.google.android.material.textfield.TextInputLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/margin_default"
+        android:layout_marginEnd="@dimen/margin_default"
+        android:layout_marginTop="@dimen/margin_default"
+        android:hint="请输入邮箱验证码"
+        app:boxBackgroundMode="outline"
+        app:boxCornerRadiusBottomEnd="4dp"
+        app:boxCornerRadiusBottomStart="4dp"
+        app:boxCornerRadiusTopEnd="4dp"
+        app:boxCornerRadiusTopStart="4dp"
+        app:boxStrokeWidth="@dimen/width_stroke"
+        app:boxStrokeWidthFocused="@dimen/width_stroke"
+        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
+        android:orientation="horizontal">
+
+        <com.google.android.material.textfield.TextInputEditText
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:inputType="number"
+            android:digits="0123456789"
+            android:textSize="@dimen/text_normal_s"
+            android:maxLength="6"/>
+
+    </com.google.android.material.textfield.TextInputLayout>
+
+    <com.google.android.material.textfield.TextInputLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/margin_default"
+        android:layout_marginEnd="@dimen/margin_default"
+        android:layout_marginTop="@dimen/margin_default"
+        android:hint="请设置密码"
+        app:boxBackgroundMode="outline"
+        app:boxCornerRadiusBottomEnd="4dp"
+        app:boxCornerRadiusBottomStart="4dp"
+        app:boxCornerRadiusTopEnd="4dp"
+        app:boxCornerRadiusTopStart="4dp"
+        app:boxStrokeWidth="@dimen/width_stroke"
+        app:boxStrokeWidthFocused="@dimen/width_stroke"
+        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+        <com.google.android.material.textfield.TextInputEditText
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:inputType="textPassword"
+            android:textSize="@dimen/text_normal_s"
+            android:maxLength="20"/>
+
+    </com.google.android.material.textfield.TextInputLayout>
+
+
+
+
+    <com.google.android.material.textfield.TextInputLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/margin_default"
+        android:layout_marginEnd="@dimen/margin_default"
+        android:layout_marginTop="@dimen/margin_default"
+        android:hint="请输入昵称"
+        app:boxBackgroundMode="outline"
+        app:boxCornerRadiusBottomEnd="4dp"
+        app:boxCornerRadiusBottomStart="4dp"
+        app:boxCornerRadiusTopEnd="4dp"
+        app:boxCornerRadiusTopStart="4dp"
+        app:boxStrokeWidth="@dimen/width_stroke"
+        app:boxStrokeWidthFocused="@dimen/width_stroke"
+        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+        <com.google.android.material.textfield.TextInputEditText
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textSize="@dimen/text_normal_s"
+            android:inputType="textEmailAddress"
+            android:maxLength="50"/>
+    </com.google.android.material.textfield.TextInputLayout>
+
+    <com.google.android.material.textfield.TextInputLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/margin_default"
+        android:layout_marginEnd="@dimen/margin_default"
+        android:layout_marginTop="@dimen/margin_default"
+        android:hint="请输入提现账号(目前仅支持支付宝)"
+        app:boxBackgroundMode="outline"
+        app:boxCornerRadiusBottomEnd="4dp"
+        app:boxCornerRadiusBottomStart="4dp"
+        app:boxCornerRadiusTopEnd="4dp"
+        app:boxCornerRadiusTopStart="4dp"
+        app:boxStrokeWidth="@dimen/width_stroke"
+        app:boxStrokeWidthFocused="@dimen/width_stroke"
+        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
+
+        <com.google.android.material.textfield.TextInputEditText
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textSize="@dimen/text_normal_s"
+            android:inputType="textEmailAddress"
+            android:maxLength="50"/>
+    </com.google.android.material.textfield.TextInputLayout>
+</LinearLayout>

+ 9 - 8
app/src/main/res/layout/view_toolbar.xml

@@ -2,19 +2,20 @@
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
-    <LinearLayout
+    <androidx.appcompat.widget.Toolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/height_tool_bar"
+        android:background="@color/colorPrimary"
+        app:titleTextAppearance="@style/Toolbar.TitleText"/>
+    <!--<LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical">
 
-        <androidx.appcompat.widget.Toolbar
-            android:id="@+id/toolbar"
-            android:layout_width="match_parent"
-            android:layout_height="@dimen/height_tool_bar"
-            android:background="@color/colorPrimary"
-            app:titleTextAppearance="@style/Toolbar.TitleText"/>
+
         <include layout="@layout/view_divider_common" />
 
 
-    </LinearLayout>
+    </LinearLayout>-->
 </merge>

+ 1 - 0
app/src/main/res/values/dimens.xml

@@ -16,6 +16,7 @@
     <dimen name="design_bottom_navigation_margin" tools:override="true">7.5dp</dimen>
     <dimen name="design_navigation_icon_padding" tools:override="true">6dp</dimen>
 
+    <dimen name="size_hello">20sp</dimen>
     <dimen name="size_title">16sp</dimen>
     <dimen name="size_title_s">15sp</dimen>
     <dimen name="size_icon_big">32dp</dimen>