Example usage for android.text.method ScrollingMovementMethod ScrollingMovementMethod

List of usage examples for android.text.method ScrollingMovementMethod ScrollingMovementMethod

Introduction

In this page you can find the example usage for android.text.method ScrollingMovementMethod ScrollingMovementMethod.

Prototype

ScrollingMovementMethod

Source Link

Usage

From source file:it.crs4.most.ehrlib.widgets.DvTextWidget.java

/**
 * Instantiates a new {@link DvTextWidget}
 *
 * @param provider the widget provider/*from   ww  w.  j a va 2  s . co  m*/
 * @param name the name of this widget
 * @param path the path of the {@link DvText} mapped on this widget
 * @param attributes the attributes of the {@link DvText} mapped on this widget
 * @param parentIndex the parent index
 */
public DvTextWidget(WidgetProvider provider, String name, String path, JSONObject attributes, int parentIndex) {
    super(provider, name, new DvText(path, attributes), parentIndex);

    LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.dv_text, null);

    _root_view = view;

    _title = (TextView) _root_view.findViewById(R.id.txt_title);
    _txtvalidity = (TextView) _root_view.findViewById(R.id.txt_validity);
    _input = (EditText) _root_view.findViewById(R.id.txt_text);

    _input.setMovementMethod(new ScrollingMovementMethod());

    this.updateLabelsContent();

    _help = (ImageView) _root_view.findViewById(R.id.image_help);

    toolTipRelativeLayout = (ToolTipRelativeLayout) _root_view
            .findViewById(R.id.activity_main_tooltipRelativeLayout);

    _help.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (myToolTipView == null) {
                myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, _help);
                //myToolTipView.setOnToolTipViewClickedListener(DvTextWidget.this);
            } else {
                myToolTipView.remove();
                myToolTipView = null;

            }
        }
    });

}

From source file:com.inmobi.ultrapush.InfoRecActivity.java

@Override
protected void onResume() {
    super.onResume();
    TextView tv = (TextView) findViewById(R.id.textview_info_rec);
    tv.setMovementMethod(new ScrollingMovementMethod());

    tv.setText("Testing..."); // TODO: No use...
    tv.invalidate();/*  w ww.j a  v  a 2  s. com*/

    // Show supported sample rate and corresponding minimum buffer size.
    String[] requested = new String[] { "8000", "11025", "16000", "22050", "32000", "44100", "48000", "96000" };
    String st = "sampleRate minBufSize\n";
    ArrayList<String> validated = new ArrayList<String>();
    for (String s : requested) {
        int rate = Integer.parseInt(s);
        int minBufSize = AudioRecord.getMinBufferSize(rate, AudioFormat.CHANNEL_IN_MONO,
                AudioFormat.ENCODING_PCM_16BIT);
        if (minBufSize != AudioRecord.ERROR_BAD_VALUE) {
            validated.add(s);
            st += s + "  \t" + Integer.toString(minBufSize) + "\n";
        }
    }
    requested = validated.toArray(new String[0]);

    tv.setText(st);
    tv.invalidate();

    // Test audio source
    String[] audioSourceString = new String[] { "DEFAULT", "MIC", "VOICE_UPLINK", "VOICE_DOWNLINK",
            "VOICE_CALL", "CAMCORDER", "VOICE_RECOGNITION" };
    int[] audioSourceId = new int[] { MediaRecorder.AudioSource.DEFAULT, // Default audio source
            MediaRecorder.AudioSource.MIC, // Microphone audio source
            MediaRecorder.AudioSource.VOICE_UPLINK, // Voice call uplink (Tx) audio source
            MediaRecorder.AudioSource.VOICE_DOWNLINK, // Voice call downlink (Rx) audio source
            MediaRecorder.AudioSource.VOICE_CALL, // Voice call uplink + downlink audio source
            MediaRecorder.AudioSource.CAMCORDER, // Microphone audio source with same orientation as camera if available, the main device microphone otherwise (apilv7)
            MediaRecorder.AudioSource.VOICE_RECOGNITION, // Microphone audio source tuned for voice recognition if available, behaves like DEFAULT otherwise. (apilv7)
            //            MediaRecorder.AudioSource.VOICE_COMMUNICATION, // Microphone audio source tuned for voice communications such as VoIP. It will for instance take advantage of echo cancellation or automatic gain control if available. It otherwise behaves like DEFAULT if no voice processing is applied. (apilv11)
            //            MediaRecorder.AudioSource.REMOTE_SUBMIX,       // Audio source for a submix of audio streams to be presented remotely. (apilv19)
    };
    tv.append("\n-- Audio Source Test --");
    for (String s : requested) {
        int sampleRate = Integer.parseInt(s);
        int recBufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_IN_MONO,
                AudioFormat.ENCODING_PCM_16BIT);
        tv.append("\n(" + Integer.toString(sampleRate) + "Hz, MONO, 16BIT)\n");
        for (int iass = 0; iass < audioSourceId.length; iass++) {
            st = "";
            // wait for AudioRecord fully released...
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            AudioRecord record;
            record = new AudioRecord(audioSourceId[iass], sampleRate, AudioFormat.CHANNEL_IN_MONO,
                    AudioFormat.ENCODING_PCM_16BIT, recBufferSize);
            if (record.getState() == AudioRecord.STATE_INITIALIZED) {
                st += audioSourceString[iass] + " successed";
                int as = record.getAudioSource();
                if (as != audioSourceId[iass]) {
                    int i = 0;
                    while (i < audioSourceId.length) {
                        if (as == audioSourceId[iass]) {
                            break;
                        }
                        i++;
                    }
                    if (i >= audioSourceId.length) {
                        st += "(auto set to \"unknown source\")";
                    } else {
                        st += "(auto set to " + audioSourceString[i] + ")";
                    }
                }
                st += "\n";
            } else {
                st += audioSourceString[iass] + " failed\n";
            }
            record.release();
            record = null;
            tv.append(st);
            tv.invalidate();
        }
    }

}

