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:org.chromium.latency.walt.DragLatencyFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    logger = SimpleLogger.getInstance(getContext());
    waltDevice = WaltDevice.getInstance(getContext());

    // Inflate the layout for this fragment
    final View view = inflater.inflate(R.layout.fragment_drag_latency, container, false);
    logTextView = (TextView) view.findViewById(R.id.txt_log_drag_latency);
    startButton = view.findViewById(R.id.button_start_drag);
    restartButton = view.findViewById(R.id.button_restart_drag);
    finishButton = view.findViewById(R.id.button_finish_drag);
    touchCatcher = (TouchCatcherView) view.findViewById(R.id.tap_catcher);
    crossCountsView = (TextView) view.findViewById(R.id.txt_cross_counts);
    dragCountsView = (TextView) view.findViewById(R.id.txt_drag_counts);
    latencyChart = (ScatterChart) view.findViewById(R.id.latency_chart);
    latencyChartLayout = view.findViewById(R.id.latency_chart_layout);
    logTextView.setMovementMethod(new ScrollingMovementMethod());
    view.findViewById(R.id.button_close_chart).setOnClickListener(this);
    restartButton.setEnabled(false);/*from   w ww . j  a v  a 2 s.c o  m*/
    finishButton.setEnabled(false);
    return view;
}

From source file:com.cerema.cloud2.ui.activity.ErrorsWhileCopyingHandlerActivity.java

/**
 * {@link}/*from  w ww .  ja v  a  2 s  .  c  o  m*/
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    /// read extra parameters in intent
    Intent intent = getIntent();
    mAccount = intent.getParcelableExtra(EXTRA_ACCOUNT);
    mRemotePaths = intent.getStringArrayListExtra(EXTRA_REMOTE_PATHS);
    mLocalPaths = intent.getStringArrayListExtra(EXTRA_LOCAL_PATHS);
    mStorageManager = new FileDataStorageManager(mAccount, getContentResolver());
    mHandler = new Handler();
    if (mCurrentDialog != null) {
        mCurrentDialog.dismiss();
        mCurrentDialog = null;
    }

    /// load generic layout
    setContentView(R.layout.generic_explanation);

    /// customize text message
    TextView textView = (TextView) findViewById(R.id.message);
    String appName = getString(R.string.app_name);
    String message = String.format(getString(R.string.sync_foreign_files_forgotten_explanation), appName,
            appName, appName, appName, mAccount.name);
    textView.setText(message);
    textView.setMovementMethod(new ScrollingMovementMethod());

    /// load the list of local and remote files that failed
    ListView listView = (ListView) findViewById(R.id.list);
    if (mLocalPaths != null && mLocalPaths.size() > 0) {
        mAdapter = new ErrorsWhileCopyingListAdapter();
        listView.setAdapter(mAdapter);
    } else {
        listView.setVisibility(View.GONE);
        mAdapter = null;
    }

    /// customize buttons
    Button cancelBtn = (Button) findViewById(R.id.cancel);
    Button okBtn = (Button) findViewById(R.id.ok);

    okBtn.setText(R.string.foreign_files_move);
    cancelBtn.setOnClickListener(this);
    okBtn.setOnClickListener(this);
}

From source file:project.pamela.slambench.fragments.SLAMResultAdapter.java

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

    // LAYOUT - LAYOUT - LAYOUT - LAYOUT - LAYOUT - LAYOUT

    super.onCreate(savedInstanceState);

    llLayout = (LinearLayout) inflater.inflate(R.layout.fragment_result, container, false);

    TextView _messageView = (TextView) llLayout.findViewById(R.id.message);
    _messageView.setMovementMethod(new ScrollingMovementMethod());
    MessageLog.setTextView(_messageView);

    if (SLAMBenchApplication.getResults() != null) {

        SLAMResultAdapter adapter = new SLAMResultAdapter(llLayout.getContext(), R.layout.list_row,
                SLAMBenchApplication.getResults());
        ListView lv = (ListView) llLayout.findViewById(R.id.listView);
        lv.setAdapter(adapter);/*from  w ww  .j  a v  a  2  s  .  com*/

        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapter, View v, int position, long arg3) {

                Intent myIntent = new Intent(v.getContext(), PlotActivity.class);
                myIntent.putExtra(SELECTED_TEST_TAG, position);
                startActivity(myIntent);

            }
        });

    }

    return llLayout;
}

From source file:eu.trentorise.smartcampus.trentinofamiglia.map.InfoDialog.java

