|
|
|
|
@ -70,6 +70,12 @@ import java.util.concurrent.Executors; |
|
|
|
|
|
|
|
|
|
import me.jessyan.autosize.utils.AutoSizeUtils; |
|
|
|
|
|
|
|
|
|
import android.graphics.Paint; |
|
|
|
|
import android.text.TextPaint; |
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
|
import android.graphics.Typeface; |
|
|
|
|
import androidx.recyclerview.widget.RecyclerView; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author pj567 |
|
|
|
|
* @date :2020/12/22 |
|
|
|
|
@ -110,6 +116,7 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
private View seriesFlagFocus = null; |
|
|
|
|
private boolean isReverse; |
|
|
|
|
private String preFlag=""; |
|
|
|
|
private V7GridLayoutManager mGridViewLayoutMgr = null; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected int getLayoutResID() { |
|
|
|
|
@ -148,7 +155,10 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
mEmptyPlayList = findViewById(R.id.mEmptyPlaylist); |
|
|
|
|
mGridView = findViewById(R.id.mGridView); |
|
|
|
|
mGridView.setHasFixedSize(true); |
|
|
|
|
mGridView.setLayoutManager(new V7GridLayoutManager(this.mContext, isBaseOnWidth() ? 6 : 7)); |
|
|
|
|
mGridView.setHasFixedSize(false); |
|
|
|
|
this.mGridViewLayoutMgr = new V7GridLayoutManager(this.mContext, isBaseOnWidth() ? 6 : 7); |
|
|
|
|
mGridView.setLayoutManager(this.mGridViewLayoutMgr); |
|
|
|
|
// mGridView.setLayoutManager(new V7GridLayoutManager(this.mContext, isBaseOnWidth() ? 6 : 7));
|
|
|
|
|
seriesAdapter = new SeriesAdapter(); |
|
|
|
|
mGridView.setAdapter(seriesAdapter); |
|
|
|
|
mGridViewFlag = findViewById(R.id.mGridViewFlag); |
|
|
|
|
@ -382,6 +392,26 @@ public class DetailActivity extends BaseActivity { |
|
|
|
|
if(canSelect)vodInfo.seriesMap.get(vodInfo.playFlag).get(vodInfo.playIndex).selected = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Paint pFont = new Paint(); |
|
|
|
|
// pFont.setTypeface(Typeface.DEFAULT );
|
|
|
|
|
Rect rect = new Rect(); |
|
|
|
|
|
|
|
|
|
List<VodInfo.VodSeries> list = vodInfo.seriesMap.get(vodInfo.playFlag); |
|
|
|
|
int w = 1; |
|
|
|
|
for(int i =0; i < list.size(); ++i){ |
|
|
|
|
String name = list.get(i).name; |
|
|
|
|
pFont.getTextBounds(name, 0, name.length(), rect); |
|
|
|
|
if(w < rect.width()){ |
|
|
|
|
w = rect.width(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
w += 32; |
|
|
|
|
int screenWidth = getWindowManager().getDefaultDisplay().getWidth()/3; |
|
|
|
|
int offset = screenWidth/w; |
|
|
|
|
if(offset <=1) offset =1; |
|
|
|
|
if(offset > 6) offset =6; |
|
|
|
|
this.mGridViewLayoutMgr.setSpanCount(offset); |
|
|
|
|
|
|
|
|
|
seriesAdapter.setNewData(vodInfo.seriesMap.get(vodInfo.playFlag)); |
|
|
|
|
mGridView.postDelayed(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
|