android.widget.ScrollView

Here are the examples of the java api class android.widget.ScrollView taken from open source projects.

1. ModifierGroup#getView()

Project: droidar
File: ModifierGroup.java
@Override
public View getView(Context context) {
    LinearLayout linLayout = new LinearLayout(context);
    linLayout.setOrientation(LinearLayout.VERTICAL);
    for (int i = 0; i < myList.size(); i++) {
        linLayout.addView(myList.get(i).getView(context));
    }
    ScrollView sv = new ScrollView(context);
    sv.addView(linLayout);
    sv.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    if (getTheme() != null) {
        getTheme().applyOuter1(sv);
    }
    return sv;
}

2. UntrustedCertificateDialog#onCreateDialog()

Project: weechat-android
File: UntrustedCertificateDialog.java
// this can get called before the activity has started
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final int padding = (int) getResources().getDimension(R.dimen.dialog_padding_full);
    final ScrollView scrollView = new ScrollView(getContext());
    final TextView textView = new AppCompatTextView(getContext());
    textView.setText(Html.fromHtml(getCertificateDescription()));
    scrollView.addView(textView);
    return new AlertDialog.Builder(getContext()).setTitle("Untrusted certificate").setView(scrollView, padding, padding / 2, padding, 0).setPositiveButton("Accept", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            SSLHandler.getInstance(getContext()).trustCertificate(certificate);
            ((WeechatActivity) getActivity()).connect();
        }
    }).setNegativeButton("Reject", null).create();
}

3. SwitchAccessEndToEndTest#testScrolling_scroll()

Project: talkback
File: SwitchAccessEndToEndTest.java
@MediumTest
public void testScrolling_scroll() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        return;
    }
    final ScrollView scrollView = (ScrollView) getActivity().findViewById(R.id.scroll_id);
    final CountDownLatch scrollsMissed = new CountDownLatch(1);
    scrollView.setAccessibilityDelegate(new AccessibilityDelegate() {

        @Override
        public boolean performAccessibilityAction(@NonNull View host, int action, Bundle args) {
            if (action == AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD) {
                scrollsMissed.countDown();
            }
            return super.performAccessibilityAction(host, action, args);
        }
    });
    sendKeyEventSync(mMoveFocusEvent);
    sendKeyEventSync(mScrollForwardEvent);
    assertEquals(0, scrollsMissed.getCount());
}

4. RxSwipeRefreshLayoutTestActivity#onCreate()

Project: RxBinding
File: RxSwipeRefreshLayoutTestActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    swipeRefreshLayout = new SwipeRefreshLayout(this);
    swipeRefreshLayout.setId(R.id.swipe_refresh_layout);
    swipeRefreshLayout.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_UP) {
                handler.removeCallbacks(stopRefreshing);
                handler.postDelayed(stopRefreshing, 300);
            }
            return false;
        }
    });
    ScrollView scrollView = new ScrollView(this);
    LayoutParams scrollParams = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
    swipeRefreshLayout.addView(scrollView, scrollParams);
    FrameLayout emptyView = new FrameLayout(this);
    LayoutParams emptyParams = new LayoutParams(MATCH_PARENT, 100000);
    scrollView.addView(emptyView, emptyParams);
    setContentView(swipeRefreshLayout);
}

5. RxNestedScrollViewTestActivity#onCreate()

Project: RxBinding
File: RxNestedScrollViewTestActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ScrollView scrollView = new ScrollView(this);
    nestedScrollView = new NestedScrollView(this);
    emptyView = new FrameLayout(this);
    LayoutParams scrollParams = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
    LayoutParams emptyParams = new LayoutParams(50000, 50000);
    nestedScrollView.addView(emptyView, emptyParams);
    scrollView.addView(nestedScrollView, scrollParams);
    setContentView(scrollView, scrollParams);
}

6. CommentEditActivity#onCreate()

Project: RedReader
File: CommentEditActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    PrefsUtility.applyTheme(this);
    super.onCreate(savedInstanceState);
    textEdit = (EditText) getLayoutInflater().inflate(R.layout.comment_edit, null);
    if (getIntent() != null && getIntent().hasExtra("commentIdAndType")) {
        commentIdAndType = getIntent().getStringExtra("commentIdAndType");
        textEdit.setText(getIntent().getStringExtra("commentText"));
    } else if (savedInstanceState != null && savedInstanceState.containsKey("commentIdAndType")) {
        textEdit.setText(savedInstanceState.getString("commentText"));
        commentIdAndType = savedInstanceState.getString("commentIdAndType");
    }
    final ScrollView sv = new ScrollView(this);
    sv.addView(textEdit);
    setBaseActivityContentView(sv);
}

7. ChangelogActivity#onCreate()

Project: RedReader
File: ChangelogActivity.java
@Override
protected void onCreate(final Bundle savedInstanceState) {
    PrefsUtility.applySettingsTheme(this);
    setToolbarActionBarEnabled(false);
    super.onCreate(savedInstanceState);
    getSupportActionBar().setTitle(R.string.title_changelog);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final LinearLayout items = new LinearLayout(this);
    items.setOrientation(LinearLayout.VERTICAL);
    ChangelogManager.generateViews(this, items, true);
    final ScrollView sv = new ScrollView(this);
    sv.addView(items);
    setBaseActivityContentView(sv);
}

8. HelpMarkdownFragment#onCreateView()

Project: open-keychain
File: HelpMarkdownFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    int mHtmlFile = getArguments().getInt(ARG_MARKDOWN_RES);
    ScrollView scroller = new ScrollView(getActivity());
    HtmlTextView text = new HtmlTextView(getActivity());
    // padding
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, getActivity().getResources().getDisplayMetrics());
    text.setPadding(padding, padding, padding, 0);
    scroller.addView(text);
    // load markdown from raw resource
    try {
        String html = new Markdown4jProcessor().process(getActivity().getResources().openRawResource(mHtmlFile));
        text.setHtmlFromString(html, new HtmlTextView.LocalImageGetter());
    } catch (IOException e) {
        Log.e(Constants.TAG, "IOException", e);
    }
    return scroller;
}

9. PullToRefreshScrollView#createRefreshableView()

Project: ONE-Unofficial
File: PullToRefreshScrollView.java
@Override
protected ScrollView createRefreshableView(Context context, AttributeSet attrs) {
    ScrollView scrollView;
    if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
        scrollView = new InternalScrollViewSDK9(context, attrs);
    } else {
        scrollView = new ScrollView(context, attrs);
    }
    scrollView.setId(R.id.scrollview);
    return scrollView;
}

10. PullToRefreshScrollView#createRefreshableView()

Project: k-9
File: PullToRefreshScrollView.java
@Override
protected ScrollView createRefreshableView(Context context, AttributeSet attrs) {
    ScrollView scrollView;
    if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
        scrollView = new InternalScrollViewSDK9(context, attrs);
    } else {
        scrollView = new ScrollView(context, attrs);
    }
    scrollView.setId(R.id.scrollview);
    return scrollView;
}

11. InternalSelectionScroll#onCreate()

Project: codeexamples-android
File: InternalSelectionScroll.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ScrollView sv = new ScrollView(this);
    ViewGroup.LayoutParams svLp = new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    LinearLayout ll = new LinearLayout(this);
    ll.setLayoutParams(svLp);
    sv.addView(ll);
    InternalSelectionView isv = new InternalSelectionView(this, 10);
    int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
    LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, // 2x screen height to ensure scrolling
    2 * screenHeight);
    isv.setLayoutParams(llLp);
    ll.addView(isv);
    setContentView(sv);
}

12. CBIActivityTerminal#terminalScroll()

Project: CarBusInterface
File: CBIActivityTerminal.java
private void terminalScroll() {
    if (DD)
        Log.d(TAG, "terminalScroll()");
    final ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
    scrollView.post(new Runnable() {

        public void run() {
            scrollView.smoothScrollTo(0, mTxtTerminal.getBottom());
        }
    });
}

13. BookEditLoaned#loaned()

Project: Book-Catalogue
File: BookEditLoaned.java
/**
	 * Display the existing loan page. It is slightly different to the loan to page
	 * 
	 * @param user The user the book was loaned to
	 */
private void loaned(String user) {
    ScrollView sv = (ScrollView) getView().findViewById(R.id.root);
    sv.removeAllViews();
    LayoutInflater inf = getActivity().getLayoutInflater();
    inf.inflate(R.layout.edit_book_loaned, sv);
    TextView mWhoText = (TextView) sv.findViewById(R.id.who);
    mWhoText.setText(user);
    Button mConfirmButton = (Button) sv.findViewById(R.id.confirm);
    mConfirmButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View view) {
            removeLoan();
            loanTo();
        }
    });
}

14. BookEditLoaned#loanTo()

Project: Book-Catalogue
File: BookEditLoaned.java
/**
	 * Display the loan to page. It is slightly different to the existing loan page
	 */
private void loanTo() {
    ScrollView sv = (ScrollView) getView().findViewById(R.id.root);
    sv.removeAllViews();
    LayoutInflater inf = getActivity().getLayoutInflater();
    inf.inflate(R.layout.edit_book_loan, sv);
    AutoCompleteTextView mUserText = (AutoCompleteTextView) sv.findViewById(R.id.loan_to_who);
    try {
        ArrayAdapter<String> series_adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_dropdown_item_1line, getFriends());
        mUserText.setAdapter(series_adapter);
    } catch (Exception e) {
        Logger.logError(e);
    }
    Button mConfirmButton = (Button) sv.findViewById(R.id.confirm);
    mConfirmButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View view) {
            String friend = saveLoan();
            loaned(friend);
        }
    });
}

15. TaskEditFragment#scrollToView()

Project: astrid
File: TaskEditFragment.java
// Scroll to view in edit task
public void scrollToView(View v) {
    View child = v;
    ScrollView scrollView = (ScrollView) getView().findViewById(R.id.edit_scroll);
    int top = v.getTop();
    while (!child.equals(scrollView)) {
        top += child.getTop();
        ViewParent parentView = child.getParent();
        if (parentView != null && View.class.isInstance(parentView)) {
            child = (View) parentView;
        } else {
            break;
        }
    }
    scrollView.smoothScrollTo(0, top);
}

16. PullToRefreshScrollView#createRefreshableView()

Project: Android-PullToRefresh
File: PullToRefreshScrollView.java
@Override
protected ScrollView createRefreshableView(Context context, AttributeSet attrs) {
    ScrollView scrollView;
    if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
        scrollView = new InternalScrollViewSDK9(context, attrs);
    } else {
        scrollView = new ScrollView(context, attrs);
    }
    scrollView.setId(R.id.scrollview);
    return scrollView;
}

17. InternalSelectionScroll#onCreate()

Project: android-maven-plugin
File: InternalSelectionScroll.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ScrollView sv = new ScrollView(this);
    ViewGroup.LayoutParams svLp = new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    LinearLayout ll = new LinearLayout(this);
    ll.setLayoutParams(svLp);
    sv.addView(ll);
    InternalSelectionView isv = new InternalSelectionView(this, 10);
    int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
    LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, // 2x screen height to ensure scrolling
    2 * screenHeight);
    isv.setLayoutParams(llLp);
    ll.addView(isv);
    setContentView(sv);
}

18. Detail#onCreateView()

Project: android-demos
File: Detail.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (container == null) {
        return null;
    }
    ScrollView scroller = new ScrollView(getActivity());
    TextView text = new TextView(getActivity());
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getActivity().getResources().getDisplayMetrics());
    text.setPadding(padding, padding, padding, padding);
    scroller.addView(text);
    text.setText(Constants.DETAILS[getArguments().getInt("index", 0)]);
    return scroller;
}

19. PullToRefreshScrollView#createRefreshableView()

Project: AcFun-Area63
File: PullToRefreshScrollView.java
@Override
protected ScrollView createRefreshableView(Context context, AttributeSet attrs) {
    ScrollView scrollView;
    if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
        scrollView = new InternalScrollViewSDK9(context, attrs);
    } else {
        scrollView = new ScrollView(context, attrs);
    }
    scrollView.setId(R.id.scrollview);
    return scrollView;
}

20. ReactScrollViewTestCase#testScrollToCommand()

Project: react-native
File: ReactScrollViewTestCase.java
/**
   * Verify that 'scrollTo' command makes ScrollView start scrolling
   */
public void testScrollToCommand() throws Exception {
    ScrollView scrollView = getViewAtPath(0);
    ScrollViewTestModule jsModule = getReactContext().getCatalystInstance().getJSModule(ScrollViewTestModule.class);
    assertEquals(0, scrollView.getScrollY());
    jsModule.scrollTo(0, 300);
    waitForBridgeAndUIIdle();
    getInstrumentation().waitForIdleSync();
    // Unfortunately we need to use timeouts here in order to wait for scroll animation to happen
    // there is no better way (yet) for waiting for scroll animation to finish
    long timeout = 10000;
    long interval = 50;
    long start = System.currentTimeMillis();
    while (System.currentTimeMillis() - start < timeout) {
        if (scrollView.getScrollY() > 0) {
            break;
        }
        Thread.sleep(interval);
    }
    assertNotSame(0, scrollView.getScrollY());
    assertFalse("Drag should not be called with scrollTo", mScrollListenerModule.dragEventsMatch());
}

