List of usage examples for android.text.method ScrollingMovementMethod ScrollingMovementMethod
ScrollingMovementMethod
From source file:org.chromium.latency.walt.ScreenResponseFragment.java
void finishAndShowStats() { setFullScreen(false);/*from ww w . j a va2 s. co m*/ // Stop the USB listener waltDevice.stopListener(); // Unregister trigger handler waltDevice.clearTriggerHandler(); waltDevice.sendAndFlush(WaltDevice.CMD_AUTO_SCREEN_OFF); waltDevice.checkDrift(); // Show deltas and the median /* // Debug printouts logger.log("deltas = array(" + deltas.toString() + ")"); logger.log("deltas_w2b = array(" + deltas_w2b.toString() + ")"); logger.log("deltas_b2w = array(" + deltas_b2w.toString() + ")"); */ double median_b2w = Utils.median(deltas_b2w); double median_w2b = Utils.median(deltas_w2b); logger.log(String.format(Locale.US, "\n-------------------------------\n" + "Median screen response latencies (N=%d):\n" + "Black to white: %.1f ms (N=%d)\n" + "White to black: %.1f ms (N=%d)\n" + "Average: %.1f ms\n" + "-------------------------------\n", deltas.size(), median_b2w, deltas_b2w.size(), median_w2b, deltas_w2b.size(), (median_b2w + median_w2b) / 2)); if (traceLogger != null) traceLogger.flush(getContext()); fastSurfaceView.setVisibility(View.GONE); blackBox.setVisibility(View.VISIBLE); blackBox.setText(logger.getLogText()); blackBox.setMovementMethod(new ScrollingMovementMethod()); blackBox.setBackgroundColor(color_gray); stopButton.setEnabled(false); startButton.setEnabled(true); if (shouldShowLatencyChart) { latencyChart.setLabel(W2B_INDEX, String.format(Locale.US, "White-to-black m=%.1f ms", median_w2b)); latencyChart.setLabel(B2W_INDEX, String.format(Locale.US, "Black-to-white m=%.1f ms", median_b2w)); } LogUploader.uploadIfAutoEnabled(getContext()); }
From source file:nl.hnogames.domoticz.app.DomoticzDashboardFragment.java
private void showDebugLayout() { try {/*from w w w . j a v a 2 s . c om*/ if (root != null) { LinearLayout debugLayout = (LinearLayout) root.findViewById(R.id.debugLayout); if (debugLayout != null) { debugLayout.setVisibility(View.VISIBLE); debugText = (TextView) root.findViewById(R.id.debugText); if (debugText != null) { debugText.setMovementMethod(new ScrollingMovementMethod()); } } } } catch (Exception ignored) { } }
From source file:eu.intermodalics.tango_ros_streamer.activities.RunningActivity.java
private void setupUI() { setContentView(R.layout.running_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);// ww w.j a va 2 s . co m mUriTextView = (TextView) findViewById(R.id.master_uri); mUriTextView.setText(mMasterUri); mRosLightImageView = (ImageView) findViewById(R.id.is_ros_ok_image); mTangoLightImageView = (ImageView) findViewById(R.id.is_tango_ok_image); mlogSwitch = (Switch) findViewById(R.id.log_switch); mlogSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { mDisplayLog = isChecked; mLogTextView.setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE); } }); mLogTextView = (TextView) findViewById(R.id.log_view); mLogTextView.setMovementMethod(new ScrollingMovementMethod()); mSaveMapButton = (Button) findViewById(R.id.save_map_button); mSaveMapButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showSaveMapDialog(); } }); mLoadOccupancyGridButton = (Button) findViewById(R.id.load_occupancy_grid_button); mLoadOccupancyGridButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mOccupancyGridNameList = new ArrayList<String>(); try { String directory = mParameterNode .getStringParam(getString(R.string.occupancy_grid_directory_key)); File occupancyGridDirectory = new File(directory); if (occupancyGridDirectory != null && occupancyGridDirectory.isDirectory()) { File[] files = occupancyGridDirectory.listFiles(); for (File file : files) { if (FilenameUtils.getExtension(file.getName()).equals("yaml")) { mOccupancyGridNameList.add(FilenameUtils.removeExtension(file.getName())); } } } showLoadOccupancyGridDialog(/* firstTry */ true, mOccupancyGridNameList); } catch (RuntimeException e) { e.printStackTrace(); } } }); updateLoadAndSaveMapButtons(); }
From source file:fi.vtt.moodtracker.ClimbTrackerActivity.java
private void getConfigJSON() { // Get a reference to our posts // Firebase ref = new Firebase(getResources().getString(R.string.firebase_url) + "/foor"); // Attach an listener to read the data at our posts reference // mFirebaseRef.orderByChild("questions").addValueEventListener(new ValueEventListener() { mFirebaseRef.orderByPriority().addValueEventListener(new ValueEventListener() { // mFirebaseRef.addValueEventListener(new ValueEventListener() { @Override/*from w w w . j ava2s . co m*/ public void onDataChange(DataSnapshot snapshot) { //TODO: Lost my nerves with GSON TypeAdapters, Maps and Firebase. //TODO: Repair ugly parsing by StringBuilder System.out.println(snapshot.getValue()); StringBuilder sb = new StringBuilder(); try { Map<String, Object> map = (Map<String, Object>) snapshot.getValue(); /* Questionnaire questionnaire = new Questionnaire(); // questionnaire.setId((String) map.get("id")); questionnaire.setDescription((String) map.get("description")); questionnaire.setInterval(safeLongToInt((Long) map.get("interval"))); questionnaire.setTitle((String) map.get("title")); System.out.println(questionnaire.getId()); System.out.println(questionnaire.getDescription()); System.out.println(Integer.toString(questionnaire.getInterval())); System.out.println(questionnaire.getTitle());*/ sb.append("{\"id\":\""); sb.append((String) map.get("id")); sb.append("\",\"description\":\""); // sb.append("{\"description\":\""); sb.append((String) map.get("description")); sb.append("\",\"interval\":"); // sb.append(safeLongToInt((Long) map.get("interval"))); sb.append(Integer.valueOf((String) map.get("interval"))); sb.append(",\"title\":\""); sb.append((String) map.get("title")); sb.append("\",\"questions\":["); for (DataSnapshot child : snapshot.getChildren()) { // List<Question> questions = new ArrayList<Question>(); for (DataSnapshot child2 : child.getChildren()) { Map<Object, Object> map2 = (Map<Object, Object>) child2.getValue(); /* Question question = new Question(); question.setQuestion((String) map2.get("question")); question.setType((String) map2.get("type"));*/ sb.append("{\"question\":\""); sb.append((String) map2.get("question")); sb.append("\",\"type\":\""); sb.append((String) map2.get("type")); sb.append("\",\"choices\":["); for (DataSnapshot child3 : child2.getChildren()) { // List<Choice> choices = new ArrayList<Choice>(); for (DataSnapshot child4 : child3.getChildren()) { Map<Object, Object> map3 = (Map<Object, Object>) child4.getValue(); /* Choice choice = new Choice(); choice.setEmoji((String) map3.get("emoji")); choice.setTitle((String) map3.get("title")); choice.setValue((safeLongToInt((Long) map3.get("value")))); choices.add(choice);*/ sb.append("{\"emoji\":\""); sb.append((String) map3.get("emoji")); sb.append("\",\"title\":\""); sb.append((String) map3.get("title")); sb.append("\",\"value\":"); sb.append(safeLongToInt((Long) map3.get("value"))); sb.append("},"); } // question.setChoices(choices); } sb.deleteCharAt(sb.length() - 1); sb.append("]},"); // questions.add(question); } // questionnaire.setQuestions(questions); } sb.deleteCharAt(sb.length() - 1); sb.append("]}"); System.out.println(sb.toString()); // Gson gson = new Gson(); Gson gson = new GsonBuilder().setPrettyPrinting().create(); // Gson gson = new GsonBuilder() // .registerTypeAdapter(Questionnaire.class, ) // .registerTypeAdapter(Id.class, new IdTypeAdapter()) // .enableComplexMapKeySerialization() // .serializeNulls() // .setDateFormat(DateFormat.LONG) // .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) // .setPrettyPrinting() // .setVersion(1.0) // .create(); // java.lang.reflect.Type type = new TypeToken <ArrayList<Question>>() {}.getType(); // configJSON = gson.toJson(questionnaire, Questionnaire.class); configJSON = gson.toJson(snapshot.getValue()); // System.out.println(configJSON); // sendJSONToWear(configJSON); configJSONBuffer = sb.toString(); sendJSONToWear(); jsonScreen.setMovementMethod(new ScrollingMovementMethod()); jsonScreen.setText(configJSON); } catch (Exception e) { e.printStackTrace(); sb.setLength(0); sb.append("Check Firebase content"); jsonScreen.setText(sb.toString()); Toast.makeText(getApplicationContext(), "Check Firebase content", Toast.LENGTH_LONG).show(); } } @Override public void onCancelled(FirebaseError firebaseError) { System.out.println("The read failed: " + firebaseError.getMessage()); } }); }
From source file:se.toxbee.sleepfighter.activity.EditGPSFilterAreaActivity.java
/** * Sets up the help splash./*from w w w . j a va2 s .c o m*/ */ private void setupSplash() { this.splashInfoContainer = (LinearLayout) this.findViewById(R.id.edit_gpsfilter_area_splash); TextView textView = (TextView) this.splashInfoContainer.findViewById(R.id.edit_gpsfilter_area_splash_text); textView.setText(Html.fromHtml(this.getString(R.string.edit_gpsfilter_area_splash_text))); textView.setMovementMethod(new ScrollingMovementMethod()); // Define fade out animation. this.splashFadeOut = new AlphaAnimation(1.00f, 0.00f); this.splashFadeOut.setDuration(SPLASH_FADE_DELAY); this.splashFadeOut.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { splashInfoContainer.setVisibility(View.GONE); } }); // Don't show if not new and we got polygon. if (!this.isConsideredFresh()) { this.splashInfoContainer.setVisibility(View.GONE); } }
From source file:com.concentricsky.android.khanacademy.app.VideoListActivity.java
private void setParentTopic(Topic topic) { this.topic = topic; if (topic != null) { topicId = topic.getId();//from w w w . j a v a2 s . c o m // header ((TextView) headerView.findViewById(R.id.header_video_list_title)).setText(topic.getTitle()); String desc = topic.getDescription(); TextView descView = (TextView) headerView.findViewById(R.id.header_video_list_description); if (desc != null && desc.length() > 0) { descView.setText(Html.fromHtml(desc).toString()); descView.setVisibility(View.VISIBLE); descView.setMovementMethod(new ScrollingMovementMethod()); } else { descView.setVisibility(View.GONE); } final ImageView thumb = (ImageView) headerView.findViewById(R.id.header_video_list_thumbnail); if (thumb != null) { new AsyncTask<Void, Void, Bitmap>() { @Override public Bitmap doInBackground(Void... arg) { Bitmap bmp = thumbnailManager.getThumbnail(VideoListActivity.this.topic.getThumb_id(), Thumbnail.QUALITY_SD); return bmp; } @Override public void onPostExecute(Bitmap bmp) { thumb.setImageBitmap(bmp); } }.execute(); } String countFormat; int param; if (isShowingDownloadedVideosOnly()) { countFormat = getString(R.string.format_downloaded_count); param = dataService.getOfflineVideoManager().getDownloadCountForTopic(dataService.getHelper(), topicId, 1); } else { countFormat = getString(R.string.format_video_count); param = topic.getVideo_count(); } ((TextView) headerView.findViewById(R.id.header_video_list_count)) .setText(String.format(countFormat, param)); listView.setAdapter(new VideoAdapter(this)); resetListContents(topic.getId()); } }
From source file:com.ratebeer.android.gui.fragments.BeerViewFragment.java
/** * Overrides the different textual details about this beer, as shown as header * @param details The beer details object containing the texts to show *///from ww w. j a v a2 s .co m public void setDetails(BeerDetails details) { nameText.setText(details.beerName); brewernameButton.setText(getString(R.string.details_bybrewer, details.brewerName)); brewernameButton.setVisibility(View.VISIBLE); boolean noScoreYet = details.overallPerc == GetBeerDetailsCommand.NO_SCORE_YET; noscoreyetText.setVisibility(noScoreYet ? View.VISIBLE : View.GONE); scoreCard.setVisibility(noScoreYet ? View.GONE : View.VISIBLE); scoreText.setText(String.format("%.0f", details.overallPerc)); stylepctlText.setText(String.format("%.0f", details.stylePerc)); ratingsText.setText(ratingsCount == UNKNOWN_RATINGS_COUNT ? "?" : Integer.toString(ratingsCount)); abvstyleButton.setText(getString(R.string.details_abvstyle, details.beerStyle, String.format(DECIMAL_FORMATTER, details.alcohol))); abvstyleButton.setVisibility(View.VISIBLE); descriptionText.setText(Html.fromHtml(details.description == null || details.description.equals("") ? getString(R.string.details_nodescription) : details.description.replace("\n", "<br />"))); descriptionText.setMovementMethod(new ScrollingMovementMethod()); // Only show the buttons bar if we have a signed in user drinkingThisButton.setVisibility(getUser() != null ? View.VISIBLE : View.GONE); addAvailabilityButton.setVisibility(getUser() != null ? View.VISIBLE : View.GONE); // Only show the cellar buttons bar if we have a signed in premium user wantthisButton.setVisibility(getUser() != null && getUser().isPremium() ? View.VISIBLE : View.GONE); havethisButton.setVisibility(getUser() != null && getUser().isPremium() ? View.VISIBLE : View.GONE); }
From source file:link.kjr.file_manager.MainActivity.java
public void license(MenuItem item) { InputStream is = getResources().openRawResource(R.raw.license); String li = ""; byte[] data = new byte[1024]; int length;//from w w w .jav a2 s . com try { length = is.read(data, 0, 1024); while (length > 0) { Log.i(BuildConfig.APPLICATION_ID, li); li += (new String(data)); length = is.read(data, 0, 1024); } } catch (IOException ioe) { ioe.printStackTrace(); } AlertDialog.Builder ab = new AlertDialog.Builder(this); TextView tv = new TextView(this); tv.setMovementMethod(new ScrollingMovementMethod()); tv.setText(li); ab.setView(tv); ab.create().show(); }
From source file:com.example.nfcreaderorigin.MainActivity.java
/** Called when the activity is first created. */ @Override//from w ww .ja v a 2 s . c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setBlockNumber(); // Get USB manager mManager = (UsbManager) getSystemService(Context.USB_SERVICE); // Initialize reader mReader = new Reader(mManager); mReader.setOnStateChangeListener(new OnStateChangeListener() { @Override public void onStateChange(int slotNum, int prevState, int currState) { if (prevState < Reader.CARD_UNKNOWN || prevState > Reader.CARD_SPECIFIC) { prevState = Reader.CARD_UNKNOWN; } if (currState < Reader.CARD_UNKNOWN || currState > Reader.CARD_SPECIFIC) { currState = Reader.CARD_UNKNOWN; } // Create output string final String outputString = "Slot " + slotNum + ": " + stateStrings[prevState] + " -> " + stateStrings[currState]; final String state = stateStrings[currState]; // Show output runOnUiThread(new Runnable() { @Override public void run() { logMsg(outputString); if (state.equals("Present")) { mAuthenticateRead = false; if (mReadMode) { setBlockNumber(); try { mTaskReadStart = false; mTaskStart = false; mTaskWriteStart = false; TimeRead = 0; TimeWrite = 0; timeEnd = 0; initStart = 0; nowRead = 0; nowWrite = 0; nowStart = 0; mBlockAuthen = true; mReadMode = true; mWriteMode = false; System.gc(); reader(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }); } }); // Register receiver for USB permission mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0); IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_USB_PERMISSION); filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED); registerReceiver(mReceiver, filter); sdf = new SimpleDateFormat("mm:ss.SSS"); mResponseTextView = (TextView) findViewById(R.id.main_text_view_response); mResponseTextView.setMovementMethod(new ScrollingMovementMethod()); mResponseTextView.setMaxLines(MAX_LINES); mResponseTextView.setText(""); mTextType = (TextView) findViewById(R.id.textType); mReadTime = (TextView) findViewById(R.id.textViewReadSet); mWriteTime = (TextView) findViewById(R.id.textViewWriteSet); mEndTime = (TextView) findViewById(R.id.textViewEndSet); mWriteType = (EditText) findViewById(R.id.EditText_writeDataType); mQty = (EditText) findViewById(R.id.QTY); formatter = new DecimalFormat("###,###,###.##"); mWriteDataBalanceEditText = (EditText) findViewById(R.id.EditText_writeDataBalance); mWriteDataIdEditText = (EditText) findViewById(R.id.EditText_writeDataId); mTextMode = (TextView) findViewById(R.id.textMode); mTextBalance = (TextView) findViewById(R.id.BALANCE); mTextId = (TextView) findViewById(R.id.textId); // Initialize reader spinner for (UsbDevice device : mManager.getDeviceList().values()) { if (mReader.isSupported(device)) { mReaderAdapterX = device.getDeviceName().toString(); } } // Initialize open button mOpenButton = (Button) findViewById(R.id.btnStart); mOpenButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { getDevices(); // Disable open button mOpenButton.setEnabled(false); } }); // Initialize close button mCloseButton = (Button) findViewById(R.id.btnStop); mCloseButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Disable buttons mOpenButton.setEnabled(false); // Clear slot items // Close reader logMsg("Closing reader..."); new CloseTask().execute(); } }); mWriteData = (Button) findViewById(R.id.btnWrite); mWriteData.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mAuthenticateRead == true) { mBlockWrite = true; setBlockNumber(); mReadMode = false; mWriteMode = true; mTextMode.setText("- W R I T E -"); // mReadData.setVisibility(View.VISIBLE); // mWriteData.setVisibility(View.GONE); try { writer(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { Toast.makeText(getApplicationContext(), "Please Authenticate first", Toast.LENGTH_SHORT).show(); } } }); mReadData = (Button) findViewById(R.id.btnRead); mReadData.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mBlockAuthen = true; setBlockNumber(); mReadMode = true; mWriteMode = false; mTextMode.setText("- R E A D -"); // mReadData.setVisibility(View.GONE); // mWriteData.setVisibility(View.VISIBLE); } }); // PIN verification command (ACOS3) byte[] pinVerifyData = { (byte) 0x80, 0x20, 0x06, 0x00, 0x08, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }; // Initialize PIN verify structure (ACOS3) mPinVerify.setTimeOut(0); mPinVerify.setTimeOut2(0); mPinVerify.setFormatString(0); mPinVerify.setPinBlockString(0x08); mPinVerify.setPinLengthFormat(0); mPinVerify.setPinMaxExtraDigit(0x0408); mPinVerify.setEntryValidationCondition(0x03); mPinVerify.setNumberMessage(0x01); mPinVerify.setLangId(0x0409); mPinVerify.setMsgIndex(0); mPinVerify.setTeoPrologue(0, 0); mPinVerify.setTeoPrologue(1, 0); mPinVerify.setTeoPrologue(2, 0); mPinVerify.setData(pinVerifyData, pinVerifyData.length); // PIN modification command (ACOS3) byte[] pinModifyData = { (byte) 0x80, 0x24, 0x00, 0x00, 0x08, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }; // Initialize PIN modify structure (ACOS3) mPinModify.setTimeOut(0); mPinModify.setTimeOut2(0); mPinModify.setFormatString(0); mPinModify.setPinBlockString(0x08); mPinModify.setPinLengthFormat(0); mPinModify.setInsertionOffsetOld(0); mPinModify.setInsertionOffsetNew(0); mPinModify.setPinMaxExtraDigit(0x0408); mPinModify.setConfirmPin(0x01); mPinModify.setEntryValidationCondition(0x03); mPinModify.setNumberMessage(0x02); mPinModify.setLangId(0x0409); mPinModify.setMsgIndex1(0); mPinModify.setMsgIndex2(0x01); mPinModify.setMsgIndex3(0); mPinModify.setTeoPrologue(0, 0); mPinModify.setTeoPrologue(1, 0); mPinModify.setTeoPrologue(2, 0); mPinModify.setData(pinModifyData, pinModifyData.length); // Initialize read key option mReadKeyOption.setTimeOut(0); mReadKeyOption.setPinMaxExtraDigit(0x0408); mReadKeyOption.setKeyReturnCondition(0x01); mReadKeyOption.setEchoLcdStartPosition(0); mReadKeyOption.setEchoLcdMode(0x01); // Disable buttons // mCloseButton.setEnabled(false); // mControlButton.setEnabled(false); // Hide input window getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); }
From source file:com.google.sample.cast.refplayer.mediaplayer.LocalPlayerActivity.java
private void loadViews() { mVideoView = (VideoView) findViewById(R.id.videoView1); mTitleView = (TextView) findViewById(R.id.titleTextView); mDescriptionView = (TextView) findViewById(R.id.descriptionTextView); mDescriptionView.setMovementMethod(new ScrollingMovementMethod()); mAuthorView = (TextView) findViewById(R.id.authorTextView); mStartText = (TextView) findViewById(R.id.startText); mStartText.setText(Utils.formatMillis(0)); mEndText = (TextView) findViewById(R.id.endText); mSeekbar = (SeekBar) findViewById(R.id.seekBar1); mPlayPause = (ImageView) findViewById(R.id.playPauseImageView); mLoading = (ProgressBar) findViewById(R.id.progressBar1); mControllers = findViewById(R.id.controllers); mContainer = findViewById(R.id.container); mCoverArt = (ImageView) findViewById(R.id.coverArtView); ViewCompat.setTransitionName(mCoverArt, getString(R.string.transition_image)); mPlayCircle = (ImageButton) findViewById(R.id.play_circle); mPlayCircle.setOnClickListener(new OnClickListener() { @Override//from w w w. j av a 2 s . c om public void onClick(View v) { togglePlayback(); } }); }