Browse Source

UI改版:修改标题栏

Arison 8 years ago
parent
commit
e2ab4d77ef

+ 2 - 2
WeiChat/src/main/AndroidManifest.xml

@@ -285,7 +285,7 @@
             android:launchMode="singleTask"
             android:screenOrientation="portrait"
             android:theme="@style/MainBaseTheme"
-            android:windowSoftInputMode="stateUnspecified|adjustNothing">
+            android:windowSoftInputMode="adjustResize">
             <intent-filter>
                 <action android:name="com.modular.main.MainActivity" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -293,7 +293,7 @@
         </activity>
         <!-- 消息模块 -->
         <activity android:name=".ui.message.ChatActivity"
-            android:theme="@style/MainBaseTheme">
+            android:theme="@style/AppTheme.NoActionBar">
             <intent-filter>
                 <action android:name="com.modular.message.ChatActivity" />
                 <category android:name="android.intent.category.DEFAULT" />

+ 33 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/ChatActivity.java

@@ -8,6 +8,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.ServiceConnection;
+import android.graphics.Rect;
 import android.media.AudioManager;
 import android.net.Uri;
 import android.os.Bundle;
@@ -16,13 +17,17 @@ import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
 import android.text.TextUtils;
+import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.view.ViewTreeObserver;
+import android.view.WindowManager;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -291,6 +296,8 @@ public class ChatActivity extends SupportToolBarActivity
                 onDeleteMore();
             }
         });
+        
+        //resetSendMsgRl(mChatContentView);
     }
 
     private void onDeleteMore() {
@@ -1042,4 +1049,30 @@ public class ChatActivity extends SupportToolBarActivity
         ViewUtil.httpSendRequest(this, url, params, mHandler, null, 5, null, null, "get");
     }
 
+
+    private void resetSendMsgRl(View  rlContent){
+
+        final View decorView=getWindow().getDecorView();
+        decorView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+            @Override
+            public void onGlobalLayout() {
+                Rect rect=new Rect();
+                decorView.getWindowVisibleDisplayFrame(rect);
+                int screenHeight = getScreenHeight();
+                int heightDifference = screenHeight - rect.bottom;//计算软键盘占有的高度  = 屏幕高度 - 视图可见高度
+                RelativeLayout.LayoutParams layoutParams= (RelativeLayout.LayoutParams) rlContent.getLayoutParams();
+                layoutParams.setMargins(0,0,0,heightDifference);//设置rlContent的marginBottom的值为软键盘占有的高度即可
+                rlContent.requestLayout();
+            }
+        });
+    }
+
+
+    private int getScreenHeight(){
+        WindowManager manager = this.getWindowManager();
+        DisplayMetrics outMetrics = new DisplayMetrics();
+        manager.getDefaultDisplay().getMetrics(outMetrics);
+        int height = outMetrics.heightPixels;
+        return  height;
+    }
 }

+ 1 - 0
WeiChat/src/main/res/values-v21/styles.xml

@@ -5,5 +5,6 @@
         <item name="windowNoTitle">true</item>
         <item name="android:windowDrawsSystemBarBackgrounds">true</item>
         <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:windowTranslucentStatus">true</item>
     </style>
 </resources>

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Thu May 17 19:47:01 CST 2018
-debugName=288
+#Fri May 18 15:58:46 CST 2018
+debugName=333
 versionName=630
-debugCode=288
+debugCode=333
 versionCode=170

+ 1 - 3
app_core/common/src/main/java/com/core/base/SupportToolBarActivity.java

@@ -33,9 +33,7 @@ public class SupportToolBarActivity extends BaseActivity {
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
-        getWindow().setSoftInputMode
-                (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN |
-                        WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
+       getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
         super.onCreate(savedInstanceState);
         super.setContentView(R.layout.base_bar_layout);
         contentFl = findViewById(R.id.contentFl);

+ 2 - 1
app_core/common/src/main/java/com/core/widget/crouton/Crouton.java

@@ -273,7 +273,8 @@ public final class Crouton {
      * @return
      */
     public static Crouton makeText(Activity activity, CharSequence text, int color, int time, ViewGroup viewGroup) {
-        Style customColor = new Style.Builder().setBackgroundColorValue(color).build();
+        Style customColor = new Style.Builder().setBackgroundColorValue(color)
+                .setGravity(Gravity.BOTTOM).build();
         Configuration customConfiguration = new Configuration.Builder().setDuration(time).build();
         return new Crouton(activity, text, customColor, viewGroup).setConfiguration(customConfiguration);
     }

+ 14 - 18
app_core/common/src/main/res/layout/base_bar_layout.xml

@@ -1,22 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
-    android:id="@+id/windowLl"
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
-
-    <ViewStub
-        android:id="@+id/toolbarVs"
-        android:layout_width="match_parent"
-        android:layout_height="?attr/actionBarSize"
-        android:layout="@layout/common_toolbar" />
-
-    <FrameLayout
-        android:id="@+id/contentFl"
+        android:id="@+id/windowLl"
+        xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:orientation="horizontal" />
-
-
-</LinearLayout>
+        android:orientation="vertical">
+        <ViewStub
+            android:id="@+id/toolbarVs"
+            android:layout_width="match_parent"
+            android:layout_height="?attr/actionBarSize"
+            android:layout="@layout/common_toolbar" />
+        <FrameLayout
+            android:id="@+id/contentFl"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="horizontal" />
+</LinearLayout>

+ 2 - 1
app_core/common/src/main/res/layout/chat.xml

@@ -3,6 +3,7 @@
     android:id="@+id/root_view"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
+  
     android:orientation="vertical">
 
     <RelativeLayout
@@ -23,7 +24,7 @@
         <com.core.xmpp.widget.ChatContentView
             android:id="@+id/chat_content_view"
             android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_height="wrap_content"
             android:layout_above="@+id/bottom_fl"
             android:layout_below="@+id/auth_state_tip"
             android:background="@drawable/bg_chat"

+ 2 - 2
app_core/common/src/main/res/layout/common_toolbar.xml

@@ -2,9 +2,9 @@
 <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/commonToolBar"
     android:layout_width="match_parent"
-    android:layout_height="?attr/actionBarSize"
+    android:layout_height="wrap_content"
+    android:minHeight="?attr/actionBarSize"
     android:background="@drawable/common_toolbar_bg">
-
     <TextView
         android:id="@+id/commonTitleTv"
         android:layout_width="wrap_content"

+ 4 - 3
app_core/common/src/main/res/values-v21/styles.xml

@@ -1,9 +1,10 @@
 <resources>>
-
     <style name="AppTheme.NoActionBar">
+        <item name="colorPrimary">@color/colorPrimary</item>
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+        <item name="colorAccent">@color/colorAccent</item>
         <item name="windowActionBar">false</item>
         <item name="windowNoTitle">true</item>
-        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
-        <item name="android:statusBarColor">@android:color/transparent</item>
+        <item name="android:windowTranslucentStatus">true</item>
     </style>
 </resources>

+ 3 - 1
app_modular/apputils/src/main/res/values/style.xml

@@ -19,7 +19,9 @@
         <item name="android:windowDisablePreview">true</item>
         <item name="styleLoadingLayout">@style/LoadingLayoutStyle</item>
         <item name="android:homeAsUpIndicator">@drawable/actionbar_up_indicator</item>
+       
         <item name="actionMenuTextColor">#ffffff</item>
-        <item name="android:windowSoftInputMode">stateHidden|adjustResize</item>
+       
+       
     </style>
 </resources>