@Override
public void onStart() {
    super.onStart();
    TextView msg = (TextView) getDialog().findViewById(R.id.mapdialog_msg);

    if (data instanceof POIObject) {
        msg.setText(Html.fromHtml("<h2>" + ((POIObject) data).getTitle() + "</h2><br/><p>"
                + Utils.getPOIshortAddress(((POIObject) data)) + "</p>"));
    } else if (data instanceof ExplorerObject) {
        ExplorerObject event = (ExplorerObject) data;
        POIObject poi = DTHelper.findPOIById(event.getPoiId());
        String msgText = "";
        msgText += "<h2>";
        msgText += event.getTitle();//from   www .j  a va2  s. c  o m
        msgText += "</h2><br/><p>";
        if (event.getType() != null) {
            msgText += "<p>";
            msgText += getString(CategoryHelper.getCategoryDescriptorByCategoryFiltered(
                    CategoryHelper.CATEGORY_TYPE_EVENTS, event.getType()).description);
            msgText += "</p><br/>";
        }
        msgText += "<p>" + event.eventDatesString() + "</p>";
        if (event.getTiming() != null) {
            msgText += "<p>" + event.getTiming() + "</p>";
        }
        if (poi != null) {
            msgText += "<p>" + Utils.getPOIshortAddress(poi) + "</p>";
        } else {
            String place = Utils.getEventShortAddress(event);
            if (place != null) {
                msgText += "<p>" + place + "</p>";
            }
        }
        msg.setText(Html.fromHtml(msgText));
    } else if (data instanceof TrackObject) {
        msg.setText(Html.fromHtml("<h2>" + data.getTitle() + "</h2>"));
    }

    msg.setMovementMethod(new ScrollingMovementMethod());

    Button b = (Button) getDialog().findViewById(R.id.mapdialog_cancel);
    b.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getDialog().dismiss();
        }
    });

    b = (Button) getDialog().findViewById(R.id.mapdialog_ok);
    b.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager()
                    .beginTransaction();
            Bundle args = new Bundle();

            if (data instanceof POIObject) {
                PoiDetailsFragment fragment = new PoiDetailsFragment();
                args.putString(PoiDetailsFragment.ARG_POI_ID, data.getId());
                fragment.setArguments(args);
                fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                fragmentTransaction.replace(R.id.frame_content, fragment, "me");
                fragmentTransaction.addToBackStack(fragment.getTag());
            } else if (data instanceof ExplorerObject) {
                EventDetailsFragment fragment = new EventDetailsFragment();
                args.putString(EventDetailsFragment.ARG_EVENT_ID, (data.getId()));
                fragment.setArguments(args);
                fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                fragmentTransaction.replace(R.id.frame_content, fragment, "me");
                fragmentTransaction.addToBackStack(fragment.getTag());
            } else if (data instanceof TrackObject) {
                TrackDetailsFragment fragment = new TrackDetailsFragment();
                args.putString(TrackDetailsFragment.ARG_TRACK_ID, (data.getId()));
                fragment.setArguments(args);
                fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                fragmentTransaction.replace(R.id.frame_content, fragment, "me");
                fragmentTransaction.addToBackStack(fragment.getTag());
            }
            fragmentTransaction.commit();
            getDialog().dismiss();
        }
    });

}

From source file:com.nbplus.vbroadlauncher.service.BroadcastChatHeadService.java

