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:ch.eitchnet.android.mabea.activity.SettingsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Logger.i(TAG, "onCreateView", "called");

    this.rootView = inflater.inflate(R.layout.fragment_settings_layout, container, false);
    this.rootView.setVisibility(View.INVISIBLE);

    this.statusTxt = ((TextView) this.rootView.findViewById(R.id.statusTxt));
    this.statusTxt.setMovementMethod(new ScrollingMovementMethod());

    initContentProvider();/*  w w w.j a  v a 2s.  co m*/
    registerObservers();

    return this.rootView;
}

From source file:eu.iescities.pilot.rovereto.roveretoexplorer.map.InfoDialog.java

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

    if (data instanceof ExplorerObject) {
        ExplorerObject event = (ExplorerObject) data;
        String msgText = "";
        msgText += "<h2>";
        msgText += event.getTitle();/*from   w  ww.j a  va2  s. com*/
        msgText += "</h2><br/><p>";
        if (event.getType() != null) {
            String categoryString = event.categoryString(getActivity());
            if (categoryString != null) {
                msgText += "<p>" + categoryString + "</p><br/>";

            }
        }
        msgText += "<p>" + event.dateTimeString() + "</p>";

        String place = Utils.getEventShortAddress(event);
        if (place != null) {
            msgText += "<p>" + place + "</p>";
        }
        msg.setText(Html.fromHtml(msgText));
    }

    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 ExplorerObject) {
                Fragment_EventDetails fragment = new Fragment_EventDetails();
                args.putString(Utils.ARG_EVENT_ID, (data.getId()));
                fragment.setArguments(args);
                fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                fragmentTransaction.replace(R.id.content_frame, fragment, "me");
                fragmentTransaction.addToBackStack(fragment.getTag());
            }
            fragmentTransaction.commit();
            getDialog().dismiss();
        }
    });

}

From source file:ru.yandex.subtitles.ui.fragment.conversations.ZoomedMessageFragment.java

@Override
public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    final TextView messageView = findView(R.id.message);
    messageView.setMovementMethod(new ScrollingMovementMethod());
    messageView.setOnClickListener(this);

    if (mMessage != null) {
        messageView.setText(mMessage.getText());

        final Bundle loaderArgs = MessageLoader.forMessageId(mMessage.getId());
        getLoaderManager().initLoader(R.id.message_loader, loaderArgs, this);
    }/*  www .  j a  v a 2  s  .  c  o m*/
}

From source file:com.xyproto.archfriend.ArchFriendActivity.java

@Override
public void onStart() {
    super.onStart();
    // Wait 0.9 sec then close splash screen (replace view context)
    // TODO: Start loading the list of names
    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        public void run() {
            setContentView(R.layout.archoverview);
        }//ww w.j  av a 2  s.c  om
    }, 900);

    // TODO: Find the best way to load the data for the spinner in the
    // background. It's currently broken.

    try {
        populateSpinner();
        populateNews();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    } catch (ParseException e) {
        e.printStackTrace();
    }

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

}

