From 25d0fbb1ebc5413984cc62b9b93b74ed340e7efb Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 3 Feb 2020 21:35:11 +0800 Subject: [PATCH] opt code --- .../tanlu/fragment/TanluCardViewFragment.java | 73 ++++++++----------- 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java index e4e82a6f85..9313ea55e5 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java @@ -198,13 +198,13 @@ public class TanluCardViewFragment extends MvpFragment> autoZoomInImageView.setVisibility(View.GONE); //视频点击 - simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - Logger.d(TAG, "simpleCoverVideoPlayer onClick -------> "); - FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, mImageUrl, mTitle, mGenerateTime); - } - }); +// simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View view) { +// Logger.d(TAG, "simpleCoverVideoPlayer onClick -------> "); +// FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, mImageUrl, mTitle, mGenerateTime); +// } +// }); } @@ -283,7 +283,7 @@ public class TanluCardViewFragment extends MvpFragment> Logger.e(TAG, "poi == null"); } } else { - Logger.e(TAG, "poi search result code = $p1"); + Logger.e(TAG, "poi search result p1 = " + p1); } } @@ -338,7 +338,7 @@ public class TanluCardViewFragment extends MvpFragment> @Override public void onStartNavi() { //开始导航 - Log.d(TAG, "onStartNavi -------> "); + Logger.d(TAG, "onStartNavi -------> "); initModelData(); getNavigationData(); } @@ -401,19 +401,6 @@ public class TanluCardViewFragment extends MvpFragment> } - private void handleMarkerExploreWay(MarkerExploreWay markerExploreWay) { - if (markerExploreWay != null) { - Log.d(TAG, "markerExploreWay.getFileType() =" + markerExploreWay.getFileType()); - if (markerExploreWay.getFileType() == 0) { //图片 - refreshPhotoData(markerExploreWay); - } else if (markerExploreWay.getFileType() == 1) { //视频 - handleData(markerExploreWay); - } - } else { - Log.e(TAG, "handleMarkerExploreWay == null"); - } - } - /** * 处理关键词搜索 * @@ -581,7 +568,7 @@ public class TanluCardViewFragment extends MvpFragment> currentPosition--; Log.d(TAG, " tv_previous_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) { - handleData(markerExploreWayList.get(currentPosition)); + handleMarkerExploreWay(markerExploreWayList.get(currentPosition)); moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon()); } } else if (id == R.id.tv_next_res) { //下一个 @@ -593,7 +580,7 @@ public class TanluCardViewFragment extends MvpFragment> currentPosition++; Log.d(TAG, " tv_next_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size()); if (markerExploreWayList.size() > currentPosition) { - handleData(markerExploreWayList.get(currentPosition)); + handleMarkerExploreWay(markerExploreWayList.get(currentPosition)); moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon()); } @@ -608,7 +595,6 @@ public class TanluCardViewFragment extends MvpFragment> mMApUIController.moveToCenter(latLng); } - /** * 执行图片动画 */ @@ -638,17 +624,18 @@ public class TanluCardViewFragment extends MvpFragment> /** * 通用的处理数据逻辑 * - * @param exploreWay + * @param markerExploreWay */ - private void handleData(MarkerExploreWay exploreWay) { - if (exploreWay != null) { - if (exploreWay.getFileType() == 0) { //图片 - refreshPhotoData(exploreWay); - } else if (exploreWay.getFileType() == 1) { //视频 - refreshVideoData(exploreWay); + private void handleMarkerExploreWay(MarkerExploreWay markerExploreWay) { + if (markerExploreWay != null) { + Log.d(TAG, "markerExploreWay.getFileType() =" + markerExploreWay.getFileType()); + if (markerExploreWay.getFileType() == 0) { //图片 + refreshPhotoData(markerExploreWay); + } else if (markerExploreWay.getFileType() == 1) { //视频 + refreshVideoData(markerExploreWay); } } else { - Logger.e(TAG, "handleData exploreWay == null "); + Log.e(TAG, "handleMarkerExploreWay == null"); } } @@ -669,18 +656,23 @@ public class TanluCardViewFragment extends MvpFragment> mGenerateTime = markerExploreWay.getGenerateTime(); mTitle = markerExploreWay.getAddr(); mAddressTv.setText(markerExploreWay.getAddr()); + Log.d(TAG, "refreshVideoData addr = " + markerExploreWay.getAddr()); mDistanceTv.setText(handleDistance(markerExploreWay.getDistance())); mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime())); //判断是图片还是视频,第一个时,上一个不可点击 + autoZoomInImageView.setVisibility(View.GONE); simpleCoverVideoPlayer.setVisibility(View.VISIBLE); //视频配置 mVideoUrl = videoUrl; + Log.d(TAG, "refreshVideoData mVideoUrl = " + mVideoUrl); simpleCoverVideoPlayer.loadCoverImage(mImageUrl, getContext()); gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG) .build(simpleCoverVideoPlayer); + simpleCoverVideoPlayer.getStartButton().performClick(); if (mImageUrl == null) { return; } + } /** @@ -700,8 +692,8 @@ public class TanluCardViewFragment extends MvpFragment> mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime())); String thumbnailUrl = markerExploreWay.getItems().get(0).getUrl(); Logger.d(TAG, "refreshPhoto thumbnailUrl ------>" + thumbnailUrl); - autoZoomInImageView.setVisibility(View.VISIBLE); simpleCoverVideoPlayer.setVisibility(View.GONE); + autoZoomInImageView.setVisibility(View.VISIBLE); mogoImageloader.downloadImage(getActivity(), thumbnailUrl, new IMogoImageLoaderListener() { @Override public void onStart() { @@ -731,14 +723,13 @@ public class TanluCardViewFragment extends MvpFragment> } /** - * C位事件,如何获取数据,需要有默认数据 + * C位事件,如何获取数据,需要有默认数据 TODO * 如果只有一个数据,不显示上下切换按钮,没有数据显示空页面 */ @Override public void onPerform() { //免唤醒 AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.PLAY_VIDEO, TanluConstants.CMD_PLAY_ROAD_CONDITION, mogoVoiceListener); - isCurrentPage = true; Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->"); mMarkerManager = mMogoMapService.getMarkerManager(getActivity()); @@ -756,7 +747,7 @@ public class TanluCardViewFragment extends MvpFragment> markerExploreWayList.add(exploreWay); } - Log.e("TAG", "tanlu卡片 onPerform 有效 markerExploreWayList.size() =" + markerExploreWayList.size()); + Log.d("TAG", "tanlu卡片 onPerform 有效 markerExploreWayList.size() =" + markerExploreWayList.size()); if (markers.size() == 1) { mPreviousTv.setVisibility(View.GONE); mNextTv.setVisibility(View.GONE); @@ -767,13 +758,7 @@ public class TanluCardViewFragment extends MvpFragment> //展示第一个数据 MarkerExploreWay markerExploreWay = markerExploreWayList.get(0); - if (markerExploreWay != null) { - if (markerExploreWay.getFileType() == 0) { //图片 - refreshPhotoData(markerExploreWay); - } else if (markerExploreWay.getFileType() == 1) { //视频 - refreshVideoData(markerExploreWay); - } - } + handleMarkerExploreWay(markerExploreWay); } else { mEmptyLayout.setVisibility(View.VISIBLE); mRootLayout.setVisibility(View.GONE);