21. ReactScrollViewTestCase#testScrollEvents()

Project: react-native
File: ReactScrollViewTestCase.java
public void testScrollEvents() {
    ScrollView scrollView = getViewAtPath(0);
    dragUp();
    waitForBridgeAndUIIdle();
    mScrollListenerModule.waitForScrollIdle();
    waitForBridgeAndUIIdle();
    ArrayList<Double> yOffsets = mScrollListenerModule.getYOffsets();
    assertFalse("Expected to receive at least one scroll event", yOffsets.isEmpty());
    assertTrue("Expected offset to be greater than 0", yOffsets.get(yOffsets.size() - 1) > 0);
    assertTrue("Expected no item click event fired", mScrollListenerModule.getItemsPressed().isEmpty());
    assertEquals("Expected last offset to be offset of scroll view", PixelUtil.toDIPFromPixel(scrollView.getScrollY()), yOffsets.get(yOffsets.size() - 1).doubleValue(), 1e-5);
    assertTrue("Begin and End Drag should be called", mScrollListenerModule.dragEventsMatch());
}

22. ParallaxViewUpFragment#onCreateView()

Project: Paralloid
File: ParallaxViewUpFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_home_dummy, container, false);
    ImageView imageView = (ImageView) rootView.findViewById(R.id.image_view);
    ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
    if (scrollView instanceof Parallaxor) {
        ((Parallaxor) scrollView).parallaxViewBy(imageView, 0.5f);
    }
    return rootView;
}

23. ParallaxViewRightFragment#onCreateView()

Project: Paralloid
File: ParallaxViewRightFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_invert_transformer, container, false);
    ImageView imageView = (ImageView) rootView.findViewById(R.id.image_view);
    ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
    if (scrollView instanceof Parallaxor) {
        ((Parallaxor) scrollView).parallaxViewBy(imageView, new RightAngleTransformer(), 0.4f);
    }
    return rootView;
}

24. ParallaxViewDownFragment#onCreateView()

Project: Paralloid
File: ParallaxViewDownFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_invert_transformer, container, false);
    ImageView imageView = (ImageView) rootView.findViewById(R.id.image_view);
    ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
    if (scrollView instanceof Parallaxor) {
        ((Parallaxor) scrollView).parallaxViewBy(imageView, new InvertTransformer(), 0.35f);
    }
    return rootView;
}

25. ParallaxViewCombiFragment#onCreateView()

Project: Paralloid
File: ParallaxViewCombiFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_combi_transformer, container, false);
    ImageView imageView = (ImageView) rootView.findViewById(R.id.image_view);
    ImageView imageView2 = (ImageView) rootView.findViewById(R.id.image_view2);
    ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
    if (scrollView instanceof Parallaxor) {
        ((Parallaxor) scrollView).parallaxViewBy(imageView, new LeftAngleTransformer(), 0.2f);
        ((Parallaxor) scrollView).parallaxViewBy(imageView2, new RightAngleTransformer(), 0.2f);
    }
    return rootView;
}

26. AddFileProviderFragment#onCreateView()

Project: PapercutPrintService
File: AddFileProviderFragment.java
//======================= lifecycle methods ===============================
/**
     * Create a new view
     *
     * @param inflater   {LayoutInflater}
     * @param parent     {ViewGroup}
     * @param savedState {Bundle}
     *
     * @return {View}
     */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedState) {
    View settingsView = inflater.inflate(R.layout.fragment_add_file_provider, parent, false);
    ScrollView scrollView = (ScrollView) settingsView.findViewById(R.id.add_file_provider_scroll_view);
    View childView;
    for (int i = 0; i <= scrollView.getChildCount() - 1; i++) {
        childView = scrollView.getChildAt(i);
        if (childView.getId() == R.id.add_dropbox) {
            childView.setOnClickListener(this);
        }
    }
    return settingsView;
}

27. CameraStreamerActivity#updateUI()

Project: media-for-mobile
File: CameraStreamerActivity.java
private void updateUI(boolean inProgress) {
    ImageButton settingsButton = (ImageButton) findViewById(R.id.settings);
    ImageButton captureButton = (ImageButton) findViewById(R.id.start);
    ImageButton changeCameraButton = (ImageButton) findViewById(R.id.change_camera);
    ScrollView container = (ScrollView) findViewById(R.id.effectsContainer);
    if (inProgress == false) {
        captureButton.setImageResource(R.drawable.rec_inact);
        settingsButton.setVisibility(View.VISIBLE);
        container.setVisibility(View.VISIBLE);
        changeCameraButton.setVisibility(View.VISIBLE);
    } else {
        captureButton.setImageResource(R.drawable.rec_act);
        settingsButton.setVisibility(View.INVISIBLE);
        container.setVisibility(View.INVISIBLE);
        changeCameraButton.setVisibility(View.INVISIBLE);
    }
}

28. LoginActivity#onCreate()

Project: HttpTest
File: LoginActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    fragmentContainer = new //????
    ScrollView(//????
    this);
    fragmentContainer.setBackgroundColor(0xfffbf7ed);
    fragmentContainer.setId(ROOT_ID);
    setContentView(fragmentContainer);
    LoginFragment loginFragment = new LoginFragment();
    getFragmentManager().beginTransaction().replace(ROOT_ID, loginFragment).commit();
    //??????????????????
    loginFragment.setLoginInterface(this);
    //?????Activity??????????????
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        String account = bundle.getString("account");
        String password = bundle.getString("password");
        loginFragment.login(this, account, password);
    }
}

29. BaseActivity#onCreate()

Project: Android-Bootstrap
File: BaseActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_base);
    ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
    if (scrollView != null) {
        scrollView.addView(LayoutInflater.from(this).inflate(getContentLayoutId(), scrollView, false));
    }
    ButterKnife.bind(this);
}

30. BootstrapDropDown#createDropDown()

Project: Android-Bootstrap
File: BootstrapDropDown.java
private void createDropDown() {
    ScrollView dropdownView = createDropDownView();
    dropdownWindow = new PopupWindow();
    dropdownWindow.setFocusable(true);
    dropdownWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
    dropdownWindow.setBackgroundDrawable(DrawableUtils.resolveDrawable(android.R.drawable.dialog_holo_light_frame, getContext()));
    dropdownWindow.setContentView(dropdownView);
    dropdownWindow.setOnDismissListener(this);
    dropdownWindow.setAnimationStyle(android.R.style.Animation_Activity);
    float longestStringWidth = measureStringWidth(getLongestString(dropdownData)) + DimenUtils.dpToPixels((baselineItemRightPadding + baselineItemLeftPadding) * bootstrapSize);
    if (longestStringWidth < getMeasuredWidth()) {
        dropdownWindow.setWidth(DimenUtils.dpToPixels(getMeasuredWidth()));
    } else {
        dropdownWindow.setWidth((int) longestStringWidth + DimenUtils.dpToPixels(8));
    }
}

31. CrashReportDialog#buildCustomView()

Project: acra
File: CrashReportDialog.java
@NonNull
protected View buildCustomView(@Nullable Bundle savedInstanceState) {
    final ScrollView root = new ScrollView(this);
    root.setPadding(PADDING, PADDING, PADDING, PADDING);
    root.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    root.setFocusable(true);
    root.setFocusableInTouchMode(true);
    root.addView(scrollable);
    addViewToDialog(getMainView());
    // Add an optional prompt for user comments
    final View comment = getCommentLabel();
    if (comment != null) {
        comment.setPadding(comment.getPaddingLeft(), PADDING, comment.getPaddingRight(), comment.getPaddingBottom());
        addViewToDialog(comment);
        String savedComment = null;
        if (savedInstanceState != null) {
            savedComment = savedInstanceState.getString(STATE_COMMENT);
        }
        userCommentView = getCommentPrompt(savedComment);
        addViewToDialog(userCommentView);
    }
    // Add an optional user email field
    final View email = getEmailLabel();
    if (email != null) {
        email.setPadding(email.getPaddingLeft(), PADDING, email.getPaddingRight(), email.getPaddingBottom());
        addViewToDialog(email);
        String savedEmail = null;
        if (savedInstanceState != null) {
            savedEmail = savedInstanceState.getString(STATE_EMAIL);
        }
        userEmailView = getEmailPrompt(savedEmail);
        addViewToDialog(userEmailView);
    }
    return root;
}

32. TemplatePicker#populateContentView()

Project: arcgis-runtime-samples-android
File: TemplatePicker.java
public View populateContentView() {
    ScrollView scrollTemplateGroup = new ScrollView(context);
    scrollTemplateGroup.setVerticalScrollBarEnabled(true);
    scrollTemplateGroup.setVisibility(View.VISIBLE);
    scrollTemplateGroup.setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET);
    LinearLayout templateGroup = new LinearLayout(context);
    templateGroup.setPadding(10, 10, 10, 10);
    templateGroup.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT));
    templateGroup.setBackgroundResource(R.drawable.popupbg);
    templateGroup.setOrientation(LinearLayout.VERTICAL);
    for (Layer layer : map.getLayers()) {
        if (layer instanceof FeatureLayer) {
            RelativeLayout templateLayout = new RelativeLayout(context);
            templateLayout.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT));
            TextView layerName = new TextView(context);
            layerName.setPadding(10, 10, 10, 10);
            layerName.setText(layer.getName());
            layerName.setTextColor(Color.MAGENTA);
            layerName.setId(1);
            RelativeLayout.LayoutParams layerTemplateParams = new RelativeLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
            layerTemplateParams.addRule(RelativeLayout.BELOW, layerName.getId());
            HorizontalScrollView scrollTemplateAndType = new HorizontalScrollView(context);
            scrollTemplateAndType.setPadding(5, 5, 5, 5);
            LinearLayout layerTemplate = new LinearLayout(context);
            layerTemplate.setBackgroundColor(Color.WHITE);
            layerTemplate.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
            layerTemplate.setId(2);
            String typeIdField = ((GeodatabaseFeatureTable) ((FeatureLayer) layer).getFeatureTable()).getTypeIdField();
            if (typeIdField.equals("")) {
                List<FeatureTemplate> featureTemp = ((GeodatabaseFeatureTable) ((FeatureLayer) layer).getFeatureTable()).getFeatureTemplates();
                for (FeatureTemplate featureTemplate : featureTemp) {
                    GeodatabaseFeature g;
                    try {
                        g = ((GeodatabaseFeatureTable) ((FeatureLayer) layer).getFeatureTable()).createFeatureWithTemplate(featureTemplate, null);
                        Renderer renderer = ((FeatureLayer) layer).getRenderer();
                        Symbol symbol = renderer.getSymbol(g);
                        Bitmap bitmap = createBitmapfromSymbol(symbol, (FeatureLayer) layer);
                        populateTemplateView(layerTemplate, bitmap, featureTemplate, (FeatureLayer) layer, symbol);
                    } catch (TableException e) {
                        e.printStackTrace();
                    }
                }
            } else {
                List<FeatureType> featureTypes = ((GeodatabaseFeatureTable) ((FeatureLayer) layer).getFeatureTable()).getFeatureTypes();
                for (FeatureType featureType : featureTypes) {
                    FeatureTemplate[] templates = featureType.getTemplates();
                    for (FeatureTemplate featureTemplate : templates) {
                        GeodatabaseFeature g;
                        try {
                            g = ((GeodatabaseFeatureTable) ((FeatureLayer) layer).getFeatureTable()).createFeatureWithTemplate(featureTemplate, null);
                            Renderer renderer = ((FeatureLayer) layer).getRenderer();
                            Symbol symbol = renderer.getSymbol(g);
                            Bitmap bitmap = createBitmapfromSymbol(symbol, (FeatureLayer) layer);
                            populateTemplateView(layerTemplate, bitmap, featureTemplate, (FeatureLayer) layer, symbol);
                        } catch (TableException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
            templateLayout.addView(layerName);
            scrollTemplateAndType.addView(layerTemplate);
            templateLayout.addView(scrollTemplateAndType, layerTemplateParams);
            templateGroup.addView(templateLayout);
        }
    }
    scrollTemplateGroup.addView(templateGroup);
    return scrollTemplateGroup;
}

33. BootstrapDropDown#createDropDownView()

Project: Android-Bootstrap
File: BootstrapDropDown.java
private ScrollView createDropDownView() {
    final LinearLayout dropdownView = new LinearLayout(getContext());
    ScrollView scrollView = new ScrollView(getContext());
    int clickableChildCounter = 0;
    dropdownView.setOrientation(LinearLayout.VERTICAL);
    LayoutParams childParams = new LayoutParams(LayoutParams.MATCH_PARENT, DimenUtils.pixelsToDp(itemHeight * bootstrapSize));
    for (String text : dropdownData) {
        TextView childView = new TextView(getContext());
        childView.setGravity(Gravity.CENTER_VERTICAL);
        childView.setLayoutParams(childParams);
        childView.setPadding(DimenUtils.dpToPixels(baselineItemLeftPadding * bootstrapSize), 0, DimenUtils.dpToPixels(baselineItemRightPadding * bootstrapSize), 0);
        childView.setTextSize(baselineDropDownViewFontSize * bootstrapSize);
        childView.setTextColor(ColorUtils.resolveColor(android.R.color.black, getContext()));
        Drawable background = getContext().obtainStyledAttributes(null, new int[] { android.R.attr.selectableItemBackground }, 0, 0).getDrawable(0);
        ViewUtils.setBackgroundDrawable(childView, background);
        childView.setTextColor(BootstrapDrawableFactory.bootstrapDropDownViewText(getContext()));
        childView.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                dropdownWindow.dismiss();
                if (onDropDownItemClickListener != null) {
                    onDropDownItemClickListener.onItemClick(dropdownView, v, v.getId());
                }
            }
        });
        if (Pattern.matches(SEARCH_REGEX_HEADER, text)) {
            childView.setText(text.replaceFirst(REPLACE_REGEX_HEADER, ""));
            childView.setTextSize((baselineDropDownViewFontSize - 2F) * bootstrapSize);
            childView.setClickable(false);
            childView.setTextColor(ColorUtils.resolveColor(R.color.bootstrap_gray_light, getContext()));
        } else if (Pattern.matches(SEARCH_REGEX_SEPARATOR, text)) {
            childView = new DividerView(getContext());
            childView.setClickable(false);
            childView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 3));
        } else if (Pattern.matches(SEARCH_REGEX_DISABLED, text)) {
            childView.setEnabled(false);
            childView.setId(clickableChildCounter++);
            childView.setText(text.replaceFirst(REPLACE_REGEX_DISABLED, ""));
        } else {
            childView.setText(text);
            childView.setId(clickableChildCounter++);
        }
        dropdownView.addView(childView);
    }
    dropdownView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
    dropDownViewHeight = dropdownView.getMeasuredHeight();
    dropDownViewWidth = dropdownView.getMeasuredWidth();
    scrollView.setVerticalScrollBarEnabled(false);
    scrollView.setHorizontalScrollBarEnabled(false);
    scrollView.addView(dropdownView);
    cleanData();
    return scrollView;
}