private void createBroadcastChatHead(Intent intent) {
    if (intent == null) {
        return;/* w w  w .java2 s  .  c om*/
    }

    mBroadcastData = intent.getParcelableExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA);
    if (mBroadcastData == null) {
        Log.d(TAG, "Broadcast data is not found!!!");
        return;
    }
    long mBroadcastIndex = intent.getLongExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, -1);
    String pushType = mBroadcastData.getServiceType();
    if (!Constants.PUSH_PAYLOAD_TYPE_NORMAL_BROADCAST.equals(pushType)
            && !Constants.PUSH_PAYLOAD_TYPE_REALTIME_BROADCAST.equals(pushType)
            && !Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(pushType)) {
        Log.d(TAG, "This is not broadcast push type !!!");
        return;
    }
    if (mIsPlaying && mChatHead != null) {
        removeChatHead(true);
    }

    mIsPlaying = true;

    int layout = -1;
    if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(pushType)) {
        layout = R.layout.fragment_text_broadcast;
    } else {
        layout = R.layout.fragment_audio_broadcast;
    }
    mChatHead = inflater.inflate(layout, null);

    if (Constants.PUSH_PAYLOAD_TYPE_TEXT_BROADCAST.equals(mBroadcastData.getServiceType())) {
        // ?
        mTextView = (TextView) mChatHead.findViewById(R.id.broadcast_text);
        mTextView.setText(mBroadcastData.getMessage());
        mTextView.setVerticalScrollBarEnabled(true);
        mTextView.setHorizontalScrollBarEnabled(false);
        mTextView.setMovementMethod(new ScrollingMovementMethod());

        mText2SpeechHandler = new TextToSpeechHandler(this, this);
        mText2Speech = new TextToSpeech(this, this);
    } else {
        // , ??
        mWebView = (WebView) mChatHead.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);
    }
    mChatHead.setTag(mBroadcastIndex);

    //        mChatHead.findViewById(R.id.btn_dismiss).setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                removeChatHead();
    //            }
    //        });

    /**
     * To create an overlay view, when setting up the LayoutParams DON'T set the type to TYPE_SYSTEM_OVERLAY.
            
     Instead set it to TYPE_PHONE.
            
     Use the following flags:
     FLAG_NOT_TOUCH_MODAL
     FLAG_WATCH_OUTSIDE_TOUCH
     FLAG_NOT_TOUCH_MODAL << I found this one to be quite important. Without it,
     focus is given to the overlay and soft-key (home, menu, etc.) presses are not passed to the activity below.
     */
    int flag = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;

    final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, flag, 0,
            PixelFormat.TRANSLUCENT);

    params.gravity = Gravity.CENTER;

    /**
     * do not use...
    mChatHead.findViewById(R.id.txt_title).setOnTouchListener(new View.OnTouchListener() {
    private int initialX;
    private int initialY;
    private float initialTouchX;
    private float initialTouchY;
            
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                initialX = params.x;
                initialY = params.y;
                initialTouchX = event.getRawX();
                initialTouchY = event.getRawY();
                return true;
            case MotionEvent.ACTION_UP:
                return true;
            case MotionEvent.ACTION_MOVE:
                params.x = initialX + (int) (event.getRawX() - initialTouchX);
                params.y = initialY + (int) (event.getRawY() - initialTouchY);
                windowManager.updateViewLayout(mChatHead, params);
                return true;
        }
        return false;
    }
    });
    */
    addChatHead(mChatHead, params);
}

From source file:ai.api.sample.AIDialogSampleActivity.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_aidialog_sample);

    resultTextView = (TextView) findViewById(R.id.resultTextView);
    resultTextView.setMovementMethod(new ScrollingMovementMethod());

    final AIConfiguration config = new AIConfiguration(Config.ACCESS_TOKEN,
            AIConfiguration.SupportedLanguages.English, AIConfiguration.RecognitionEngine.System);

    aiDialog = new AIDialog(this, config);
    aiDialog.setResultsListener(this);
    dialogue = "";
    handler = new Handler(Looper.getMainLooper());
    isDialogEnd = false;//from   ww  w  . jav a2 s  .co m
    //aiDialog.getAIService().resetContexts();
    itemsToAdd = new ArrayList<String>();
}

From source file:edu.asu.bsse.vtanders.finalproject.MainActivity.java

License:asdf

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

    messageEditor = (EditText) findViewById(R.id.message_editor);
    users = new ArrayList<String>();
    //        users.add("Gabe");
    //        users.add("Alex");
    //        users.add("Hillary");
    //        users.add("Vance");
    userListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, users);

    userList = (ListView) findViewById(R.id.user_list);
    userList.setAdapter(userListAdapter);

    ArrayList<String> channels = new ArrayList<String>();
    channels.add("Android Project");
    channels.add("Webapp Group");
    channels.add("Help");
    channels.add("Misc");
    ArrayAdapter<String> channelListAdapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, channels);

    //corresponds to the commented out stuff in the layout
    //        channelList = (ListView)findViewById(R.id.channel_list);
    //        channelList.setAdapter(channelListAdapter);

    chatHistory = (TextView) findViewById(R.id.chat_history);
    // setup up connection info

    Button sendButton = (Button) findViewById(R.id.button_send);
    sendButton.setOnClickListener(new SendListener(messageEditor));
    //        StringBuilder sb = new StringBuilder();
    //        sb.append("08:40 Gabe: Isn't this chat service really cool?\n")
    //            .append("08:41 Alex: It certainly is. Whoever developed this for us is pretty awesome.\n")
    //            .append("08:41 Hillary: I agree. It's a pretty simplistic approach and it keeps our productivity high!\n")
    //            .append("08:45 Vance: Thanks guys. I think it's pretty cool, too. Get back to work please\n")
    //            .append("08:51 Alex: @Gabe, do you wanna do this PR real quick? I need to get this issue out of code review at some point today\n")
    //            .append("08:53 Gabe: Sure, you wanna take the conversation to the webapp channel though?\n")
    //            .append("08:53 Alex: That's probably best\n")
    //            .append("09:18 Hillary: Anyone else on the cs17 server having connection issues?\n")
    //            .append("09:20 Vance: Yeah I've been using it all day and it's been performing like garbage\n")
    //            .append("11:48 SERVER: _Jeff has joined the channel.\n")
    //            .append("11:48 _Jeff: Hey guys. Lunch is here\n")
    //            .append("11:49 SERVER: _Jeff has left the channel.\n")
    //            .append("11:50 Vance: NICE");
    //        chatHistory.setText(sb.toString());
    chatHistory.setMovementMethod(new ScrollingMovementMethod());
}

