parent
3f56ec44c1
commit
18c2b25cfd
@ -1,58 +0,0 @@ |
||||
package com.github.tvbox.osc.bean; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
public class ChannelGroup { |
||||
/** |
||||
* num : 1 |
||||
* name : 央视频道 |
||||
* password : 频道密码 |
||||
*/ |
||||
private int groupNum; |
||||
private String groupName; |
||||
private String groupPassword; |
||||
private ArrayList<LiveChannel> liveChannels; |
||||
private boolean isSelected = false; |
||||
private boolean isFocused = false; |
||||
|
||||
|
||||
public int getGroupNum() { |
||||
return groupNum; |
||||
} |
||||
|
||||
public void setGroupNum(int groupNum) { |
||||
this.groupNum = groupNum; |
||||
} |
||||
|
||||
public String getGroupName() { |
||||
return groupName; |
||||
} |
||||
|
||||
public void setGroupName(String groupName) { |
||||
this.groupName = groupName; |
||||
} |
||||
|
||||
public ArrayList<LiveChannel> getLiveChannels() { |
||||
return liveChannels; |
||||
} |
||||
|
||||
public void setLiveChannels(ArrayList<LiveChannel> liveChannels) { |
||||
this.liveChannels = liveChannels; |
||||
} |
||||
|
||||
public boolean isSelected() { |
||||
return isSelected; |
||||
} |
||||
|
||||
public void setSelected(boolean selected) { |
||||
isSelected = selected; |
||||
} |
||||
|
||||
public boolean isFocused() { |
||||
return isFocused; |
||||
} |
||||
|
||||
public void setFocused(boolean focused) { |
||||
isFocused = focused; |
||||
} |
||||
} |
||||
@ -0,0 +1,39 @@ |
||||
package com.github.tvbox.osc.bean; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
public class LiveChannelGroup { |
||||
/** |
||||
* groupIndex : 分组索引号 |
||||
* groupName : 分组名称 |
||||
* password : 分组密码 |
||||
*/ |
||||
private int groupIndex; |
||||
private String groupName; |
||||
private String groupPassword; |
||||
private ArrayList<LiveChannelItem> liveChannelItems; |
||||
|
||||
public int getGroupIndex() { |
||||
return groupIndex; |
||||
} |
||||
|
||||
public void setGroupIndex(int groupIndex) { |
||||
this.groupIndex = groupIndex; |
||||
} |
||||
|
||||
public String getGroupName() { |
||||
return groupName; |
||||
} |
||||
|
||||
public void setGroupName(String groupName) { |
||||
this.groupName = groupName; |
||||
} |
||||
|
||||
public ArrayList<LiveChannelItem> getLiveChannels() { |
||||
return liveChannelItems; |
||||
} |
||||
|
||||
public void setLiveChannels(ArrayList<LiveChannelItem> liveChannelItems) { |
||||
this.liveChannelItems = liveChannelItems; |
||||
} |
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
package com.github.tvbox.osc.bean; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
public class LiveSettingGroup { |
||||
private int groupIndex; |
||||
private String groupName; |
||||
private ArrayList<LiveSettingItem> liveSettingItems; |
||||
|
||||
public int getGroupIndex() { |
||||
return groupIndex; |
||||
} |
||||
|
||||
public void setGroupIndex(int groupIndex) { |
||||
this.groupIndex = groupIndex; |
||||
} |
||||
|
||||
public String getGroupName() { |
||||
return groupName; |
||||
} |
||||
|
||||
public void setGroupName(String groupName) { |
||||
this.groupName = groupName; |
||||
} |
||||
|
||||
public ArrayList<LiveSettingItem> getLiveSettingItems() { |
||||
return liveSettingItems; |
||||
} |
||||
|
||||
public void setLiveSettingItems(ArrayList<LiveSettingItem> liveSettingItems) { |
||||
this.liveSettingItems = liveSettingItems; |
||||
} |
||||
} |
||||
@ -0,0 +1,36 @@ |
||||
package com.github.tvbox.osc.bean; |
||||
|
||||
/** |
||||
* @author pj567 |
||||
* @date :2021/1/12 |
||||
* @description: |
||||
*/ |
||||
public class LiveSettingItem { |
||||
private int itemIndex; |
||||
private String itemName; |
||||
private boolean itemSelected = false; |
||||
|
||||
public int getItemIndex() { |
||||
return itemIndex; |
||||
} |
||||
|
||||
public void setItemIndex(int itemIndex) { |
||||
this.itemIndex = itemIndex; |
||||
} |
||||
|
||||
public String getItemName() { |
||||
return itemName; |
||||
} |
||||
|
||||
public void setItemName(String itemName) { |
||||
this.itemName = itemName; |
||||
} |
||||
|
||||
public boolean isItemSelected() { |
||||
return itemSelected; |
||||
} |
||||
|
||||
public void setItemSelected(boolean itemSelected) { |
||||
this.itemSelected = itemSelected; |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -1,34 +0,0 @@ |
||||
package com.github.tvbox.osc.ui.adapter; |
||||
|
||||
import android.graphics.Color; |
||||
import android.widget.TextView; |
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter; |
||||
import com.chad.library.adapter.base.BaseViewHolder; |
||||
import com.github.tvbox.osc.R; |
||||
import com.github.tvbox.osc.bean.ChannelGroup; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
|
||||
/** |
||||
* @author pj567 |
||||
* @date :2021/1/12 |
||||
* @description: |
||||
*/ |
||||
public class ChannelGroupAdapter extends BaseQuickAdapter<ChannelGroup, BaseViewHolder> { |
||||
public ChannelGroupAdapter() { |
||||
super(R.layout.item_channel_group, new ArrayList<>()); |
||||
} |
||||
|
||||
@Override |
||||
protected void convert(BaseViewHolder holder, ChannelGroup item) { |
||||
TextView tvGroupName = holder.getView(R.id.tvGroupName); |
||||
tvGroupName.setText(item.getGroupName()); |
||||
if (item.isSelected() && !item.isFocused()) { |
||||
tvGroupName.setTextColor(mContext.getResources().getColor(R.color.color_1890FF)); |
||||
} else { |
||||
tvGroupName.setTextColor(Color.WHITE); |
||||
} |
||||
} |
||||
} |
||||
@ -1,38 +0,0 @@ |
||||
package com.github.tvbox.osc.ui.adapter; |
||||
|
||||
import android.graphics.Color; |
||||
import android.widget.TextView; |
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter; |
||||
import com.chad.library.adapter.base.BaseViewHolder; |
||||
import com.github.tvbox.osc.R; |
||||
import com.github.tvbox.osc.bean.LiveChannel; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
/** |
||||
* @author pj567 |
||||
* @date :2021/1/12 |
||||
* @description: |
||||
*/ |
||||
public class LiveChannelAdapter extends BaseQuickAdapter<LiveChannel, BaseViewHolder> { |
||||
public LiveChannelAdapter() { |
||||
super(R.layout.item_live_channel, new ArrayList<>()); |
||||
} |
||||
|
||||
@Override |
||||
protected void convert(BaseViewHolder helper, LiveChannel item) { |
||||
TextView tvChannelNum = helper.getView(R.id.tvChannelNum); |
||||
TextView tvChannel = helper.getView(R.id.tvChannel); |
||||
tvChannelNum.setText(String.format("%s", item.getChannelNum())); |
||||
tvChannel.setText(item.getChannelName()); |
||||
if (item.isSelected() && !item.isFocused()) { |
||||
tvChannelNum.setTextColor(mContext.getResources().getColor(R.color.color_1890FF)); |
||||
tvChannel.setTextColor(mContext.getResources().getColor(R.color.color_1890FF)); |
||||
} |
||||
else{ |
||||
tvChannelNum.setTextColor(Color.WHITE); |
||||
tvChannel.setTextColor(Color.WHITE); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,55 @@ |
||||
package com.github.tvbox.osc.ui.adapter; |
||||
|
||||
import android.graphics.Color; |
||||
import android.widget.TextView; |
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter; |
||||
import com.chad.library.adapter.base.BaseViewHolder; |
||||
import com.github.tvbox.osc.R; |
||||
import com.github.tvbox.osc.bean.LiveChannelGroup; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
|
||||
/** |
||||
* @author pj567 |
||||
* @date :2021/1/12 |
||||
* @description: |
||||
*/ |
||||
public class LiveChannelGroupAdapter extends BaseQuickAdapter<LiveChannelGroup, BaseViewHolder> { |
||||
private int selectedGroupIndex = -1; |
||||
private int focusedGroupIndex = -1; |
||||
|
||||
public LiveChannelGroupAdapter() { |
||||
super(R.layout.item_live_channel_group, new ArrayList<>()); |
||||
} |
||||
|
||||
@Override |
||||
protected void convert(BaseViewHolder holder, LiveChannelGroup item) { |
||||
TextView tvGroupName = holder.getView(R.id.tvChannelGroupName); |
||||
tvGroupName.setText(item.getGroupName()); |
||||
int groupIndex = item.getGroupIndex(); |
||||
if (groupIndex == selectedGroupIndex && groupIndex != focusedGroupIndex) { |
||||
tvGroupName.setTextColor(mContext.getResources().getColor(R.color.color_1890FF)); |
||||
} else { |
||||
tvGroupName.setTextColor(Color.WHITE); |
||||
} |
||||
} |
||||
|
||||
public void setSelectedGroupIndex(int selectedGroupIndex) { |
||||
int preSelectedGroupIndex = this.selectedGroupIndex; |
||||
this.selectedGroupIndex = selectedGroupIndex; |
||||
if (preSelectedGroupIndex != -1) |
||||
notifyItemChanged(preSelectedGroupIndex); |
||||
if (this.selectedGroupIndex != -1) |
||||
notifyItemChanged(this.selectedGroupIndex); |
||||
} |
||||
|
||||
public void setFocusedGroupIndex(int focusedGroupIndex) { |
||||
this.focusedGroupIndex = focusedGroupIndex; |
||||
if (this.focusedGroupIndex != -1) |
||||
notifyItemChanged(this.focusedGroupIndex); |
||||
else if (this.selectedGroupIndex != -1) |
||||
notifyItemChanged(this.selectedGroupIndex); |
||||
} |
||||
} |
||||
@ -0,0 +1,62 @@ |
||||
package com.github.tvbox.osc.ui.adapter; |
||||
|
||||
import android.graphics.Color; |
||||
import android.widget.TextView; |
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter; |
||||
import com.chad.library.adapter.base.BaseViewHolder; |
||||
import com.github.tvbox.osc.R; |
||||
import com.github.tvbox.osc.bean.LiveChannelItem; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
/** |
||||
* @author pj567 |
||||
* @date :2021/1/12 |
||||
* @description: |
||||
*/ |
||||
public class LiveChannelItemAdapter extends BaseQuickAdapter<LiveChannelItem, BaseViewHolder> { |
||||
private int selectedChannelIndex = -1; |
||||
private int focusedChannelIndex = -1; |
||||
|
||||
public LiveChannelItemAdapter() { |
||||
super(R.layout.item_live_channel, new ArrayList<>()); |
||||
} |
||||
|
||||
@Override |
||||
protected void convert(BaseViewHolder holder, LiveChannelItem item) { |
||||
TextView tvChannelNum = holder.getView(R.id.tvChannelNum); |
||||
TextView tvChannel = holder.getView(R.id.tvChannelName); |
||||
tvChannelNum.setText(String.format("%s", item.getChannelNum())); |
||||
tvChannel.setText(item.getChannelName()); |
||||
int channelIndex = item.getChannelIndex(); |
||||
if (channelIndex == selectedChannelIndex && channelIndex != focusedChannelIndex) { |
||||
tvChannelNum.setTextColor(mContext.getResources().getColor(R.color.color_1890FF)); |
||||
tvChannel.setTextColor(mContext.getResources().getColor(R.color.color_1890FF)); |
||||
} |
||||
else{ |
||||
tvChannelNum.setTextColor(Color.WHITE); |
||||
tvChannel.setTextColor(Color.WHITE); |
||||
} |
||||
} |
||||
|
||||
public void setSelectedChannelIndex(int selectedChannelIndex) { |
||||
int preSelectedChannelIndex = this.selectedChannelIndex; |
||||
this.selectedChannelIndex = selectedChannelIndex; |
||||
if (preSelectedChannelIndex != -1) |
||||
notifyItemChanged(preSelectedChannelIndex); |
||||
if (this.selectedChannelIndex != -1) |
||||
notifyItemChanged(this.selectedChannelIndex); |
||||
} |
||||
|
||||
public void setFocusedChannelIndex(int focusedChannelIndex) { |
||||
int preFocusedChannelIndex = this.focusedChannelIndex; |
||||
this.focusedChannelIndex = focusedChannelIndex; |
||||
if (preFocusedChannelIndex != -1) |
||||
notifyItemChanged(preFocusedChannelIndex); |
||||
if (this.focusedChannelIndex != -1) |
||||
notifyItemChanged(this.focusedChannelIndex); |
||||
else if (this.selectedChannelIndex != -1) |
||||
notifyItemChanged(this.selectedChannelIndex); |
||||
} |
||||
} |
||||
@ -0,0 +1,59 @@ |
||||
package com.github.tvbox.osc.ui.adapter; |
||||
|
||||
import android.graphics.Color; |
||||
import android.widget.TextView; |
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter; |
||||
import com.chad.library.adapter.base.BaseViewHolder; |
||||
import com.github.tvbox.osc.R; |
||||
import com.github.tvbox.osc.bean.LiveSettingGroup; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
|
||||
/** |
||||
* @author pj567 |
||||
* @date :2021/1/12 |
||||
* @description: |
||||
*/ |
||||
public class LiveSettingGroupAdapter extends BaseQuickAdapter<LiveSettingGroup, BaseViewHolder> { |
||||
private int selectedGroupIndex = -1; |
||||
private int focusedGroupIndex = -1; |
||||
|
||||
public LiveSettingGroupAdapter() { |
||||
super(R.layout.item_live_setting_group, new ArrayList<>()); |
||||
} |
||||
|
||||
@Override |
||||
protected void convert(BaseViewHolder holder, LiveSettingGroup group) { |
||||
TextView tvGroupName = holder.getView(R.id.tvSettingGroupName); |
||||
tvGroupName.setText(group.getGroupName()); |
||||
int groupIndex = group.getGroupIndex(); |
||||
if (groupIndex == selectedGroupIndex && groupIndex != focusedGroupIndex) { |
||||
tvGroupName.setTextColor(mContext.getResources().getColor(R.color.color_1890FF)); |
||||
} else { |
||||
tvGroupName.setTextColor(Color.WHITE); |
||||
} |
||||
} |
||||
|
||||
public void setSelectedGroupIndex(int selectedGroupIndex) { |
||||
int preSelectedGroupIndex = this.selectedGroupIndex; |
||||
this.selectedGroupIndex = selectedGroupIndex; |
||||
if (preSelectedGroupIndex != -1) |
||||
notifyItemChanged(preSelectedGroupIndex); |
||||
if (this.selectedGroupIndex != -1) |
||||
notifyItemChanged(this.selectedGroupIndex); |
||||
} |
||||
|
||||
public int getSelectedGroupIndex() { |
||||
return selectedGroupIndex; |
||||
} |
||||
|
||||
public void setFocusedGroupIndex(int focusedGroupIndex) { |
||||
this.focusedGroupIndex = focusedGroupIndex; |
||||
if (this.focusedGroupIndex != -1) |
||||
notifyItemChanged(this.focusedGroupIndex); |
||||
else if (this.selectedGroupIndex != -1) |
||||
notifyItemChanged(this.selectedGroupIndex); |
||||
} |
||||
} |
||||
@ -0,0 +1,70 @@ |
||||
package com.github.tvbox.osc.ui.adapter; |
||||
|
||||
import android.graphics.Color; |
||||
import android.widget.TextView; |
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter; |
||||
import com.chad.library.adapter.base.BaseViewHolder; |
||||
import com.github.tvbox.osc.R; |
||||
import com.github.tvbox.osc.bean.LiveSettingItem; |
||||
|
||||
import java.util.ArrayList; |
||||
|
||||
|
||||
/** |
||||
* @author pj567 |
||||
* @date :2021/1/12 |
||||
* @description: |
||||
*/ |
||||
public class LiveSettingItemAdapter extends BaseQuickAdapter<LiveSettingItem, BaseViewHolder> { |
||||
private int focusedItemIndex = -1; |
||||
|
||||
public LiveSettingItemAdapter() { |
||||
super(R.layout.item_live_setting, new ArrayList<>()); |
||||
} |
||||
|
||||
@Override |
||||
protected void convert(BaseViewHolder holder, LiveSettingItem item) { |
||||
TextView tvItemName = holder.getView(R.id.tvSettingItemName); |
||||
tvItemName.setText(item.getItemName()); |
||||
int itemIndex = item.getItemIndex(); |
||||
if (item.isItemSelected() && itemIndex != focusedItemIndex) { |
||||
tvItemName.setTextColor(mContext.getResources().getColor(R.color.color_1890FF)); |
||||
} else { |
||||
tvItemName.setTextColor(Color.WHITE); |
||||
} |
||||
} |
||||
|
||||
public void selectItem(int selectedItemIndex, boolean select, boolean unselectPreItemIndex) { |
||||
if (unselectPreItemIndex) { |
||||
int preSelectedItemIndex = getSelectedItemIndex(); |
||||
if (preSelectedItemIndex != -1) { |
||||
getData().get(preSelectedItemIndex).setItemSelected(false); |
||||
notifyItemChanged(preSelectedItemIndex); |
||||
} |
||||
} |
||||
if (selectedItemIndex != -1) { |
||||
getData().get(selectedItemIndex).setItemSelected(select); |
||||
notifyItemChanged(selectedItemIndex); |
||||
} |
||||
} |
||||
|
||||
public void setFocusedItemIndex(int focusedItemIndex) { |
||||
int preFocusItemIndex = this.focusedItemIndex; |
||||
this.focusedItemIndex = focusedItemIndex; |
||||
if (preFocusItemIndex != -1) |
||||
notifyItemChanged(preFocusItemIndex); |
||||
if (this.focusedItemIndex != -1) |
||||
notifyItemChanged(this.focusedItemIndex); |
||||
else |
||||
notifyDataSetChanged(); |
||||
} |
||||
|
||||
public int getSelectedItemIndex() { |
||||
for (LiveSettingItem item : getData()) { |
||||
if (item.isItemSelected()) |
||||
return item.getItemIndex(); |
||||
} |
||||
return -1; |
||||
} |
||||
} |
||||
@ -0,0 +1,24 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="10mm" |
||||
android:layout_marginBottom="10mm" |
||||
android:layout_gravity="center" |
||||
android:background="@drawable/shape_live_focus" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="false" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvSettingItemName" |
||||
android:layout_width="0mm" |
||||
android:layout_height="60mm" |
||||
android:layout_weight="1" |
||||
android:ellipsize="marquee" |
||||
android:gravity="center" |
||||
android:marqueeRepeatLimit="marquee_forever" |
||||
android:singleLine="true" |
||||
android:textColor="@android:color/white" |
||||
android:textSize="22mm" /> |
||||
</LinearLayout> |
||||
@ -0,0 +1,24 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="10mm" |
||||
android:layout_marginBottom="10mm" |
||||
android:layout_gravity="center" |
||||
android:background="@drawable/shape_live_focus" |
||||
android:focusable="true" |
||||
android:focusableInTouchMode="false" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tvSettingGroupName" |
||||
android:layout_width="0mm" |
||||
android:layout_height="60mm" |
||||
android:layout_weight="1" |
||||
android:ellipsize="marquee" |
||||
android:gravity="center" |
||||
android:marqueeRepeatLimit="marquee_forever" |
||||
android:singleLine="true" |
||||
android:textColor="@android:color/white" |
||||
android:textSize="22mm" /> |
||||
</LinearLayout> |
||||
Loading…
Reference in new issue