34. M_Container#getView()

Project: droidar
File: M_Container.java
@Override
public View getView(Context target) {
    LinearLayout containerForAllItems = new LinearLayout(target);
    ScrollView scrollContainer = new ScrollView(target);
    LinearLayout mostOuterBox = new LinearLayout(target);
    LayoutParams layParams = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1);
    containerForAllItems.setLayoutParams(layParams);
    containerForAllItems.setPadding(MOST_OUTER_PADDING, MOST_OUTER_PADDING, MOST_OUTER_PADDING, MOST_OUTER_PADDING);
    containerForAllItems.setOrientation(LinearLayout.VERTICAL);
    scrollContainer.setLayoutParams(layParams);
    scrollContainer.addView(containerForAllItems);
    mostOuterBox.setGravity(Gravity.CENTER);
    mostOuterBox.setBackgroundColor(OUTER_BACKGROUND_DIMMING_COLOR);
    mostOuterBox.setPadding(MOST_OUTER_PADDING, MOST_OUTER_PADDING, MOST_OUTER_PADDING, MOST_OUTER_PADDING);
    mostOuterBox.addView(scrollContainer);
    BACKGROUND.applyTo(scrollContainer);
    if (myDecorator != null) {
        int level = myDecorator.getCurrentLevel();
        myDecorator.decorate(target, mostOuterBox, level + 1, UiDecorator.TYPE_CONTAINER);
        myDecorator.decorate(target, scrollContainer, level + 2, UiDecorator.TYPE_CONTAINER);
        myDecorator.setCurrentLevel(level + 3);
    }
    createViewsForAllModifiers(target, containerForAllItems);
    if (myDecorator != null) {
        /*
			 * Then reduce level again to the previous value
			 */
        myDecorator.setCurrentLevel(myDecorator.getCurrentLevel() - 3);
    }
    return mostOuterBox;
}

35. ProfileEditActivity#initComponents()

Project: YiBo
File: ProfileEditActivity.java
private void initComponents() {
    LinearLayout llHeaderBase = (LinearLayout) findViewById(R.id.llHeaderBase);
    ThemeUtil.setSecondaryHeader(llHeaderBase);
    //??????
    LinearLayout llProfileHeader = (LinearLayout) findViewById(R.id.llProfileHeader);
    tvScreenName = (TextView) findViewById(R.id.tvScreenName);
    ivVerify = (ImageView) findViewById(R.id.ivVerify);
    tvImpress = (TextView) findViewById(R.id.tvImpress);
    ThemeUtil.setHeaderProfile(llProfileHeader);
    Theme theme = ThemeUtil.createTheme(this);
    tvScreenName.setTextColor(theme.getColor("highlight"));
    ivVerify.setImageDrawable(GlobalResource.getIconVerification(this));
    tvImpress.setTextColor(theme.getColor("content"));
    //????
    ScrollView llContentPanel = (ScrollView) findViewById(R.id.llContentPanel);
    LinearLayout llChangeProfilePhoto = (LinearLayout) findViewById(R.id.llChangeProfilePhoto);
    ImageView ivProfileEdit = (ImageView) findViewById(R.id.ivProfileEdit);
    TextView tvProfileEdit = (TextView) findViewById(R.id.tvProfileEdit);
    etScreenName = (EditText) this.findViewById(R.id.etProfileScreenName);
    etDescription = (EditText) this.findViewById(R.id.etProfileDescription);
    llContentPanel.setBackgroundColor(theme.getColor("background_content"));
    llChangeProfilePhoto.setBackgroundDrawable(theme.getDrawable("selector_btn_action_negative"));
    ivProfileEdit.setImageDrawable(theme.getDrawable("icon_profile_edit"));
    tvProfileEdit.setTextColor(theme.getColorStateList("selector_btn_action_negative"));
    etScreenName.setBackgroundDrawable(theme.getDrawable("selector_input_frame"));
    int content = theme.getColor("content");
    etScreenName.setTextColor(content);
    etDescription.setBackgroundDrawable(theme.getDrawable("selector_input_frame"));
    etDescription.setTextColor(content);
    //???
    LinearLayout llToolbar = (LinearLayout) findViewById(R.id.llToolbar);
    Button btnProfileUpdate = (Button) findViewById(R.id.btnProfileUpdate);
    Button btnProfileReset = (Button) findViewById(R.id.btnProfileReset);
    llToolbar.setBackgroundDrawable(theme.getDrawable("bg_toolbar"));
    llToolbar.setGravity(Gravity.CENTER);
    int padding4 = theme.dip2px(4);
    llToolbar.setPadding(padding4, padding4, padding4, padding4);
    ThemeUtil.setBtnActionPositive(btnProfileUpdate);
    ThemeUtil.setBtnActionNegative(btnProfileReset);
    profileTextWatcher = new ProfileTextWatcher(this);
    Button btnFollow = (Button) this.findViewById(R.id.btnFollow);
    btnFollow.setVisibility(View.INVISIBLE);
}

36. CommentDetailFragment#showComment()

Project: WordPress-Android
File: CommentDetailFragment.java
/*
     * display the current comment
     */
private void showComment() {
    if (!isAdded() || getView() == null)
        return;
    // these two views contain all the other views except the progress bar
    final ScrollView scrollView = (ScrollView) getView().findViewById(R.id.scroll_view);
    final View layoutBottom = getView().findViewById(R.id.layout_bottom);
    // hide container views when comment is null (will happen when opened from a notification)
    if (mComment == null) {
        scrollView.setVisibility(View.GONE);
        layoutBottom.setVisibility(View.GONE);
        if (mNote != null && mShouldRequestCommentFromNote) {
            // If a remote comment was requested, check if we have the comment for display.
            // Otherwise request the comment via the REST API
            int localTableBlogId = WordPress.wpDB.getLocalTableBlogIdForRemoteBlogId(mNote.getSiteId());
            if (localTableBlogId > 0) {
                Comment comment = CommentTable.getComment(localTableBlogId, mNote.getParentCommentId());
                if (comment != null) {
                    setComment(localTableBlogId, comment);
                    return;
                }
            }
            long commentId = mNote.getParentCommentId() > 0 ? mNote.getParentCommentId() : mNote.getCommentId();
            requestComment(localTableBlogId, mNote.getSiteId(), commentId);
        } else if (mNote != null) {
            showCommentForNote(mNote);
        }
        return;
    }
    scrollView.setVisibility(View.VISIBLE);
    layoutBottom.setVisibility(View.VISIBLE);
    // Add action buttons footer
    if ((mNote == null || mShouldRequestCommentFromNote) && mLayoutButtons.getParent() == null) {
        ViewGroup commentContentLayout = (ViewGroup) getView().findViewById(R.id.comment_content_container);
        commentContentLayout.addView(mLayoutButtons);
    }
    final WPNetworkImageView imgAvatar = (WPNetworkImageView) getView().findViewById(R.id.image_avatar);
    final TextView txtName = (TextView) getView().findViewById(R.id.text_name);
    final TextView txtDate = (TextView) getView().findViewById(R.id.text_date);
    txtName.setText(mComment.hasAuthorName() ? HtmlUtils.fastUnescapeHtml(mComment.getAuthorName()) : getString(R.string.anonymous));
    txtDate.setText(DateTimeUtils.javaDateToTimeSpan(mComment.getDatePublished()));
    int maxImageSz = getResources().getDimensionPixelSize(R.dimen.reader_comment_max_image_size);
    CommentUtils.displayHtmlComment(mTxtContent, mComment.getCommentText(), maxImageSz);
    int avatarSz = getResources().getDimensionPixelSize(R.dimen.avatar_sz_large);
    if (mComment.hasProfileImageUrl()) {
        imgAvatar.setImageUrl(GravatarUtils.fixGravatarUrl(mComment.getProfileImageUrl(), avatarSz), WPNetworkImageView.ImageType.AVATAR);
    } else if (mComment.hasAuthorEmail()) {
        String avatarUrl = GravatarUtils.gravatarFromEmail(mComment.getAuthorEmail(), avatarSz);
        imgAvatar.setImageUrl(avatarUrl, WPNetworkImageView.ImageType.AVATAR);
    } else {
        imgAvatar.setImageUrl(null, WPNetworkImageView.ImageType.AVATAR);
    }
    updateStatusViews();
    // navigate to author's blog when avatar or name clicked
    if (mComment.hasAuthorUrl()) {
        View.OnClickListener authorListener = new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                ReaderActivityLauncher.openUrl(getActivity(), mComment.getAuthorUrl());
            }
        };
        imgAvatar.setOnClickListener(authorListener);
        txtName.setOnClickListener(authorListener);
        txtName.setTextColor(ContextCompat.getColor(getActivity(), R.color.reader_hyperlink));
    } else {
        txtName.setTextColor(ContextCompat.getColor(getActivity(), R.color.grey_darken_30));
    }
    showPostTitle(getRemoteBlogId(), mComment.postID);
    // make sure reply box is showing
    if (mLayoutReply.getVisibility() != View.VISIBLE && canReply()) {
        AniUtils.animateBottomBar(mLayoutReply, true);
        if (mEditReply != null && mShouldFocusReplyField) {
            mEditReply.requestFocus();
            disableShouldFocusReplyField();
        }
    }
    getFragmentManager().invalidateOptionsMenu();
}

37. MenuInScrollViewActivity#onCreate()

