List of usage examples for android.text.method ScrollingMovementMethod ScrollingMovementMethod
ScrollingMovementMethod
From source file:br.com.rescue_bots_android.bluetooth.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_blue); ActivityHelper.initialize(this); routeController = new RouteController(this); coordinates = new ArrayList<Path>(); trackerController = new TrackerController(this); Intent intent = getIntent();/* w ww . j a v a2 s. co m*/ Bundle b = intent.getExtras(); mDevice = b.getParcelable(Homescreen.DEVICE_EXTRA); mDeviceUUID = UUID.fromString(b.getString(Homescreen.DEVICE_UUID)); mMaxChars = b.getInt(Homescreen.BUFFER_SIZE); Log.d(TAG, "Ready"); mBtnDisconnect = (Button) findViewById(R.id.btnDisconnect); mBtnSend = (Button) findViewById(R.id.btnSend); mBtnClear = (Button) findViewById(R.id.btnClear); mTxtReceive = (TextView) findViewById(R.id.txtReceive); mEditSend = (EditText) findViewById(R.id.editSend); scrollView = (ScrollView) findViewById(R.id.viewScroll); chkScroll = (CheckBox) findViewById(R.id.chkScroll); chkReceiveText = (CheckBox) findViewById(R.id.chkReceiveText); checkBoxJoystickEnable = (CheckBox) findViewById(R.id.checkBoxJoystickEnable); mBtnClearInput = (Button) findViewById(R.id.btnClearInput); mBtnConfig = (Button) findViewById(R.id.buttonConfig2); //imageButtonClaw (Button)findViewById(R.id.imageButtonClaw); editTextAngle = (TextView) findViewById(R.id.editTextAngle); joystickView = (JoystickView) findViewById(R.id.viewJoystick); //Event listener that always returns the variation of the angle in degrees, motion power in percentage and direction of movement ibClaw = (ImageButton) findViewById(R.id.imageButtonClaw); clawControll = new ClawControll(ibClaw); joystickView.setOnJoystickMoveListener(new OnJoystickMoveListener() { @Override public void onValueChanged(int angle, int power, int direction) { // TODO Auto-generated method stub mTxtReceive.append(" " + String.valueOf(angle) + ""); mTxtReceive.append(" " + String.valueOf(power) + "%"); switch (direction) { case JoystickView.FRONT: mTxtReceive.append("FRONT"); sendSerial("a"); break; case JoystickView.FRONT_RIGHT: mTxtReceive.append("FRONT_RIGHT"); sendSerial("c"); break; case JoystickView.RIGHT: mTxtReceive.append("RIGHT"); sendSerial("c"); break; case JoystickView.RIGHT_BOTTOM: mTxtReceive.append("RIGHT_BOTTOM"); sendSerial("f"); break; case JoystickView.BOTTOM: mTxtReceive.append("BOTTOM"); sendSerial("d"); break; case JoystickView.BOTTOM_LEFT: mTxtReceive.append("BOTTOM_LEFT"); sendSerial("e"); break; case JoystickView.LEFT: mTxtReceive.append("LEFT"); sendSerial("b"); break; case JoystickView.LEFT_FRONT: mTxtReceive.append("LEFT_FRONT"); sendSerial("b"); break; default: mTxtReceive.append("CENTER"); sendSerial("g"); } } }, JoystickView.DEFAULT_LOOP_INTERVAL); mTxtReceive.setMovementMethod(new ScrollingMovementMethod()); mBtnDisconnect.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mIsUserInitiatedDisconnect = true; new DisConnectBT().execute(); } }); mBtnSend.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { try { mBTSocket.getOutputStream().write(mEditSend.getText().toString().getBytes()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); mBtnClear.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mEditSend.setText(""); } }); mBtnClearInput.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { //mTxtReceive.setText(""); if (mBtnClearInput.getText().toString().equalsIgnoreCase(LocationManager.GPS_PROVIDER)) { mBtnClearInput.setText(LocationManager.NETWORK_PROVIDER); gps.setProvider(LocationManager.NETWORK_PROVIDER); } else { mBtnClearInput.setText(LocationManager.GPS_PROVIDER); gps.setProvider(LocationManager.GPS_PROVIDER); } } }); mBtnConfig.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent(MainActivity.this, ConfigActivity.class); startActivity(i); } }); ibClaw.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (clawControll != null) { clawControll.changeState(); } } }); checkBoxJoystickEnable.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (checkBoxJoystickEnable.isChecked()) { joystickEnabled = true; joystickView.setEnabled(true); ibClaw.setEnabled(true); } else { joystickEnabled = false; joystickView.setEnabled(false); ibClaw.setEnabled(false); } } }); joystickView.setEnabled(true); ibClaw.setEnabled(true); initGPSListener(); // initialize your android device sensor capabilities mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); image = (ImageView) findViewById(R.id.compassImg); }
From source file:de.elanev.studip.android.app.frontend.courses.CourseOverviewFragment.java
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (getActivity() == null) { return;// w ww .jav a 2s .c o m } cursor.moveToFirst(); int loaderId = loader.getId(); switch (loaderId) { case COURSE_LOADER: if (!cursor.isAfterLast()) { String courseTitle = cursor .getString(cursor.getColumnIndex(CoursesContract.Columns.Courses.COURSE_TITLE)); String courseDescription = cursor .getString(cursor.getColumnIndex(CoursesContract.Columns.Courses.COURSE_DESCIPTION)); int courseTyp = cursor.getInt(cursor.getColumnIndex(CoursesContract.Columns.Courses.COURSE_TYPE)); mTitleTextView.setText(courseTitle); getActivity().setTitle(courseTitle); String courseTypeString = Settings .fromJson(Prefs.getInstance(getActivity()).getApiSettings()).semTypes.get(courseTyp).name; mCourseTypeTextView.setText(courseTypeString); if (!TextUtils.isEmpty(courseDescription)) { mDescriptionTextView.setText(courseDescription); mDescriptionTextView.setMovementMethod(new ScrollingMovementMethod()); } } break; case COURSE_EVENTS_LOADER: if (cursor.getCount() >= 1) { String room = cursor.getString(cursor.getColumnIndex(EventsContract.Columns.EVENT_ROOM)); String title = cursor.getString(cursor.getColumnIndex(EventsContract.Columns.EVENT_TITLE)); mNextAppointmentTextView.setText(String.format("%s\n%s", title, room)); } break; case COURSE_NEWS_LOADER: if (cursor.getCount() >= 1) { final String newsTopic = cursor.getString(cursor.getColumnIndex(NewsContract.Columns.NEWS_TOPIC)); final Long newsDate = cursor.getLong(cursor.getColumnIndex(NewsContract.Columns.NEWS_MKDATE)); final String newsBody = cursor.getString(cursor.getColumnIndex(NewsContract.Columns.NEWS_BODY)); final String userForename = cursor .getString(cursor.getColumnIndex(UsersContract.Columns.USER_FORENAME)); final String userLastname = cursor .getString(cursor.getColumnIndex(UsersContract.Columns.USER_LASTNAME)); mNewsTitleTextView.setText(newsTopic); mNewsAuthorTextView.setText(TextTools.getLocalizedAuthorAndDateString( String.format("%s %s", userForename, userLastname), newsDate, getActivity())); mNewsAuthorTextView.setVisibility(View.VISIBLE); mNewsShowMoreTextView.setVisibility(View.VISIBLE); mNewsTextTextView.setText(Html.fromHtml(newsBody)); } break; case COURSE_TEACHERS_LOADER: String teachersString; if (!cursor.isAfterLast()) { String teacherAvatarUrl = cursor .getString(cursor.getColumnIndex(UsersContract.Columns.USER_AVATAR_NORMAL)); teachersString = TextTools.createNameSting( cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_TITLE_PRE)), cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_FORENAME)), cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_LASTNAME)), cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_TITLE_POST))); mTeacherNameTextView.setText(teachersString); int teacherCount = cursor.getCount(); if (teacherCount > 1) { teacherCount -= 1; mTeacherCountTextView .setText(String.format(getString(R.string.and_more_teachers), teacherCount)); mTeacherCountTextView.setVisibility(View.VISIBLE); } Picasso.with(mContext).load(teacherAvatarUrl) .resizeDimen(R.dimen.user_image_icon_size, R.dimen.user_image_icon_size).centerCrop() .placeholder(R.drawable.nobody_normal).into(mUserImageView); } break; } }
From source file:org.iotivity.base.examples.fridgeclient.FridgeClient.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fridge_client); registerReceiver(mMessageReceiver, new IntentFilter(StringConstants.INTENT)); mEventsTextView = new TextView(this); mEventsTextView.setMovementMethod(new ScrollingMovementMethod()); LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayout); layout.addView(mEventsTextView,/* w ww . j a v a 2 s. co m*/ new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1f)); ifaces = new LinkedList<>(); ifaces.add(StringConstants.RESOURCE_INTERFACE); mDeviceCode = -1; mDeviceName = ""; initOICStack(); }
From source file:com.microblink.ocr.customcamera.camera2.Camera2Fragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { mTextureView = (AutoFitTextureView) view.findViewById(R.id.texture); mTvResult = (TextView) view.findViewById(R.id.tv_result); mTvResult.setMovementMethod(new ScrollingMovementMethod()); }
From source file:de.elanev.studip.android.app.frontend.messages.MessageDetailFragment.java
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (getActivity() == null || cursor.getCount() < 1) { return;/* www. ja va 2 s. c o m*/ } cursor.moveToFirst(); mMessageId = cursor.getString(cursor.getColumnIndex(MessagesContract.Columns.Messages.MESSAGE_ID)); mSubject = cursor.getString(cursor.getColumnIndex(MessagesContract.Columns.Messages.MESSAGE_SUBJECT)); getActivity().setTitle(mSubject); mDate = cursor.getLong(cursor.getColumnIndex(MessagesContract.Columns.Messages.MESSAGE_MKDATE)); mMessage = cursor.getString(cursor.getColumnIndex(MessagesContract.Columns.Messages.MESSAGE)); mSenderTitlePre = cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_TITLE_PRE)); mSenderForename = cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_FORENAME)); mSenderLastname = cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_LASTNAME)); mSenderTitlePost = cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_TITLE_POST)); mSenderId = cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_ID)); mUserImageUrl = cursor.getString(cursor.getColumnIndex(UsersContract.Columns.USER_AVATAR_NORMAL)); mMessageBodyTextView.setMovementMethod(new ScrollingMovementMethod()); mMessageSubjectTextView.setText(mSubject); if (mMessage != null) { mMessageBodyTextView.setText(Html.fromHtml(mMessage)); } mMessageAuthorTextView.setText( TextTools.createNameSting(mSenderTitlePre, mSenderForename, mSenderLastname, mSenderTitlePost)); mMessageDateTextView.setText(TextTools.getLocalizedTime(mDate, mContext)); Picasso.with(mContext).load(mUserImageUrl) .resizeDimen(R.dimen.user_image_icon_size, R.dimen.user_image_icon_size).centerCrop() .placeholder(R.drawable.nobody_normal).into(mUserImageView); }
From source file:org.rm3l.ddwrt.tiles.syslog.StatusSyslogTile.java
@Override public void onLoadFinished(@NotNull Loader<NVRAMInfo> loader, @Nullable NVRAMInfo data) { //Set tiles// w w w. jav a2s .co m Log.d(LOG_TAG, "onLoadFinished: loader=" + loader + " / data=" + data); layout.findViewById(R.id.tile_status_router_syslog_header_loading_view).setVisibility(View.GONE); layout.findViewById(R.id.tile_status_router_syslog_content_loading_view).setVisibility(View.GONE); layout.findViewById(R.id.tile_status_router_syslog_state).setVisibility(View.VISIBLE); layout.findViewById(R.id.tile_status_router_syslog_content).setVisibility(View.VISIBLE); if (data == null) { data = new NVRAMInfo().setException(new DDWRTNoDataException("No Data!")); } @NotNull final TextView errorPlaceHolderView = (TextView) this.layout .findViewById(R.id.tile_status_router_syslog_error); @Nullable final Exception exception = data.getException(); if (!(exception instanceof DDWRTTileAutoRefreshNotAllowedException)) { if (exception == null) { errorPlaceHolderView.setVisibility(View.GONE); } final String syslogdEnabledPropertyValue = data.getProperty(SYSLOGD_ENABLE); final boolean isSyslogEnabled = "1".equals(syslogdEnabledPropertyValue); final TextView syslogState = (TextView) this.layout.findViewById(R.id.tile_status_router_syslog_state); final View syslogContentView = this.layout.findViewById(R.id.tile_status_router_syslog_content); final EditText filterEditText = (EditText) this.layout .findViewById(R.id.tile_status_router_syslog_filter); syslogState.setText( syslogdEnabledPropertyValue == null ? "-" : (isSyslogEnabled ? "Enabled" : "Disabled")); syslogState.setVisibility(mDisplayStatus ? View.VISIBLE : View.GONE); final TextView logTextView = (TextView) syslogContentView; if (isSyslogEnabled) { //Highlight textToFind for new log lines final String newSyslog = data.getProperty(SYSLOG, EMPTY_STRING); //Hide container if no data at all (no existing data, and incoming data is empty too) final View scrollView = layout.findViewById(R.id.tile_status_router_syslog_content_scrollview); //noinspection ConstantConditions Spanned newSyslogSpan = new SpannableString(newSyslog); final SharedPreferences sharedPreferences = this.mParentFragmentPreferences; final String existingSearch = sharedPreferences != null ? sharedPreferences.getString(getFormattedPrefKey(LAST_SEARCH), null) : null; if (!isNullOrEmpty(existingSearch)) { if (isNullOrEmpty(filterEditText.getText().toString())) { filterEditText.setText(existingSearch); } if (!isNullOrEmpty(newSyslog)) { //noinspection ConstantConditions newSyslogSpan = findAndHighlightOutput(newSyslog, existingSearch); } } // if (!(isNullOrEmpty(existingSearch) || isNullOrEmpty(newSyslog))) { // filterEditText.setText(existingSearch); // //noinspection ConstantConditions // newSyslogSpan = findAndHighlightOutput(newSyslog, existingSearch); // } if (isNullOrEmpty(logTextView.getText().toString()) && isNullOrEmpty(newSyslog)) { scrollView.setVisibility(View.INVISIBLE); } else { scrollView.setVisibility(View.VISIBLE); logTextView.setMovementMethod(new ScrollingMovementMethod()); logTextView.append( new SpannableStringBuilder().append(Html.fromHtml("<br/>")).append(newSyslogSpan)); } filterEditText.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { final int DRAWABLE_LEFT = 0; final int DRAWABLE_TOP = 1; final int DRAWABLE_RIGHT = 2; final int DRAWABLE_BOTTOM = 3; if (event.getAction() == MotionEvent.ACTION_UP) { if (event.getRawX() >= (filterEditText.getRight() - filterEditText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { //Reset everything filterEditText.setText(EMPTY_STRING); //this will trigger the TextWatcher, thus disabling the "Find" button //Highlight text in textview final String currentText = logTextView.getText().toString(); logTextView.setText(currentText.replaceAll(SLASH_FONT_HTML, EMPTY_STRING) .replaceAll(FONT_COLOR_YELLOW_HTML, EMPTY_STRING)); if (sharedPreferences != null) { final SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(getFormattedPrefKey(LAST_SEARCH), EMPTY_STRING); editor.apply(); } return true; } } return false; } }); filterEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { final String textToFind = filterEditText.getText().toString(); if (isNullOrEmpty(textToFind)) { //extra-check, even though we can be pretty sure the button is enabled only if textToFind is present return true; } if (sharedPreferences != null) { if (textToFind.equalsIgnoreCase(existingSearch)) { //No need to go further as this is already the string we are looking for return true; } final SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(getFormattedPrefKey(LAST_SEARCH), textToFind); editor.apply(); } //Highlight text in textview final String currentText = logTextView.getText().toString(); logTextView.setText( findAndHighlightOutput(currentText.replaceAll(SLASH_FONT_HTML, EMPTY_STRING) .replaceAll(FONT_COLOR_YELLOW_HTML, EMPTY_STRING), textToFind)); return true; } return false; } }); } } if (exception != null && !(exception instanceof DDWRTTileAutoRefreshNotAllowedException)) { //noinspection ThrowableResultOfMethodCallIgnored final Throwable rootCause = Throwables.getRootCause(exception); errorPlaceHolderView.setText("Error: " + (rootCause != null ? rootCause.getMessage() : "null")); final Context parentContext = this.mParentFragmentActivity; errorPlaceHolderView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { //noinspection ThrowableResultOfMethodCallIgnored if (rootCause != null) { Toast.makeText(parentContext, rootCause.getMessage(), Toast.LENGTH_LONG).show(); } } }); errorPlaceHolderView.setVisibility(View.VISIBLE); } doneWithLoaderInstance(this, loader, R.id.tile_status_router_syslog_togglebutton_title, R.id.tile_status_router_syslog_togglebutton); Log.d(LOG_TAG, "onLoadFinished(): done loading!"); }
From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); acquireCpuWakeLock();/* ww w .j a v a 2s . c o m*/ KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); km.inKeyguardRestrictedInputMode(); if (km.inKeyguardRestrictedInputMode()) { Log.i(TAG, " ??"); isKeyguardRestrictedInputMode = true; } else { Log.i(TAG, " ??"); } mLastNetworkStatus = NetworkUtils.isConnected(this); Intent intent = getIntent(); if (intent == null || !PushConstants.ACTION_PUSH_MESSAGE_RECEIVED.equals(intent.getAction())) { Log.d(TAG, "empty or none broadcast intent value ..."); finishActivity(); return; } mBroadcastData = intent.getParcelableExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA); if (mBroadcastData == null) { Log.d(TAG, ">> payload data is null"); finishActivity(); return; } mBroadcastPayloadIdx = intent.getLongExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, -1); Log.d(TAG, ">> onCreate() mBroadcastPayloadIdx= " + mBroadcastPayloadIdx); // ? ms ? ?? ? ? ? ???? // broadcast ? . // ?? ?? ??. Intent i = new Intent(this, RealtimeBroadcastActivity.class); i.setAction(intent.getAction()); i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA, mBroadcastData); i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, mBroadcastPayloadIdx); LocalBroadcastManager.getInstance(this).sendBroadcast(i); IntentFilter filter = new IntentFilter(); filter.addAction(PushConstants.ACTION_PUSH_MESSAGE_RECEIVED); filter.addAction(Constants.ACTION_BROWSER_ACTIVITY_CLOSE); LocalBroadcastManager.getInstance(this).registerReceiver(mBroadcastReceiver, filter); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); registerReceiver(mBroadcastReceiver, intentFilter); hideSystemUI(); /* final Window win = getWindow(); win.setFlags( WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD, WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON); */ if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) { setContentView(R.layout.fragment_text_broadcast); } else { setContentView(R.layout.fragment_audio_broadcast); } getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) { mcheckText2SpeechLister = this; // ? mTextView = (TextView) findViewById(R.id.broadcast_text); mTextView.setText(mBroadcastData.getMessage()); mTextView.setVerticalScrollBarEnabled(true); mTextView.setHorizontalScrollBarEnabled(false); mTextView.setMovementMethod(new ScrollingMovementMethod()); mHandler.sendEmptyMessageDelayed(HANDLER_MESSAGE_SETUP_CURRENT_PLAYING, 800); Log.d(TAG, "text broadcast = " + mBroadcastData.getMessage()); mText2SpeechHandler = new TextToSpeechHandler(this, this); checkText2SpeechAvailable(); mIsTTS = true; } else { // , ?? mWebView = (WebView) findViewById(R.id.webview); mWebViewClient = new RealtimeBroadcastWebViewClient(this, mWebView, this); mWebViewClient.setBackgroundTransparent(); String url = mBroadcastData.getMessage(); if (url.indexOf("?") > 0) { if (!url.contains("UUID=")) { url += ("&UUID=" + LauncherSettings.getInstance(this).getDeviceID()); } if (!url.contains("APPID=")) { url += ("&APPID=" + getApplicationContext().getPackageName()); } } else { if (!url.contains("UUID=")) { url += ("?UUID=" + LauncherSettings.getInstance(this).getDeviceID()); } if (!url.contains("APPID=")) { if (!url.contains("UUID=")) { url += ("?APPID=" + getApplicationContext().getPackageName()); } else { url += ("&APPID=" + getApplicationContext().getPackageName()); } } } mWebViewClient.loadUrl(url); mIsTTS = false; } AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mStreamMusicVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC); audio.setStreamVolume(AudioManager.STREAM_MUSIC, audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC), AudioManager.FLAG_PLAY_SOUND); if (Constants.OPEN_BETA_PHONE && LauncherSettings.getInstance(this).isSmartPhone()) { StateListener phoneStateListener = new StateListener(); TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); } }
From source file:cc.echonet.coolmicapp.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home);// www. ja v a 2s. c om timerValue = (TextView) findViewById(R.id.timerValue); BroadcastReceiver mPowerKeyReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String strAction = intent.getAction(); if (strAction.equals(Intent.ACTION_SCREEN_OFF) || strAction.equals(Intent.ACTION_SCREEN_ON) || strAction.equals(Intent.ACTION_USER_PRESENT)) { if (isThreadOn) { RedFlashLight(); } } } }; final IntentFilter theFilter = new IntentFilter(); /** System Defined Broadcast */ theFilter.addAction(Intent.ACTION_SCREEN_ON); theFilter.addAction(Intent.ACTION_SCREEN_OFF); theFilter.addAction(Intent.ACTION_USER_PRESENT); getApplicationContext().registerReceiver(mPowerKeyReceiver, theFilter); imageView1 = (ImageView) findViewById(R.id.imageView1); Log.v("onCreate", (imageView1 == null ? "iv null" : "iv ok")); android.view.ViewGroup.LayoutParams layoutParams = imageView1.getLayoutParams(); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { layoutParams.height = 400; } else { layoutParams.height = 180; } imageView1.setLayoutParams(layoutParams); myClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); animation.setDuration(500); // duration - half a second animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely animation.setRepeatMode(Animation.REVERSE); start_button = (Button) findViewById(R.id.start_recording_button); stop_button = (Button) findViewById(R.id.stop_recording_button); buttonColor = start_button.getBackground(); logArea = (TextView) findViewById(R.id.log_area); logArea.setMovementMethod(new ScrollingMovementMethod()); coolmic = new CoolMic(this, "default"); if (Wrapper.getState() == Wrapper.WrapperInitializationStatus.WRAPPER_UNINITIALIZED) { if (Wrapper.init() == Wrapper.WrapperInitializationStatus.WRAPPER_INITIALIZATION_ERROR) { Log.d("WrapperInit", Wrapper.getInitException().toString()); Toast.makeText(getApplicationContext(), "Could not initialize native components :( Blocking controls!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "Native components initialized!", Toast.LENGTH_SHORT) .show(); } } else if (Wrapper.init() == Wrapper.WrapperInitializationStatus.WRAPPER_INITIALIZATION_ERROR) { Toast.makeText(getApplicationContext(), "Previous problem detected with native components :( Blocking controls!", Toast.LENGTH_SHORT) .show(); } else if (Wrapper.init() != Wrapper.WrapperInitializationStatus.WRAPPER_INTITIALIZED) { Toast.makeText(getApplicationContext(), "Native components in unknown state!", Toast.LENGTH_SHORT) .show(); } txtListeners = (TextView) findViewById(R.id.txtListeners); IntentFilter mStatusIntentFilter = new IntentFilter(Constants.BROADCAST_STREAM_STATS_SERVICE); LocalBroadcastManager.getInstance(this).registerReceiver(mStreamStatsReceiver, mStatusIntentFilter); }
From source file:com.inmobi.ultrapush.AnalyzeActivity.java
private void showInstructions() { TextView tv = new TextView(this); tv.setMovementMethod(new ScrollingMovementMethod()); tv.setText(Html.fromHtml(getString(R.string.instructions_text))); new AlertDialog.Builder(this).setTitle(R.string.instructions_title).setView(tv) .setNegativeButton(R.string.dismiss, null).create().show(); }
From source file:com.esminis.server.library.activity.main.MainViewImpl.java
@Override public void setMessage(boolean preloaderBackground, boolean preloader, String buttonTitle, String message) { final Activity activity = this.activity.get(); if (activity == null) { return;//from w w w .j a va2 s .c om } activity.findViewById(R.id.preloader_container) .setVisibility(preloaderBackground ? View.VISIBLE : View.GONE); if (preloaderBackground) { final Button button = (Button) activity.findViewById(R.id.preloader_button_ok); button.setVisibility(buttonTitle != null ? View.VISIBLE : View.GONE); button.setText(buttonTitle); activity.findViewById(R.id.preloader).setVisibility(preloader ? View.VISIBLE : View.GONE); TextView textView = (TextView) activity.findViewById(R.id.preloader_label); textView.setMovementMethod(new ScrollingMovementMethod()); textView.setText(message); } }