Search in sources :

Example 91 with ScrollView

use of android.widget.ScrollView in project android_frameworks_base by crdroidandroid.

the class DpiTestActivity method scrollWrap.

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;
}
Also used : ScrollView(android.widget.ScrollView)

Example 92 with ScrollView

use of android.widget.ScrollView in project android_frameworks_base by AOSPA.

the class BigCache method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    final LinearLayout testBed = new LinearLayout(this);
    testBed.setOrientation(LinearLayout.VERTICAL);
    testBed.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    final int cacheSize = ViewConfiguration.getMaximumDrawingCacheSize();
    final Display display = getWindowManager().getDefaultDisplay();
    final int screenWidth = display.getWidth();
    final int screenHeight = display.getHeight();
    final View tiny = new View(this);
    tiny.setId(R.id.a);
    tiny.setBackgroundColor(0xFFFF0000);
    tiny.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, screenHeight));
    final View large = new View(this);
    large.setId(R.id.b);
    large.setBackgroundColor(0xFF00FF00);
    // Compute the height of the view assuming a cache size based on ARGB8888
    final int height = 2 * (cacheSize / 2) / screenWidth;
    large.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, height));
    final ScrollView scroller = new ScrollView(this);
    scroller.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    testBed.addView(tiny);
    testBed.addView(large);
    scroller.addView(testBed);
    setContentView(scroller);
}
Also used : ScrollView(android.widget.ScrollView) ViewGroup(android.view.ViewGroup) ScrollView(android.widget.ScrollView) View(android.view.View) LinearLayout(android.widget.LinearLayout) Display(android.view.Display)

Example 93 with ScrollView

use of android.widget.ScrollView in project easy by MehdiBenmesa.

the class Utils method canScroll.

static boolean canScroll(View view) {
    if (view instanceof ScrollView) {
        ScrollView scrollView = (ScrollView) view;
        View child = scrollView.getChildAt(0);
        if (child != null) {
            int childHeight = child.getHeight();
            return scrollView.getHeight() < childHeight + scrollView.getPaddingTop() + scrollView.getPaddingBottom();
        }
        return false;
    } else if (view instanceof RecyclerView) {
        RecyclerView recyclerView = (RecyclerView) view;
        int yOffset = recyclerView.computeVerticalScrollOffset();
        return yOffset != 0;
    }
    return true;
}
Also used : ScrollView(android.widget.ScrollView) NestedScrollView(android.support.v4.widget.NestedScrollView) RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) ScrollView(android.widget.ScrollView) View(android.view.View) NestedScrollView(android.support.v4.widget.NestedScrollView) ListView(android.widget.ListView) WebView(android.webkit.WebView)

Example 94 with ScrollView

use of android.widget.ScrollView in project LeafPic by HoraApps.

the class AlertDialogsHelper method showChangelogDialog.

public static AlertDialog showChangelogDialog(final ThemedActivity activity) {
    final AlertDialog.Builder changelogDialogBuilder = new AlertDialog.Builder(activity, activity.getDialogStyle());
    View dialogLayout = activity.getLayoutInflater().inflate(R.layout.dialog_changelog, null);
    TextView dialogTitle = dialogLayout.findViewById(R.id.dialog_changelog_title);
    TextView dialogMessage = dialogLayout.findViewById(R.id.dialog_changelog_text);
    CardView cvBackground = dialogLayout.findViewById(R.id.dialog_changelog_card);
    ScrollView scrChangelog = dialogLayout.findViewById(R.id.changelog_scrollview);
    cvBackground.setCardBackgroundColor(activity.getCardBackgroundColor());
    dialogTitle.setBackgroundColor(activity.getPrimaryColor());
    activity.getThemeHelper().setScrollViewColor(scrChangelog);
    dialogTitle.setText(activity.getString(R.string.changelog));
    Bypass bypass = new Bypass(activity);
    String markdownString;
    try {
        markdownString = getChangeLogFromAssets(activity);
    } catch (IOException e) {
        ChromeCustomTabs.launchUrl(activity, LEAFPIC_CHANGELOG);
        return null;
    }
    CharSequence string = bypass.markdownToSpannable(markdownString);
    dialogMessage.setText(string);
    dialogMessage.setMovementMethod(LinkMovementMethod.getInstance());
    dialogMessage.setTextColor(activity.getTextColor());
    changelogDialogBuilder.setView(dialogLayout);
    changelogDialogBuilder.setPositiveButton(activity.getString(R.string.ok_action).toUpperCase(), null);
    changelogDialogBuilder.setNeutralButton(activity.getString(R.string.show_full).toUpperCase(), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ChromeCustomTabs.launchUrl(activity, LEAFPIC_CHANGELOG);
        }
    });
    return changelogDialogBuilder.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) CardView(android.support.v7.widget.CardView) IOException(java.io.IOException) ImageView(android.widget.ImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) ScrollView(android.widget.ScrollView) Bypass(in.uncod.android.bypass.Bypass) TextView(android.widget.TextView)

Example 95 with ScrollView

use of android.widget.ScrollView in project LeafPic by HoraApps.

the class SettingsActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    unbinder = ButterKnife.bind(this);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(getToolbarIcon(GoogleMaterial.Icon.gmd_arrow_back));
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    optionStatusbar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            updateTheme();
            setStatusBarColor();
        }
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (ViewUtil.hasNavBar(this)) {
            optionColoredNavbar.setOnClickListener(new View.OnClickListener() {

                @SuppressLint("NewApi")
                @Override
                public void onClick(View view) {
                    updateTheme();
                    getWindow().setNavigationBarColor(isNavigationBarColored() ? getPrimaryColor() : ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000));
                }
            });
        } else
            optionColoredNavbar.setVisibility(View.GONE);
    }
    ScrollView scrollView = findViewById(R.id.settingAct_scrollView);
    setScrollViewColor(scrollView);
}
Also used : ScrollView(android.widget.ScrollView) SuppressLint(android.annotation.SuppressLint) BindView(butterknife.BindView) View(android.view.View) SettingWithSwitchView(org.horaapps.leafpic.views.SettingWithSwitchView) ScrollView(android.widget.ScrollView)

Aggregations

ScrollView (android.widget.ScrollView)363 View (android.view.View)173 TextView (android.widget.TextView)149 LinearLayout (android.widget.LinearLayout)93 ImageView (android.widget.ImageView)65 ViewGroup (android.view.ViewGroup)53 Button (android.widget.Button)36 EditText (android.widget.EditText)36 ListView (android.widget.ListView)29 RecyclerView (android.support.v7.widget.RecyclerView)25 Intent (android.content.Intent)24 AbsListView (android.widget.AbsListView)24 AdapterView (android.widget.AdapterView)24 GridLayout (android.widget.GridLayout)24 ArrayList (java.util.ArrayList)21 SuppressLint (android.annotation.SuppressLint)20 WebView (android.webkit.WebView)19 FrameLayout (android.widget.FrameLayout)19 Dialog (android.app.Dialog)17 DialogInterface (android.content.DialogInterface)16