Project: UltimateAndroid
File: MenuInScrollViewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.circular_floating_menu_activity_menu_in_scroll_view);
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
    LinearLayout scrollViewBody = (LinearLayout) findViewById(R.id.scrollViewBody);
    menus = new ArrayList<FloatingActionMenu>();
    // add 20 views into body, each with a menu attached
    for (int i = 0; i < 20; i++) {
        LinearLayout item = (LinearLayout) inflater.inflate(R.layout.circular_floating_menu_item_scroll_view, null, false);
        scrollViewBody.addView(item);
        View mainActionView = item.findViewById(R.id.itemActionView);
        SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
        ImageView rlIcon1 = new ImageView(this);
        ImageView rlIcon2 = new ImageView(this);
        ImageView rlIcon3 = new ImageView(this);
        rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_chat_light));
        rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_camera_light));
        rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_video_light));
        FloatingActionMenu itemMenu = new FloatingActionMenu.Builder(this).setStartAngle(-45).setEndAngle(-135).setRadius(getResources().getDimensionPixelSize(R.dimen.radius_small)).addSubActionView(rLSubBuilder.setContentView(rlIcon1).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon2).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon3).build()).setStateChangeListener(// listen state changes of each menu
        this).attachTo(mainActionView).build();
        //
        menus.add(itemMenu);
    }
    // listen scroll events on root ScrollView
    scrollView.getViewTreeObserver().addOnScrollChangedListener(this);
    findViewById(R.id.buttom_bar_edit_text).clearFocus();
    // Attach a menu to the button in the bottom bar, just to prove that it works.
    View bottomActionButton = findViewById(R.id.bottom_bar_action_button);
    SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
    ImageView rlIcon1 = new ImageView(this);
    ImageView rlIcon2 = new ImageView(this);
    ImageView rlIcon3 = new ImageView(this);
    rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_place_light));
    rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_picture_light));
    rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_camera_light));
    bottomMenu = new FloatingActionMenu.Builder(this).addSubActionView(rLSubBuilder.setContentView(rlIcon1).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon2).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon3).build()).setStartAngle(-40).setEndAngle(-90).setRadius(getResources().getDimensionPixelSize(R.dimen.radius_medium)).attachTo(bottomActionButton).build();
    // Listen layout (size) changes on a main layout so that we could reposition the bottom menu
    scrollView.addOnLayoutChangeListener(this);
}

38. MenuInScrollViewActivity#onCreate()

Project: UltimateAndroid
File: MenuInScrollViewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.circular_floating_menu_activity_menu_in_scroll_view);
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
    LinearLayout scrollViewBody = (LinearLayout) findViewById(R.id.scrollViewBody);
    menus = new ArrayList<FloatingActionMenu>();
    // add 20 views into body, each with a menu attached
    for (int i = 0; i < 20; i++) {
        LinearLayout item = (LinearLayout) inflater.inflate(R.layout.circular_floating_menu_item_scroll_view, null, false);
        scrollViewBody.addView(item);
        View mainActionView = item.findViewById(R.id.itemActionView);
        SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
        ImageView rlIcon1 = new ImageView(this);
        ImageView rlIcon2 = new ImageView(this);
        ImageView rlIcon3 = new ImageView(this);
        rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_chat_light));
        rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_camera_light));
        rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_video_light));
        FloatingActionMenu itemMenu = new FloatingActionMenu.Builder(this).setStartAngle(-45).setEndAngle(-135).setRadius(getResources().getDimensionPixelSize(R.dimen.radius_small)).addSubActionView(rLSubBuilder.setContentView(rlIcon1).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon2).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon3).build()).setStateChangeListener(// listen state changes of each menu
        this).attachTo(mainActionView).build();
        //
        menus.add(itemMenu);
    }
    // listen scroll events on root ScrollView
    scrollView.getViewTreeObserver().addOnScrollChangedListener(this);
    findViewById(R.id.buttom_bar_edit_text).clearFocus();
    // Attach a menu to the button in the bottom bar, just to prove that it works.
    View bottomActionButton = findViewById(R.id.bottom_bar_action_button);
    SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
    ImageView rlIcon1 = new ImageView(this);
    ImageView rlIcon2 = new ImageView(this);
    ImageView rlIcon3 = new ImageView(this);
    rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_place_light));
    rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_picture_light));
    rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.circular_menu_ic_action_camera_light));
    bottomMenu = new FloatingActionMenu.Builder(this).addSubActionView(rLSubBuilder.setContentView(rlIcon1).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon2).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon3).build()).setStartAngle(-40).setEndAngle(-90).setRadius(getResources().getDimensionPixelSize(R.dimen.radius_medium)).attachTo(bottomActionButton).build();
    // Listen layout (size) changes on a main layout so that we could reposition the bottom menu
    scrollView.addOnLayoutChangeListener(this);
}

39. StandOutWindow#getDropDown()

Project: Roundr
File: StandOutWindow.java
/**
	 * You probably want to leave this method alone and implement
	 * {@link #getDropDownItems(int)} instead. Only implement this method if you
	 * want more control over the drop down menu.
	 * 
	 * <p>
	 * Implement this method to set a custom drop down menu when the user clicks
	 * on the icon of the window corresponding to the id. The icon is only shown
	 * when {@link StandOutFlags#FLAG_DECORATION_SYSTEM} is set.
	 * 
	 * @param id
	 *            The id of the window.
	 * @return The drop down menu to be anchored to the icon, or null to have no
	 *         dropdown menu.
	 */
public PopupWindow getDropDown(final int id) {
    final List<DropDownListItem> items;
    List<DropDownListItem> dropDownListItems = getDropDownItems(id);
    if (dropDownListItems != null) {
        items = dropDownListItems;
    } else {
        items = new ArrayList<StandOutWindow.DropDownListItem>();
    }
    // add default drop down items
    items.add(new DropDownListItem(android.R.drawable.ic_menu_close_clear_cancel, "Quit " + getAppName(), new Runnable() {

        @Override
        public void run() {
            closeAll();
        }
    }));
    // turn item list into views in PopupWindow
    LinearLayout list = new LinearLayout(this);
    list.setOrientation(LinearLayout.VERTICAL);
    ScrollView scroller = new ScrollView(this);
    scroller.addView(list);
    final PopupWindow dropDown = new PopupWindow(scroller, StandOutLayoutParams.WRAP_CONTENT, StandOutLayoutParams.WRAP_CONTENT, true);
    for (final DropDownListItem item : items) {
        ViewGroup listItem = (ViewGroup) mLayoutInflater.inflate(R.layout.drop_down_list_item, null);
        list.addView(listItem);
        ImageView icon = (ImageView) listItem.findViewById(R.id.icon);
        icon.setImageResource(item.icon);
        TextView description = (TextView) listItem.findViewById(R.id.description);
        description.setText(item.description);
        listItem.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                item.action.run();
                dropDown.dismiss();
            }
        });
    }
    Drawable background = getResources().getDrawable(android.R.drawable.editbox_dropdown_dark_frame);
    dropDown.setBackgroundDrawable(background);
    return dropDown;
}

40. PropertiesDialog#onCreateDialog()

Project: RedReader
File: PropertiesDialog.java
@NonNull
@Override
public final Dialog onCreateDialog(final Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    if (alreadyCreated)
        return getDialog();
    alreadyCreated = true;
    final AppCompatActivity context = (AppCompatActivity) getActivity();
    final TypedArray attr = context.obtainStyledAttributes(new int[] { R.attr.rrListHeaderTextCol, R.attr.rrListDividerCol, R.attr.rrMainTextCol });
    rrListHeaderTextCol = attr.getColor(0, 0);
    rrListDividerCol = attr.getColor(1, 0);
    rrCommentBodyCol = attr.getColor(2, 0);
    attr.recycle();
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    final LinearLayout items = new LinearLayout(context);
    items.setOrientation(LinearLayout.VERTICAL);
    prepare(context, items);
    builder.setTitle(getTitle(context));
    final ScrollView sv = new ScrollView(context);
    sv.addView(items);
    builder.setView(sv);
    builder.setNeutralButton(R.string.dialog_close, null);
    return builder.create();
}

41. PostSubmitActivity#onCreate()

Project: RedReader
File: PostSubmitActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    PrefsUtility.applyTheme(this);
    super.onCreate(savedInstanceState);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.post_submit, null);
    typeSpinner = (Spinner) layout.findViewById(R.id.post_submit_type);
    usernameSpinner = (Spinner) layout.findViewById(R.id.post_submit_username);
    subredditEdit = (EditText) layout.findViewById(R.id.post_submit_subreddit);
    titleEdit = (EditText) layout.findViewById(R.id.post_submit_title);
    textEdit = (EditText) layout.findViewById(R.id.post_submit_body);
    final Intent intent = getIntent();
    if (intent != null) {
        if (intent.hasExtra("subreddit")) {
            final String subreddit = intent.getStringExtra("subreddit");
            if (subreddit != null && subreddit.length() > 0 && !subreddit.matches("/?(r/)?all/?") && subreddit.matches("/?(r/)?\\w+/?")) {
                subredditEdit.setText(subreddit);
            }
        } else if (Intent.ACTION_SEND.equalsIgnoreCase(intent.getAction()) && intent.hasExtra(Intent.EXTRA_TEXT)) {
            final String url = intent.getStringExtra(Intent.EXTRA_TEXT);
            textEdit.setText(url);
        }
    } else if (savedInstanceState != null && savedInstanceState.containsKey("post_title")) {
        titleEdit.setText(savedInstanceState.getString("post_title"));
        textEdit.setText(savedInstanceState.getString("post_body"));
        subredditEdit.setText(savedInstanceState.getString("subreddit"));
        typeSpinner.setSelection(savedInstanceState.getInt("post_type"));
    }
    final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts();
    final ArrayList<String> usernames = new ArrayList<>();
    for (RedditAccount account : accounts) {
        if (!account.isAnonymous()) {
            usernames.add(account.username);
        }
    }
    if (usernames.size() == 0) {
        General.quickToast(this, R.string.error_toast_notloggedin);
        finish();
    }
    usernameSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, usernames));
    typeSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, postTypes));
    // TODO remove the duplicate code here
    setHint();
    typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            setHint();
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    final ScrollView sv = new ScrollView(this);
    sv.addView(layout);
    setBaseActivityContentView(sv);
}

42. ImgurUploadActivity#onCreate()

Project: RedReader
File: ImgurUploadActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    PrefsUtility.applyTheme(this);
    super.onCreate(savedInstanceState);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(R.string.upload_to_imgur);
    final FrameLayout outerLayout = new FrameLayout(this);
    final LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    mTextView = new TextView(this);
    mTextView.setText(R.string.no_file_selected);
    layout.addView(mTextView);
    General.setAllMarginsDp(ImgurUploadActivity.this, mTextView, 10);
    mUploadButton = new Button(this);
    mUploadButton.setText(R.string.button_upload);
    mUploadButton.setEnabled(false);
    layout.addView(mUploadButton);
    updateUploadButtonVisibility();
    final Button browseButton = new Button(this);
    browseButton.setText(R.string.button_browse);
    layout.addView(browseButton);
    mThumbnailView = new ImageView(this);
    layout.addView(mThumbnailView);
    General.setAllMarginsDp(this, mThumbnailView, 20);
    browseButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.setType("image/*");
            startActivityForResult(intent, REQUEST_CODE);
        }
    });
    mUploadButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            if (mBase64Data != null) {
                uploadImage();
            } else {
                General.quickToast(ImgurUploadActivity.this, R.string.no_file_selected);
            }
        }
    });
    final ScrollView sv = new ScrollView(this);
    sv.addView(layout);
    outerLayout.addView(sv);
    {
        mLoadingOverlay = new LoadingSpinnerView(this);
        outerLayout.addView(mLoadingOverlay);
        mLoadingOverlay.setBackgroundColor(Color.argb(220, 50, 50, 50));
        final ViewGroup.LayoutParams layoutParams = mLoadingOverlay.getLayoutParams();
        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
        layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
        mLoadingOverlay.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(final View v) {
            // Do nothing
            }
        });
        mLoadingOverlay.setVisibility(View.GONE);
    }
    setBaseActivityContentView(outerLayout);
    General.setAllMarginsDp(ImgurUploadActivity.this, layout, 20);
}

43. CommentReplyActivity#onCreate()

Project: RedReader
File: CommentReplyActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    PrefsUtility.applyTheme(this);
    super.onCreate(savedInstanceState);
    final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.comment_reply, null);
    usernameSpinner = (Spinner) layout.findViewById(R.id.comment_reply_username);
    textEdit = (EditText) layout.findViewById(R.id.comment_reply_text);
    if (getIntent() != null && getIntent().hasExtra("parentIdAndType")) {
        parentIdAndType = getIntent().getStringExtra("parentIdAndType");
    } else if (savedInstanceState != null && savedInstanceState.containsKey("comment_text")) {
        textEdit.setText(savedInstanceState.getString("comment_text"));
        parentIdAndType = savedInstanceState.getString("parentIdAndType");
    } else if (lastText != null) {
        textEdit.setText(lastText);
        parentIdAndType = lastParentIdAndType;
    }
    final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts();
    final ArrayList<String> usernames = new ArrayList<>();
    for (RedditAccount account : accounts) {
        if (!account.isAnonymous()) {
            usernames.add(account.username);
        }
    }
    if (usernames.size() == 0) {
        General.quickToast(this, "You must be logged in to do that.");
        finish();
    }
    usernameSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, usernames));
    final ScrollView sv = new ScrollView(this);
    sv.addView(layout);
    setBaseActivityContentView(sv);
}