From source file:com.honu.giftwise.InfoActivity.java

protected void showLicenseInfo() {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle("License information");

    TextView tv = new TextView(this);
    tv.setText(Html.fromHtml(getString(R.string.isc_license)));
    tv.setMovementMethod(new ScrollingMovementMethod());
    tv.setPadding(12, 0, 12, 0);/*w  w  w .j a v  a 2s .  c  om*/
    alert.setView(tv);

    alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int id) {
            dialog.dismiss();
        }
    });
    alert.show();
}

From source file:org.iotivity.base.examples.fridgeserver.FridgeServer.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fridge_server);
    registerReceiver(mMessageReceiver, new IntentFilter(StringConstants.INTENT));

    mEventsTextView = new TextView(this);
    mEventsTextView.setMovementMethod(new ScrollingMovementMethod());
    LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayout);
    layout.addView(mEventsTextView,/*www .j  a  v  a2  s  .c om*/
            new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1f));
    mContext = this;

    initOICStack();
}

From source file:org.chirpradio.mobile.Playing.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.playing);/* w  w  w.j  av a 2s.  c  om*/

    //doBindService();
    //setupNotification();

    nowPlayingTextView = (TextView) findViewById(R.id.now_playing);
    recentlyPlayedTextView = (TextView) findViewById(R.id.previous);
    recentlyPlayedTextView.setMovementMethod(new ScrollingMovementMethod());
    //playButton = (ImageButton)findViewById(R.id.play_button);
    playButton = (Button) findViewById(R.id.play_button);
    playButton.setOnClickListener(this);
}

From source file:com.nexus.nsnik.randomno.view.fragments.RandomNumberFragment.java

private void initialize() {
    if (getActivity() != null) {
        mResources = getActivity().getResources();
    }/*from  w  ww .j a  v  a2 s  .c om*/
    mRandomNumber.setMovementMethod(new ScrollingMovementMethod());
    mCompositeDisposable = new CompositeDisposable();
    mRandomNumberViewModel = ViewModelProviders.of(this).get(RandomNumberViewModel.class);
    mRandomNumberViewModel.getRandomNumberList().observe(this,
            integers -> mRandomNumber.setText(buildNumberString(integers, 0)));
}

