Example usage for android.text.method ScrollingMovementMethod getInstance

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

Introduction

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

Prototype

public static MovementMethod getInstance() 

Source Link

Usage

From source file:com.memetro.android.alerts.CommentDialog.java

public static void showDialog(final Context context, String comment, String creator, boolean isMine,
        final Long id) {

    final Dialog mDialog = new Dialog(context);
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setContentView(R.layout.comment_dialog);
    mDialog.setCancelable(true);/*from  ww w  .j a v  a2 s.co  m*/

    TextView titleText = (TextView) mDialog.findViewById(R.id.title);
    TextView messageText = (TextView) mDialog.findViewById(R.id.message);
    Button closeButton = (Button) mDialog.findViewById(R.id.close);
    Button deleteButton = (Button) mDialog.findViewById(R.id.delete);

    titleText.setText(titleText.getText().toString() + " " + creator);
    messageText.setMovementMethod(ScrollingMovementMethod.getInstance());
    messageText.setText(comment);

    if (isMine) {
        deleteButton.setVisibility(View.VISIBLE);
        deleteButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new DeleteInBg(context, String.valueOf(id)).execute();
                mDialog.dismiss();
                // TODO Refrescar las alertas
            }
        });
    }

    closeButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            mDialog.dismiss();
        }
    });

    mDialog.show();

}

From source file:com.hiqes.android.demopermissionsm.ui.ProgLogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root;/*from   w  w  w  .  java 2  s  . co  m*/

    root = inflater.inflate(R.layout.fragment_prog_log, container, false);
    mLoadedLog = (TextView) root.findViewById(R.id.progress_log);
    mLoadedLog.setMovementMethod(ScrollingMovementMethod.getInstance());
    mLoad = (Button) root.findViewById(R.id.prog_log_load);
    mLoad.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startLoadDialog();
        }
    });

    return root;
}

From source file:cn.apputest.ctria.section2.Dialog_DriverLicenseCard.java

public void alert_DriverLicenseCardDialog(Context context, EditText carnum) {
    // TODO Auto-generated method stub
    contextAlawys = context;//from  w  ww. j  a v  a2 s .  c  o m

    preferencesuser = context.getSharedPreferences(Login.FILE_USER, Context.MODE_PRIVATE);
    String DBName = preferencesuser.getString(Login.KEY_NAME, "1");
    helper = new DBHelper(context, DBName + "_DB");
    mgr = new DBManager(helper);

    final Dialog dialog = new Dialog(context, R.style.add_dialog);
    View vv = LayoutInflater.from(context)
            .inflate(R.layout.section2activity_lucha2_alert_driverlicensecard_dialog, null);
    dialog.setCanceledOnTouchOutside(true);
    dialog.setContentView(vv);
    // dialog.getWindow().setLayout(480, 524);
    // dialog.getWindow().setLayout(720, 1050);
    Resources r = context.getResources();
    int x = (int) r.getDimension(R.dimen.x320);
    int y = (int) r.getDimension(R.dimen.y350);
    dialog.getWindow().setLayout(x, y);
    dialog.getWindow().setGravity(Gravity.BOTTOM);

    Information = (TextView) vv.findViewById(R.id.DriverLicensecard);
    Information.setClickable(false);
    Information.setLongClickable(false);
    Information.setMovementMethod(ScrollingMovementMethod.getInstance());

    getDriverLicense(carnum);
    ImageButton backButton = (ImageButton) vv.findViewById(R.id.backImageButton);
    backButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            dialog.dismiss();
        }
    });
    dialog.show();
}

From source file:com.timothy.android.api.fragment.RightFragment.java

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

    activity = (SlidingActivity) getActivity();
    mContext = activity.getApplicationContext();
    sp = activity.getSharedPreferences("AndroidAPISP", 0);

    View view = inflater.inflate(R.layout.right, null);

    boolean syncFlag = SPUtil.getBooleanFromSP(SPUtil.SP_KEY_SYNC_FLAG, sp);
    //syncFlag// w  w  w  .j a v  a  2 s . co m
    ToggleButton syncFlagBtn = (ToggleButton) view.findViewById(R.id.syncFlagBtn);
    syncFlagBtn.setChecked(syncFlag);
    syncFlagBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ToggleButton tb = (ToggleButton) v;
            SPUtil.save2SP(SPUtil.SP_KEY_SYNC_FLAG, tb.isChecked(), sp);
        }
    });

    //lstReadTV
    TextView lstReadTV = (TextView) view.findViewById(R.id.lstReadTV);
    lstReadTV.setMovementMethod(ScrollingMovementMethod.getInstance());

    int branchIndex = SPUtil.getIntegerFromSP(SPUtil.CURRENT_BRANCH_INDEX, sp);
    String[] contentsArray = activity.filterBranch(branchIndex);

    String contents = ContentUtil.getContentsById(contentsArray,
            SPUtil.getIntegerFromSP(SPUtil.CURRENT_INDEX, sp));
    if (contents != null) {
        String[] contentArray = contents.split(",");
        if (contentArray != null && contentArray.length >= 4) {
            String contentName = contentArray[3];
            lstReadTV.setText(contentName);
        }
    }

    Button gotoBtn = (Button) view.findViewById(R.id.gotoBtn);
    gotoBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            refreshActivity();
        }
    });

    return view;
}