44. BugReportActivity#onCreate()

Project: RedReader
File: BugReportActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    final TextView title = new TextView(this);
    title.setText(R.string.bug_title);
    layout.addView(title);
    title.setTextSize(20.0f);
    final TextView text = new TextView(this);
    text.setText(R.string.bug_message);
    layout.addView(text);
    text.setTextSize(15.0f);
    final int paddingPx = General.dpToPixels(this, 20);
    title.setPadding(paddingPx, paddingPx, paddingPx, paddingPx);
    text.setPadding(paddingPx, paddingPx, paddingPx, paddingPx);
    final Button send = new Button(this);
    send.setText(R.string.bug_button_send);
    send.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final LinkedList<RRError> errors = BugReportActivity.getErrors();
            StringBuilder sb = new StringBuilder(1024);
            sb.append("Error report -- RedReader v").append(Constants.version(BugReportActivity.this)).append("\r\n\r\n");
            for (RRError error : errors) {
                sb.append("-------------------------------");
                if (error.title != null)
                    sb.append("Title: ").append(error.title).append("\r\n");
                if (error.message != null)
                    sb.append("Message: ").append(error.message).append("\r\n");
                if (error.httpStatus != null)
                    sb.append("HTTP Status: ").append(error.httpStatus).append("\r\n");
                appendException(sb, error.t, 25);
            }
            final Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("message/rfc822");
            // no spam, thanks
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "bug" + "reports" + '@' + "redreader" + '.' + "org" });
            intent.putExtra(Intent.EXTRA_SUBJECT, "Bug Report");
            intent.putExtra(Intent.EXTRA_TEXT, sb.toString());
            try {
                startActivity(Intent.createChooser(intent, "Email bug report"));
            } catch (android.content.ActivityNotFoundException ex) {
                General.quickToast(BugReportActivity.this, "No email apps installed!");
            }
            finish();
        }
    });
    final Button ignore = new Button(this);
    ignore.setText(R.string.bug_button_ignore);
    ignore.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    layout.addView(send);
    layout.addView(ignore);
    final ScrollView sv = new ScrollView(this);
    sv.addView(layout);
    setBaseActivityContentView(sv);
}

45. PullToZoomScrollViewEx#createRootView()

Project: PullZoomView
File: PullToZoomScrollViewEx.java
@Override
protected ScrollView createRootView(Context context, AttributeSet attrs) {
    ScrollView scrollView = new InternalScrollView(context, attrs);
    scrollView.setId(R.id.scrollview);
    return scrollView;
}

46. ShareFileFragment#updateListOfUserGroups()

Project: MyRepository-master
File: ShareFileFragment.java
private void updateListOfUserGroups() {
    // Update list of users/groups
    // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
    mUserGroupsAdapter = new ShareUserListAdapter(getActivity(), R.layout.share_user_item, mPrivateShares, this);
    // Show data
    TextView noShares = (TextView) getView().findViewById(R.id.shareNoUsers);
    ListView usersList = (ListView) getView().findViewById(R.id.shareUsersList);
    if (mPrivateShares.size() > 0) {
        noShares.setVisibility(View.GONE);
        usersList.setVisibility(View.VISIBLE);
        usersList.setAdapter(mUserGroupsAdapter);
        setListViewHeightBasedOnChildren(usersList);
    } else {
        noShares.setVisibility(View.VISIBLE);
        usersList.setVisibility(View.GONE);
    }
    // Set Scroll to initial position
    ScrollView scrollView = (ScrollView) getView().findViewById(R.id.shareScroll);
    scrollView.scrollTo(0, 0);
}

47. MessagePagerAdapter#createChannel()

Project: IrssiNotifier
File: MessagePagerAdapter.java
private View createChannel(int position, boolean feed) {
    Channel channel = channels.get(position);
    List<IrcMessage> messages = channel.getMessages();
    View channelView = layoutInflater.inflate(R.layout.channel, null);
    LinearLayout messageContainer = (LinearLayout) channelView.findViewById(R.id.message_container);
    LinearLayout feedChannel = null;
    if (feed)
        feedChannel = (LinearLayout) layoutInflater.inflate(R.layout.feed_channel, null);
    String lastChannel = "";
    String lastDate = "";
    for (IrcMessage message : messages) {
        boolean dateChange = false;
        String prettyDate = message.getServerTimestampAsPrettyDate();
        if (!prettyDate.equals(lastDate)) {
            lastDate = message.getServerTimestampAsPrettyDate();
            dateChange = true;
            if (feed) {
                feedChannel = (LinearLayout) layoutInflater.inflate(R.layout.feed_channel, null);
                messageContainer.addView(feedChannel);
            }
            TextView tv = (TextView) layoutInflater.inflate(R.layout.datechange_header, null);
            tv.setText(lastDate);
            if (feed)
                feedChannel.addView(tv);
            else
                messageContainer.addView(tv);
        }
        if (feed && (dateChange || !message.getLogicalChannel().equals(lastChannel))) {
            TextView tv;
            if (!dateChange)
                tv = (TextView) layoutInflater.inflate(R.layout.channel_header_paddingtop, null);
            else
                tv = (TextView) layoutInflater.inflate(R.layout.channel_header, null);
            lastChannel = message.getLogicalChannel();
            tv.setText(lastChannel);
            feedChannel.addView(tv);
        }
        TextView tv = (TextView) layoutInflater.inflate(R.layout.message, null);
        String s = message.getServerTimestampAsString() + " (" + message.getNick() + ") " + message.getMessage();
        final SpannableString ss = new SpannableString(s);
        Linkify.addLinks(ss, Linkify.ALL);
        tv.setText(ss);
        tv.setAutoLinkMask(Linkify.ALL);
        tv.setLinksClickable(true);
        tv.setMovementMethod(LinkMovementMethod.getInstance());
        if (feed)
            feedChannel.addView(tv);
        else
            messageContainer.addView(tv);
    }
    final ScrollView sv = (ScrollView) channelView.findViewById(R.id.scroll_view);
    sv.post(new Runnable() {

        public void run() {
            boolean originalSmoothScroll = sv.isSmoothScrollingEnabled();
            sv.setSmoothScrollingEnabled(false);
            sv.fullScroll(ScrollView.FOCUS_DOWN);
            sv.setSmoothScrollingEnabled(originalSmoothScroll);
        }
    });
    return channelView;
}

48. MDA_DraggedViewPager#scrollToPageBottom()

Project: DraggedViewPager
File: MDA_DraggedViewPager.java
/**
     * ??????
     *
     * @param pageIndex ???
     */
public void scrollToPageBottom(int pageIndex) {
    final ScrollView scrollView = (ScrollView) container.getChildAt(pageIndex).findViewById(R.id.dvp_scroll_view);
    scrollView.post(new Runnable() {

        @Override
        public void run() {
            scrollView.fullScroll(FOCUS_DOWN);
        }
    });
}

49. ZoneListFragment#onCreateView()

Project: denominator
File: ZoneListFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    zones = new TableLayout(getActivity());
    zones.setGravity(CENTER);
    ScrollView view = new ScrollView(getActivity());
    view.addView(zones);
    return view;
}

50. DensityActivity#scrollWrap()

Project: codeexamples-android
File: DensityActivity.java
private View scrollWrap(View view) {
    ScrollView scroller = new ScrollView(this);
    scroller.addView(view, new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT, ScrollView.LayoutParams.MATCH_PARENT));
    return scroller;
}

51. DeveloperSettingsController#onCreate()

Project: Clover
File: DeveloperSettingsController.java
@Override
public void onCreate() {
    super.onCreate();
    databaseManager = Chan.getDatabaseManager();
    navigationItem.setTitle(R.string.settings_developer);
    LinearLayout wrapper = new LinearLayout(context);
    wrapper.setOrientation(LinearLayout.VERTICAL);
    Button crashButton = new Button(context);
    crashButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            throw new RuntimeException("Debug crash");
        }
    });
    crashButton.setText("Crash the app");
    wrapper.addView(crashButton);
    summaryText = new TextView(context);
    summaryText.setPadding(0, dp(25), 0, 0);
    wrapper.addView(summaryText);
    setDbSummary();
    Button resetDbButton = new Button(context);
    resetDbButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Chan.getDatabaseManager().reset();
            System.exit(0);
        }
    });
    resetDbButton.setText("Delete database");
    wrapper.addView(resetDbButton);
    Button savedReplyDummyAdd = new Button(context);
    savedReplyDummyAdd.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            Random r = new Random();
            int j = 0;
            for (int i = 0; i < 100; i++) {
                j += r.nextInt(10000);
                SavedReply saved = new SavedReply("g", j, "");
                databaseManager.runTask(databaseManager.getDatabaseSavedReplyManager().saveReply(saved));
            }
            setDbSummary();
        }
    });
    savedReplyDummyAdd.setText("Add test rows to savedReply");
    wrapper.addView(savedReplyDummyAdd);
    ScrollView scrollView = new ScrollView(context);
    scrollView.addView(wrapper);
    view = scrollView;
    view.setBackgroundColor(getAttrColor(context, R.attr.backcolor));
}

52. MenuInScrollViewActivity#onCreate()

Project: CircularFloatingActionMenu
File: MenuInScrollViewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_menu_in_scroll_view);
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
    LinearLayout scrollViewBody = (LinearLayout) findViewById(R.id.scrollViewBody);
    menus = new ArrayList<FloatingActionMenu>();
    // add 20 views into body, each with a menu attached
    for (int i = 0; i < 20; i++) {
        LinearLayout item = (LinearLayout) inflater.inflate(R.layout.item_scroll_view, null, false);
        scrollViewBody.addView(item);
        View mainActionView = item.findViewById(R.id.itemActionView);
        SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
        ImageView rlIcon1 = new ImageView(this);
        ImageView rlIcon2 = new ImageView(this);
        ImageView rlIcon3 = new ImageView(this);
        rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_chat_light));
        rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_camera_light));
        rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_video_light));
        FloatingActionMenu itemMenu = new FloatingActionMenu.Builder(this).setStartAngle(-45).setEndAngle(-135).setRadius(getResources().getDimensionPixelSize(R.dimen.radius_small)).addSubActionView(rLSubBuilder.setContentView(rlIcon1).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon2).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon3).build()).setStateChangeListener(// listen state changes of each menu
        this).attachTo(mainActionView).build();
        //
        menus.add(itemMenu);
    }
    // listen scroll events on root ScrollView
    scrollView.getViewTreeObserver().addOnScrollChangedListener(this);
    findViewById(R.id.buttom_bar_edit_text).clearFocus();
    // Attach a menu to the button in the bottom bar, just to prove that it works.
    View bottomActionButton = findViewById(R.id.bottom_bar_action_button);
    SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
    ImageView rlIcon1 = new ImageView(this);
    ImageView rlIcon2 = new ImageView(this);
    ImageView rlIcon3 = new ImageView(this);
    rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_place_light));
    rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_picture_light));
    rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_camera_light));
    bottomMenu = new FloatingActionMenu.Builder(this).addSubActionView(rLSubBuilder.setContentView(rlIcon1).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon2).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon3).build()).setStartAngle(-40).setEndAngle(-90).setRadius(getResources().getDimensionPixelSize(R.dimen.radius_medium)).attachTo(bottomActionButton).build();
    // Listen layout (size) changes on a main layout so that we could reposition the bottom menu
    scrollView.addOnLayoutChangeListener(this);
}

53. LiveChatActivity#response()

Project: BotLibre
File: LiveChatActivity.java
public void response(String text) {
    if (this.closing) {
        return;
    }
    String user = "";
    String message = text;
    int index = text.indexOf(':');
    if (index != -1) {
        user = text.substring(0, index);
        message = text.substring(index + 2, text.length());
    }
    if (user.equals("Online")) {
        HttpAction action = new HttpGetLiveChatUsersAction(this, message);
        action.execute();
        return;
    }
    if (user.equals("Media")) {
        return;
    }
    WebView responseView = (WebView) findViewById(R.id.responseText);
    responseView.loadDataWithBaseURL(null, Utils.linkHTML(text), "text/html", "utf-8", null);
    WebView log = (WebView) findViewById(R.id.logText);
    this.html = this.html + "<b>" + user + "</b><br/>" + Utils.linkHTML(message) + "<br/>";
    log.loadDataWithBaseURL(null, this.html, "text/html", "utf-8", null);
    final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView);
    scroll.postDelayed(new Runnable() {

        public void run() {
            scroll.fullScroll(View.FOCUS_DOWN);
        }
    }, 200);
    if ((System.currentTimeMillis() - startTime) < (1000 * 5)) {
        return;
    }
    boolean speak = this.speak;
    boolean chime = this.chime;
    if (user.equals("Error") || user.equals("Info")) {
        speak = false;
    } else if (MainActivity.user == null) {
        if (user.startsWith("anonymous")) {
            speak = false;
            chime = false;
        }
    } else {
        if (user.equals(MainActivity.user.user)) {
            speak = false;
            chime = false;
        }
    }
    if (speak) {
        this.tts.speak(message, TextToSpeech.QUEUE_FLUSH, null);
    } else if (chime) {
        if (this.chimePlayer != null && this.chimePlayer.isPlaying()) {
            return;
        }
        chime();
    }
}

