Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
/**
|
||||
* 滑动设置
|
||||
*/
|
||||
public class SlideSettingsDialog extends AbsDialogFragment {
|
||||
private ImageView slideSwitch;
|
||||
private boolean slide;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_slide_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.BOTTOM;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
slideSwitch = (ImageView) findViewById(R.id.slide_switch);
|
||||
slide = IMLoginManager.get(getActivity()).isSlide();
|
||||
if (slide) {
|
||||
ImgLoader.display(getContext(), R.mipmap.special_icon_on, slideSwitch);
|
||||
} else {
|
||||
ImgLoader.display(getContext(), R.mipmap.special_icon_off, slideSwitch);
|
||||
}
|
||||
//滑动设置
|
||||
ViewClicksAntiShake.clicksAntiShake(slideSwitch, () -> {
|
||||
slide = !slide;
|
||||
if (slide) {
|
||||
ImgLoader.display(getContext(), R.mipmap.special_icon_on, slideSwitch);
|
||||
} else {
|
||||
ImgLoader.display(getContext(), R.mipmap.special_icon_off, slideSwitch);
|
||||
}
|
||||
//滑动设置
|
||||
IMLoginManager.get(getContext()).initSlide(slide);
|
||||
if (callBack != null) {
|
||||
callBack.initSlide(slide);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private SlideSettingsCallBack callBack;
|
||||
|
||||
public SlideSettingsDialog setCallBack(SlideSettingsCallBack callBack) {
|
||||
this.callBack = callBack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface SlideSettingsCallBack {
|
||||
void initSlide(boolean slide);
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
private final static String GiftEffect = "giftEffect";
|
||||
private final static String MountEffect = "mountEffect";
|
||||
private final static String IS_CHAT = "isChat";
|
||||
private final static String IS_SLIDE = "isSlide";
|
||||
|
||||
/**
|
||||
* @param isChat 是否隐藏聊天列表 is_chat 1:开启 0:关闭
|
||||
@@ -38,6 +39,24 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
put(IS_CHAT, isChat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置直播间是否滚动
|
||||
*
|
||||
* @param isSlide 滚动
|
||||
*/
|
||||
public void initSlide(boolean isSlide) {
|
||||
put(IS_SLIDE, isSlide);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取之比肩是否滚动
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isSlide() {
|
||||
return getBoolean(IS_SLIDE, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否隐藏聊天列表
|
||||
*
|
||||
|
||||
@@ -245,6 +245,28 @@
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/slide_settings_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="23dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/live_more_icon_sliding" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/slide_settings"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/system_notice"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
42
common/src/main/res/layout/view_slide_settings.xml
Normal file
42
common/src/main/res/layout/view_slide_settings.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_live_tota"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="@string/slide_settings"
|
||||
android:textColor="#FFF6F7FB"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="21dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/up_slide_settings"
|
||||
android:textColor="#FF9A9A9A"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/slide_switch"
|
||||
android:layout_width="40.8dp"
|
||||
android:layout_height="24.8dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:src="@mipmap/special_icon_off" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
BIN
common/src/main/res/mipmap-xxhdpi/live_more_icon_sliding.png
Normal file
BIN
common/src/main/res/mipmap-xxhdpi/live_more_icon_sliding.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
@@ -912,6 +912,8 @@
|
||||
<string name="order_query">订单查询中</string>
|
||||
<string name="order_query_success">订单无异常</string>
|
||||
<string name="login_invalid">登錄失效,請重新登錄</string>
|
||||
<string name="slide_settings">滑動設置</string>
|
||||
<string name="up_slide_settings">上下滑動切換直播間</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user