Commit a6ebd3d5 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent e2f9aea3
...@@ -12,6 +12,8 @@ import android.view.ViewGroup; ...@@ -12,6 +12,8 @@ import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
import android.view.WindowManager; import android.view.WindowManager;
import com.duben.xixiplaylet.MintsApplication;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -22,13 +24,25 @@ import java.lang.reflect.Method; ...@@ -22,13 +24,25 @@ import java.lang.reflect.Method;
public class UIUtils { public class UIUtils {
public static int getScreenWidth(Context context) { public static int getScreenWidth(Context context) {
try {
DisplayMetrics dm = context.getResources().getDisplayMetrics(); DisplayMetrics dm = context.getResources().getDisplayMetrics();
return dm.widthPixels; return dm.widthPixels;
}catch (Exception e){
DisplayMetrics dm = MintsApplication.getContext().getResources().getDisplayMetrics();
return dm.widthPixels;
}
} }
public static int getScreenHeight(Context context) { public static int getScreenHeight(Context context) {
try {
DisplayMetrics dm = context.getResources().getDisplayMetrics(); DisplayMetrics dm = context.getResources().getDisplayMetrics();
return dm.heightPixels; return dm.heightPixels;
}catch (Exception e){
DisplayMetrics dm = MintsApplication.getContext().getResources().getDisplayMetrics();
return dm.heightPixels;
}
} }
......
...@@ -54,6 +54,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -54,6 +54,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private var orderTagsList: ArrayList<String>? = null private var orderTagsList: ArrayList<String>? = null
private var playIndex = 1 private var playIndex = 1
private var vedioAdPosition=0
override fun getContentViewLayoutID() = R.layout.activity_new_tx_video override fun getContentViewLayoutID() = R.layout.activity_new_tx_video
...@@ -287,6 +288,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -287,6 +288,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
} }
override fun onCustomChildClick(view: View, position: Int) { override fun onCustomChildClick(view: View, position: Int) {
vedioAdPosition=position
when (view.id) { when (view.id) {
R.id.ll_collect -> { R.id.ll_collect -> {
// 无收藏 // 无收藏
...@@ -336,13 +338,13 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -336,13 +338,13 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
} }
override fun adClose(vo: HashMap<String, Any>?) { override fun adClose(vo: HashMap<String, Any>?) {
updateEpisodeData(position, vo) updateEpisodeData(vedioAdPosition, vo)
} }
}) })
} }
override fun adClose(vo: HashMap<String, Any>?) { override fun adClose(vo: HashMap<String, Any>?) {
updateEpisodeData(position, vo) updateEpisodeData(vedioAdPosition, vo)
} }
}) })
} }
......
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