54. BookCatalogueClassic#sortOptions()

Project: Book-Catalogue
File: BookCatalogueClassic.java
/**
	 * Setup the sort options. This function will also call fillData when 
	 * complete having loaded the appropriate view. 
	 */
private void sortOptions() {
    ScrollView sv = new ScrollView(this);
    RadioGroup group = new RadioGroup(this);
    sv.addView(group);
    final AlertDialog sortDialog = new AlertDialog.Builder(this).setView(sv).create();
    sortDialog.setTitle(R.string.menu_sort_by);
    sortDialog.setIcon(android.R.drawable.ic_menu_info_details);
    sortDialog.show();
    RadioButton radio_author = new RadioButton(this);
    radio_author.setText(R.string.sortby_author);
    group.addView(radio_author);
    if (sort == SORT_AUTHOR) {
        radio_author.setChecked(true);
    } else {
        radio_author.setChecked(false);
    }
    radio_author.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_AUTHOR);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_author_one = new RadioButton(this);
    radio_author_one.setText(R.string.sortby_author_one);
    group.addView(radio_author_one);
    if (sort == SORT_AUTHOR_ONE) {
        radio_author_one.setChecked(true);
    } else {
        radio_author_one.setChecked(false);
    }
    radio_author_one.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_AUTHOR_ONE);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_author_given = new RadioButton(this);
    radio_author_given.setText(R.string.sortby_author_given);
    group.addView(radio_author_given);
    if (sort == SORT_AUTHOR_GIVEN) {
        radio_author_given.setChecked(true);
    } else {
        radio_author_given.setChecked(false);
    }
    radio_author_given.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_AUTHOR_GIVEN);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_title = new RadioButton(this);
    radio_title.setText(R.string.sortby_title);
    group.addView(radio_title);
    if (sort == SORT_TITLE) {
        radio_title.setChecked(true);
    } else {
        radio_title.setChecked(false);
    }
    radio_title.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_TITLE);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_series = new RadioButton(this);
    radio_series.setText(R.string.sortby_series);
    group.addView(radio_series);
    if (sort == SORT_SERIES) {
        radio_series.setChecked(true);
    } else {
        radio_series.setChecked(false);
    }
    radio_series.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_SERIES);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_genre = new RadioButton(this);
    radio_genre.setText(R.string.sortby_genre);
    group.addView(radio_genre);
    if (sort == SORT_GENRE) {
        radio_genre.setChecked(true);
    } else {
        radio_genre.setChecked(false);
    }
    radio_genre.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_GENRE);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_loan = new RadioButton(this);
    radio_loan.setText(R.string.sortby_loan);
    group.addView(radio_loan);
    if (sort == SORT_LOAN) {
        radio_loan.setChecked(true);
    } else {
        radio_loan.setChecked(false);
    }
    radio_loan.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_LOAN);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_unread = new RadioButton(this);
    radio_unread.setText(R.string.sortby_unread);
    group.addView(radio_unread);
    if (sort == SORT_UNREAD) {
        radio_unread.setChecked(true);
    } else {
        radio_unread.setChecked(false);
    }
    radio_unread.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_UNREAD);
            sortDialog.dismiss();
            return;
        }
    });
    RadioButton radio_published = new RadioButton(this);
    radio_published.setText(R.string.sortby_published);
    group.addView(radio_published);
    if (sort == SORT_PUBLISHED) {
        radio_published.setChecked(true);
    } else {
        radio_published.setChecked(false);
    }
    radio_published.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            saveSortBy(SORT_PUBLISHED);
            sortDialog.dismiss();
            return;
        }
    });
}

55. HelpMarkdownFragment#onCreateView()

Project: apg
File: HelpMarkdownFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mActivity = getActivity();
    mHtmlFile = getArguments().getInt(ARG_MARKDOWN_RES);
    ScrollView scroller = new ScrollView(mActivity);
    HtmlTextView text = new HtmlTextView(mActivity);
    // padding
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, mActivity.getResources().getDisplayMetrics());
    text.setPadding(padding, padding, padding, 0);
    scroller.addView(text);
    // load markdown from raw resource
    try {
        String html = new Markdown4jProcessor().process(getActivity().getResources().openRawResource(mHtmlFile));
        text.setHtmlFromString(html, true);
    } catch (IOException e) {
        Log.e(Constants.TAG, "IOException", e);
    }
    // no flickering when clicking textview for Android < 4
    text.setTextColor(getResources().getColor(android.R.color.black));
    return scroller;
}

56. MainActivity#scroll()

Project: AndroidWearable-Samples
File: MainActivity.java
private void scroll(final int scrollDirection) {
    final ScrollView scrollView = (ScrollView) findViewById(R.id.scroll);
    scrollView.post(new Runnable() {

        @Override
        public void run() {
            scrollView.fullScroll(scrollDirection);
        }
    });
}

57. MenuInScrollViewActivity#onCreate()

Project: android-open-project-demo
File: MenuInScrollViewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_menu_in_scroll_view);
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
    LinearLayout scrollViewBody = (LinearLayout) findViewById(R.id.scrollViewBody);
    menus = new ArrayList<FloatingActionMenu>();
    // add 20 views into body, each with a menu attached
    for (int i = 0; i < 20; i++) {
        LinearLayout item = (LinearLayout) inflater.inflate(R.layout.item_scroll_view, null, false);
        scrollViewBody.addView(item);
        View mainActionView = item.findViewById(R.id.itemActionView);
        SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
        ImageView rlIcon1 = new ImageView(this);
        ImageView rlIcon2 = new ImageView(this);
        ImageView rlIcon3 = new ImageView(this);
        rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_chat_light));
        rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_camera_light));
        rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_video_light));
        FloatingActionMenu itemMenu = new FloatingActionMenu.Builder(this).setStartAngle(-45).setEndAngle(-135).setRadius(getResources().getDimensionPixelSize(R.dimen.radius_small)).addSubActionView(rLSubBuilder.setContentView(rlIcon1).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon2).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon3).build()).setStateChangeListener(// listen state changes of each menu
        this).attachTo(mainActionView).build();
        //
        menus.add(itemMenu);
    }
    // listen scroll events on root ScrollView
    scrollView.getViewTreeObserver().addOnScrollChangedListener(this);
    findViewById(R.id.buttom_bar_edit_text).clearFocus();
    // Attach a menu to the button in the bottom bar, just to prove that it works.
    View bottomActionButton = findViewById(R.id.bottom_bar_action_button);
    SubActionButton.Builder rLSubBuilder = new SubActionButton.Builder(this);
    ImageView rlIcon1 = new ImageView(this);
    ImageView rlIcon2 = new ImageView(this);
    ImageView rlIcon3 = new ImageView(this);
    rlIcon1.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_place_light));
    rlIcon2.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_picture_light));
    rlIcon3.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_camera_light));
    bottomMenu = new FloatingActionMenu.Builder(this).addSubActionView(rLSubBuilder.setContentView(rlIcon1).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon2).build()).addSubActionView(rLSubBuilder.setContentView(rlIcon3).build()).setStartAngle(-40).setEndAngle(-90).setRadius(getResources().getDimensionPixelSize(R.dimen.radius_medium)).attachTo(bottomActionButton).build();
    // Listen layout (size) changes on a main layout so that we could reposition the bottom menu
    scrollView.addOnLayoutChangeListener(this);
}

58. DensityActivity#scrollWrap()

Project: android-maven-plugin
File: DensityActivity.java
private View scrollWrap(View view) {
    ScrollView scroller = new ScrollView(this);
    scroller.addView(view, new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT, ScrollView.LayoutParams.MATCH_PARENT));
    return scroller;
}

59. ShareFileFragment#updateListOfUserGroups()

Project: android
File: ShareFileFragment.java
private void updateListOfUserGroups() {
    // Update list of users/groups
    // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
    mUserGroupsAdapter = new ShareUserListAdapter(getActivity(), R.layout.share_user_item, mPrivateShares, this);
    // Show data
    TextView noShares = (TextView) getView().findViewById(R.id.shareNoUsers);
    ListView usersList = (ListView) getView().findViewById(R.id.shareUsersList);
    if (mPrivateShares.size() > 0) {
        noShares.setVisibility(View.GONE);
        usersList.setVisibility(View.VISIBLE);
        usersList.setAdapter(mUserGroupsAdapter);
        setListViewHeightBasedOnChildren(usersList);
    } else {
        noShares.setVisibility(View.VISIBLE);
        usersList.setVisibility(View.GONE);
    }
    // Set Scroll to initial position
    ScrollView scrollView = (ScrollView) getView().findViewById(R.id.shareScroll);
    scrollView.scrollTo(0, 0);
}

60. EditPagePort#initBody()

Project: zhsz
File: EditPagePort.java
private void initBody(RelativeLayout rlBody, float ratio) {
    svContent = new ScrollView(activity);
    rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    LinearLayout llContent = new LinearLayout(activity);
    llContent.setOrientation(LinearLayout.VERTICAL);
    svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    etContent = new EditText(activity);
    int padding = (int) (DESIGN_LEFT_PADDING * ratio);
    etContent.setPadding(padding, padding, padding, padding);
    etContent.setBackgroundDrawable(null);
    etContent.setTextColor(0xff3b3b3b);
    etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
    etContent.setText(sp.getText());
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    llContent.addView(etContent, lp);
    etContent.addTextChangedListener(this);
    rlThumb = new RelativeLayout(activity);
    rlThumb.setBackgroundColor(0xff313131);
    int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio);
    int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio);
    lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth);
    lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding;
    llContent.addView(rlThumb, lp);
    aivThumb = new AsyncImageView(activity) {

        public void onImageGot(String url, Bitmap bm) {
            thumb = bm;
            super.onImageGot(url, bm);
        }
    };
    aivThumb.setScaleToCropCenter(true);
    RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth);
    rlThumb.addView(aivThumb, rllp);
    aivThumb.setOnClickListener(this);
    initThumb(aivThumb);
    xvRemove = new XView(activity);
    xvRemove.setRatio(ratio);
    rllp = new RelativeLayout.LayoutParams(xWidth, xWidth);
    rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    rlThumb.addView(xvRemove, rllp);
    xvRemove.setOnClickListener(this);
}

61. EditPageLand#initBody()

Project: zhsz
File: EditPageLand.java
private void initBody(RelativeLayout rlBody, float ratio) {
    svContent = new ScrollView(activity);
    rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    LinearLayout llContent = new LinearLayout(activity);
    llContent.setOrientation(LinearLayout.HORIZONTAL);
    svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    etContent = new EditText(activity);
    int padding = (int) (DESIGN_LEFT_PADDING * ratio);
    etContent.setPadding(padding, padding, padding, padding);
    etContent.setBackgroundDrawable(null);
    etContent.setTextColor(0xff3b3b3b);
    etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
    etContent.setText(sp.getText());
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT);
    lp.weight = 1;
    llContent.addView(etContent, lp);
    etContent.addTextChangedListener(this);
    rlThumb = new RelativeLayout(activity);
    rlThumb.setBackgroundColor(0xff313131);
    int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio);
    int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio);
    lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth);
    lp.rightMargin = lp.bottomMargin = lp.topMargin = padding;
    llContent.addView(rlThumb, lp);
    aivThumb = new AsyncImageView(activity) {

        public void onImageGot(String url, Bitmap bm) {
            thumb = bm;
            super.onImageGot(url, bm);
        }
    };
    aivThumb.setScaleToCropCenter(true);
    RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth);
    rlThumb.addView(aivThumb, rllp);
    aivThumb.setOnClickListener(this);
    initThumb(aivThumb);
    xvRemove = new XView(activity);
    xvRemove.setRatio(ratio);
    rllp = new RelativeLayout.LayoutParams(xWidth, xWidth);
    rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    rlThumb.addView(xvRemove, rllp);
    xvRemove.setOnClickListener(this);
}

62. AddAccountActivity#initComponents()