From source file:com.teraim.fieldapp.ui.LoginConsoleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_login_console, container, false);
    TextView versionTxt;/*from  w  ww.  j a v a2  s  .co  m*/
    Log.e("vortex", "oncreatevieww!");
    TextView log = view.findViewById(R.id.logger);
    versionTxt = view.findViewById(R.id.versionTxt);

    final ImageView logo = view.findViewById(R.id.logo);
    final ImageView bg = view.findViewById(R.id.bgImg);
    appTxt = view.findViewById(R.id.appTxt);

    //Typeface type=Typeface.createFromAsset(getActivity().getAssets(),
    //      "clacon.ttf");
    //log.setTypeface(type);
    log.setMovementMethod(new ScrollingMovementMethod());
    versionTxt.setText("Field Pad ver. " + Constants.VORTEX_VERSION);

    //Create global state

    globalPh = new PersistenceHelper(getActivity().getApplicationContext()
            .getSharedPreferences(Constants.GLOBAL_PREFS, Context.MODE_PRIVATE));

    debugConsole = Start.singleton.getLogger();

    //Send a signal that init starts

    //First time vortex runs? Then create global folders.
    if (this.initIfFirstTime()) {
        if (!Connectivity.isConnected(getActivity())) {
            showErrorMsg(
                    "You need a network connection first time you start the program. Vortex requires configuration files to run.");
            return view;
        } else {
            this.initialize();
        }
    }
    //First time this application runs? Then create config folder.
    if (!new File(Constants.VORTEX_ROOT_DIR + bundleName).isDirectory()) {
        Log.d("vortex", "First time execution!");
        debugConsole.addRow("");
        debugConsole.addPurpleText("First time execution of App " + bundleName);
    } //else
      //   Log.d("vortex","This application has been executed before.");

    //TODO: Move this code into above in next release.
    File folder = new File(Constants.VORTEX_ROOT_DIR + bundleName);
    folder = new File(Constants.VORTEX_ROOT_DIR + bundleName + "/config");
    folder = new File(Constants.VORTEX_ROOT_DIR + bundleName + "/cache");

    //write down version..quickly! :)
    globalPh.put(PersistenceHelper.CURRENT_VERSION_OF_PROGRAM, Constants.VORTEX_VERSION);

    bundleName = globalPh.get(PersistenceHelper.BUNDLE_NAME);
    if (bundleName == null || bundleName.length() == 0)
        bundleName = InitialBundleName;

    ph = new PersistenceHelper(getActivity().getApplicationContext()
            .getSharedPreferences(globalPh.get(PersistenceHelper.BUNDLE_NAME), Context.MODE_PRIVATE));
    oldV = ph.getF(PersistenceHelper.CURRENT_VERSION_OF_APP);

    appTxt.setText(bundleName + " " + (oldV == -1 ? "" : oldV));
    String p_serverURL = globalPh.get(PersistenceHelper.SERVER_URL);
    String checked_URL = Tools.server(p_serverURL);
    if (!checked_URL.equals(p_serverURL))
        globalPh.put(PersistenceHelper.SERVER_URL, checked_URL);
    String appBaseUrl = checked_URL + bundleName.toLowerCase() + "/";
    final String appRootFolderPath = Constants.VORTEX_ROOT_DIR + globalPh.get(PersistenceHelper.BUNDLE_NAME)
            + "/";
    loginConsole = new PlainLogger(getActivity(), "INITIAL");
    loginConsole.setOutputView(log);

    Tools.onLoadCacheImage(appBaseUrl, "bg_image.jpg", appRootFolderPath + "cache/", new Tools.WebLoaderCb() {
        @Override
        public void loaded(Boolean result) {
            if (result) {
                Bitmap bm = BitmapFactory.decodeFile(appRootFolderPath + "cache/bg_image.jpg",
                        new BitmapFactory.Options());
                if (bm != null)
                    bg.setImageBitmap(bm);
            }
        }

        @Override
        public void progress(int bytesRead) {
        }
    });
    Tools.onLoadCacheImage(appBaseUrl, "logo.png", appRootFolderPath + "cache/", new Tools.WebLoaderCb() {
        @Override
        public void loaded(Boolean result) {
            if (result) {
                Bitmap bm = BitmapFactory.decodeFile(appRootFolderPath + "cache/logo.png",
                        new BitmapFactory.Options());
                if (bm != null)
                    logo.setImageBitmap(bm);
            }
        }

        @Override
        public void progress(int bytesRead) {
        }
    });

    //Tools.preCacheImage(bgUrl,"logo.png",appRootFolderPath+"cache/",loginConsole);

    //new DownloadImageTask((ImageView) view.findViewById(R.id.bgImg))
    //      .execute(bgUrl.toLowerCase());

    //create module descriptors for all known configuration files.
    //Log.d("vortex","Creating Configuration and ModuleLoader");

    //Check if configuration should be loaded from server or from file system.

    if (globalPh.getB("local_config"))
        myModules = new Configuration(Constants.getCurrentlyKnownModules(ConfigurationModule.Source.file,
                globalPh, ph, null, bundleName, debugConsole));
    else
        myModules = new Configuration(Constants.getCurrentlyKnownModules(ConfigurationModule.Source.internet,
                globalPh, ph, globalPh.get(PersistenceHelper.SERVER_URL), bundleName, debugConsole));
    String loaderId = "moduleLoader";
    boolean allFrozen = ph.getB(PersistenceHelper.ALL_MODULES_FROZEN + loaderId);
    myLoader = new ModuleLoader(loaderId, myModules, loginConsole, globalPh, allFrozen, debugConsole, this,
            getActivity());

    if (Constants.FreeVersion && expired())
        showErrorMsg(
                "The license has expired. The App still works, but you will not be able to export any data.");

    return view;
}

