Example usage for android.widget ScrollView fullScroll

List of usage examples for android.widget ScrollView fullScroll

Introduction

In this page you can find the example usage for android.widget ScrollView fullScroll.

Prototype

public boolean fullScroll(int direction) 

Source Link

Document

Handles scrolling in response to a "home/end" shortcut press.

Usage

From source file:com.carver.paul.truesight.Ui.MainActivity.java

protected void scrollToTop() {
    ScrollView scrollView = (ScrollView) findViewById(R.id.scroll_view);
    scrollView.fullScroll(ScrollView.FOCUS_UP);
}

From source file:com.levien.audiobuffersize.AudioBufferSize.java

synchronized void log(String text) {
    msgLog += text + "\n";
    final TextView tv = (TextView) findViewById(R.id.textView1);
    //tv.setText(msgLog);
    tv.append(text + "\n");
    final ScrollView sv = (ScrollView) findViewById(R.id.scrollView);
    sv.fullScroll(View.FOCUS_DOWN);
}

From source file:com.example.android.basicandroidkeystore.LogFragment.java

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

    View result = inflater.inflate(R.layout.log_fragment, container, false);

    mLogView = (LogView) result.findViewById(R.id.sample_output);

    // Wire up so when the text changes, the view scrolls down.
    final ScrollView scrollView = ((ScrollView) result.findViewById(R.id.log_scroll));

    mLogView.addTextChangedListener(new TextWatcher() {
        @Override/*from   ww w  . j a v a 2 s. c o m*/
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        }

        @Override
        public void afterTextChanged(Editable s) {
            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        }
    });

    return result;
}

From source file:eu.fistar.sdcs.pa.MainActivity.java

private void updateLog(String log) {
    Log.d(LOGTAG, log);// www .  ja v  a 2 s .c o  m

    final String fLog = log;

    final TextView tv = (TextView) findViewById(R.id.logBox);
    tv.post(new Runnable() {
        @Override
        public void run() {
            tv.append(fLog + "\n");
        }
    });

    final ScrollView sv = (ScrollView) findViewById(R.id.scrollBox);
    sv.postDelayed(new Runnable() {
        @Override
        public void run() {
            sv.fullScroll(ScrollView.FOCUS_DOWN);
        }
    }, 100L);

}

From source file:com.kaliturin.blacklist.fragments.AddOrEditContactFragment.java

private void moveScroll() {
    View view = getView();/* w w  w .j  a v  a  2s .c  o m*/
    if (view != null) {
        final ScrollView scroll = (ScrollView) view.findViewById(R.id.scroll);
        scroll.post(new Runnable() {
            @Override
            public void run() {
                scroll.fullScroll(ScrollView.FOCUS_DOWN);
            }
        });
    }
}

From source file:com.houseofslack.pullscoring.Scoring.java

private void redrawOneSetOfScores(LinearLayout layout, List<Integer> scores, int scoreLayoutId,
        int scrollLayoutId, String teamName, int teamAndScoreId) {
    LayoutInflater inflater = getLayoutInflater();
    layout.removeAllViews();//from  w w  w  .ja v a  2 s  .  c o  m
    int totalScore = 0;
    for (int score : scores) {
        totalScore += score;
        TextView textView = (TextView) inflater.inflate(scoreLayoutId, null);
        textView.setText(String.valueOf(score));
        layout.addView(textView);
    }
    TextView textView = (TextView) findViewById(teamAndScoreId);
    textView.setText(getString(R.string.total_score, teamName, totalScore));
    // set the scroll view to the bottom of the display
    final ScrollView scrollView = (ScrollView) findViewById(scrollLayoutId);
    scrollView.post(new Runnable() {
        @Override
        public void run() {
            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        }
    });
}

From source file:android.melbournehistorymap.MapsActivity.java

public void expandTile(View view) {
    //        Toast.makeText(MapsActivity.this, "Expand", Toast.LENGTH_SHORT).show();
    TextView fab = (TextView) findViewById(R.id.fab);
    FloatingActionButton shareIcon = (FloatingActionButton) findViewById(R.id.shareIcon);
    //hide small tile
    smallTile.setVisibility(View.GONE);
    fab.setVisibility(View.GONE);
    //show big tile
    expandedTile.setVisibility(View.VISIBLE);
    shareIcon.setVisibility(View.VISIBLE);

    //lock the map
    mMap.getUiSettings().setAllGesturesEnabled(false);

    //Reset ScrollView to top
    ScrollView scrollView = (ScrollView) findViewById(R.id.scrollViewDesc);
    scrollView.fullScroll(View.FOCUS_UP);

    //disable mapicon from being clickable
    TextView mapIcon = (TextView) findViewById(R.id.iconMap);
    mapIcon.setClickable(false);//from   w w w  .j  av  a 2  s  .c o  m
}