Project: YiBo
File: AddAccountActivity.java
private void initComponents() {
    LinearLayout llHeaderBase = (LinearLayout) findViewById(R.id.llHeaderBase);
    ScrollView svContentPanel = (ScrollView) findViewById(R.id.svContentPanel);
    spServiceProvider = (Spinner) findViewById(R.id.spServiceProvider);
    spConfigApp = (Spinner) findViewById(R.id.spConfigApp);
    etUsername = (EditText) findViewById(R.id.etUsername);
    etPassword = (EditText) findViewById(R.id.etPassword);
    cbMakeDefault = (CheckBox) findViewById(R.id.cbDefault);
    cbFollowOffical = (CheckBox) findViewById(R.id.cbFollowOffical);
    cbUseProxy = (CheckBox) findViewById(R.id.cbUseApiProxy);
    etRestProxy = (EditText) findViewById(R.id.etRestProxy);
    etSearchProxy = (EditText) findViewById(R.id.etSearchProxy);
    btnAuthorize = (Button) findViewById(R.id.btnAuthorize);
    LinearLayout llOAuthIntro = (LinearLayout) findViewById(R.id.llOAuthIntro);
    TextView tvOAuthIntro = (TextView) findViewById(R.id.tvOAuthIntro);
    LinearLayout llFooterAction = (LinearLayout) findViewById(R.id.llFooterAction);
    ThemeUtil.setSecondaryHeader(llHeaderBase);
    ThemeUtil.setContentBackground(svContentPanel);
    spServiceProvider.setBackgroundDrawable(theme.getDrawable("selector_btn_dropdown"));
    spConfigApp.setBackgroundDrawable(theme.getDrawable("selector_btn_dropdown"));
    int padding2 = theme.dip2px(2);
    spServiceProvider.setPadding(padding2, padding2, padding2, padding2);
    spConfigApp.setPadding(padding2, padding2, padding2, padding2);
    int content = theme.getColor("content");
    etUsername.setBackgroundDrawable(theme.getDrawable("selector_input_frame"));
    etUsername.setTextColor(content);
    etPassword.setBackgroundDrawable(theme.getDrawable("selector_input_frame"));
    etPassword.setTextColor(content);
    cbMakeDefault.setButtonDrawable(theme.getDrawable("selector_checkbox"));
    cbMakeDefault.setTextColor(content);
    cbFollowOffical.setButtonDrawable(theme.getDrawable("selector_checkbox"));
    cbFollowOffical.setTextColor(content);
    cbUseProxy.setButtonDrawable(theme.getDrawable("selector_checkbox"));
    cbUseProxy.setTextColor(content);
    etRestProxy.setBackgroundDrawable(theme.getDrawable("selector_input_frame"));
    etRestProxy.setTextColor(content);
    etSearchProxy.setBackgroundDrawable(theme.getDrawable("selector_input_frame"));
    etSearchProxy.setTextColor(content);
    llOAuthIntro.setBackgroundDrawable(theme.getDrawable("bg_frame_normal"));
    int padding8 = theme.dip2px(8);
    llOAuthIntro.setPadding(padding8, padding8, padding8, padding8);
    tvOAuthIntro.setTextColor(theme.getColor("quote"));
    llFooterAction.setBackgroundDrawable(theme.getDrawable("bg_footer_action"));
    llFooterAction.setPadding(padding8, padding8, padding8, padding8);
    llFooterAction.setGravity(Gravity.CENTER);
    ThemeUtil.setBtnActionPositive(btnAuthorize);
    TextView tvTitle = (TextView) this.findViewById(R.id.tvTitle);
    tvTitle.setText(R.string.title_add_account);
    ConfigSystemDao configDao = new ConfigSystemDao(this);
    Passport passport = configDao.getPassport();
    if (passport != null) {
        isCustomKeyLevel = passport.getPointsLevel().getPoints() >= Constants.POINTS_CUSTOM_SOURCE_LEVEL;
    }
    // ???
    isCustomKeyLevel = true;
    if (isCustomKeyLevel) {
    }
}

63. UserStatsFragment#onCreateView()

Project: wigle-wifi-wardriving
File: UserStatsFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final int orientation = getResources().getConfiguration().orientation;
    MainActivity.info("USERSTATS: onCreateView. orientation: " + orientation);
    final ScrollView scrollView = (ScrollView) inflater.inflate(R.layout.userstats, container, false);
    // download token if needed
    final SharedPreferences prefs = getActivity().getSharedPreferences(ListFragment.SHARED_PREFS, 0);
    final boolean beAnonymous = prefs.getBoolean(ListFragment.PREF_BE_ANONYMOUS, false);
    final String authname = prefs.getString(ListFragment.PREF_AUTHNAME, null);
    MainActivity.info("authname: " + authname);
    if (!beAnonymous) {
        if (authname == null) {
            MainActivity.info("No authname, going to request token");
            final Handler handler = new DownloadHandler(scrollView, numberFormat, getActivity().getPackageName(), getResources());
            final ApiDownloader task = getUserStatsTaks(scrollView, handler);
            downloadToken(task);
        } else {
            downloadLatestUserStats(scrollView);
        }
    }
    return scrollView;
}

64. SiteStatsFragment#onCreateView()

Project: wigle-wifi-wardriving
File: SiteStatsFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final int orientation = getResources().getConfiguration().orientation;
    MainActivity.info("SITESTATS: onCreateView. orientation: " + orientation);
    final ScrollView scrollView = (ScrollView) inflater.inflate(R.layout.sitestats, container, false);
    downloadLatestSiteStats(scrollView);
    return scrollView;
}

65. LeftMenuFragment#onCreateView()

Project: weiciyuan
File: LeftMenuFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final ScrollView view = (ScrollView) inflater.inflate(R.layout.slidingdrawer_contents, container, false);
    layout = new Layout();
    layout.avatar = (Spinner) view.findViewById(R.id.avatar);
    layout.nickname = (TextView) view.findViewById(R.id.nickname);
    layout.home = (LinearLayout) view.findViewById(R.id.btn_home);
    layout.mention = (LinearLayout) view.findViewById(R.id.btn_mention);
    layout.comment = (LinearLayout) view.findViewById(R.id.btn_comment);
    layout.search = (Button) view.findViewById(R.id.btn_search);
    layout.profile = (Button) view.findViewById(R.id.btn_profile);
    //        layout.location = (Button) view.findViewById(R.id.btn_location);
    layout.setting = (Button) view.findViewById(R.id.btn_setting);
    layout.dm = (Button) view.findViewById(R.id.btn_dm);
    layout.logout = (Button) view.findViewById(R.id.btn_logout);
    layout.fav = (Button) view.findViewById(R.id.btn_favourite);
    layout.homeCount = (TextView) view.findViewById(R.id.tv_home_count);
    layout.mentionCount = (TextView) view.findViewById(R.id.tv_mention_count);
    layout.commentCount = (TextView) view.findViewById(R.id.tv_comment_count);
    boolean blackMagic = GlobalContext.getInstance().getAccountBean().isBlack_magic();
    if (!blackMagic) {
        layout.dm.setVisibility(View.GONE);
        layout.search.setVisibility(View.GONE);
    }
    return view;
}

66. MarqueeView#initView()

Project: UltimateAndroid
File: MarqueeView.java
private void initView(Context context) {
    // Scroll View
    LayoutParams sv1lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    sv1lp.gravity = Gravity.CENTER_HORIZONTAL;
    mScrollView = new ScrollView(context);
    // Scroll View 1 - Text Field
    mTextField = (TextView) getChildAt(0);
    removeView(mTextField);
    mScrollView.addView(mTextField, new ScrollView.LayoutParams(TEXTVIEW_VIRTUAL_WIDTH, LayoutParams.WRAP_CONTENT));
    mTextField.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            final boolean continueAnimation = mStarted;
            reset();
            prepareAnimation();
            cutTextView();
            post(new Runnable() {

                @Override
                public void run() {
                    if (continueAnimation) {
                        startMarquee();
                    }
                }
            });
        }
    });
    addView(mScrollView, sv1lp);
}

67. CoolDragAndDropActivity#onCreate()

Project: UltimateAndroid
File: CoolDragAndDropActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.cooldrag_drop_activity);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
    mCoolDragAndDropGridView = (CoolDragAndDropGridView) findViewById(R.id.coolDragAndDropGridView);
    for (int r = 0; r < 2; r++) {
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_airport_highlighted, 1, "Airport", "Heathrow"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_bar_highlighted, 2, "Bar", "Connaught Bar"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_drink_highlighted, 2, "Drink", "Tequila"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_eat_highlighted, 2, "Eat", "Sliced Steaks"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_florist_highlighted, 1, "Florist", "Roses"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_gas_station_highlighted, 3, "Gas station", "QuickChek"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_general_highlighted, 1, "General", "Service Station"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_grocery_store_highlighted, 1, "Grocery", "E-Z-Mart"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_pizza_highlighted, 1, "Pizza", "Pizza Hut"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_post_office_highlighted, 2, "Post office", "USPS"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_see_highlighted, 2, "See", "Tower Bridge"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_shipping_service_highlighted, 3, "Shipping service", "Celio*"));
    }
    mItemAdapter = new ItemAdapter(this, mItems);
    mCoolDragAndDropGridView.setAdapter(mItemAdapter);
    mCoolDragAndDropGridView.setScrollingStrategy(new SimpleScrollingStrategy(scrollView));
    mCoolDragAndDropGridView.setDragAndDropListener(this);
    mCoolDragAndDropGridView.setOnItemLongClickListener(this);
}

68. MarqueeView#initView()

Project: UltimateAndroid
File: MarqueeView.java
private void initView(Context context) {
    // Scroll View
    LayoutParams sv1lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    sv1lp.gravity = Gravity.CENTER_HORIZONTAL;
    mScrollView = new ScrollView(context);
    // Scroll View 1 - Text Field
    mTextField = (TextView) getChildAt(0);
    removeView(mTextField);
    mScrollView.addView(mTextField, new ScrollView.LayoutParams(TEXTVIEW_VIRTUAL_WIDTH, LayoutParams.WRAP_CONTENT));
    mTextField.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            final boolean continueAnimation = mStarted;
            reset();
            prepareAnimation();
            cutTextView();
            post(new Runnable() {

                @Override
                public void run() {
                    if (continueAnimation) {
                        startMarquee();
                    }
                }
            });
        }
    });
    addView(mScrollView, sv1lp);
}

69. CoolDragAndDropActivity#onCreate()

Project: UltimateAndroid
File: CoolDragAndDropActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.cooldrag_drop_activity);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView);
    mCoolDragAndDropGridView = (CoolDragAndDropGridView) findViewById(R.id.coolDragAndDropGridView);
    for (int r = 0; r < 2; r++) {
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_airport_highlighted, 1, "Airport", "Heathrow"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_bar_highlighted, 2, "Bar", "Connaught Bar"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_drink_highlighted, 2, "Drink", "Tequila"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_eat_highlighted, 2, "Eat", "Sliced Steaks"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_florist_highlighted, 1, "Florist", "Roses"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_gas_station_highlighted, 3, "Gas station", "QuickChek"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_general_highlighted, 1, "General", "Service Station"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_grocery_store_highlighted, 1, "Grocery", "E-Z-Mart"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_pizza_highlighted, 1, "Pizza", "Pizza Hut"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_post_office_highlighted, 2, "Post office", "USPS"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_see_highlighted, 2, "See", "Tower Bridge"));
        mItems.add(new Item(R.drawable.cool_drag_drop_ic_local_search_shipping_service_highlighted, 3, "Shipping service", "Celio*"));
    }
    mItemAdapter = new ItemAdapter(this, mItems);
    mCoolDragAndDropGridView.setAdapter(mItemAdapter);
    mCoolDragAndDropGridView.setScrollingStrategy(new SimpleScrollingStrategy(scrollView));
    mCoolDragAndDropGridView.setDragAndDropListener(this);
    mCoolDragAndDropGridView.setOnItemLongClickListener(this);
}

70. TalkBackService#confirmSuspendTalkBack()

Project: talkback
File: TalkBackService.java
/**
     * Shows a dialog asking the user to confirm suspension of TalkBack.
     */
private void confirmSuspendTalkBack() {
    // Ensure only one dialog is showing.
    if (mSuspendDialog != null) {
        if (mSuspendDialog.isShowing()) {
            return;
        } else {
            mSuspendDialog.dismiss();
            mSuspendDialog = null;
        }
    }
    final LayoutInflater inflater = LayoutInflater.from(this);
    @SuppressLint("InflateParams") final ScrollView root = (ScrollView) inflater.inflate(R.layout.suspend_talkback_dialog, null);
    final CheckBox confirmCheckBox = (CheckBox) root.findViewById(R.id.show_warning_checkbox);
    final TextView message = (TextView) root.findViewById(R.id.message_resume);
    final DialogInterface.OnClickListener okayClick = new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                if (!confirmCheckBox.isChecked()) {
                    SharedPreferencesUtils.putBooleanPref(mPrefs, getResources(), R.string.pref_show_suspension_confirmation_dialog, false);
                }
                suspendTalkBack();
            }
        }
    };
    final OnDismissListener onDismissListener = new OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            mSuspendDialog = null;
        }
    };
    if (mAutomaticResume.equals(getString(R.string.resume_screen_keyguard))) {
        message.setText(getString(R.string.message_resume_keyguard));
    } else if (mAutomaticResume.equals(getString(R.string.resume_screen_manual))) {
        message.setText(getString(R.string.message_resume_manual));
    } else {
        // screen on is the default value
        message.setText(getString(R.string.message_resume_screen_on));
    }
    mSuspendDialog = new AlertDialog.Builder(this).setTitle(R.string.dialog_title_suspend_talkback).setView(root).setNegativeButton(android.R.string.cancel, null).setPositiveButton(android.R.string.ok, okayClick).create();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        mSuspendDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY);
    } else {
        mSuspendDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
    }
    mSuspendDialog.setOnDismissListener(onDismissListener);
    mSuspendDialog.show();
}