From source file:com.blueserial.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ActivityHelper.initialize(this);

    Intent intent = getIntent();/*from  w w w .j  a v  a  2 s. c o 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);

    jsonParser = new JSONParser();
    url = "http://172.16.152.129/my_projects/android_database/add_sonar_data.php";

    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);
    mBtnClearInput = (Button) findViewById(R.id.btnClearInput);

    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("");
        }
    });

}

From source file:com.photon.phresco.nativeapp.eshop.activity.ProductDetailActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    try {//www  . ja v a  2 s.  co  m
        super.onCreate(savedInstanceState);
        setContentView(R.layout.product_detail);
        initEnvironment();
        productDescription.setMovementMethod(new ScrollingMovementMethod());

        productItemIntent = getIntent();
        if (productItemIntent != null && productItemIntent.getExtras() != null) {
            productItem = (Product) productItemIntent.getExtras().getSerializable("product");
            productId = productItem.getId();
            previousActivity = getExtrasPreviousActivity();
            currentActivity = productItemIntent.getExtras().getString(currActivity);
        }
        PhrescoLogger.info(TAG + " - previousActivity : " + previousActivity);
        PhrescoLogger.info(TAG + " - currentActivity : " + currentActivity);
        PhrescoLogger.info(TAG + " - productId : " + productId);

        String productIdOrientactionCheck = (String) getLastNonConfigurationInstance();
        doOperation(productIdOrientactionCheck);

        backButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                try {
                    goBackToPreviousActivity();
                } catch (Exception ex) {
                    PhrescoLogger.info(TAG + " - backButton  - Exception : " + ex.toString());
                    PhrescoLogger.warning(ex);
                }
            }

        });

        addToCartButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                try {
                    startMyCartActivity();
                } catch (Exception ex) {
                    PhrescoLogger.info(TAG + " - addToCartButton  - Exception : " + ex.toString());
                    PhrescoLogger.warning(ex);
                }
            }
        });

        reviewButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                try {
                    startProductReviewActivity();
                } catch (Exception ex) {
                    PhrescoLogger.info(TAG + " - reviewButton  - Exception : " + ex.toString());
                    PhrescoLogger.warning(ex);
                }
            }
        });

    } catch (Exception ex) {
        PhrescoLogger.info(TAG + " - onCreate - Exception : " + ex.toString());
        PhrescoLogger.warning(ex);
    }

}

From source file:com.mohammedsazid.android.tagger.TaggerFragment.java

/**
 * Bind listeners to views//from  w  w  w  .ja v a  2  s.co m
 */
private void bindListeners() {
    buttonCopy.setOnClickListener(this);
    buttonShareFacebook.setOnClickListener(this);
    buttonRequestFacebook.setOnClickListener(this);
    switchMode.setOnCheckedChangeListener(this);
    inputEt.addTextChangedListener(this);
    outputTv.setMovementMethod(new ScrollingMovementMethod());
}

