Search in sources :

Example 11 with ObservableScrollView

use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project Android-ObservableScrollView by ksoichiro.

the class ViewPagerTab2ScrollViewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_scrollview_noheader, container, false);
    final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll);
    Activity parentActivity = getActivity();
    scrollView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
        scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
}
Also used : ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) Activity(android.app.Activity) ObservableScrollViewCallbacks(com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View)

Example 12 with ObservableScrollView

use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project Android-ObservableScrollView by ksoichiro.

the class FillGap2ScrollViewActivity method createScrollable.

@Override
protected ObservableScrollView createScrollable() {
    ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll);
    scrollView.setScrollViewCallbacks(this);
    return scrollView;
}
Also used : ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView)

Example 13 with ObservableScrollView

use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project Android-ObservableScrollView by ksoichiro.

the class FillGap3ScrollViewActivity method createScrollable.

@Override
protected ObservableScrollView createScrollable() {
    ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll);
    scrollView.setScrollViewCallbacks(this);
    return scrollView;
}
Also used : ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView)

Example 14 with ObservableScrollView

use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project Android-ObservableScrollView by ksoichiro.

the class HandleTouchScrollViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_handletouchscrollview);
    ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll);
    scrollView.setScrollViewCallbacks(this);
    int[] ids = new int[] { R.id.button1, R.id.button2, R.id.button3 };
    for (int i = 0; i < ids.length; i++) {
        final int number = i + 1;
        findViewById(ids[i]).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                click(number);
            }
        });
    }
}
Also used : ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View)

Example 15 with ObservableScrollView

use of com.github.ksoichiro.android.observablescrollview.ObservableScrollView in project CoCoin by Nightonke.

the class HelpFeedbackFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mScrollView = (ObservableScrollView) view.findViewById(R.id.scrollView);
    MaterialViewPagerHelper.registerScrollView(getActivity(), mScrollView, null);
    title = (TextView) view.findViewById(R.id.title);
    title.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    input = (EditText) view.findViewById(R.id.edittext);
    input.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    help = (TextView) view.findViewById(R.id.helper);
    help.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    number = (TextView) view.findViewById(R.id.number);
    number.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    send = (TextView) view.findViewById(R.id.send);
    send.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (exceed) {
                new MaterialDialog.Builder(mContext).title(R.string.help_feedback_dialog_title).content(R.string.help_feedback_dialog_content).positiveText(R.string.ok_1).show();
            } else {
                CoCoinUtil.getInstance().showToast(CoCoinApplication.getAppContext(), CoCoinApplication.getAppContext().getResources().getString(R.string.help_feedback_sent));
                Feedback feedback = new Feedback();
                feedback.setContent(input.getText().toString());
                feedback.save(CoCoinApplication.getAppContext(), new SaveListener() {

                    @Override
                    public void onSuccess() {
                        CoCoinUtil.getInstance().showToast(CoCoinApplication.getAppContext(), CoCoinApplication.getAppContext().getResources().getString(R.string.help_feedback_sent_successfully));
                    }

                    @Override
                    public void onFailure(int code, String arg0) {
                        CoCoinUtil.getInstance().showToast(CoCoinApplication.getAppContext(), CoCoinApplication.getAppContext().getResources().getString(R.string.help_feedback_sent_fail));
                    }
                });
            }
        }
    });
    input.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            setNumberText();
            try {
                ((OnTextChangeListener) activity).onTextChange(input.getText().toString(), exceed);
            } catch (ClassCastException cce) {
                cce.printStackTrace();
            }
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
    send.requestFocus();
    setNumberText();
}
Also used : SaveListener(cn.bmob.v3.listener.SaveListener) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) TextView(android.widget.TextView) ObservableScrollView(com.github.ksoichiro.android.observablescrollview.ObservableScrollView) View(android.view.View) Feedback(com.nightonke.saver.model.Feedback) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Aggregations

ObservableScrollView (com.github.ksoichiro.android.observablescrollview.ObservableScrollView)28 View (android.view.View)14 ObservableScrollViewCallbacks (com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks)7 Activity (android.app.Activity)6 Bundle (android.os.Bundle)5 Fragment (android.support.v4.app.Fragment)5 ActionBar (android.support.v7.app.ActionBar)2 ViewTreeObserver (android.view.ViewTreeObserver)2 FrameLayout (android.widget.FrameLayout)2 TextView (android.widget.TextView)2 Toolbar (android.support.v7.widget.Toolbar)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 ViewGroup (android.view.ViewGroup)1 WebView (android.webkit.WebView)1 ImageButton (android.widget.ImageButton)1 SaveListener (cn.bmob.v3.listener.SaveListener)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 Feedback (com.nightonke.saver.model.Feedback)1