Bladeren bron

1.修改IM聊天页面UI

王鹏鹏 2 jaren geleden
bovenliggende
commit
ce3cb24c1f

+ 2 - 1
.idea/misc.xml

@@ -291,6 +291,7 @@
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/drawable/action_audio_selector.xml" value="0.155" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/drawable/action_face_selector.xml" value="0.158" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/drawable/action_more_selector.xml" value="0.155" />
+        <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/drawable/bg_session_prompt.xml" value="0.144" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/drawable/chat_bubble_other_cavity_bg.xml" value="0.1565" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/drawable/chat_bubble_self_cavity_bg.xml" value="0.1565" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/drawable/chat_pop_menu_divider.xml" value="0.1565" />
@@ -310,7 +311,7 @@
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_input_layout.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_inputmore_fragment.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_inputmore_layout.xml" value="0.23697916666666666" />
-        <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_layout.xml" value="0.23697916666666666" />
+        <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_layout.xml" value="0.4" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_menu_face_item_layout.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_menu_recent_face_item_layout.xml" value="0.23697916666666666" />
         <entry key="..\:/workspace/hcp-pad/tuichat/src/main/res/layout/chat_patient_info.xml" value="0.72" />

+ 72 - 0
baselib/src/main/java/com/yingyangfly/baselib/utils/ViewTool.java

@@ -426,4 +426,76 @@ public class ViewTool {
         return false;
     }
 
+    public static View inflateFragmentPixelsById(Context context, int layoutId, ViewGroup container,
+                                                 int width, int height) {
+        View views = LayoutInflater.from(context).inflate(layoutId, container);
+        if (views == null) {
+            return null;
+        }
+        DisplayMetrics dm2 = new DisplayMetrics();
+        ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE))
+                .getDefaultDisplay().getMetrics(dm2);
+        if (heightPixels <= 0) {
+            heightPixels = dm2.heightPixels;
+            widthPixels = dm2.widthPixels;
+            Class<?> c = null;
+            Object obj = null;
+            Field field = null;
+            int x = 0, sbar = 0;
+            try {
+                c = Class.forName("com.android.internal.R$dimen");
+                obj = c.newInstance();
+                field = c.getField("status_bar_height");
+                x = Integer.parseInt(field.get(obj).toString());
+                sbar = context.getResources().getDimensionPixelSize(x);
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+            heightPixels = heightPixels - sbar;
+        }
+
+        Resources resources = context.getResources();
+
+        float heightPixelsN, widthPixelsN;
+        heightPixelsN = heightPixels;
+        widthPixelsN = widthPixels;
+        int rid = resources.getIdentifier("config_showNavigationBar", "bool",
+                "android");
+        if (resources.getBoolean(rid)) {
+            // ��ȡ�������Ƿ���ʾtrue or false
+
+            int resourceId = resources.getIdentifier("navigation_bar_height",
+                    "dimen", "android");
+            if (resourceId > 0) {
+
+                if (isScreenChange(context)) {
+                    widthPixelsN += resources.getDimensionPixelSize(resourceId);
+                } else {
+                    heightPixelsN += resources
+                            .getDimensionPixelSize(resourceId);
+                }
+            }
+
+        }
+
+        if (widthPixelsN / heightPixelsN == 9.0 / 16.0) {
+            width = (int) ((9.0 / 16.0) * height);
+
+        } else if (widthPixelsN / heightPixelsN == 10.0 / 16.0) {
+            width = (int) ((10.0 / 16.0) * height);
+        }
+        initPixels(views, width, height);
+        ViewGroup.LayoutParams lp = views.getLayoutParams();
+        if (lp != null) {
+
+            if (lp.height > 0) {
+                lp.height = (int) (((float) lp.height) / height * heightPixels);
+            }
+            if (lp.width > 0) {
+                lp.width = (int) (((float) lp.width) / width * widthPixels);
+            }
+            views.setLayoutParams(lp);
+        }
+        return views;
+    }
 }

+ 8 - 0
tuichat/src/main/res/drawable/bg_session_prompt.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:shape="rectangle"
+    tools:ignore="ResourceName">
+    <corners android:radius="@dimen/divider_27px" />
+    <solid android:color="@color/color_C74A76FF" />
+</shape>

+ 15 - 1
tuichat/src/main/res/layout/chat_layout.xml

@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@drawable/icon_uniform_background"
@@ -26,6 +25,19 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
+            <TextView
+                android:id="@+id/titleLayout"
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/divider_54px"
+                android:layout_marginStart="@dimen/divider_36px"
+                android:layout_marginTop="@dimen/divider_20px"
+                android:layout_marginEnd="@dimen/divider_36px"
+                android:background="@drawable/bg_session_prompt"
+                android:gravity="center"
+                android:orientation="vertical"
+                android:text="已通知医生接诊,24小时后未接诊将自动退款"
+                android:textColor="@android:color/white" />
+
             <FrameLayout
                 android:id="@+id/custom_layout"
                 android:layout_width="match_parent"
@@ -38,6 +50,8 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_above="@id/chat_input_layout"
+                android:layout_below="@+id/titleLayout"
+                android:layout_marginTop="@dimen/divider_10px"
                 android:baselineAligned="false"
                 android:clickable="false"
                 android:descendantFocusability="blocksDescendants" />

+ 1 - 0
tuichat/src/main/res/values/colors.xml

@@ -56,4 +56,5 @@
     <color name="color_FFECEFF5">#FFECEFF5</color>
     <color name="color_FF4A76FF">#FF4A76FF</color>
     <color name="color_FFAEA8A8" tools:ignore="MissingDefaultResource">#FFAEA8A8</color>
+    <color name="color_C74A76FF">#C74A76FF</color>
 </resources>