From source file:alaindc.crowdroid.View.MainActivity.java

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

    listGeofenceCircle = new HashMap<>();
    listCircles = new HashMap<>();

    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

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

    sensorsCheckbox = (CheckBox) findViewById(R.id.sensorscheck);
    requestsCheckbox = (CheckBox) findViewById(R.id.requestscheck);

    this.settingsButton = (Button) findViewById(R.id.settbutton);
    settingsButton.setOnClickListener(new View.OnClickListener() {
        @Override/*from w  w  w.j a  v a 2s  .  c om*/
        public void onClick(View v) {
            Intent i = new Intent(getApplicationContext(), StakeholdersActivity.class);
            startActivity(i);
        }
    });

    this.requestButton = (Button) findViewById(R.id.button);
    requestButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // TODO: Disable
            //requestButton.setEnabled(false);

            // Start sending messages to server
            Intent serviceIntent[] = new Intent[Constants.MONITORED_SENSORS.length];
            for (int i = 0; i < Constants.MONITORED_SENSORS.length; i++) {
                serviceIntent[i] = new Intent(getApplicationContext(), SendIntentService.class);
                serviceIntent[i].setAction(Constants.ACTION_SENDDATA + Constants.MONITORED_SENSORS[i]);
                serviceIntent[i].putExtra(Constants.EXTRA_TYPE_OF_SENSOR_TO_SEND,
                        Constants.MONITORED_SENSORS[i]); // TODO Here set to send all kind of sensor for start
                getApplicationContext().startService(serviceIntent[i]);

            }
        }
    });

    this.sensorButton = (Button) findViewById(R.id.buttonLoc);
    sensorButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            sensorButton.setEnabled(false);

            // Clear preferences
            getSharedPreferences(Constants.PREF_FILE, Context.MODE_PRIVATE).edit().clear().commit();

            // Start service for PhoneListener
            Intent phoneListIntent = new Intent(getApplicationContext(), NeverSleepService.class);
            getApplicationContext().startService(phoneListIntent);

            // Start intent service for update position
            Intent posintent = new Intent(getApplicationContext(), PositionIntentService.class);
            getApplicationContext().startService(posintent);

            // Start intent service for update sensors
            Intent sensorintent = new Intent(getApplicationContext(), SensorsIntentService.class);
            sensorintent.setAction(Constants.INTENT_START_SENSORS);
            getApplicationContext().startService(sensorintent);

            // Start intent service for update amplitude sensing
            Intent amplintent = new Intent(getApplicationContext(), SensorsIntentService.class);
            amplintent.setAction(Constants.INTENT_START_AUDIOAMPLITUDE_SENSE);
            getApplicationContext().startService(amplintent);
        }
    });

    BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(Constants.INTENT_RECEIVED_DATA)) {
                String response = intent.getStringExtra(Constants.INTENT_RECEIVED_DATA_EXTRA_DATA);
                if (response != null && requestsCheckbox.isChecked())
                    textView.append(response + "\n");
            } else if (intent.getAction().equals(Constants.INTENT_UPDATE_POS)) {
                setLocationAndMap();
            } else if (intent.getAction().equals(Constants.INTENT_UPDATE_SENSORS)) {
                String response = intent.getStringExtra(Constants.INTENT_RECEIVED_DATA_EXTRA_DATA);
                if (response != null && sensorsCheckbox.isChecked())
                    textView.append(response + "\n");
            } else if (intent.getAction().equals(Constants.INTENT_UPDATE_GEOFENCEVIEW)) { // Geofencing
                addGeofenceView(intent.getIntExtra(Constants.INTENT_GEOFENCEEXTRA_SENSOR, 0),
                        intent.getDoubleExtra(Constants.INTENT_GEOFENCEEXTRA_LATITUDE, 0),
                        intent.getDoubleExtra(Constants.INTENT_GEOFENCEEXTRA_LONGITUDE, 0),
                        intent.getFloatExtra(Constants.INTENT_GEOFENCEEXTRA_RADIUS, 100));
            } else {
                Log.d("", "");
            }
        }
    };

    IntentFilter rcvDataIntFilter = new IntentFilter(Constants.INTENT_RECEIVED_DATA);
    IntentFilter updatePosIntFilter = new IntentFilter(Constants.INTENT_UPDATE_POS);
    IntentFilter updateSenseIntFilter = new IntentFilter(Constants.INTENT_UPDATE_SENSORS);
    IntentFilter updateGeofenceViewIntFilter = new IntentFilter(Constants.INTENT_UPDATE_GEOFENCEVIEW);
    LocalBroadcastManager.getInstance(this).registerReceiver(receiver, rcvDataIntFilter);
    LocalBroadcastManager.getInstance(this).registerReceiver(receiver, updatePosIntFilter);
    LocalBroadcastManager.getInstance(this).registerReceiver(receiver, updateSenseIntFilter);
    LocalBroadcastManager.getInstance(this).registerReceiver(receiver, updateGeofenceViewIntFilter);

}

From source file:de.eidottermihi.rpicheck.fragment.RunCommandDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    this.device = (RaspberryDeviceBean) this.getArguments().getSerializable("pi");
    this.command = (CommandBean) this.getArguments().getSerializable("cmd");
    if (this.getArguments().getString("passphrase") != null) {
        this.passphrase = this.getArguments().getString("passphrase");
    }// w w w .jav  a 2s . c  om

    builder.setTitle(getString(R.string.run_cmd_dialog_title, this.command.getName()));

    // fetching the theme-dependent icon
    TypedValue icon = new TypedValue();
    if (getActivity().getTheme().resolveAttribute(R.attr.ic_dialog_run, icon, true)) {
        builder.setIcon(icon.resourceId);
    }

    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // just closing the dialog
        }
    });
    final LayoutInflater inflater = getActivity().getLayoutInflater();
    final View view = inflater.inflate(R.layout.dialog_command_run, null);
    builder.setView(view);
    consoleOutput = (TextView) view.findViewById(R.id.runCommandOutput);
    consoleOutput.setMovementMethod(new ScrollingMovementMethod());
    if (savedInstanceState != null) {
        this.didRun = savedInstanceState.getBoolean("didRun", false);
    }
    return builder.create();
}