From source file:gc.david.dfm.ui.fragment.OpenSourceDetailFragment.java

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    tvName.setText(openSourceLibraryModel.getName());
    tvLongLicense.setText(LicensePrinter.print(openSourceLibraryModel, getContext()));
    tvLongLicense.setMovementMethod(ScrollingMovementMethod.getInstance());
}

From source file:com.hiqes.android.demopermissionsm.ui.EchoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root;/*from w  ww .  j  a  v a 2s  .c  om*/

    // Inflate the layout for this fragment
    root = inflater.inflate(R.layout.fragment_echo, container, false);
    mEchoText = (EditText) root.findViewById(R.id.echo_text);
    mEchoText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                mSubmitListener.onClick(mSubmitBtn);
            }

            return false;
        }
    });

    mProgLogText = (TextView) root.findViewById(R.id.progress_log);
    mProgLogText.setMovementMethod(ScrollingMovementMethod.getInstance());
    mSaveProgLog = (CheckBox) root.findViewById(R.id.save_log);
    mSaveProgLog.setOnCheckedChangeListener(mCheckChangeListener);
    mTvLogWriter = new TextViewLogWriter(mProgLogText);

    mSubmitBtn = (Button) root.findViewById(R.id.echo_submit);
    mSubmitBtn.setOnClickListener(mSubmitListener);
    return root;
}

From source file:org.mklab.mikity.android.SampleSelectionFragment.java

/**
 * ???????//from w  ww.ja v a2 s.  c om
 * 
 * @param mainView
 */
private void createModelComponent(View mainView) {
    final Button modelButton = (Button) mainView.findViewById(R.id.sampleModelSelectButton);
    modelButton.setOnClickListener(new OnClickListener() {

        /**
         * {@inheritDoc}
         */
        public void onClick(View view) {
            final FragmentManager manager = SampleSelectionFragment.this.mainActivity
                    .getSupportFragmentManager();
            final FragmentTransaction transaction = manager.beginTransaction();
            transaction.addToBackStack(null);

            if (SampleSelectionFragment.this.modelViewFragment != null) {
                transaction.remove(SampleSelectionFragment.this.modelViewFragment);
                SampleSelectionFragment.this.modelViewFragment = null;
            }

            SampleSelectionFragment.this.modelViewFragment = new AssetsListViewFragment();
            final Bundle arguments = new Bundle();
            arguments.putBoolean("isModelData", true); //$NON-NLS-1$
            SampleSelectionFragment.this.modelViewFragment.setArguments(arguments);

            transaction.add(R.id.fragment_navigation_drawer, SampleSelectionFragment.this.modelViewFragment);
            transaction.commit();
        }
    });

    this.modelFileNameView = (TextView) mainView.findViewById(R.id.sampleModelFileNameView);
    this.modelFileNameView.setText(this.modelFileName);
    this.modelFileNameView.setMovementMethod(ScrollingMovementMethod.getInstance());
}

From source file:com.bingzer.android.eula.EulaFragment.java

private TextView initializeTextView(View root) {
    textView = (TextView) root.findViewById(R.id.br_text);
    textView.setMovementMethod(ScrollingMovementMethod.getInstance());
    return textView;
}

From source file:org.mklab.mikity.android.FileSelectionFragment.java

/**
 * ???????//from   ww  w  .j  av  a 2s.com
 * 
 * @param mainView
 */
