add click
This commit is contained in:
@@ -1,11 +1,10 @@
|
|||||||
package com.mogo.tanlu.fragment;
|
package com.mogo.tanlu.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -27,8 +26,6 @@ import com.mogo.map.search.poisearch.MogoPoiResult;
|
|||||||
import com.mogo.map.uicontroller.EnumMapUI;
|
import com.mogo.map.uicontroller.EnumMapUI;
|
||||||
import com.mogo.service.MogoServicePaths;
|
import com.mogo.service.MogoServicePaths;
|
||||||
import com.mogo.service.imageloader.IMogoImageloader;
|
import com.mogo.service.imageloader.IMogoImageloader;
|
||||||
import com.mogo.service.imageloader.MogoImageView;
|
|
||||||
import com.mogo.service.map.IMogoMapService;
|
|
||||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||||
import com.mogo.tanlu.R;
|
import com.mogo.tanlu.R;
|
||||||
import com.mogo.tanlu.video.FullMediaActivity;
|
import com.mogo.tanlu.video.FullMediaActivity;
|
||||||
@@ -42,7 +39,7 @@ import static com.mogo.tanlu.video.VideoInitKt.initVideo;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lixiaopeng
|
* @author lixiaopeng
|
||||||
* @description
|
* @description 探路卡片
|
||||||
* @since 2020-01-02
|
* @since 2020-01-02
|
||||||
*/
|
*/
|
||||||
public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||||
@@ -51,19 +48,26 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
|||||||
IMogoModuleLifecycle,
|
IMogoModuleLifecycle,
|
||||||
IMogoMapListener,
|
IMogoMapListener,
|
||||||
IMogoPoiSearchListener,
|
IMogoPoiSearchListener,
|
||||||
IMogoLocationListener {
|
IMogoLocationListener,
|
||||||
|
View.OnClickListener {
|
||||||
|
|
||||||
private static final String TAG = "TanluCardViewFragment";
|
private static final String TAG = "liyz";
|
||||||
|
|
||||||
private IMogoMarker mLastClickedMarker;
|
//map
|
||||||
private TanluInfoWindowAdapter mDemoInfoWindowAdapter;
|
private IMogoMarker mPoiMarker;
|
||||||
private int position = -1;
|
private int position = -1;
|
||||||
|
|
||||||
|
//media
|
||||||
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
|
||||||
// private String videoUrl = "http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/ZD801B1942L02537/ZD801B1942L02537_20200103161355/PhotoFront_20200103_161351.JPG?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1578042652%3B1578049852%26q-key-time%3D1578042652%3B1578049852%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Db9530357bc3d80fb13ec54dfaa9a7a1ee86180e2";
|
// private String videoUrl = "";
|
||||||
private String videoUrl = "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8";
|
private String videoUrl = "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8";
|
||||||
|
private String imageUrl = "https://oimagec4.ydstatic.com/image?id=-5397300958976572132&product=adpublish&w=520&h=347";
|
||||||
SimpleCoverVideoPlayer simpleCoverVideoPlayer;
|
SimpleCoverVideoPlayer simpleCoverVideoPlayer;
|
||||||
AutoZoomInImageView autoZoomInImageView;
|
AutoZoomInImageView autoZoomInImageView;
|
||||||
private IMogoImageloader mogoImageloader;
|
private IMogoImageloader mogoImageloader;
|
||||||
|
private TextView mPreviousTv;
|
||||||
|
private TextView mNextTv;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@@ -76,31 +80,32 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
|||||||
position = getArguments().getInt("position");
|
position = getArguments().getInt("position");
|
||||||
simpleCoverVideoPlayer = findViewById(R.id.video_player_main);
|
simpleCoverVideoPlayer = findViewById(R.id.video_player_main);
|
||||||
autoZoomInImageView = findViewById(R.id.tanlu_photo_imageView);
|
autoZoomInImageView = findViewById(R.id.tanlu_photo_imageView);
|
||||||
|
mPreviousTv = findViewById(R.id.tv_previous_res);
|
||||||
|
mNextTv = findViewById(R.id.tv_next_res);
|
||||||
|
mPreviousTv.setOnClickListener(this);
|
||||||
|
mNextTv.setOnClickListener(this);
|
||||||
|
|
||||||
|
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||||
|
autoZoomInImageView.setVisibility(View.GONE);
|
||||||
|
|
||||||
//视频配置
|
//视频配置
|
||||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||||
.build(simpleCoverVideoPlayer);
|
.build(simpleCoverVideoPlayer);
|
||||||
// simpleCoverVideoPlayer.getStartButton().performClick();
|
// simpleCoverVideoPlayer.getStartButton().performClick();
|
||||||
simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() {
|
simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Log.d("liyz", "onClick ---------> ");
|
Logger.d(TAG, "simpleCoverVideoPlayer onClick -------> ");
|
||||||
// Intent intent = new Intent("fullscreen.video.play", Uri.parse("video://666"));
|
|
||||||
// getActivity().startActivity(intent);
|
|
||||||
|
|
||||||
FullMediaActivity.Companion.launch(getActivity(), videoUrl, "image");
|
FullMediaActivity.Companion.launch(getActivity(), videoUrl, "image");
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//图片显示
|
//图片配置
|
||||||
mogoImageloader = (IMogoImageloader) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_IMAGE_LOADER ).navigation();
|
mogoImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation();
|
||||||
mogoImageloader.displayImage("https://oimagec4.ydstatic.com/image?id=-5397300958976572132&product=adpublish&w=520&h=347", autoZoomInImageView);
|
|
||||||
|
|
||||||
//当前定位信息
|
//当前定位信息
|
||||||
TanluServiceHandler.getPoiSearch().setPoiSearchListener(this);
|
TanluServiceHandler.getPoiSearch().setPoiSearchListener(this);
|
||||||
// mLocation = TanluServiceHandler.getLocationClient().getLastKnowLocation();
|
// mLocation = TanluServiceHandler.getLocationClient().getLastKnowLocation();
|
||||||
mDemoInfoWindowAdapter = new TanluInfoWindowAdapter(getContext(), TanluServiceHandler.getNavi(), TanluServiceHandler.getImageloader());
|
|
||||||
|
|
||||||
TanluServiceHandler.getLocationClient().addLocationListener(new IMogoLocationListener() {
|
TanluServiceHandler.getLocationClient().addLocationListener(new IMogoLocationListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -117,8 +122,35 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
|||||||
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
|
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
int id = view.getId();
|
||||||
|
if (id == R.id.tv_previous_res) { //上一个
|
||||||
|
//判断是图片还是视频,第一个时,上一个不可点击
|
||||||
|
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||||
|
autoZoomInImageView.setVisibility(View.GONE);
|
||||||
|
//视频配置
|
||||||
|
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||||
|
.build(simpleCoverVideoPlayer);
|
||||||
|
|
||||||
|
} else if (id == R.id.tv_next_res) { //下一个
|
||||||
|
//判断是图片还是视频,最后一个时,下一个不可点击
|
||||||
|
//图片显示
|
||||||
|
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||||
|
simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||||
|
mogoImageloader.displayImage(imageUrl, autoZoomInImageView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* marker点击事件 TODO
|
* marker点击事件 TODO
|
||||||
|
*
|
||||||
* @param marker
|
* @param marker
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -136,7 +168,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO C位事件
|
//TODO C位事件,如何获取数据,需要有默认数据
|
||||||
@Override
|
@Override
|
||||||
public void onPerform() {
|
public void onPerform() {
|
||||||
Logger.d(TAG, "卡片2有效");
|
Logger.d(TAG, "卡片2有效");
|
||||||
@@ -177,40 +209,24 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMogoMarker mPoiMarker;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPoiItemSearched(MogoPoiItem item, int errorCode) {
|
public void onPoiItemSearched(MogoPoiItem item, int errorCode) {
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (mPoiMarker != null) {
|
|
||||||
// mPoiMarker.destroy();
|
|
||||||
// }
|
|
||||||
// mPoiMarker = TanluServiceHandler.getMarkerManager().addMarker(TanluConstants.TAG, new MogoMarkerOptions()
|
|
||||||
// .longitude(item.getPoint().lng)
|
|
||||||
// .latitude(item.getPoint().lat)
|
|
||||||
// .icon(mMarkerIcon));
|
|
||||||
// if (mPoiMarker != null) {
|
|
||||||
// mPoiMarker.setInfoWindowAdapter(mDemoInfoWindowAdapter);
|
|
||||||
// mPoiMarker.setObject(item);
|
|
||||||
// mPoiMarker.showInfoWindow();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLocationChanged(MogoLocation location) {
|
public void onLocationChanged(MogoLocation location) {
|
||||||
// mLocation = location;
|
// if (location.getErrCode() == 0) {
|
||||||
// Logger.i(TAG, "接受到的地图模块定位信息");
|
// Logger.d(TAG, "onLocationChanged 当前位置 -->" + location.getAddress());
|
||||||
// if (mLocInfo != null) {
|
// } else {
|
||||||
// if (location.getErrCode() == 0) {
|
// Logger.d(TAG, "onLocationChanged 定位失败 -->" + location.getErrInfo());
|
||||||
// mLocInfo.setText("当前位置:" + location.getAddress());
|
|
||||||
// } else {
|
|
||||||
// mLocInfo.setText(location.getErrInfo());
|
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMapClick(MogoLatLng latLng) {
|
public void onMapClick(MogoLatLng latLng) {
|
||||||
|
|
||||||
@@ -227,7 +243,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
public void onMapChanged(MogoLatLng location, float zoom, float tilt, float bearing) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,10 +253,10 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
|||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
getViewLifecycleOwner().getLifecycle().removeObserver(mPresenter);
|
getViewLifecycleOwner().getLifecycle().removeObserver(mPresenter);
|
||||||
TanluServiceHandler.getLocationClient().removeLocationListener(this);
|
TanluServiceHandler.getLocationClient().removeLocationListener(this);
|
||||||
if (mLastClickedMarker != null) {
|
|
||||||
mLastClickedMarker.destroy();
|
|
||||||
mLastClickedMarker = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ package com.mogo.tanlu.video
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.mogo.tanlu.R
|
import com.mogo.tanlu.R
|
||||||
import com.mogo.tanlu.constant.REQUESTCODE_MAINACTIVITY
|
|
||||||
import com.mogo.tanlu.model.Informations
|
import com.mogo.tanlu.model.Informations
|
||||||
import com.mogo.tanlu.model.global.GlobalSharedInformation
|
|
||||||
import com.mogo.tanlu.util.HideControl
|
import com.mogo.tanlu.util.HideControl
|
||||||
import com.mogo.tanlu.util.isDoubleClickTime
|
import com.mogo.utils.logger.Logger
|
||||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||||
import kotlinx.android.synthetic.main.tanlu_activity_media_full.*
|
import kotlinx.android.synthetic.main.tanlu_activity_media_full.*
|
||||||
@@ -53,7 +50,6 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
|||||||
private var currentImgPosition: Int = 0
|
private var currentImgPosition: Int = 0
|
||||||
private var currentPosition: Int = 50
|
private var currentPosition: Int = 50
|
||||||
private var control = HideControl()
|
private var control = HideControl()
|
||||||
|
|
||||||
private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||||
private var videoUrl: String? = null
|
private var videoUrl: String? = null
|
||||||
private var thumbUrl: String? = null
|
private var thumbUrl: String? = null
|
||||||
@@ -73,13 +69,7 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
|||||||
videoUrl = intent.getStringExtra(PARAM_VIDEO_URL)
|
videoUrl = intent.getStringExtra(PARAM_VIDEO_URL)
|
||||||
thumbUrl = intent.getStringExtra(PARAM_THUMB_URL)
|
thumbUrl = intent.getStringExtra(PARAM_THUMB_URL)
|
||||||
|
|
||||||
Log.e("liyz", "videoUrl = $videoUrl --->thumbUrl = $thumbUrl")
|
Logger.e("liyz", "videoUrl = $videoUrl --->thumbUrl = $thumbUrl")
|
||||||
// currentPosition += strategyInfo.size * 10000
|
|
||||||
// if (strategyInfo.size == 1) {
|
|
||||||
// group_media_page_up.visibility = View.GONE
|
|
||||||
// group_media_page_up.updatePreLayout(cl_media)
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@@ -121,9 +111,10 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
|||||||
video_view.startButton.performClick()
|
video_view.startButton.performClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun updateInformation() {
|
private fun updateInformation() {
|
||||||
// tv_media_title_content.text = strategyInfo!![currentImgPosition].addr
|
tv_media_title_content.text = "北京市"
|
||||||
// tv_media_title_time.text = formatDate(strategyInfo!![currentImgPosition].generateTime)
|
tv_media_title_time.text = "2020-1-6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -145,7 +136,7 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleBack() {
|
private fun handleBack() {
|
||||||
Log.d("liyz", "handleBack ------> finish ")
|
Logger.d("liyz", "handleBack ------> finish ")
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:longClickable="true" />
|
android:longClickable="true" />
|
||||||
|
|
||||||
|
|
||||||
<!--顶部区域-->
|
<!--顶部区域-->
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/constraintLayout_media"
|
android:id="@+id/constraintLayout_media"
|
||||||
@@ -26,8 +27,8 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_media_back"
|
android:id="@+id/iv_media_back"
|
||||||
android:layout_width="70dp"
|
android:layout_width="45dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="45dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginTop="18dp"
|
android:layout_marginTop="18dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
@@ -39,7 +40,7 @@
|
|||||||
android:id="@+id/tv_media_title_content"
|
android:id="@+id/tv_media_title_content"
|
||||||
android:layout_width="560dp"
|
android:layout_width="560dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="18dp"
|
android:layout_marginTop="28dp"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxWidth="560dp"
|
android:maxWidth="560dp"
|
||||||
@@ -53,12 +54,12 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_media_title_time"
|
android:id="@+id/tv_media_title_time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="19dp"
|
android:layout_height="21dp"
|
||||||
android:layout_marginTop="58dp"
|
android:layout_marginTop="28dp"
|
||||||
android:layout_marginRight="50dp"
|
android:layout_marginRight="50dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="17dp"
|
android:textSize="18dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user