From source file:com.vadimfrolov.duorem.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Create action bar as a toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
    setSupportActionBar(toolbar);/*  w  w w  .ja v  a 2s.co  m*/

    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mPrefs.registerOnSharedPreferenceChangeListener(this);

    mViewName = (TextView) findViewById(R.id.id);
    // mViewAddress = (TextView) findViewById(R.id.content);
    mIconAlive = (ImageView) findViewById(R.id.alive);
    mBtnTogglePower = (Button) findViewById(R.id.btn_toggle_power);
    mBtnRestart = (Button) findViewById(R.id.btn_restart);
    mViewStatus = (TextView) findViewById(R.id.text_status);

    mViewStatus.setMovementMethod(new ScrollingMovementMethod());

    Gson gson = new Gson();
    String targetJson = mPrefs.getString(KEY_PREF_TARGET, "");
    if (targetJson.length() > 0) {
        mTarget = gson.fromJson(targetJson, HostBean.class);
    }

    mSshTasks = new Stack<>();
    mDelegate = this;
    mIsConnected = false;

    mBtnRestart.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            stopTargetPolling();

            RemoteCommand cmd = new RemoteCommand(mTarget, RemoteCommand.SSH);
            cmd.command = "sudo shutdown -r now";
            mSshTasks.push(new RemoteAsyncTask(mDelegate));
            mSshTasks.peek().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, cmd);

            logForUser(getResources().getString(R.string.reboot_sent));
        }
    });
    mBtnTogglePower.setOnClickListener(mPowerActor);

    // create a pool with only 3 threads
    mSch = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(3);
    mSch.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
}

From source file:org.chromium.latency.walt.AudioFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    logger = SimpleLogger.getInstance(getContext());

    audioTest = new AudioTest(getActivity());
    audioTest.setTestStateListener(this);

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_audio, container, false);
    textView = (TextView) view.findViewById(R.id.txt_box_audio);
    textView.setMovementMethod(new ScrollingMovementMethod());
    startButton = view.findViewById(R.id.button_start_audio);
    stopButton = view.findViewById(R.id.button_stop_audio);
    chartLayout = view.findViewById(R.id.chart_layout);
    chart = (LineChart) view.findViewById(R.id.chart);
    latencyChart = (HistogramChart) view.findViewById(R.id.latency_chart);

    view.findViewById(R.id.button_close_chart).setOnClickListener(this);
    enableButtons();//from w  ww .j av  a2 s. co  m

    // Configure the audio mode spinner
    modeSpinner = (Spinner) view.findViewById(R.id.spinner_audio_mode);
    ArrayAdapter<CharSequence> modeAdapter = ArrayAdapter.createFromResource(getContext(),
            R.array.audio_mode_array, android.R.layout.simple_spinner_item);
    modeAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
    modeSpinner.setAdapter(modeAdapter);

    return view;
}

From source file:com.afwsamples.testdpc.safetynet.SafetyNetFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    BLACK = ContextCompat.getColor(getActivity(), R.color.text_black);
    DARK_RED = ContextCompat.getColor(getActivity(), R.color.dark_red);
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View rootView = inflater.inflate(R.layout.safety_net_attest_dialog, null);
    mMessageView = (TextView) rootView.findViewById(R.id.message_view);
    // Show scrollbar in textview.
    mMessageView.setMovementMethod(new ScrollingMovementMethod());
    return new AlertDialog.Builder(getActivity()).setView(rootView).setTitle(R.string.safetynet_dialog_title)
            .setNeutralButton(android.R.string.ok, null).create();
}

From source file:com.seven.designbox.designpatterns.patterns.compound.mvp.view.PlayerDetailFragment.java

private void initViews() {
    mNameTv = findViewById(R.id.tv_name);
    mSingerTv = findViewById(R.id.tv_singer);
    mLyricsTv = findViewById(R.id.tv_lyrics);
    mLyricsTv.setMovementMethod(new ScrollingMovementMethod());
    mLastBtn = findViewById(R.id.btn_last);
    mNextBtn = findViewById(R.id.btn_next);
}