新增左下角功能view添加模块
This commit is contained in:
@@ -876,27 +876,29 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
tv.setText(" height: " + currentHeight + ": " + v);
|
||||
ViewGroup.LayoutParams params =
|
||||
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, currentHeight);
|
||||
mApis.getTopViewManager().addView(v, params, new IMogoTopViewStatusListener() {
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(TAG, "onViewAdded: " + view);
|
||||
}
|
||||
mApis.getEntranceButtonController().addLeftFeatureView(v);
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(TAG, "onViewRemoved: " + view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(TAG, "beforeViewAddAnim: " + view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(TAG, "beforeViewRemoveAnim: " + view);
|
||||
}
|
||||
});
|
||||
// mApis.getTopViewManager().addView(v, params, new IMogoTopViewStatusListener() {
|
||||
// @Override
|
||||
// public void onViewAdded(View view) {
|
||||
// Logger.d(TAG, "onViewAdded: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onViewRemoved(View view) {
|
||||
// Logger.d(TAG, "onViewRemoved: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void beforeViewAddAnim(View view) {
|
||||
// Logger.d(TAG, "beforeViewAddAnim: " + view);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void beforeViewRemoveAnim(View view) {
|
||||
// Logger.d(TAG, "beforeViewRemoveAnim: " + view);
|
||||
// }
|
||||
// });
|
||||
});
|
||||
|
||||
findViewById(R.id.btnDebugAddBottomLayerView).setOnClickListener(v -> {
|
||||
|
||||
@@ -43,4 +43,14 @@ public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonCont
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLeftFeatureView(View view) {
|
||||
EntranceViewHolder.getInstance().addLeftFeatureView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLeftFeatureView(View view) {
|
||||
EntranceViewHolder.getInstance().removeLeftFeatureView(view);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -19,6 +20,7 @@ import java.util.List;
|
||||
public class EntranceViewHolder {
|
||||
private static final String TAG = "EntranceViewHolder";
|
||||
private List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
|
||||
private List<View> leftFeaturePreAddView = new ArrayList<>();
|
||||
private EntranceViewHolder(){}
|
||||
private volatile static EntranceViewHolder instance = null;
|
||||
public static EntranceViewHolder getInstance(){
|
||||
@@ -32,11 +34,13 @@ public class EntranceViewHolder {
|
||||
return instance;
|
||||
}
|
||||
private ViewGroup rootViewGroup = null;
|
||||
private ViewGroup featureViewGroup = null;
|
||||
public void initRootViewGroup(View rootView) {
|
||||
Logger.i(TAG, "initRootViewGroup==");
|
||||
if(rootView instanceof ViewGroup) {
|
||||
Logger.d(TAG, "initRootViewGroup 赋值");
|
||||
rootViewGroup = (ViewGroup) rootView.getParent();
|
||||
featureViewGroup = rootView.findViewById(R.id.module_entrance_id_buttons_container);
|
||||
if (!preAddView.isEmpty()) {
|
||||
Logger.d(TAG, "initRootViewGroup 增加底层view: " + preAddView.size());
|
||||
Iterator<BottomLayerViewWrapper> iterator = preAddView.iterator();
|
||||
@@ -46,6 +50,12 @@ public class EntranceViewHolder {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (!leftFeaturePreAddView.isEmpty()) {
|
||||
Logger.d(TAG, "initRootViewGroup 增加左下角FeatureView: " + leftFeaturePreAddView.size());
|
||||
for (View view : leftFeaturePreAddView) {
|
||||
featureViewGroup.addView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +89,16 @@ public class EntranceViewHolder {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean containFeatureView(View view) {
|
||||
int count = featureViewGroup.getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
if(featureViewGroup.getChildAt(i).equals(view)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用的时候需要预先判断rootViewGroup是否为空,本方法默认rootViewGroup不为空
|
||||
*/
|
||||
@@ -107,7 +127,36 @@ public class EntranceViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public void release(){
|
||||
public void addLeftFeatureView(View view) {
|
||||
Logger.d(TAG, "addLeftFeatureView==" + view);
|
||||
if (featureViewGroup == null) {
|
||||
// 先缓存起来,等待时机加载
|
||||
if(!leftFeaturePreAddView.contains(view)) {
|
||||
leftFeaturePreAddView.add(view);
|
||||
}
|
||||
}else{
|
||||
// 直接加载
|
||||
if (!containFeatureView(view)) {
|
||||
featureViewGroup.addView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeLeftFeatureView(View view) {
|
||||
if (featureViewGroup != null) {
|
||||
featureViewGroup.removeView(view);
|
||||
}
|
||||
Iterator<View> iterator = leftFeaturePreAddView.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
View wrapper = iterator.next();
|
||||
if (wrapper.equals(view)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void release(){
|
||||
rootViewGroup = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
>
|
||||
<View
|
||||
android:id="@+id/module_map_id_navi_bg"
|
||||
android:layout_width="match_parent"
|
||||
style="@style/NaviViewStyle"
|
||||
android:layout_height="@dimen/module_ext_navi_info_panel_height"
|
||||
android:background="@drawable/module_ext_dw_navi_info_panel_bkg"
|
||||
android:focusable="true"
|
||||
@@ -14,9 +14,7 @@
|
||||
android:layout_marginLeft="@dimen/module_common_shadow_width_pos"
|
||||
android:layout_marginRight="@dimen/module_common_shadow_width_pos"
|
||||
android:layout_marginTop="@dimen/module_common_shadow_width_pos"
|
||||
app:layout_constraintHorizontal_bias="0.501"
|
||||
app:layout_constraintLeft_toLeftOf="@id/module_entrance_id_top_container"
|
||||
app:layout_constraintRight_toRightOf="@id/module_entrance_id_top_container"
|
||||
app:layout_constraintTop_toTopOf="@id/module_entrance_id_top_motion_layout" />
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
<!--关联别的控件的头部容器-->
|
||||
<com.mogo.module.extensions.navi.TopView
|
||||
android:id="@+id/module_entrance_id_top_container"
|
||||
android:layout_width="match_parent"
|
||||
style="@style/NaviViewStyle"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="NaviViewStyle">
|
||||
<item name="android:layout_width">@dimen/module_ext_navi_width</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -9,4 +9,7 @@
|
||||
<dimen name="module_ext_destination_online_car_paddingLeft">14px</dimen>
|
||||
<dimen name="module_ext_destination_online_car_paddingRight">14px</dimen>
|
||||
<dimen name="module_common_shadow_width_pos">8px</dimen>
|
||||
<dimen name="module_ext_top_view_max_width">1920px</dimen>
|
||||
<dimen name="module_ext_navi_width">-1</dimen>
|
||||
<dimen name="module_ext_bottom_btn_margin_bottom">0px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="NaviViewStyle">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -154,4 +154,8 @@
|
||||
<dimen name="module_ext_destination_online_car_drawablePadding">8px</dimen>
|
||||
<dimen name="module_ext_destination_online_car_paddingLeft">21px</dimen>
|
||||
<dimen name="module_ext_destination_online_car_paddingRight">31px</dimen>
|
||||
<dimen name="module_ext_top_view_max_width">1920px</dimen>
|
||||
|
||||
<dimen name="module_ext_navi_width">-1</dimen>
|
||||
<dimen name="module_ext_bottom_btn_margin_bottom">0px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="NaviViewStyle">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -168,4 +168,6 @@
|
||||
<dimen name="module_ext_seek_help_notice_text_size">34px</dimen>
|
||||
<dimen name="module_ext_seek_help_notice_text_margin_start">20px</dimen>
|
||||
<dimen name="module_ext_seek_help_notice_number_text_size">40px</dimen>
|
||||
<dimen name="module_ext_navi_width">-1</dimen>
|
||||
<dimen name="module_ext_bottom_btn_margin_bottom">0px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="NaviViewStyle">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -111,7 +111,7 @@
|
||||
<dimen name="module_ext_voice_msg_padding_bottom">9px</dimen>
|
||||
<dimen name="module_ext_voice_msg_padding_left">18px</dimen>
|
||||
<dimen name="module_ext_voice_msg_padding_right">18px</dimen>
|
||||
<dimen name="module_ext_voice_msg_icon_margin_left">-1px</dimen>
|
||||
<dimen name="module_ext_voice_msg_icon_margin_left">-1</dimen>
|
||||
|
||||
<dimen name="module_ext_weather_bkg_corner">30px</dimen>
|
||||
<dimen name="module_ext_weather_container_paddingLeft">23px</dimen>
|
||||
@@ -178,4 +178,7 @@
|
||||
<dimen name="module_ext_navi_small_corner">11px</dimen>
|
||||
<dimen name="module_ext_navi_small_margin_bottom">11px</dimen>
|
||||
<dimen name="module_ext_navi_small_margin_right">10px</dimen>
|
||||
|
||||
<dimen name="module_ext_navi_width">-1</dimen>
|
||||
<dimen name="module_ext_bottom_btn_margin_bottom">0px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="NaviViewStyle">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -27,5 +27,8 @@
|
||||
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">8px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingTop">2px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingBottom">2px</dimen>
|
||||
<dimen name="module_ext_top_view_max_width">1920px</dimen>
|
||||
|
||||
<dimen name="module_main_panel_margin_right">0px</dimen>
|
||||
</resources>
|
||||
@@ -27,5 +27,8 @@
|
||||
<dimen name="module_main_entrance_fragment_container_width">1263px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">20px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingTop">20px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingBottom">20px</dimen>
|
||||
<dimen name="module_ext_top_view_max_width">1920px</dimen>
|
||||
|
||||
<dimen name="module_main_panel_margin_right">0px</dimen>
|
||||
</resources>
|
||||
@@ -27,5 +27,7 @@
|
||||
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
|
||||
<dimen name="module_event_fragment_container_padding">8px</dimen>
|
||||
<dimen name="module_main_apps_fragment_container_paddingTop">8px</dimen>
|
||||
|
||||
<dimen name="module_main_apps_fragment_container_paddingBottom">2px</dimen>
|
||||
<dimen name="module_ext_top_view_max_width">1920px</dimen>
|
||||
<dimen name="module_main_panel_margin_right">0px</dimen>
|
||||
</resources>
|
||||
@@ -41,4 +41,16 @@ public interface IMogoEntranceButtonController extends IProvider {
|
||||
* @param view 待移除view
|
||||
*/
|
||||
void removeBottomLayerView(View view);
|
||||
|
||||
/**
|
||||
* 添加左下角功能View,按顺序添加到最底端
|
||||
* @param view 待添加view
|
||||
*/
|
||||
void addLeftFeatureView(View view);
|
||||
|
||||
/**
|
||||
* 移除左下角功能按钮
|
||||
* @param view 待移除view
|
||||
*/
|
||||
void removeLeftFeatureView(View view);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user