From source file:sysnetlab.android.sdc.ui.fragments.ExperimentViewSensorDataFragment.java

private void updateSensorDataView(List<AbstractSensor> lstSensors, int sensorNo) {
    if (lstSensors == null || lstSensors.isEmpty()) {
        ((TextView) mView.findViewById(R.id.textview_fragment_experiment_view_notes_note_text))
                .setText(mView.getResources().getString(R.string.text_experiment_has_no_sensors));
        return;// w w  w .ja va  2s .c o  m
    }

    AbstractSensor sensor = lstSensors.get(sensorNo);
    ListView listView = (ListView) mView
            .findViewById(R.id.listview_fragment_experiment_view_sensor_data_sensor_properties);

    UserInterfaceUtils.fillSensorProperties(getActivity(), listView, sensor, true);

    String sensorData = getSensorData(sensor, MAXIMUM_LINES_OF_DATA_TO_READ);

    TextView textView = (TextView) mView.findViewById(R.id.textview_fragment_experiment_view_notes_note_text);
    if (sensorData.trim().equals("")) {
        textView.setText(getResources().getString(R.string.text_sensor_has_not_recorded_any_data));
        textView.setMovementMethod(new ScrollingMovementMethod());
    } else {
        textView.setText(sensorData);
        textView.setMovementMethod(new ScrollingMovementMethod());
    }
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.PostFragment.java

/**
 * Initializes some UI elements if the user is posting a reply rather than a new ThreadComment.
 *//*w  ww.  j a v a 2  s . com*/
@Override
public void onStart() {
    super.onStart();
    if (commentToReplyTo != null) {
        TextView replyTo = (TextView) getActivity().findViewById(R.id.comment_replyingTo);
        TextView bodyReplyTo = (TextView) getActivity().findViewById(R.id.reply_to_body);
        bodyReplyTo.setMovementMethod(new ScrollingMovementMethod());
        bodyReplyTo.setText(commentToReplyTo.getTextPost());
        replyTo.setText(commentToReplyTo.getUser() + " says:");
    }
}

From source file:com.example.administrator.myapplication2._2_exercise._2_Status_heart.fragments.LeftFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout._2_status_heart, container, false);

    SharedPreferences myPrefs = getActivity().getSharedPreferences("alert", Context.MODE_PRIVATE);
    if ((myPrefs != null) && (myPrefs.contains("alert"))) {
        alert = myPrefs.getBoolean("alert", false);
    }//from www .j a v  a 2  s.c  o  m

    mTextChat = (TextView) rootView.findViewById(R.id.text_chat);
    mTextChat.setMaxLines(1000);
    mTextChat.setVerticalScrollBarEnabled(true);
    mTextChat.setMovementMethod(new ScrollingMovementMethod());

    //mEditChat = (EditText) rootView.findViewById(R.id.edit_chat);
    //mEditChat.setOnEditorActionListener(mWriteListener);

    mBtnSend = (Button) rootView.findViewById(R.id.button_send);
    mBtnSend.setOnClickListener(this);

    handler = new MyHandler();
    progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar2);

    new Thread() {

        @Override

        public void run() {
            try {
                while (true) {
                    sleep(1000);
                    handler.sendMessage(new Message());

                    if (threadBool == false) {
                        break;
                    }

                }
            } catch (InterruptedException e) {

                e.printStackTrace();
            }
        }
    }.start();

    /*///////?//////////*/

    heartRateList = new ArrayList<>();
    tvTime = (TextView) rootView.findViewById(R.id.tvTime);
    ibPause = (ImageButton) rootView.findViewById(R.id.ibPause);
    ibStop = (ImageButton) rootView.findViewById(R.id.ibStop);

    ibPause.setOnClickListener(this);
    ibStop.setOnClickListener(this);

    m_display_run = new Runnable() {
        public void run() {
            // ? ? .
            tvTime.setText(m_display_string);
        }
    };

    /*gps*/
    //  ? ?  -   
    mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE);

    arrayPoints = new ArrayList<LatLng>();
    arrayPoints_network = new ArrayList<LatLng>();

    postJsonData1();

    //  ?   
    startLocationService();
    return rootView;
}