Commit 898fc71b by 霍志良

feat:底部布局浮在输入法上面

parent 820e7f59
......@@ -8,8 +8,8 @@ import com.ydl.component.mvp.DemoPresenter
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.yidianling.consultant.ExpertSearchFragment
//import com.yidianling.consultant.ExpertSearchFragment
import com.yidianling.dynamic.trendsHome.TrendsHomeFragment
//import com.yidianling.consultant.ExpertSearchFragment
import com.yidianling.home.ui.fragment.YdlHomeFragment
//import com.yidianling.dynamic.trendsHome.TrendsHomeFragment
//import com.yidianling.home.ui.fragment.YdlHomeFragment
......
......@@ -43,6 +43,10 @@
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".publishTrend.PublishTrendActivityTrends"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".topic.AllTopicActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
......
......@@ -6,10 +6,7 @@ import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import com.yidianling.dynamic.R
import com.yidianling.dynamic.dialog.listener.CancelFocusDialogListener
import com.yidianling.dynamic.dialog.listener.TrendsQuestionListener
import kotlinx.android.synthetic.main.dynamic_cancel_focus_dialog_layout.*
import kotlinx.android.synthetic.main.dynamic_cancel_focus_dialog_layout.cancel_focus_dialog_cancel
import kotlinx.android.synthetic.main.dynamic_question_and_trends_dialog_layout.*
/**
......@@ -19,24 +16,27 @@ class TrendsAndQuestionDialog(val mContext: Context, val listener: TrendsQuestio
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.dynamic_question_and_trends_dialog_layout)
val params = window.attributes
params.width = WindowManager.LayoutParams.MATCH_PARENT
params.height = WindowManager.LayoutParams.MATCH_PARENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
params.gravity=Gravity.BOTTOM
window.attributes = params
window.setGravity(Gravity.BOTTOM)
setCanceledOnTouchOutside(true)
ll_publish_trends.setOnClickListener {
listener.publishTrends()
hide()
}
cancel_focus_dialog_sure.setOnClickListener {
ll_publish_question.setOnClickListener {
listener.publishQuestion()
hide()
}
publish_close.setOnClickListener {
hide()
}
}
......
......@@ -11,6 +11,7 @@ import androidx.viewpager.widget.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
......@@ -33,6 +34,8 @@ import com.yidianling.dynamic.R;
import com.yidianling.dynamic.bean.TrendTabEntity;
import com.yidianling.dynamic.publishTrend.fragment.PublishQuestionAndTrendFragment;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
......@@ -57,6 +60,12 @@ public class PublishTrendActivity extends BaseActivity {
private Handler handler;
private LinearLayout mPublishTrendTitle;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
public static Intent newIntent(Activity activity, String url, String cover, String title) {
Intent intent = new Intent(activity, PublishTrendActivity.class);
Bundle bundle = new Bundle();
......@@ -127,11 +136,11 @@ public class PublishTrendActivity extends BaseActivity {
}
private void initData() {
titleList.add(new TrendTabEntity("动态", 0, 0));
// titleList.add(new TrendTabEntity("发动态", 0, 0));
titleList.add(new TrendTabEntity("提问", 0, 0));
mTableLayout.setTabData(titleList);
fragmentList.add(PublishQuestionAndTrendFragment.getInstance(PublishQuestionAndTrendFragment.TYPE_TREND));
// fragmentList.add(PublishQuestionAndTrendFragment.getInstance(PublishQuestionAndTrendFragment.TYPE_TREND));
fragmentList.add(PublishQuestionAndTrendFragment.getInstance(PublishQuestionAndTrendFragment.TYPE_QUESTION));
FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
......
......@@ -8,10 +8,14 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AlertDialog;
......@@ -25,6 +29,7 @@ import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
......@@ -118,7 +123,8 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
private ImageView iv_fm;
private ImageView iv_to_expert;
private TextView publish_trend_ad_tv;
private ConstraintLayout trends_publish_question;
private LinearLayout ll_bottom_img_emoji;
RxFileTool fileUtils;
private String head_dir;//目录
private String head_path;//路径
......@@ -154,7 +160,6 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
protected Handler uiHandler;
private boolean isKeyboardShowed = true; // 是否显示键盘
//测试结果页(或者fm页面、文章页面)传过来的数据
private String Test_url;
private String Test_cover;
......@@ -168,8 +173,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
private static final String TITLE = "Test_title";
private View dialogContentView;
private Activity activity;
private int isCanlayout=0;
public static Fragment getInstance(String type) {
PublishQuestionAndTrendFragment fragment = new PublishQuestionAndTrendFragment();
fragment.type = type;
......@@ -193,6 +197,17 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onStop() {
super.onStop();
isCanlayout=0;
}
@Override
public void initDataAndEventLazy() {
rxPermissions = new RxPermissions(getActivity());
imgFiles = new ArrayList<File>();
......@@ -326,6 +341,8 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
private void initView() {
trends_publish_question=getRootView().findViewById(R.id.trends_publish_question);
ll_bottom_img_emoji=getRootView().findViewById(R.id.ll_bottom_img_emoji);
publish_trend_ad_rel = getRootView().findViewById(R.id.publish_trend_ad_rel);
iv_fm = getRootView().findViewById(R.id.iv_fm);
publish_trend_ad_iv = getRootView().findViewById(R.id.publish_trend_ad_iv);
......@@ -348,6 +365,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
publish_trend_title_editext.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
isCanlayout=1;
if (hasFocus) {
// 此处为得到焦点时的处理内容
writeing_title = true;
......@@ -365,6 +383,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
});
publish_trend_content_editext.setOnTouchListener((v, event) -> {
isCanlayout=1;
hideEmojiLayout();
publish_emoji_iv.setImageResource(R.drawable.dynamic_edict_ico_emoji);
return false;
......@@ -386,6 +405,18 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
"2、你想寻求哪方面的帮助\n" +
"这样更容易获得咨询师准确、专业的解答哦~");
}
trends_publish_question.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (isCanlayout!=0){
Rect rect=new Rect();
trends_publish_question.getWindowVisibleDisplayFrame(rect);
ll_bottom_img_emoji.layout(0, rect.height()-ll_bottom_img_emoji.getHeight()-96,ll_bottom_img_emoji.getWidth(),rect.height());
}
}
});
}
private void initEvent() {
......
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<LinearLayout
android:id="@+id/publish_trend_title_rel"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/dynamic_background_publish_trend_top"
>
<RelativeLayout
android:layout_gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="48dp"
>
<ImageView
android:id="@+id/img_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:paddingLeft="15dp"
android:paddingRight="@dimen/platform_dp_15"
android:src="@drawable/platform_common_back" />
<com.flyco.tablayout.CommonTabLayout
android:id="@+id/tab_layout"
android:layout_width="110dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_marginBottom="6dp"
app:tl_indicator_anim_enable="false"
app:tl_indicator_height="0dp"
app:tl_tab_space_equal="true"
app:tl_textSelectColor="@color/platform_color_242424"
app:tl_textUnselectColor="@color/platform_white"
app:tl_textsize="17sp" />
<TextView
android:id="@+id/publish_trend_sure_tv"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginRight="15dp"
android:background="@drawable/dynamic_bg_publish_button"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="发布"
android:textColor="@color/platform_but_text_color_selected"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/dynamic_white">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/publish_trend_content_editext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/dynamic_white"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="left|top"
android:hint="1、清晰描述事情的背景及经过\n2、你想寻求哪方面的帮助\n这样更容易获得咨询师准确、专业的解答哦~"
android:includeFontPadding="false"
android:minLines="6"
android:padding="15dp"
android:paddingLeft="15dp"
android:textColor="@color/dynamic_text_trend_title_black"
android:textColorHint="@color/dynamic_text_trend_defult"
android:textSize="15sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/publish_trend_img_rcv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/publish_trend_content_editext"
android:layout_marginTop="16dp"
android:paddingLeft="-5dp"
android:paddingRight="-5dp"
android:visibility="gone" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/publish_trend_img_rcv"
android:layout_margin="15dp">
<TextView
android:id="@+id/publish_trend_bottom_topic_tv"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:background="@drawable/dynamic_bg_topic"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="# 选择话题"
android:textColor="@color/platform_color_666666"
android:textSize="11sp" />
<TextView
android:id="@+id/publish_trend_content_num_tv"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:gravity="center_vertical"
android:includeFontPadding="false"
android:text="0/1000"
android:textColor="#FF757575"
android:textSize="11sp" />
<View
android:id="@+id/line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/publish_trend_content_num_tv"
android:layout_marginTop="15dp"
android:background="@color/platform_new_divide_color" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/line"
android:layout_marginLeft="1dp"
android:layout_marginTop="15dp"
android:layout_marginRight="1dp"
android:layout_marginBottom="@dimen/platform_dp_1"
android:elevation="1dp"
app:cardCornerRadius="6dp">
<RelativeLayout
android:id="@+id/publish_trend_ad_rel"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/platform_color_F7F7F7"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/publish_trend_ad_iv"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerVertical="true"
android:scaleType="fitXY"
android:src="@drawable/dynamic_default_img" />
<ImageView
android:id="@+id/iv_fm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:src="@drawable/dynamic_img_trend_fm_play"
android:visibility="gone"
tools:visibility="visible" />
<TextView
android:id="@+id/publish_trend_ad_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toRightOf="@+id/publish_trend_ad_iv"
android:maxLines="2"
android:text="测测你的童年阴影"
android:textColor="#333"
android:textSize="15sp" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<include layout="@layout/dynamic_layout_publish_trend_bottom" />
</LinearLayout>
<?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="wrap_content"
android:orientation="vertical">
......@@ -17,7 +18,8 @@
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:padding="3dp"
android:src="@drawable/dynamic_edit_img" />
android:src="@drawable/dynamic_edit_img"
/>
<ImageView
android:id="@+id/publish_emoji_iv"
......
......@@ -2,7 +2,8 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="232dp"
android:layout_height="wrap_content"
android:paddingBottom="66dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/dynamic_publish_trends_question_background">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment