@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_bak); Toolbar toolbar = findView(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = findView(R.id.fab); assert fab != null; textView = findView(R.id.httpResponse); assert textView != null; textView.setMovementMethod(ScrollingMovementMethod.getInstance()); fab.setOnClickListener( view -> { textView.setText(""); Snackbar.make(view, "Clear logs", Snackbar.LENGTH_LONG) .setAction("Action", (v) -> goWebActivity()) .show(); onEvent(this, AnaticsManager.EVENT.CLICK, "FloatingActionButton"); }); loadingLayout = findView(R.id.loadingview); loadingLayout.setOnRetryClickListener((view) -> getAction()); loadingLayout.setOnEmptyClickListener(v -> buildAction()); findViewById(R.id.http_get).setOnClickListener((view) -> getAction()); findViewById(R.id.http_post).setOnClickListener((view) -> postAction()); findViewById(R.id.http_build).setOnClickListener((view) -> buildAction()); }
public void initTextView() { textView = (TextView) findViewById(R.id.textView1); textView.setMovementMethod(ScrollingMovementMethod.getInstance()); textView.setBackgroundColor(Color.argb(232, 200, 200, 169)); textView.setTextColor(Color.argb(255, 255, 255, 255)); // 根据时间显示文字 String name = getResources().getString(R.string.app_master) + ","; Date d = new Date(); int hour = d.getHours(); int minute = d.getMinutes(); if (5 <= hour && hour < 11) { textView.setHint(name + "早上好!!!"); } else if (11 <= hour && hour < 15) { textView.setHint(name + "中午好!!!"); } else if (15 <= hour && hour < 18) { textView.setHint(name + "下午好!!!"); } else { if (hour == 18 && minute < 30 && minute > 20) { textView.setHint(name + "要下班了!!!"); } else { textView.setHint(name + "晚上好!!!"); } } // textView.setHint(textView.getHint().toString()+minute); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); setContentView(R.layout.activity_third_game_detail); ScaleViewUtils.init(this); ScaleViewUtils.scaleView(getWindow().getDecorView()); setBlackTitle(false); icon = (ImageView) findViewById(R.id.iv_icon); gameSize = (TextView) findViewById(R.id.tv_game_size); handleType = (TextView) findViewById(R.id.tv_game_handle); gameName = (TextView) findViewById(R.id.tv_game_name); gameDesc = (TextView) findViewById(R.id.tv_game_desc); gameDesc.setMovementMethod(ScrollingMovementMethod.getInstance()); gameDesc.setOnFocusChangeListener(onFocusChangeListener); mRecyclerView = (RecyclerView) findViewById(R.id.rv_game_source); LayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); mRecyclerView.setLayoutManager(layoutManager); mAdapter = new GameSourceAdapter(this, mRecyclerView, mImageFetcher); mRecyclerView.setAdapter(mAdapter); // gameSourceLayout = (LinearLayout)findViewById(R.id.ll_game_source); contentView = (RelativeLayout) findViewById(R.id.rl_desc); loadingView = (LoadingView) findViewById(R.id.contentLoading); loadingView.setDataView(contentView); if (getIntent() != null) { mGameId = getIntent().getStringExtra(GAMEID); } if (mGameId != null && mGameId != "") { Log.i("life", "mGameId:" + mGameId); getData(mGameId); } registReceiver(); }
private void initView() { btn_back = (Button) findViewById(R.id.btn_back_version_feature); txt_version_feature = (TextView) findViewById(R.id.txt_version_feature); btn_back.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { finish(); } }); StringBuilder version_feature = new StringBuilder(); version_feature.append("<html><body>"); version_feature.append("<p><strong>1. 当前版本</strong></p>"); version_feature.append("<p>1.1</p>"); version_feature.append("<p>当前版本为本软件第一版本,版本名为1.1。</p>"); version_feature.append("<p><strong>2. 版本功能</strong></p>"); version_feature.append("<p>2.1</p>"); version_feature.append("<p>用户可进行任务的发布,报名任务,留言,以及其他一些相关设置。</p>"); version_feature.append("<p>2.2</p>"); version_feature.append("<p>消息页面有4类消息,分别是:有人留言、有人报名、选你执行、评价了你。</p>"); version_feature.append("<p>2.3</p>"); version_feature.append("<p>用户可自由发布任务,有人报名后可选择任意个报名人执行你的任务。"); version_feature.append("任务过期或完结任务后别人将不可报名你的任务。同时完结任务后可对执行者进行评价和给赞。"); version_feature.append("对于别人发布的任务,用户在可报名的情况下只能报名一次。报名后流程同上。</p>"); version_feature.append("<p>2.4</p>"); version_feature.append("<p>用户可随意对任务进行留言,可回复任务发布人也可以是留言列表里的任何人。</p>"); version_feature.append("<p>2.5</p>"); version_feature.append("<p>排行页面只显示当前排名的1到20名。敢快报名任务得到更多的赞吧!!!</p>"); version_feature.append("<p><strong>3. 关于点赞</strong></p>"); version_feature.append("<p>3.1</p>"); version_feature.append("<p>用户报名任务且任务发布者选你执行,当发布者完结此任务后将可以给你0到32个赞,"); version_feature.append("而不是由用户在页面上直接点赞。</p>"); version_feature.append("</body></html>"); version_feature.append("<p><strong>4. 关于实名资料</strong></p>"); version_feature.append("<p>4.1</p>"); version_feature.append("<p>1.1版本将由用户设置是否对所有人公开实名资料,可以点击设置页面“实名资料”项进行设置。"); version_feature.append("用户设置不公开实名资料后,只有在这三种情况下,实名资料才强制向对方公开,"); version_feature.append("分别是用户报名任务后,或有人报名你的任务且你选他执行,或对你任务的执行者给赞,"); version_feature.append("即在“有人报名”、“选我执行”、“评价了你”的消息详情页面点击头像可查看对方实名资料。</p>"); version_feature.append("</body></html>"); txt_version_feature.setMovementMethod(ScrollingMovementMethod.getInstance()); txt_version_feature.setText(Html.fromHtml(version_feature.toString())); }
public TooltipText(Context context, String text, int viewResource) { mContext = context; mWindow = new PopupWindow(context); mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); setContentView(layoutInflater.inflate(viewResource, null)); tooltipText = (TextView) mView.findViewById(R.id.tooltipText); upArrow = (ImageView) mView.findViewById(R.id.arrow_up); downArrow = (ImageView) mView.findViewById(R.id.arrow_down); tooltipText.setMovementMethod(ScrollingMovementMethod.getInstance()); tooltipText.setSelected(true); }
void initWebView() { navigation = (RelativeLayout) findViewById(MResource.getIdByName(getApplication(), "id", "navigation")); view = (WebView) findViewById(MResource.getIdByName(getApplication(), "id", "wv_main")); query_pro = (ProgressBar) findViewById(MResource.getIdByName(getApplication(), "id", "query_pro")); left_finish = (RelativeLayout) findViewById(MResource.getIdByName(getApplication(), "id", "left_finish")); tv_title = (TextView) findViewById(MResource.getIdByName(getApplication(), "id", "center_text_string")); tv_title.setMovementMethod(ScrollingMovementMethod.getInstance()); tv_title.setSelected(true); left_text_string = (TextView) findViewById(MResource.getIdByName(getApplication(), "id", "left_text_string")); left_finish.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (view.canGoBack()) { view.goBack(); } else { SdkPreferences.clear(); finish(); } } }); WebSettings wSettings = view.getSettings(); wSettings.setJavaScriptCanOpenWindowsAutomatically(true); wSettings.setDomStorageEnabled(true); wSettings.setDisplayZoomControls(true); wSettings.setSupportZoom(true); wSettings.setBuiltInZoomControls(true); wSettings.setJavaScriptEnabled(true); wSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); view.requestFocusFromTouch(); view.addJavascriptInterface(new JavaScriptinterface(this), "android"); view.setWebViewClient(mWebViewClient); view.setWebChromeClient(mChromeClient); // view.loadUrl("file:///android_asset/index.html"); }
public void init() { ArrayAdapter<String> myAdapter = new ArrayAdapter<String>(this, R.layout.list_city_item) { @Override public int getCount() { return citys.length; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) convertView = View.inflate(getContext(), R.layout.list_city_item, null); TextView txt_city = (TextView) convertView.findViewById(R.id.txt_city); txt_city.setText(citys[position]); return convertView; } }; lv_citys.setAdapter(myAdapter); lv_citys.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ChooseCityActivity.this.jumpPage(citys[position]); } }); ll_gps.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (city != null) jumpPage(city); } }); // gps txt_gps.setMovementMethod(ScrollingMovementMethod.getInstance()); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.base_bar); bar_seek = (SeekBar) super.findViewById(R.id.bar_seek); bar_msg = (TextView) super.findViewById(R.id.bar_msg); bar_show = (SeekBar) super.findViewById(R.id.bar_show); bar_img = (ImageView) super.findViewById(R.id.bar_img); bar_seek.setOnSeekBarChangeListener( new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar bar) { bar_msg.append("Í£Ö¹ÍÏק;¿Ì¶È:" + bar.getProgress() + "\n"); } @Override public void onStartTrackingTouch(SeekBar bar) { bar_msg.append("¿ªÊ¼ÍÏק;¿Ì¶È:" + bar.getProgress() + "\n"); } @Override public void onProgressChanged(SeekBar bar, int prog, boolean formUser) { bar_msg.append("ÕýÔÚÍÏק;¿Ì¶È:" + prog + " ÊÇ·ñΪÓû§»¬¶¯:" + formUser + "\n"); } }); bar_msg.setMovementMethod(ScrollingMovementMethod.getInstance()); bar_show.setMax(11); bar_show.setOnSeekBarChangeListener( new OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar bar) {} @Override public void onStartTrackingTouch(SeekBar bar) {} @Override public void onProgressChanged(SeekBar bar, int prog, boolean fromUser) { bar_img.setImageResource(BGalley0.pics[bar.getProgress()]); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_lunch_info); Intent intent = this.getIntent(); TextView title = (TextView) findViewById(R.id.lunch_info_title); String str = intent.getStringExtra(Consts.LUNCH_INFO_TITLE); str = Utils.getFormatText(str, MAX_CHARS_IN_LINE, false); title.setText(str); TextView description = (TextView) findViewById(R.id.lunch_info_description); str = intent.getStringExtra(Consts.LUNCH_INFO_DESCRIPTION); description.setText(str); description.setMovementMethod(ScrollingMovementMethod.getInstance()); float cost = intent.getFloatExtra(Consts.LUNCH_INFO_PRICE, -1f); str = String.format(Locale.US, "%.2f ", cost); TextView price = (TextView) findViewById(R.id.lunch_info_price); price.setText(str); ImageStorage imageStorage = new ImageStorage(this); str = intent.getStringExtra(Consts.LUNCH_INFO_IMAGE); imageStorage.getImage(str, this); }
@Override public void onClick(View v) { StringBuilder str = new StringBuilder(showText.getText()); switch (v.getId()) { case R.id.clear_btn: if (str.length() != 0) { str.delete(str.length() - 1, str.length()); } break; case R.id.call_btn: if (str.length() != 0) { call(str.toString()); } break; default: str.append(((Button) v).getText()); break; } showText.setText(str); showText.setMovementMethod(ScrollingMovementMethod.getInstance()); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bug_report_view); final String stackTrace = getIntent().getStringExtra(STACKTRACE); final TextView reportTextView = (TextView) findViewById(R.id.report_text); reportTextView.setMovementMethod(ScrollingMovementMethod.getInstance()); reportTextView.setClickable(false); reportTextView.setLongClickable(false); final String versionName = getVersionName(); reportTextView.append( "FBReader " + versionName + " has been crached, sorry. You can help to fix this bug by sending the report below to FBReader developers. The report will be sent by e-mail. Thank you in advance!\n\n"); reportTextView.append(stackTrace); findViewById(R.id.send_report) .setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"*****@*****.**"}); sendIntent.putExtra(Intent.EXTRA_TEXT, stackTrace); sendIntent.putExtra( Intent.EXTRA_SUBJECT, "FBReader " + versionName + " exception report"); sendIntent.setType("message/rfc822"); startActivity(sendIntent); finish(); } }); findViewById(R.id.cancel_report) .setOnClickListener( new View.OnClickListener() { public void onClick(View view) { finish(); } }); }
private void initView() { textView = (TextView) findViewById(R.id.txtsf03); html = "<html><head><title></title></head>" + "<body>" + "<h2> 元代赵孟頫行书《洛神赋》卷</h2>" + "<small><font color='#00bbaa'> 来源:中国书法家园 时间:2015.12.18</font></small><br/><br/>" + " 赵孟頫书,纸本,行书。纵29cm,横220.9cm。 全卷共80行,末署款“子昂”。后纸元员峤山人(李倜),明高启,清王铎、曹溶题跋。前隔水王铎“戍子五月”又题。<br/>" + " <img src='" + R.drawable.imgsf03 + "' />" + " <small>元 《洛神赋》卷</small><br/>" + " 赵孟頫是元代著名书画家,不仅绘画创一代新风,书法更是元代第一人,如元代书法名家鲜于枢所评:“子昂篆、隶、真、行、颠草为当今第一。”赵氏所创书风,后人称之为“赵体”。赵孟頫师承也极广泛,初宗宋人,学赵构、黄庭坚,继而由智永上溯锺繇、二王,晚年又取法李邕。他模拟古法力求微肖,书写十分熟练,尤倾心于二王,元虞集在《道园学古录》中指出:“楷法深得《洛神赋》而揽其标;行书诣《圣教序》而入其室;至于草书,饱《十七帖》而变其形。”赵孟頫的书法成就突出表现在楷、行书方面,创遒劲姿媚新风,对元人和后世均产生极大影响。" + "此卷《洛神赋》即为赵氏行书代表作。行中兼楷的结体、点画,深得二王遗意,尤其是王献之《洛神赋》的神韵,即妍美洒脱之风致。如端正匀称的结构、优美潇洒的字姿、圆润灵秀的运笔、密中有疏的布局等;同时,又呈现自身的追求,象比较丰腴的点画,轻捷的连笔,飘逸中见内敛的运锋,端美中具俯仰起伏的气势,都显示出他博取众长而自成一体的艺术特色。故后纸诸家题跋如是评述此卷,李倜曰:“大令好写洛神赋,人间合有数本,惜乎未见其全。此松雪书无一笔不合法,盖以兰亭肥本运腕而出之者,可云买王得羊矣。”高启云:“赵魏公行草写洛神赋,其法虽出入王氏父子间,然肆笔自得,则别有天趣,故其体势逸发,真如见矫若游龙之入于烟雾中也。”" + "</body>" + "</html>"; textView.setMovementMethod(ScrollingMovementMethod.getInstance()); // 滚动 ImageGetter imageGetter = new ImageGetter() { @Override public Drawable getDrawable(String source) { int id = Integer.parseInt(source); // 根据id从资源文件中获取图片对象 Drawable d = getResources().getDrawable(id); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); return d; } }; textView.append(Html.fromHtml(html, imageGetter, null)); // handler = new Handler() { // @Override // public void handleMessage(Message msg) { // if (msg.what == 0x101) { // textView.setText((CharSequence) msg.obj); // } // super.handleMessage(msg); // } // }; // // // 因为从网上下载图片是耗时操作 所以要开启新线程 // Thread t = new Thread(new Runnable() { // Message msg = Message.obtain(); // // @Override // public void run() { // /** // * 要实现图片的显示需要使用Html.fromHtml的一个重构方法:public static Spanned // * fromHtml (String source, Html.ImageGetterimageGetter, // * Html.TagHandler // * tagHandler)其中Html.ImageGetter是一个接口,我们要实现此接口,在它的getDrawable // * (String source)方法中返回图片的Drawable对象才可以。 // */ // ImageGetter imageGetter = new ImageGetter() { // // @Override // public Drawable getDrawable(String source) { // URL url; // Drawable drawable = null; // try { // url = new URL(source); // drawable = Drawable.createFromStream( // url.openStream(), null); // Log.e("width:", drawable.getIntrinsicWidth() + ""); // Log.e("height:", drawable.getIntrinsicHeight() + ""); // int[] res = ProcBoundUtil.procBound( // drawable.getIntrinsicWidth(), // drawable.getIntrinsicHeight()); // drawable.setBounds(0, 0, res[0], res[1]); // } catch (MalformedURLException e) { // e.printStackTrace(); // } catch (IOException e) { // e.printStackTrace(); // } // return drawable; // } // }; // CharSequence test = Html.fromHtml(html, imageGetter, null); // msg.what = 0x101; // msg.obj = test; // handler.sendMessage(msg); // } // }); // t.start(); }
public void updateArticleView(int position) { TextView article = (TextView) getActivity().findViewById(R.id.article); article.setMovementMethod(ScrollingMovementMethod.getInstance()); article.setText(Ipsum.Articles[position]); mCurrentPosition = position; }
public void loadComponents() { // set header components catalogsTL = (TableLayout) findViewById(R.id.catalogsTL); catalogsTL.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Log.i(LOG_TAG, "catalogsTL.onClick()..."); showWindow(v); } }); catalogsTV = (TextView) findViewById(R.id.header_tv_catalogs); questionTV = (TextView) findViewById(R.id.questionTV); questionTV.setMovementMethod(ScrollingMovementMethod.getInstance()); listView = (ListView) findViewById(R.id.choicesListView); listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View view, int arg2, long arg3) { List<Choice> choices = question.getChoices(); List<Choice> updChoices = new ArrayList<Choice>(); for (Choice choice : choices) { if (choice.getIndex() == (arg2 + 1)) { choice.setSelect(!choice.isSelect()); } else { if (question.getType() == 2) { // single choices choice.setSelect(false); } } updChoices.add(choice); } question.setChoices(updChoices); // choiceAdapter.refresh(updChoices); saveAnswer(); Message msg = new Message(); msg.what = 0; handler.sendMessage(msg); } }); // set footer components backArrow = (ImageView) findViewById(R.id.backArrow); backArrow.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (qId > 1) { changeQuestion(cId, qId - 1); } } }); pendQueNumber = (Button) findViewById(R.id.pendQueNumber); pendQueNumber.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (pendQuestions.size() > 0) { go2PendingQuestion(mContext); } else { ShowDialog( mContext.getResources().getString(R.string.dialog_note), mContext.getResources().getString(R.string.message_tv_no_question)); } } }); nextArrow = (ImageView) findViewById(R.id.nextArrow); nextArrow.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int maxQuestion = ExamParse.getMaxQuestion(exam, cId); Log.i( LOG_TAG, "maxQuestion of catalog " + String.valueOf(cId) + ":" + String.valueOf(maxQuestion)); if (qId < maxQuestion) { changeQuestion(cId, qId + 1); } } }); }
@Override protected MovementMethod getDefaultMovementMethod() { return ScrollingMovementMethod.getInstance(); }
public Dialog getDialogToShowTips(boolean showFirst, boolean random) { final Dialog dlg = new Dialog(ctx); dlg.setContentView(R.layout.tips_and_tricks); final TextView tipDescription = (TextView) dlg.findViewById(R.id.TipDescription); tipDescription.setMovementMethod(ScrollingMovementMethod.getInstance()); int nextInd = 0; final TIntArrayList toShow = new TIntArrayList(); final int[] historyInd = new int[1]; if (showFirst) { dlg.setTitle(R.string.tip_initial); tipDescription.setText(R.string.tip_initial_t); historyInd[0] = -1; } else if (!random) { nextInd = 0; dlg.setTitle(getTipName(nextInd)); tipDescription.setText(getTipDescription(nextInd)); toShow.add(nextInd); historyInd[0] = 0; } else { nextInd = getNextRandomTipToShow(); dlg.setTitle(getTipName(nextInd)); tipDescription.setText(getTipDescription(nextInd)); toShow.add(nextInd); historyInd[0] = 0; } final Button nextButton = ((Button) dlg.findViewById(R.id.NextButton)); final Button prevButton = (Button) dlg.findViewById(R.id.PreviousButton); prevButton.setEnabled(historyInd[0] > 0); nextButton.setEnabled(historyInd[0] < getNumberOfTips() - 1); nextButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if (historyInd[0] == toShow.size() - 1) { int suggest = 0; if (historyInd[0] >= 0) { suggest = toShow.get(historyInd[0]) + 1; } toShow.add(getNextTipToShow(suggest)); } historyInd[0]++; dlg.setTitle(getTipName(toShow.get(historyInd[0]))); tipDescription.setText(getTipDescription(toShow.get(historyInd[0]))); tipDescription.scrollTo(0, 0); prevButton.setEnabled(historyInd[0] > 0); nextButton.setEnabled(historyInd[0] < getNumberOfTips() - 1); } }); prevButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { if (historyInd[0] > 0) { historyInd[0]--; dlg.setTitle(getTipName(toShow.get(historyInd[0]))); tipDescription.setText(getTipDescription(toShow.get(historyInd[0]))); tipDescription.scrollTo(0, 0); } prevButton.setEnabled(historyInd[0] > 0); nextButton.setEnabled(historyInd[0] < getNumberOfTips() - 1); } }); ((Button) dlg.findViewById(R.id.CloseButton)) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { dlg.dismiss(); } }); return dlg; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Check bluetooth is available. If not, exit if (!checkAndInitBluetooth()) { showMessage(getString(R.string.error_bluetooth_not_available)); finish(); return; } // Initialize the UI components, and register a listeners setContentView(R.layout.main); // Load device picker components mButtonSelectDevice = (LinearLayout) findViewById(R.id.btn_selectdevice); mButtonSelectDevice.setOnClickListener(this); mTextDeviceName = (TextView) findViewById(R.id.deviceName); mTextDeviceAddress = (TextView) findViewById(R.id.deviceAddress); // Load connection components mButtonConnect = (Button) findViewById(R.id.btn_connect); mButtonConnect.setOnClickListener(this); mButtonDisconnect = (Button) findViewById(R.id.btn_disconnect); mButtonDisconnect.setOnClickListener(this); mTextConnectionState = (TextView) findViewById(R.id.connectionState); // Load hello service components mLabelHelloInput = (TextView) findViewById(R.id.label_hello_input); mLabelHelloInput.setText( getString(R.string.label_hello_input, Constants.HELLO_CHARACTERISTIC_INPUT_UUID)); mSpinnerHelloInput = (Spinner) findViewById(R.id.sp_hello_input); mSpinnerHelloInput.setEnabled(false); mButtonReadHelloInput = (Button) findViewById(R.id.btn_read_hello_input); mButtonReadHelloInput.setOnClickListener(this); mLabelHelloConfiguration = (TextView) findViewById(R.id.label_hello_configuration); mLabelHelloConfiguration.setText( getString( R.string.label_hello_configuration, Constants.HELLO_CHARACTERISTIC_CONFIGURATION_UUID)); mEditTextHelloConfiguration = (EditText) findViewById(R.id.value_hello_configuration); mButtonReadHelloConfiguration = (Button) findViewById(R.id.btn_read_hello_configuration); mButtonReadHelloConfiguration.setOnClickListener(this); mButtonWriteHelloConfiguration = (Button) findViewById(R.id.btn_write_hello_configuration); mButtonWriteHelloConfiguration.setOnClickListener(this); // Load device info components mTextManufacturerName = (TextView) findViewById(R.id.value_manufacturer_name); mTextModelNumber = (TextView) findViewById(R.id.value_model_number); mTextSystemId = (TextView) findViewById(R.id.value_system_id); mButtonReadDeviceInfo = (Button) findViewById(R.id.btn_read_device_info); mButtonReadDeviceInfo.setOnClickListener(this); // Load battery info components mTextBatteryLevel = (TextView) findViewById(R.id.value_battery_lvel); mButtonReadBatteryInfo = (Button) findViewById(R.id.btn_read_battery); mButtonReadBatteryInfo.setOnClickListener(this); // Load notification components mTextAreaNotification = (TextView) findViewById(R.id.value_notifications); mTextAreaNotification.setMovementMethod(ScrollingMovementMethod.getInstance()); mButtonClear = (Button) findViewById(R.id.btn_clear); mButtonClear.setOnClickListener(this); // Initialize the device picker UI fragment initDevicePicker(); // refresh the UI component states updateWidgets(); }