From source file:cx.ring.fragments.AccountCreationFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
    final View inflatedView = inflater.inflate(R.layout.frag_account_creation, parent, false);

    mAliasView = (EditText) inflatedView.findViewById(R.id.alias);
    mHostnameView = (EditText) inflatedView.findViewById(R.id.hostname);
    mUsernameView = (EditText) inflatedView.findViewById(R.id.username);
    mPasswordView = (EditText) inflatedView.findViewById(R.id.password);

    mPasswordView.setOnEditorActionListener(new OnEditorActionListener() {
        @Override/*from w ww  . j  ava2s . co m*/
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == getResources().getInteger(R.integer.register_sip_account_actionid) || event == null
                    || (event.getAction() == KeyEvent.ACTION_UP)) {
                inflatedView.findViewById(R.id.create_sip_button).callOnClick();
            }
            return true;
        }
    });
    inflatedView.findViewById(R.id.ring_card_view).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mAccountType = AccountDetailBasic.ACCOUNT_TYPE_RING;
            initAccountCreation();
        }
    });
    inflatedView.findViewById(R.id.create_sip_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mAccountType = AccountDetailBasic.ACCOUNT_TYPE_SIP;
            mAlias = mAliasView.getText().toString();
            mHostname = mHostnameView.getText().toString();
            mUsername = mUsernameView.getText().toString();
            mPassword = mPasswordView.getText().toString();
            attemptCreation();
        }
    });
    inflatedView.findViewById(R.id.import_card_view).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startImport();
        }
    });

    mSipFormLinearLayout = (LinearLayout) inflatedView.findViewById(R.id.sipFormLinearLayout);
    mSipFormLinearLayout.setVisibility(View.GONE);
    inflatedView.findViewById(R.id.sipHeaderLinearLayout).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (null != mSipFormLinearLayout) {
                if (mSipFormLinearLayout.getVisibility() != View.VISIBLE) {
                    mSipFormLinearLayout.setVisibility(View.VISIBLE);
                    //~ Let the time to perform setVisibility before scrolling.
                    final ScrollView loginForm = (ScrollView) inflatedView.findViewById(R.id.login_form);
                    loginForm.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            loginForm.fullScroll(ScrollView.FOCUS_DOWN);
                            mAliasView.requestFocus();
                        }
                    }, 100);
                }
            }
        }
    });

    return inflatedView;
}

From source file:org.ros.android.app_chooser.ExchangeActivity.java

public void addTextToTextView(String message) {

    dialog_text.append(message);//from  w  w  w .  j  av a 2s . c  o m

    final ScrollView dialog_scroll = (ScrollView) dialog.findViewById(R.id.dialog_scrollview);
    dialog_scroll.post(new Runnable() {
        @Override
        public void run() {
            dialog_scroll.fullScroll(View.FOCUS_DOWN);
        }
    });
}

From source file:com.wubydax.dbeditor.TableValuesFragment.java

private void showDialog(final String key, final String value, final int position) {
    @SuppressLint("InflateParams")
    View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_layout, null, false);
    TextView keyText = (TextView) view.findViewById(R.id.textKey);
    final EditText editText = (EditText) view.findViewById(R.id.valueEditText);
    final ScrollView scroll = (ScrollView) view.findViewById(R.id.ScrollView1);
    if (value.matches("\\d+(?:\\.\\d+)?")) {
        editText.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
        editText.setSingleLine(true);/*  ww w .  ja v  a  2  s .c om*/
    } else {
        editText.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        editText.setHint(getResources().getString(R.string.enter_string));
    }
    keyText.setText(key);
    editText.setText(value);
    editText.setSelection(editText.getText().length());
    scroll.post(new Runnable() {
        @Override
        public void run() {
            scroll.fullScroll(View.FOCUS_DOWN);
        }
    });
    new AlertDialog.Builder(getActivity()).setTitle(getResources().getString(R.string.change_value))
            .setView(view).setNegativeButton(android.R.string.cancel, null)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String newValue = editText.getText().toString();
                    boolean isGranted = Settings.System.canWrite(getActivity());
                    if (!isGranted) {
                        Intent grantPermission = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS);
                        startActivity(grantPermission);
                    } else {
                        switch (mTableName) {
                        case "system":
                            Settings.System.putString(getActivity().getContentResolver(), key, newValue);
                            break;
                        case "global":
                            Settings.Global.putString(getActivity().getContentResolver(), key, newValue);
                            break;
                        case "secure":
                            Settings.Secure.putString(getActivity().getContentResolver(), key, newValue);
                            break;
                        }
                        mList.get(position).value = newValue;
                    }
                    mRecyclerView.getAdapter().notifyDataSetChanged();
                }
            }).show();
}