本文整理汇总了Java中android.media.tv.TvInputInfo.loadLabel方法的典型用法代码示例。如果您正苦于以下问题:Java TvInputInfo.loadLabel方法的具体用法?Java TvInputInfo.loadLabel怎么用?Java TvInputInfo.loadLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.tv.TvInputInfo
的用法示例。
在下文中一共展示了TvInputInfo.loadLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateLabel
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
public void updateLabel() {
MainActivity mainActivity = (MainActivity) getContext();
Channel channel = mainActivity.getCurrentChannel();
if (channel == null || !channel.isPassthrough()) {
return;
}
TvInputInfo input = mainActivity.getTvInputManagerHelper().getTvInputInfo(
channel.getInputId());
CharSequence customLabel = input.loadCustomLabel(getContext());
CharSequence label = input.loadLabel(getContext());
if (TextUtils.isEmpty(customLabel) || customLabel.equals(label)) {
mInputLabelTextView.setText(label);
mSecondaryInputLabelTextView.setVisibility(View.GONE);
} else {
mInputLabelTextView.setText(customLabel);
mSecondaryInputLabelTextView.setText(label);
mSecondaryInputLabelTextView.setVisibility(View.VISIBLE);
}
}
示例2: setItemViewText
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
private void setItemViewText(View v, TvInputInfo input) {
TextView inputLabelView = (TextView) v.findViewById(R.id.input_label);
TextView secondaryInputLabelView = (TextView) v.findViewById(R.id.secondary_input_label);
CharSequence customLabel = input.loadCustomLabel(getContext());
CharSequence label = input.loadLabel(getContext());
if (TextUtils.isEmpty(customLabel) || customLabel.equals(label)) {
inputLabelView.setText(label);
secondaryInputLabelView.setVisibility(View.GONE);
} else {
inputLabelView.setText(customLabel);
secondaryInputLabelView.setText(label);
secondaryInputLabelView.setVisibility(View.VISIBLE);
}
}
示例3: compare
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
@Override
public int compare(TvInputInfo lhs, TvInputInfo rhs) {
if (lhs == null) {
return (rhs == null) ? 0 : 1;
}
if (rhs == null) {
return -1;
}
boolean enabledL = isInputEnabled(lhs);
boolean enabledR = isInputEnabled(rhs);
if (enabledL != enabledR) {
return enabledL ? -1 : 1;
}
int priorityL = getPriority(lhs);
int priorityR = getPriority(rhs);
if (priorityL != priorityR) {
return priorityR - priorityL;
}
String customLabelL = (String) lhs.loadCustomLabel(getContext());
String customLabelR = (String) rhs.loadCustomLabel(getContext());
if (!TextUtils.equals(customLabelL, customLabelR)) {
customLabelL = customLabelL == null ? "" : customLabelL;
customLabelR = customLabelR == null ? "" : customLabelR;
return customLabelL.compareToIgnoreCase(customLabelR);
}
String labelL = (String) lhs.loadLabel(getContext());
String labelR = (String) rhs.loadLabel(getContext());
labelL = labelL == null ? "" : labelL;
labelR = labelR == null ? "" : labelR;
return labelL.compareToIgnoreCase(labelR);
}