Search in sources :

Example 66 with ScrollView

use of android.widget.ScrollView in project platform_frameworks_base by android.

the class AnimatedVectorDrawableTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    final int[] layerTypes = { View.LAYER_TYPE_SOFTWARE, View.LAYER_TYPE_HARDWARE };
    final boolean[] forceOnUi = { false, true };
    super.onCreate(savedInstanceState);
    ScrollView scrollView = new ScrollView(this);
    GridLayout container = new GridLayout(this);
    scrollView.addView(container);
    container.setColumnCount(layerTypes.length * forceOnUi.length);
    for (int j = 0; j < layerTypes.length; j++) {
        for (int k = 0; k < forceOnUi.length; k++) {
            TextView textView = new TextView(this);
            String category = "Layer:" + (layerTypes[j] == View.LAYER_TYPE_SOFTWARE ? "SW" : "HW") + (forceOnUi[k] == true ? ",forceUI" : "");
            textView.setText(category);
            container.addView(textView);
        }
    }
    for (int i = 0; i < icon.length; i++) {
        for (int j = 0; j < layerTypes.length; j++) {
            for (int k = 0; k < forceOnUi.length; k++) {
                Button button = new Button(this);
                button.setWidth(300);
                button.setHeight(300);
                button.setLayerType(layerTypes[j], null);
                button.setBackgroundResource(icon[i]);
                AnimatedVectorDrawable d = (AnimatedVectorDrawable) button.getBackground();
                if (forceOnUi[k] == true) {
                    d.forceAnimationOnUI();
                }
                d.registerAnimationCallback(new Animatable2.AnimationCallback() {

                    @Override
                    public void onAnimationStart(Drawable drawable) {
                        Log.v(LOGCAT, "Animator start");
                    }

                    @Override
                    public void onAnimationEnd(Drawable drawable) {
                        Log.v(LOGCAT, "Animator end");
                    }
                });
                container.addView(button);
                button.setOnClickListener(this);
            }
        }
    }
    setContentView(scrollView);
}
Also used : AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable) Drawable(android.graphics.drawable.Drawable) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable) Animatable2(android.graphics.drawable.Animatable2) GridLayout(android.widget.GridLayout) ScrollView(android.widget.ScrollView) Button(android.widget.Button) TextView(android.widget.TextView)

Example 67 with ScrollView

use of android.widget.ScrollView in project platform_frameworks_base by android.

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 68 with ScrollView

use of android.widget.ScrollView in project platform_frameworks_base by android.

the class GlyphCacheActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ScrollView scrollView = new ScrollView(this);
    scrollView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    scrollView.addView(layout);
    while (mTotalChars < 10000) {
        layout.addView(createTextView());
    }
    setContentView(scrollView);
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ScrollView(android.widget.ScrollView) LinearLayout(android.widget.LinearLayout)

Example 69 with ScrollView

use of android.widget.ScrollView in project platform_frameworks_base by android.

the class BigEditTextActivityScrollableResize method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    mRootView = new ScrollView(this);
    ((ScrollView) mRootView).setFillViewport(true);
    mRootView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mLayout = new LinearLayout(this);
    mLayout.setOrientation(LinearLayout.VERTICAL);
    mLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    View view = getLayoutInflater().inflate(R.layout.full_screen_edit_text, ((ScrollView) mRootView), false);
    mLayout.addView(view);
    ((ScrollView) mRootView).addView(mLayout);
    mDefaultFocusedView = view.findViewById(R.id.data);
    setContentView(mRootView);
}
Also used : ScrollView(android.widget.ScrollView) ViewGroup(android.view.ViewGroup) ScrollView(android.widget.ScrollView) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 70 with ScrollView

use of android.widget.ScrollView in project platform_frameworks_base by android.

the class InputTypeActivity method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mScrollView = new ScrollView(this);
    mLayout = new LinearLayout(this);
    mLayout.setOrientation(LinearLayout.VERTICAL);
    mLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    mInflater = getLayoutInflater();
    mParent = mLayout;
    /* Normal Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_NORMAL, R.string.normal_edit_text_label));
    /* Normal Edit Text w/Cap Chars Flag*/
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_NORMAL | EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS, R.string.cap_chars_edit_text_label));
    /* Normal Edit Text w/Cap Words Flag*/
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_NORMAL | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS, R.string.cap_words_edit_text_label));
    /* Normal Edit Text w/Cap Multiline Flag */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_NORMAL | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE, R.string.multiline_edit_text_label));
    /* Normal Edit Text w/Cap Sentences Flag */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_NORMAL | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES, R.string.cap_sentences_edit_text_label));
    /* Normal Edit Text w/Auto-complete Flag */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_NORMAL | EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE, R.string.auto_complete_edit_text_label));
    /* Normal Edit Text w/Auto-correct Flag */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_NORMAL | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT, R.string.auto_correct_edit_text_label));
    /* Uri Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_URI, R.string.uri_edit_text_label));
    /* Email Address Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS, R.string.email_address_edit_text_label));
    /* Email Subject Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_SUBJECT, R.string.email_subject_edit_text_label));
    /* Email Content Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_LONG_MESSAGE, R.string.email_content_edit_text_label));
    /* Person Name Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME, R.string.person_name_edit_text_label));
    /* Postal Address Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_POSTAL_ADDRESS, R.string.postal_address_edit_text_label));
    /* Password Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD, R.string.password_edit_text_label));
    /* Web Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT, R.string.web_edit_text_label));
    /* Signed Number Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_SIGNED, R.string.signed_number_edit_text_label));
    /* Decimal Number Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL, R.string.decimal_number_edit_text_label));
    /* Phone Number Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_PHONE, R.string.phone_number_edit_text_label));
    /* Normal Datetime Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_DATETIME | EditorInfo.TYPE_DATETIME_VARIATION_NORMAL, R.string.normal_datetime_edit_text_label));
    /* Date Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_DATETIME | EditorInfo.TYPE_DATETIME_VARIATION_DATE, R.string.date_edit_text_label));
    /* Time Edit Text */
    mLayout.addView(buildEntryView(EditorInfo.TYPE_CLASS_DATETIME | EditorInfo.TYPE_DATETIME_VARIATION_TIME, R.string.time_edit_text_label));
    mScrollView.addView(mLayout);
    setContentView(mScrollView);
}
Also used : ScrollView(android.widget.ScrollView) ViewGroup(android.view.ViewGroup) LinearLayout(android.widget.LinearLayout)

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