71. TalkBackPreferencesActivity#showDimScreenDialog()

Project: talkback
File: TalkBackPreferencesActivity.java
private void showDimScreenDialog(final DialogInterface.OnClickListener onConfirmListener) {
    LayoutInflater inflater = LayoutInflater.from(this);
    @SuppressLint("InflateParams") final ScrollView root = (ScrollView) inflater.inflate(R.layout.dim_screen_confirmation_dialog, null);
    final CheckBox confirmCheckBox = (CheckBox) root.findViewById(R.id.show_warning_checkbox);
    final DialogInterface.OnClickListener okayClick = new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                if (!confirmCheckBox.isChecked()) {
                    SharedPreferencesUtils.putBooleanPref(mPrefs, getResources(), R.string.pref_show_dim_screen_confirmation_dialog, false);
                }
                if (onConfirmListener != null) {
                    onConfirmListener.onClick(dialog, which);
                }
            }
        }
    };
    Dialog dialog = new AlertDialog.Builder(this).setTitle(R.string.dialog_title_dim_screen).setView(root).setNegativeButton(android.R.string.cancel, null).setPositiveButton(android.R.string.ok, okayClick).create();
    dialog.show();
}

72. ScrollViewSimpleFragment#bindData()

Project: StickyHeaderViewPager
File: ScrollViewSimpleFragment.java
@Override
public void bindData() {
    ScrollView scrollView = getScrollView();
    LinearLayout linearLayout = (LinearLayout) scrollView.findViewById(R.id.ly_content);
    TextView tv_title = (TextView) scrollView.findViewById(R.id.tv_title);
    tv_title.setText("???·?");
    TextView tv_data = (TextView) scrollView.findViewById(R.id.tv_data);
    tv_data.setText("????\n" + "????\n" + "????\n" + "?????\n" + "????\n" + "????\n" + "????\n" + "????\n" + "????\n" + "???????\n" + "???\n" + "?????\n" + "????\n" + "\n" + "??????\n" + "????????\n" + "?????\n" + "????\n" + "????\n" + "????\n" + "????\n" + "????\n" + "???????\n" + "???\n" + "?????\n" + "????");
    if (callBack != null) {
        callBack.bindData();
    }
}

73. StickHeaderScrollViewFragment#createView()

Project: StickyHeaderViewPager
File: StickHeaderScrollViewFragment.java
@Override
public ScrollView createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ScrollView scrollView = layoutId > 0 ? (ScrollView) inflater.inflate(layoutId, container, false) : null;
    if (scrollView == null) {
        throw new IllegalStateException("ScrollView can't be null");
    }
    return scrollView;
}

74. AppLog#displayAsDialog()

Project: sms-backup-plus
File: AppLog.java
public static Dialog displayAsDialog(String name, Context context) {
    final int PAD = 5;
    final TextView view = new TextView(context);
    view.setId(ID);
    readLog(name, view);
    final ScrollView sView = new ScrollView(context) {

        {
            addView(view);
            setPadding(PAD, PAD, PAD, PAD);
        }

        @Override
        protected void onLayout(boolean changed, int l, int t, int r, int b) {
            super.onLayout(changed, l, t, r, b);
            scrollTo(0, view.getHeight());
        }
    };
    return new AlertDialog.Builder(context).setCustomTitle(null).setPositiveButton(android.R.string.ok, null).setView(sView).create();
}

75. ReactScrollViewTestCase#testScrolling()

Project: react-native
File: ReactScrollViewTestCase.java
public void testScrolling() {
    ScrollView scrollView = getViewAtPath(0);
    assertNotNull(scrollView);
    assertEquals(0, scrollView.getScrollY());
    dragUp();
    assertTrue("Expected to scroll by at least 50 pixels", scrollView.getScrollY() >= 50);
}

76. JSResponderTestCase#testResponderLocksScrollView()

Project: react-native
File: JSResponderTestCase.java
public void testResponderLocksScrollView() {
    ScrollView scrollView = getViewByTestId("scroll_view");
    assertNotNull(scrollView);
    assertEquals(0, scrollView.getScrollY());
    float inpx40dp = PixelUtil.toPixelFromDIP(40f);
    float inpx100dp = PixelUtil.toPixelFromDIP(100f);
    SingleTouchGestureGenerator gestureGenerator = createGestureGenerator();
    gestureGenerator.startGesture(30, 30 + inpx100dp).dragTo(30 + inpx40dp, 30, 10, 1200).endGesture(180, 100);
    waitForBridgeAndUIIdle();
    assertTrue("Expected to scroll by at least 80 dp", scrollView.getScrollY() >= inpx100dp * .8f);
    int previousScroll = scrollView.getScrollY();
    gestureGenerator.startGesture(30, 30 + inpx100dp).dragTo(30 + inpx40dp, 30 + inpx100dp, 10, 1200);
    waitForBridgeAndUIIdle();
    gestureGenerator.dragTo(30 + inpx40dp, 30, 10, 1200).endGesture();
    waitForBridgeAndUIIdle();
    assertEquals("Expected not to scroll", scrollView.getScrollY(), previousScroll);
}

77. CatalystSubviewsClippingTestCase#scrollToDpInUIThread()

Project: react-native
File: CatalystSubviewsClippingTestCase.java
private void scrollToDpInUIThread(final int yPositionInDP) throws Throwable {
    final ScrollView mainScrollView = getViewByTestId("scroll_view");
    runTestOnUiThread(new Runnable() {

        @Override
        public void run() {
            mainScrollView.scrollTo(0, (int) PixelUtil.toPixelFromDIP(yPositionInDP));
        }
    });
    waitForBridgeAndUIIdle();
}

78. ShiftBackgroundFragment#onCreateView()

Project: Paralloid
File: ShiftBackgroundFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_parallax_background, container, false);
    ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
    if (scrollView instanceof Parallaxor) {
        ((Parallaxor) scrollView).parallaxViewBackgroundBy(scrollView, getResources().getDrawable(R.drawable.example_rainbow), 1f);
    }
    return rootView;
}

79. MicroBenchmarks#onCreate()

Project: libgdx
File: MicroBenchmarks.java
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    tv = new TextView(this);
    sv = new ScrollView(this);
    sv.addView(tv);
    setContentView(sv);
    testThread.start();
}

80. InboxLayoutScrollView#createDragableView()

Project: InboxLayout
File: InboxLayoutScrollView.java
@Override
protected ScrollView createDragableView(Context context, AttributeSet attrs) {
    mScrollView = new ScrollView(context);
    mScrollView.setId(R.id.scrollview);
    return mScrollView;
}

81. LeftMenuFragment#onCreateView()

Project: iBeebo
File: LeftMenuFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final ScrollView view = (ScrollView) inflater.inflate(R.layout.main_timeline_left_drawer_layout, container, false);
    mCoverBlureImage = ViewUtility.findViewById(view, R.id.coverBlureImage);
    displayCover();
    layout = new LeftDrawerViewHolder();
    layout.avatar = (ImageView) view.findViewById(R.id.avatar);
    layout.nickname = (TextView) view.findViewById(R.id.nickname);
    layout.home = (LinearLayout) view.findViewById(R.id.btn_home);
    // layot.location = (Button) view.findViewById(R.id.btn_location);
    layout.fav = (Button) view.findViewById(R.id.btn_favourite);
    layout.homeCount = (TextView) view.findViewById(R.id.tv_home_count);
    layout.leftDrawerSettingBtn = (Button) view.findViewById(R.id.leftDrawerSettingBtn);
    layout.homeButton = (Button) view.findViewById(R.id.homeButton);
    layout.mHotWeibo = ViewUtility.findViewById(view, R.id.btnHotWeibo);
    layout.mHotHuaTi = ViewUtility.findViewById(view, R.id.btnHotHuaTi);
    layout.mHotModel = ViewUtility.findViewById(view, R.id.btnHotModel);
    return view;
}

82. PickerQuizView#createQuizContentView()

Project: android-topeka
File: PickerQuizView.java
@Override
protected View createQuizContentView() {
    initStep();
    mMin = getQuiz().getMin();
    ScrollView layout = (ScrollView) getLayoutInflater().inflate(R.layout.quiz_layout_picker, this, false);
    mCurrentSelection = (TextView) layout.findViewById(R.id.seekbar_progress);
    mCurrentSelection.setText(String.valueOf(mMin));
    mSeekBar = (SeekBar) layout.findViewById(R.id.seekbar);
    mSeekBar.setMax(getSeekBarMax());
    mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            setCurrentSelectionText(mMin + progress);
            allowAnswer();
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        /* no-op */
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        /* no-op */
        }
    });
    return layout;
}

83. AlphaPickerQuizView#createQuizContentView()

Project: android-topeka
File: AlphaPickerQuizView.java
@Override
protected View createQuizContentView() {
    ScrollView layout = (ScrollView) getLayoutInflater().inflate(R.layout.quiz_layout_picker, this, false);
    mCurrentSelection = (TextView) layout.findViewById(R.id.seekbar_progress);
    mCurrentSelection.setText(getAlphabet().get(0));
    mSeekBar = (SeekBar) layout.findViewById(R.id.seekbar);
    mSeekBar.setMax(getAlphabet().size() - 1);
    mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mCurrentSelection.setText(getAlphabet().get(progress));
            allowAnswer();
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        /* no-op */
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        /* no-op */
        }
    });
    return layout;
}

84. LogFragment#inflateViews()

Project: android-play-places
File: LogFragment.java
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);
    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);
    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);
    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
    mScrollView.addView(mLogView);
    return mScrollView;
}

85. LogFragment#inflateViews()

Project: android-play-places
File: LogFragment.java
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);
    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);
    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);
    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
    mScrollView.addView(mLogView);
    return mScrollView;
}

86. LogFragment#inflateViews()

Project: android-play-places
File: LogFragment.java
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);
    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);
    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);
    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
    mScrollView.addView(mLogView);
    return mScrollView;
}

87. LogFragment#inflateViews()

Project: android-play-places
File: LogFragment.java
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);
    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);
    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);
    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
    mScrollView.addView(mLogView);
    return mScrollView;
}

88. LogFragment#inflateViews()

Project: android-play-awareness
File: LogFragment.java
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);
    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);
    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);
    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_DeviceDefault_Medium);
    mScrollView.addView(mLogView);
    return mScrollView;
}

89. SanityCheckRootTools#onCreate()

Project: afwall
File: SanityCheckRootTools.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    /*StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                .detectDiskReads()
                .detectDiskWrites()
                .detectNetwork()   // or .detectAll() for all detectable problems
                .penaltyLog()
                .build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                .detectLeakedSqlLiteObjects()
                .detectLeakedClosableObjects()
                .penaltyLog()
                .penaltyDeath()
                .build());*/
    RootTools.debugMode = true;
    mTextView = new TextView(this);
    mTextView.setText("");
    mScrollView = new ScrollView(this);
    mScrollView.addView(mTextView);
    setContentView(mScrollView);
    // Great the user with our version number
    String version = "?";
    try {
        PackageInfo packageInfo = this.getPackageManager().getPackageInfo(this.getPackageName(), 0);
        version = packageInfo.versionName;
    } catch (PackageManager.NameNotFoundException e) {
    }
    print("SanityCheckRootTools v " + version + "\n\n");
    if (RootTools.isRootAvailable()) {
        print("Root found.\n");
    } else {
        print("Root not found");
    }
    try {
        Shell.startRootShell();
    } catch (IOException e2) {
        e2.printStackTrace();
    } catch (TimeoutException e) {
        print("[ TIMEOUT EXCEPTION! ]\n");
        e.printStackTrace();
    } catch (RootDeniedException e) {
        print("[ ROOT DENIED EXCEPTION! ]\n");
        e.printStackTrace();
    }
    try {
        if (!RootTools.isAccessGiven()) {
            print("ERROR: No root access to this device.\n");
            return;
        }
    } catch (Exception e) {
        print("ERROR: could not determine root access to this device.\n");
        return;
    }
    // Display infinite progress bar
    mPDialog = new ProgressDialog(this);
    mPDialog.setCancelable(false);
    mPDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    new SanityCheckThread(this, new TestHandler()).start();
}