private void createModelComponent(View mainView) {
    final Button modelButton = (Button) mainView.findViewById(R.id.modelSelectButton);
    modelButton.setOnClickListener(new View.OnClickListener() {
        /**
         * {@inheritDoc}
         */
        public void onClick(View view) {
            if (FileSelectionFragment.this.canvasFragment.isModelChanged() == false) {
                FileSelectionFragment.this.mainActivity.sendFileChooseIntentForLoadingModel();
                return;
            }

            final DialogFragment fragment = new DialogFragment() {
                /**
                 * {@inheritDoc}
                 */
                @Override
                public Dialog onCreateDialog(Bundle savedInstanceState) {
                    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                    builder.setMessage(
                            getString(R.string.modelIsChanged) + " " + getString(R.string.willYouSave)) //$NON-NLS-1$
                            .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {
                                    if (FileSelectionFragment.this.mainActivity.modelFileUri == null) {
                                        FileSelectionFragment.this.mainActivity
                                                .sendFileChooseIntentForSavingModel();
                                    } else {
                                        FileSelectionFragment.this.mainActivity.saveModelData();
                                    }
                                    FileSelectionFragment.this.mainActivity
                                            .sendFileChooseIntentForLoadingModel();
                                }
                            }).setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {
                                    FileSelectionFragment.this.mainActivity
                                            .sendFileChooseIntentForLoadingModel();
                                }
                            });
                    return builder.create();
                }
            };

            fragment.show(getFragmentManager(), "confirmDialog"); //$NON-NLS-1$
        }
    });

    this.modelFileNameView = (TextView) mainView.findViewById(R.id.modelFileNameView);
    this.modelFileNameView.setText(this.modelFileName);
    this.modelFileNameView.setMovementMethod(ScrollingMovementMethod.getInstance());
}

From source file:de.da_sense.moses.client.DetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mThisInstance = this;
    if (container == null) {
        return null;
    } else {/*from  www.java 2  s  .  c o  m*/
        container.setBackgroundColor(getResources().getColor(android.R.color.background_light));

        // get the arguments
        final String appname;
        String description;
        String startDate, endDate, apkVersion;
        ArrayList<Integer> sensors;

        // if this gets started as a fragment
        if (savedInstanceState == null) {
            Log.d(LOG_TAG, "savedInstance == null");
            savedInstanceState = getArguments();
            Log.d(LOG_TAG, "NOW savedInstance = " + savedInstanceState);
        }

        // supposed to show a placeholder?
        String placeholder = savedInstanceState.getString("de.da_sense.moses.client.placeholder");
        if (placeholder != null && placeholder.equals("yes")) {
            // inflate the placeholder
            Log.d(LOG_TAG, "onCreateView about to inflate PLACEHOLDER");
            mDetailFragmentView = inflater.inflate(R.layout.app_info_placeholder, container, false);
        } else { // normal display of details
            // retrieve the arguments
            mIndex = savedInstanceState.getInt("de.da_sense.moses.client.index");
            mBelongsTo = savedInstanceState.getInt(WelcomeActivity.KEY_BELONGS_TO);
            appname = savedInstanceState.getString("de.da_sense.moses.client.appname");
            description = savedInstanceState.getString("de.da_sense.moses.client.description");
            sensors = savedInstanceState.getIntegerArrayList("de.da_sense.moses.client.sensors");
            mAPKID = savedInstanceState.getString(ExternalApplication.KEY_APK_ID);
            apkVersion = savedInstanceState.getString("de.da_sense.moses.client.apkVersion");
            startDate = savedInstanceState.getString("de.da_sense.moses.client.startDate");
            endDate = savedInstanceState.getString("de.da_sense.moses.client.endDate");

            Log.d(LOG_TAG,
                    "\nretrieved index = " + mIndex + "\nretrieved belongsTo = " + mBelongsTo
                            + "\nretrieved appname = " + appname + "\nretireved description = " + description
                            + "\nretireved sensors = " + sensors + "\nretireved apkid = " + mAPKID
                            + "\nretireved startDate = " + startDate + "\nretireved endDate = " + endDate
                            + "\nretireved apkVersion = " + apkVersion);

            if (appname != null) {
                // inflate the detail view
                Log.d(LOG_TAG, "onCreateView about to inflate View");
                mDetailFragmentView = inflater.inflate(R.layout.app_info, container, false);
                // insert app name
                TextView t = (TextView) mDetailFragmentView.findViewById(R.id.usname);
                t.setText(appname);
                // insert description
                t = (TextView) mDetailFragmentView.findViewById(R.id.description);
                t.setMovementMethod(ScrollingMovementMethod.getInstance());
                t.setText(description);
                t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_startdate);
                t.setText(startDate);
                t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_enddate);
                t.setText(endDate);
                t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_apkversion);
                t.setText(apkVersion);
            } else {
                Log.e(LOG_TAG, "User study's informations are missing");
                return null;
            }
        }

        return mDetailFragmentView;
    }
}