use of android.widget.RelativeLayout in project NewPipe by TeamNewPipe.
the class VideoItemDetailFragment method updateInfo.
private void updateInfo(final StreamInfo info) {
Activity a = getActivity();
RelativeLayout textContentLayout = (RelativeLayout) activity.findViewById(R.id.detail_text_content_layout);
final TextView videoTitleView = (TextView) activity.findViewById(R.id.detail_video_title_view);
TextView uploaderView = (TextView) activity.findViewById(R.id.detail_uploader_view);
TextView viewCountView = (TextView) activity.findViewById(R.id.detail_view_count_view);
TextView thumbsUpView = (TextView) activity.findViewById(R.id.detail_thumbs_up_count_view);
TextView thumbsDownView = (TextView) activity.findViewById(R.id.detail_thumbs_down_count_view);
TextView uploadDateView = (TextView) activity.findViewById(R.id.detail_upload_date_view);
TextView descriptionView = (TextView) activity.findViewById(R.id.detail_description_view);
RecyclerView nextStreamView = (RecyclerView) activity.findViewById(R.id.detail_next_stream_content);
RelativeLayout nextVideoRootFrame = (RelativeLayout) activity.findViewById(R.id.detail_next_stream_root_layout);
TextView similarTitle = (TextView) activity.findViewById(R.id.detail_similar_title);
Button backgroundButton = (Button) activity.findViewById(R.id.detail_stream_thumbnail_window_background_button);
View thumbnailView = activity.findViewById(R.id.detail_thumbnail_view);
View topView = activity.findViewById(R.id.detailTopView);
Button channelButton = (Button) activity.findViewById(R.id.channel_button);
// prevents a crash if the activity/fragment was already left when the response came
if (channelButton != null) {
progressBar.setVisibility(View.GONE);
if (info.next_video != null) {
// todo: activate this function or remove it
nextStreamView.setVisibility(View.GONE);
} else {
nextStreamView.setVisibility(View.GONE);
activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE);
}
textContentLayout.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT < 18) {
playVideoButton.setVisibility(View.VISIBLE);
} else {
ImageView playArrowView = (ImageView) activity.findViewById(R.id.play_arrow_view);
playArrowView.setVisibility(View.VISIBLE);
}
if (!showNextStreamItem) {
nextVideoRootFrame.setVisibility(View.GONE);
similarTitle.setVisibility(View.GONE);
}
videoTitleView.setText(info.title);
topView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == android.view.MotionEvent.ACTION_UP) {
ImageView arrow = (ImageView) activity.findViewById(R.id.toggle_description_view);
View extra = activity.findViewById(R.id.detailExtraView);
if (extra.getVisibility() == View.VISIBLE) {
extra.setVisibility(View.GONE);
arrow.setImageResource(R.drawable.arrow_down);
} else {
extra.setVisibility(View.VISIBLE);
arrow.setImageResource(R.drawable.arrow_up);
}
}
return true;
}
});
// Since newpipe is designed to work even if certain information is not available,
// the UI has to react on missing information.
videoTitleView.setText(info.title);
if (!info.uploader.isEmpty()) {
uploaderView.setText(info.uploader);
} else {
activity.findViewById(R.id.detail_uploader_view).setVisibility(View.GONE);
}
if (info.view_count >= 0) {
viewCountView.setText(Localization.localizeViewCount(info.view_count, a));
} else {
viewCountView.setVisibility(View.GONE);
}
if (info.dislike_count >= 0) {
thumbsDownView.setText(Localization.localizeNumber(info.dislike_count, a));
} else {
thumbsDownView.setVisibility(View.INVISIBLE);
activity.findViewById(R.id.detail_thumbs_down_count_view).setVisibility(View.GONE);
}
if (info.like_count >= 0) {
thumbsUpView.setText(Localization.localizeNumber(info.like_count, a));
} else {
thumbsUpView.setVisibility(View.GONE);
activity.findViewById(R.id.detail_thumbs_up_img_view).setVisibility(View.GONE);
thumbsDownView.setVisibility(View.GONE);
activity.findViewById(R.id.detail_thumbs_down_img_view).setVisibility(View.GONE);
}
if (!info.upload_date.isEmpty()) {
uploadDateView.setText(Localization.localizeDate(info.upload_date, a));
} else {
uploadDateView.setVisibility(View.GONE);
}
if (!info.description.isEmpty()) {
descriptionView.setText(Html.fromHtml(info.description));
} else {
descriptionView.setVisibility(View.GONE);
}
descriptionView.setMovementMethod(LinkMovementMethod.getInstance());
// parse streams
Vector<VideoStream> streamsToUse = new Vector<>();
for (VideoStream i : info.video_streams) {
if (useStream(i, streamsToUse)) {
streamsToUse.add(i);
}
}
textContentLayout.setVisibility(View.VISIBLE);
if (info.next_video == null) {
activity.findViewById(R.id.detail_next_stream_title).setVisibility(View.GONE);
}
if (info.related_streams != null && !info.related_streams.isEmpty()) {
initSimilarVideos(info);
} else {
activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE);
activity.findViewById(R.id.similar_streams_view).setVisibility(View.GONE);
}
setupActionBarHandler(info);
if (autoPlayEnabled) {
playVideo(info);
}
if (android.os.Build.VERSION.SDK_INT < 18) {
playVideoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
playVideo(info);
}
});
}
backgroundButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
playVideo(info);
}
});
//todo: make backgroundButton handle this
thumbnailView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
playVideo(info);
}
});
if (info.channel_url != null && info.channel_url != "") {
channelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavStack.getInstance().openChannelActivity(getActivity(), info.channel_url, info.service_id);
}
});
} else {
channelButton.setVisibility(Button.GONE);
}
initThumbnailViews(info);
}
}
use of android.widget.RelativeLayout in project GT by Tencent.
the class GTOpMulPerfActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gt_perf_op_mul_detail);
Intent intent = this.getIntent();
if (intent == null) {
finish();
}
Bundle extras = intent.getExtras();
if (extras == null) {
finish();
}
final String name = extras.getString("name");
final String alias = extras.getString("alias");
final String client = extras.getString("client");
// 出参的性能数据源取法
dataSet = OpPerfBridge.getProfilerData(name);
// 在onCreat之前数据源可能被清理了,这样就不打开页面
if (null == dataSet) {
finish();
return;
}
// 保存对应的出参变量,以便刷值
op = ClientManager.getInstance().getClient(client).getOutPara(name);
attentEntry = dataSet.getSubTagEntrys()[0];
about = dataSet.getDesc();
tvTitle = (TextView) findViewById(R.id.perf_detail_title);
tvTitle.setText(alias);
tvKey = (TextView) findViewById(R.id.op_perf_detail_key);
tvKey.setText(name);
tvAbout = (TextView) findViewById(R.id.op_perf_detail_about);
tvAbout.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
GTOutParaPerfDialog dialog = new GTOutParaPerfDialog(v.getContext(), alias, name, about);
dialog.show();
}
});
lv_attentAttr = (ListView) findViewById(R.id.op_perf_detail_attent_list);
attrAdapter = new ArrayAdapter<String>(this, R.layout.gt_simple_dropdown_item);
for (TagTimeEntry itemName : dataSet.getChildren()) {
attrAdapter.add(itemName.getName());
}
lv_attentAttr.setAdapter(attrAdapter);
lv_attentAttr.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long arg3) {
img_empty.setVisibility(View.GONE);
lv_attentAttr.setVisibility(View.GONE);
String lastSelectedItem = btn_attent.getText().toString();
btn_attent.setText(attrAdapter.getItem(position));
attentEntry = dataSet.getSubTagEntrys()[position];
if (!lastSelectedItem.equals(attentEntry.getName())) {
refreshAttent();
refreshThreshold();
}
}
});
/*
* 用于覆盖整个屏幕的透明ImageView,
* 主要帮助点击非lv_attentAttr区域使lv_attentAttr消失
*/
img_empty = (ImageView) findViewById(R.id.view_empty);
img_empty.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
img_empty.setVisibility(View.GONE);
lv_attentAttr.setVisibility(View.GONE);
return true;
}
});
btn_attent = (Button) findViewById(R.id.op_perf_detail_attent);
btn_attent.setText(attrAdapter.getItem(0));
btn_attent.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
btn_attent.setBackgroundResource(R.drawable.a_gt_perf_op_btn_selected_border);
handler.postDelayed(new Runnable() {
@Override
public void run() {
btn_attent.setBackgroundResource(R.drawable.a_gt_perf_op_btn_default_border);
}
}, 200);
if (lv_attentAttr.getVisibility() == View.VISIBLE) {
img_empty.setVisibility(View.GONE);
lv_attentAttr.setVisibility(View.GONE);
} else {
lv_attentAttr.setVisibility(View.VISIBLE);
img_empty.setVisibility(View.VISIBLE);
}
}
});
btn_back = (ImageButton) findViewById(R.id.perf_detail_back);
btn_back.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
// btn_save = (ImageButton)findViewById(R.id.perf_detail_save);
// btn_save.setOnClickListener(new OnClickListener() {
//
// public void onClick(View v) {
// String lastSaveLog = GTGWInternal.getLastSaveFolder();
// if (lastSaveLog != null && lastSaveLog.contains(".")
// && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX))
// {
// lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
// }
// et_savePath3.setText(lastSaveLog.trim());
// dlg_save.show();
// }
// });
RelativeLayout rl_save = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.gt_dailog_save_gw, null, false);
ImageButton btn_cleanSavePath = (ImageButton) rl_save.findViewById(R.id.save_clean);
btn_cleanSavePath.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
et_savePath3.setText("");
}
});
et_savePath1 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent1);
et_savePath2 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent2);
et_savePath3 = (EditText) rl_save.findViewById(R.id.save_editor);
et_saveTestDesc = (EditText) rl_save.findViewById(R.id.save_editor_desc);
String lastSaveLog = GTGWInternal.getLastSaveFolder();
if (lastSaveLog != null && lastSaveLog.contains(".") && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX)) {
lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
}
et_savePath3.setText(lastSaveLog);
et_savePath1.setText(Env.CUR_APP_NAME);
et_savePath2.setText(Env.CUR_APP_VER);
dlg_save = new Builder(this).setTitle(getString(R.string.save)).setView(rl_save).setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String path1 = et_savePath1.getText().toString().trim();
if (!StringUtil.isLetter(path1)) {
ToastUtil.ShowShortToast(GTOpMulPerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String path2 = et_savePath2.getText().toString().trim();
if (!StringUtil.isLetter(path2)) {
ToastUtil.ShowShortToast(GTOpMulPerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String path3 = et_savePath3.getText().toString().trim();
if (!StringUtil.isLetter(path3)) {
ToastUtil.ShowShortToast(GTOpMulPerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String testDesc = et_saveTestDesc.getText().toString().trim();
GWSaveEntry saveEntry = new GWSaveEntry(path1, path2, path3, testDesc);
GTGWInternal.saveGWData(saveEntry, dataSet);
dialog.dismiss();
}
}).create();
btn_delete = (ImageButton) findViewById(R.id.perf_detail_delete);
btn_delete.setOnClickListener(showDeleteDlg);
// 告警区操作的UI
tvWarningCntToast = (TextView) findViewById(R.id.op_perf_detail_warning_cnt_toast);
tvWarningCnt = (TextView) findViewById(R.id.bh_perf_detail_warning_cnt);
// 告警区
final LinearLayout ll_warnArea = (LinearLayout) findViewById(R.id.op_perf_detail_warnarea);
img_bottom_arrow = (ImageView) findViewById(R.id.bottom_arrow);
if (dataSet.getThresholdEntry().isEnable()) {
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
} else {
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
}
// 告警抬头文本
tvWaringArea = (TextView) findViewById(R.id.op_perf_detail_interval_toast);
// 折叠线
ll_fold = (LinearLayout) findViewById(R.id.warning_fold);
// 因为多曲线情况的各子项的告警的enable值是一起变化的,所以从一个判断决定UI初始状态即可
if (!attentEntry.getThresholdEntry().isEnable()) {
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
tvWarningCntToast.setVisibility(View.GONE);
tvWarningCnt.setVisibility(View.GONE);
tvWaringArea.setText(getString(R.string.warning_title_mul_disable));
}
ll_fold.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO 需要对所有的子项告警全开和全屏蔽,UI与业务逻辑混一起了,需要重构
if (attentEntry.getThresholdEntry().isEnable()) {
for (TagTimeEntry temp : dataSet.getSubTagEntrys()) {
temp.getThresholdEntry().setEnable(false);
}
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
tvWarningCntToast.setVisibility(View.GONE);
tvWarningCnt.setVisibility(View.GONE);
tvWaringArea.setText(getString(R.string.warning_title_mul_disable));
} else {
for (TagTimeEntry temp : dataSet.getSubTagEntrys()) {
temp.getThresholdEntry().setEnable(true);
}
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
tvWarningCntToast.setVisibility(View.VISIBLE);
tvWarningCnt.setVisibility(View.VISIBLE);
tvWaringArea.setText(getString(R.string.warning_title_mul));
}
}
});
// 从未开始统计过的出参,不允许设置告警
if (!op.hasMonitorOnce) {
etUpperInterval.setEnabled(false);
etUpperValue.setEnabled(false);
etLowerValue.setEnabled(false);
} else {
etUpperInterval = (EditText) findViewById(R.id.op_perf_detail_upper_interval);
etUpperValue = (EditText) findViewById(R.id.op_perf_detail_upper_value);
etLowerValue = (EditText) findViewById(R.id.op_perf_detail_lower_value);
etUpperInterval.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etLowerValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperInterval.setOnKeyListener(thresholdKeyListener);
etUpperValue.setOnKeyListener(thresholdKeyListener);
etLowerValue.setOnKeyListener(thresholdKeyListener);
refreshThreshold();
}
tvValue = (TextView) findViewById(R.id.op_perf_detail_value);
tvTimes = (TextView) findViewById(R.id.bh_perf_detail_times);
tvMin = (TextView) findViewById(R.id.bh_perf_detail_min);
tvMax = (TextView) findViewById(R.id.bh_perf_detail_max);
tvAve = (TextView) findViewById(R.id.bh_perf_detail_ave);
// tvValue.setText(dataSet.getLastValue());
tvValue.setText(op.getValue());
refreshAttent();
LinearLayout ll_chart = (LinearLayout) findViewById(R.id.bh_perf_detail_chart);
chartView = new GTMulOpPerfDetailView(this, dataSet);
chartView.setInput(0);
ll_chart.addView(chartView);
}
use of android.widget.RelativeLayout in project GT by Tencent.
the class GTOpSMActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gt_perf_op_detail_sm);
Intent intent = this.getIntent();
Bundle extras = intent.getExtras();
final String name = extras.getString("name");
final String alias = extras.getString("alias");
final String client = extras.getString("client");
// 出参的性能数据源取法
dataSet = OpPerfBridge.getProfilerData(name);
// 在onCreat之前数据源可能被清理了,这样就不打开页面
if (null == dataSet) {
finish();
return;
}
// 保存对应的出参变量,以便刷值
op = ClientManager.getInstance().getClient(client).getOutPara(name);
about = dataSet.getDesc();
tvTitle = (TextView) findViewById(R.id.perf_detail_title);
// tvTitle.setText(alias);
tvTitle.setText("SM for Test");
tvKey = (TextView) findViewById(R.id.op_perf_detail_key);
tvKey.setText(name);
tvAbout = (TextView) findViewById(R.id.op_perf_detail_about);
tvAbout.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
GTOutParaPerfDialog dialog = new GTOutParaPerfDialog(v.getContext(), alias, name, about);
dialog.show();
}
});
btn_back = (ImageButton) findViewById(R.id.perf_detail_back);
btn_back.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
// btn_save = (ImageButton)findViewById(R.id.perf_detail_save);
// btn_save.setOnClickListener(new OnClickListener() {
//
// public void onClick(View v) {
// String lastSaveLog = GTGWInternal.getLastSaveFolder();
// if (lastSaveLog != null && lastSaveLog.contains(".")
// && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX))
// {
// lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
// }
// et_savePath3.setText(lastSaveLog.trim());
// dlg_save.show();
// }
// });
btn_delete = (ImageButton) findViewById(R.id.perf_detail_delete);
btn_delete.setOnClickListener(showDeleteDlg);
// 告警区
final LinearLayout ll_warnArea = (LinearLayout) findViewById(R.id.op_perf_detail_warnarea);
img_bottom_arrow = (ImageView) findViewById(R.id.bottom_arrow);
if (dataSet.getThresholdEntry().isEnable()) {
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
} else {
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
}
// 告警抬头文本
tvWaringArea = (TextView) findViewById(R.id.op_perf_detail_interval_toast);
if (!dataSet.getThresholdEntry().isEnable()) {
tvWaringArea.setText(getString(R.string.warning_title_disable));
}
// 折叠线
ll_fold = (LinearLayout) findViewById(R.id.warning_fold);
ll_fold.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (dataSet.getThresholdEntry().isEnable()) {
dataSet.getThresholdEntry().setEnable(false);
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
tvWaringArea.setText(getString(R.string.warning_title_disable));
} else {
dataSet.getThresholdEntry().setEnable(true);
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
tvWaringArea.setText(getString(R.string.warning_title));
}
}
});
etUpperInterval = (EditText) findViewById(R.id.op_perf_detail_upper_interval);
etUpperValue = (EditText) findViewById(R.id.op_perf_detail_upper_value);
etLowerValue = (EditText) findViewById(R.id.op_perf_detail_lower_value);
// 从未开始统计过的出参,不允许设置告警
if (!op.hasMonitorOnce) {
etUpperInterval.setEnabled(false);
etUpperValue.setEnabled(false);
etLowerValue.setEnabled(false);
// isfoldWarnArea = true;
// img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
// ll_warnArea.setVisibility(View.GONE);
} else {
etUpperInterval.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etLowerValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperInterval.setOnKeyListener(thresholdKeyListener);
etUpperValue.setOnKeyListener(thresholdKeyListener);
etLowerValue.setOnKeyListener(thresholdKeyListener);
int upperDuration = dataSet.getThresholdEntry().getduration();
if (upperDuration != Integer.MAX_VALUE) {
etUpperInterval.setText(Integer.toString(upperDuration));
}
double upperValue = dataSet.getThresholdEntry().getUpperValue();
if (upperValue != Integer.MAX_VALUE) {
etUpperValue.setText(Double.toString(upperValue));
}
double lowerValue = dataSet.getThresholdEntry().getLowerValue();
if (lowerValue != Integer.MIN_VALUE) {
etLowerValue.setText(Double.toString(lowerValue));
}
}
RelativeLayout rl_save = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.gt_dailog_save_gw, null, false);
ImageButton btn_cleanSavePath = (ImageButton) rl_save.findViewById(R.id.save_clean);
btn_cleanSavePath.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
et_savePath3.setText("");
}
});
et_savePath1 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent1);
et_savePath2 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent2);
et_savePath3 = (EditText) rl_save.findViewById(R.id.save_editor);
et_saveTestDesc = (EditText) rl_save.findViewById(R.id.save_editor_desc);
String lastSaveLog = GTGWInternal.getLastSaveFolder();
if (lastSaveLog != null && lastSaveLog.contains(".") && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX)) {
lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
}
et_savePath3.setText(lastSaveLog);
et_savePath1.setText(Env.CUR_APP_NAME);
et_savePath2.setText(Env.CUR_APP_VER);
dlg_save = new Builder(this).setTitle(getString(R.string.save)).setView(rl_save).setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String path1 = et_savePath1.getText().toString().trim();
if (!StringUtil.isLetter(path1)) {
ToastUtil.ShowShortToast(GTOpSMActivity.this, getString(R.string.save_folder_valid));
return;
}
String path2 = et_savePath2.getText().toString().trim();
if (!StringUtil.isLetter(path2)) {
ToastUtil.ShowShortToast(GTOpSMActivity.this, getString(R.string.save_folder_valid));
return;
}
String path3 = et_savePath3.getText().toString().trim();
if (!StringUtil.isLetter(path3)) {
ToastUtil.ShowShortToast(GTOpSMActivity.this, getString(R.string.save_folder_valid));
return;
}
String testDesc = et_saveTestDesc.getText().toString().trim();
GWSaveEntry saveEntry = new GWSaveEntry(path1, path2, path3, testDesc);
GTGWInternal.saveGWDataForSM(saveEntry, dataSet);
dialog.dismiss();
}
}).create();
tvValue = (TextView) findViewById(R.id.op_perf_detail_value);
tvTimes = (TextView) findViewById(R.id.bh_perf_detail_times);
tvMin = (TextView) findViewById(R.id.bh_perf_detail_min);
// tvMax = (TextView) findViewById(R.id.bh_perf_detail_max);
tvAve = (TextView) findViewById(R.id.bh_perf_detail_ave);
tvScore = (TextView) findViewById(R.id.bh_perf_detail_score);
tvGood = (TextView) findViewById(R.id.bh_perf_detail_good);
tvBad = (TextView) findViewById(R.id.bh_perf_detail_bad);
tvWarningCnt = (TextView) findViewById(R.id.bh_perf_detail_warning_cnt);
if (op == null) {
tvValue.setText(dataSet.getLastValue());
} else {
tvValue.setText(op.getValue());
}
TagTimeEntry anchorEntry = dataSet;
if (dataSet.getSubTagEntrys().length > 0) {
anchorEntry = dataSet.getSubTagEntrys()[0];
}
ArrayList<Integer> smrs = SMUtils.getSmDetail(anchorEntry.getRecordList());
if (smrs.size() < 6) {
finish();
return;
}
dataSet.exInt_1 = smrs.get(1);
dataSet.exInt_2 = smrs.get(3);
dataSet.exInt_3 = smrs.get(5);
tvTimes.setText(anchorEntry.getRecordSizeText());
tvMin.setText(anchorEntry.getMin());
// tvMax.setText(anchorEntry.getMax());
tvAve.setText(anchorEntry.getAve());
tvScore.setText(smrs.get(5).toString());
tvGood.setText(smrs.get(3).toString());
tvBad.setText(smrs.get(1).toString());
tvWarningCnt.setText(Integer.toString(anchorEntry.getThresholdEntry().getUpperWariningCount() + anchorEntry.getThresholdEntry().getLowerWariningCount()));
LinearLayout ll_chart = (LinearLayout) findViewById(R.id.bh_perf_detail_chart);
chartView = new GTPerfDetailView(this, dataSet);
chartView.setInput(0);
ll_chart.addView(chartView);
}
use of android.widget.RelativeLayout in project GT by Tencent.
the class GTAUTFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View autLayout = inflater.inflate(R.layout.gt_settingactivity, container, false);
tv_Appstatus = (TextView) autLayout.findViewById(R.id.app_status);
tv_select = (TextView) autLayout.findViewById(R.id.selected_app_bg);
tv_select.setOnClickListener(select);
tv_PkName = (TextView) autLayout.findViewById(R.id.select_tested_pkn);
tv_selectedApp = (TextView) autLayout.findViewById(R.id.app_pic);
tv_AppName = (TextView) autLayout.findViewById(R.id.selected_apn);
tv_refresh = (TextView) autLayout.findViewById(R.id.app_refresh);
tv_refresh.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
proDialog = ProgressDialog.show(getActivity(), "Searching..", "searching..wait....", true, false);
tv_refresh.setTextColor(Color.GREEN);
Thread loginThread = new Thread(new ProcessRefresher());
loginThread.start();
v.performClick();
}
return true;
}
});
tv_refresh.setVisibility(View.GONE);
cb_cpu = (CheckBox) autLayout.findViewById(R.id.cb_cpu);
cb_jiffies = (CheckBox) autLayout.findViewById(R.id.cb_jiffies);
cb_net = (CheckBox) autLayout.findViewById(R.id.cb_net);
cb_pss = (CheckBox) autLayout.findViewById(R.id.cb_pss);
cb_pd = (CheckBox) autLayout.findViewById(R.id.cb_pd);
cb_boxs = new CheckBox[] { cb_cpu, cb_jiffies, cb_net, cb_pss, cb_pd };
cb_cpu.setOnClickListener(cb_check);
cb_jiffies.setOnClickListener(cb_check);
cb_net.setOnClickListener(cb_check);
cb_pss.setOnClickListener(cb_check);
cb_pd.setOnClickListener(cb_check);
memOn = (TextView) autLayout.findViewById(R.id.btn_memon);
memOff = (TextView) autLayout.findViewById(R.id.btn_memoff);
memSwitch = autLayout.findViewById(R.id.memswitch);
selectDrawable = R.drawable.swbtn_selected;
defaultDrawable = R.drawable.swbtn_default;
if (isAutoGetMem) {
memOn.setText("");
memOn.setBackgroundResource(selectDrawable);
memOff.setText("off");
memOff.setBackgroundResource(defaultDrawable);
} else {
memOn.setText("on");
memOn.setBackgroundResource(selectDrawable);
memOff.setText("");
memOff.setBackgroundResource(defaultDrawable);
}
RelativeLayout rl_save = (RelativeLayout) LayoutInflater.from(getActivity()).inflate(R.layout.gt_dailog_save, container, false);
et_savePath = (EditText) rl_save.findViewById(R.id.save_editor);
dlg_save = new Builder(getActivity()).setTitle(getString(R.string.save)).setView(rl_save).setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
GTMemHelperFloatview.memInfoList.clear();
}
}).setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 简单保存
String path = et_savePath.getText().toString();
LogUtils.writeTagMemData(tv_PkName.getText().toString(), path + ".csv");
GTMemHelperFloatview.memInfoList.clear();
dialog.dismiss();
}
}).create();
memSwitch.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!tv_PkName.getText().toString().equals("n/a")) {
if (isAutoGetMem) {
isAutoGetMem = false;
memOn.setText("on");
memOn.setBackgroundResource(defaultDrawable);
memOff.setText("");
memOff.setBackgroundResource(selectDrawable);
// if(!tv_PkName.getText().toString().equals("n/a")){
Intent intent = new Intent(GTApp.getContext(), GTMemHelperFloatview.class);
intent.putExtra("pName", tv_PkName.getText().toString());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PluginManager.getInstance().getPluginControler().startService(GTMemHelperFloatview.getInstance(), intent);
// }
} else {
isAutoGetMem = true;
memOn.setText("");
memOn.setBackgroundResource(selectDrawable);
memOff.setText("off");
memOff.setBackgroundResource(defaultDrawable);
GTMemHelperFloatview.tagTimes = 0;
PluginManager.getInstance().getPluginControler().stopService(GTMemHelperFloatview.getInstance());
dlg_save.show();
}
}
v.performClick();
return false;
}
});
return autLayout;
}
use of android.widget.RelativeLayout in project Reader by TheKeeperOfPie.
the class FragmentNewPost method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_new_post, container, false);
layoutCoordinator = (CoordinatorLayout) view.findViewById(R.id.layout_coordinator);
layoutAppBar = (AppBarLayout) view.findViewById(R.id.layout_app_bar);
scrollText = (NestedScrollView) view.findViewById(R.id.scroll_text);
textInfo = (TextView) view.findViewById(R.id.text_info);
textSubmit = (TextView) view.findViewById(R.id.text_submit);
editTextTitle = (EditText) view.findViewById(R.id.edit_title);
editTextBody = (EditText) view.findViewById(R.id.edit_body);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setTitle(getString(R.string.new_post));
toolbar.setTitleTextColor(themer.getColorFilterPrimary().getColor());
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
toolbar.setNavigationOnClickListener(v -> {
UtilsInput.hideKeyboard(editTextBody);
mListener.onNavigationBackClick();
});
toolbar.getNavigationIcon().mutate().setColorFilter(themer.getColorFilterPrimary());
setUpOptionsMenu();
textInfo.setText(getString(R.string.submitting_post, getArguments().getString(SUBREDDIT), getArguments().getString(USER)));
String submitTextHtml = getArguments().getString(SUBMIT_TEXT_HTML);
Log.d(TAG, "submitTextHtml: " + submitTextHtml);
if (TextUtils.isEmpty(submitTextHtml) || "null".equals(submitTextHtml)) {
textSubmit.setVisibility(View.GONE);
} else {
textSubmit.setText(UtilsReddit.getFormattedHtml(submitTextHtml));
}
textSubmit.setMovementMethod(LinkMovementMethod.getInstance());
if (Reddit.PostType.LINK == postType) {
editTextBody.setHint("URL");
} else {
editTextBody.setHint("Text");
}
View.OnFocusChangeListener onFocusChangeListener = (v, hasFocus) -> {
if (hasFocus) {
AppBarLayout.Behavior behaviorAppBar = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutAppBar.getLayoutParams()).getBehavior();
behaviorAppBar.onNestedFling(layoutCoordinator, layoutAppBar, null, 0, 1000, true);
}
};
editTextTitle.setOnFocusChangeListener(onFocusChangeListener);
editTextBody.setOnFocusChangeListener(onFocusChangeListener);
editMarginDefault = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics());
editMarginWithActions = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 56, getResources().getDisplayMetrics());
textPreview = (TextView) view.findViewById(R.id.text_preview);
viewDivider = view.findViewById(R.id.view_divider);
toolbarActions = (Toolbar) view.findViewById(R.id.toolbar_actions);
toolbarActions.inflateMenu(R.menu.menu_editor_actions);
toolbarActions.setOnMenuItemClickListener(this);
tabLayout = (TabLayout) view.findViewById(R.id.layout_tab);
tabLayout.setTabMode(TabLayout.MODE_FIXED);
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
tabLayout.setTabTextColors(themer.getColorFilterTextMuted().getColor(), themer.getColorFilterPrimary().getColor());
viewPager = (ViewPager) view.findViewById(R.id.view_pager);
viewPager.setAdapter(new PagerAdapter() {
@Override
public CharSequence getPageTitle(int position) {
switch(position) {
case PAGE_POST:
return getString(R.string.page_post);
case PAGE_PREVIEW:
return getString(R.string.page_preview);
}
return super.getPageTitle(position);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
return viewPager.getChildAt(position);
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
}
@Override
public int getCount() {
if (Reddit.PostType.LINK == postType) {
tabLayout.setVisibility(View.GONE);
toolbarActions.setVisibility(View.GONE);
viewDivider.setVisibility(View.GONE);
itemHideActions.setVisible(false);
return 1;
}
return viewPager.getChildCount();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
});
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if (position == PAGE_POST && toolbarActions.getVisibility() == View.VISIBLE) {
float translationY = positionOffset * (toolbarActions.getHeight() + viewDivider.getHeight());
viewDivider.setTranslationY(translationY);
toolbarActions.setTranslationY(translationY);
}
}
@Override
public void onPageSelected(int position) {
if (position == PAGE_PREVIEW) {
if (editTextBody.length() == 0) {
textPreview.setText(R.string.empty_reply_preview);
} else {
textPreview.setText(Html.fromHtml(Processor.process(editTextBody.getText().toString())));
}
}
if (Reddit.PostType.SELF == postType) {
itemHideActions.setVisible(position == PAGE_POST);
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
tabLayout.setupWithViewPager(viewPager);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
layoutCaptcha = (RelativeLayout) view.findViewById(R.id.layout_captcha);
imageCaptcha = (ImageView) view.findViewById(R.id.image_captcha);
editCaptcha = (EditText) view.findViewById(R.id.edit_captcha);
buttonCaptchaRefresh = (ImageButton) view.findViewById(R.id.button_captcha_refresh);
buttonCaptchaRefresh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadCaptcha();
}
});
if (getArguments().getBoolean(IS_EDIT, false)) {
loadEditValues();
} else {
reddit.needsCaptcha().subscribe(new Observer<String>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
}
@Override
public void onNext(String response) {
if ("true".equalsIgnoreCase(response)) {
layoutCaptcha.setVisibility(View.VISIBLE);
loadCaptcha();
}
}
});
}
view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Menu menu = toolbarActions.getMenu();
int maxNum = (int) (view.getWidth() / TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, getResources().getDisplayMetrics()));
int numShown = 0;
for (int index = 0; index < menu.size(); index++) {
MenuItem menuItem = menu.getItem(index);
menuItem.getIcon().setColorFilter(themer.getColorFilterIcon());
if (numShown++ < maxNum - 1) {
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
} else {
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
}
// Toggle visibility to fix weird bug causing tabs to not be added
tabLayout.setVisibility(View.GONE);
tabLayout.setVisibility(View.VISIBLE);
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
return view;
}
Aggregations