Java Code Examples for android.view.View.addView()

The following are Jave code examples for showing how to use addView() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: letv   File: JazzyViewPager.java   Source Code and License Vote up 6 votes
private View wrapChild(View child) {
    if (!this.mOutlineEnabled || (child instanceof OutlineContainer)) {
        return child;
    }
    View out = new OutlineContainer(getContext());
    out.setLayoutParams(generateDefaultLayoutParams());
    child.setLayoutParams(new LayoutParams(-1, -1));
    out.addView(child);
    return out;
}
 
Example 2
Project: boohee_v5.6   File: a.java   Source Code and License Vote up 6 votes
protected final void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    Context context = getContext();
    View linearLayout = new LinearLayout(context);
    LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, a(context, (float) IntFloatWheelView.DEFAULT_VALUE));
    layoutParams.gravity = 17;
    linearLayout.setOrientation(0);
    linearLayout.setLayoutParams(layoutParams);
    Drawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setColor(-450944201);
    gradientDrawable.setCornerRadius((float) a(context, 5.0f));
    linearLayout.setBackgroundDrawable(gradientDrawable);
    View imageView = new ImageView(context);
    layoutParams = new LinearLayout.LayoutParams(a(context, 20.0f), a(context, 20.0f));
    layoutParams.gravity = 16;
    layoutParams.setMargins(a(this.a.f, 17.0f), a(this.a.f, 10.0f), a(this.a.f, 8.0f), a(this.a.f, 10.0f));
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ScaleType.FIT_CENTER);
    imageView.setImageDrawable(a(context, a.d));
    Animation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
    rotateAnimation.setRepeatCount(-1);
    rotateAnimation.setDuration(900);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    imageView.startAnimation(rotateAnimation);
    View textView = new TextView(context);
    textView.setText(TextUtils.isEmpty(this.a.g) ? a.a : this.a.g);
    textView.setTextSize(16.0f);
    textView.setTextColor(-1);
    layoutParams = new LinearLayout.LayoutParams(-2, -2);
    layoutParams.gravity = 16;
    layoutParams.setMargins(0, 0, a(context, 17.0f), 0);
    textView.setLayoutParams(layoutParams);
    linearLayout.addView(imageView);
    linearLayout.addView(textView);
    setContentView(linearLayout);
    setCancelable(false);
}
 
Example 3
Project: boohee_v5.6   File: a.java   Source Code and License Vote up 6 votes
private View a(Context context) {
    View linearLayout = new LinearLayout(context);
    LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, a(context, (float) IntFloatWheelView.DEFAULT_VALUE));
    layoutParams.gravity = 17;
    linearLayout.setOrientation(0);
    linearLayout.setLayoutParams(layoutParams);
    Drawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setColor(-450944201);
    gradientDrawable.setCornerRadius((float) a(context, 5.0f));
    linearLayout.setBackgroundDrawable(gradientDrawable);
    View imageView = new ImageView(context);
    layoutParams = new LinearLayout.LayoutParams(a(context, 20.0f), a(context, 20.0f));
    layoutParams.gravity = 16;
    layoutParams.setMargins(a(this.a.f, 17.0f), a(this.a.f, 10.0f), a(this.a.f, 8.0f), a(this.a.f, 10.0f));
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ScaleType.FIT_CENTER);
    imageView.setImageDrawable(a(context, a.d));
    Animation rotateAnimation = new RotateAnimation(0.0f, 359.0f, 1, 0.5f, 1, 0.5f);
    rotateAnimation.setRepeatCount(-1);
    rotateAnimation.setDuration(900);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    imageView.startAnimation(rotateAnimation);
    View textView = new TextView(context);
    textView.setText(TextUtils.isEmpty(this.a.g) ? a.a : this.a.g);
    textView.setTextSize(16.0f);
    textView.setTextColor(-1);
    layoutParams = new LinearLayout.LayoutParams(-2, -2);
    layoutParams.gravity = 16;
    layoutParams.setMargins(0, 0, a(context, 17.0f), 0);
    textView.setLayoutParams(layoutParams);
    linearLayout.addView(imageView);
    linearLayout.addView(textView);
    return linearLayout;
}
 
Example 4
Project: letv   File: H5AuthActivity.java   Source Code and License Vote up 5 votes
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            String string = extras.getString("url");
            if (k.a(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.c = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.a = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.a.setVisibility(0);
                linearLayout.addView(this.a, layoutParams);
                WebSettings settings = this.a.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + k.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.a.setVerticalScrollbarOverlay(true);
                this.a.setWebViewClient(new a());
                this.a.setDownloadListener(new a(this));
                this.a.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.a.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.a.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.a.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.a, new Object[]{"searchBoxJavaBridge_"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
Example 5
Project: letv   File: H5PayActivity.java   Source Code and License Vote up 5 votes
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            String string = extras.getString("url");
            if (k.a(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.c = new Handler(getMainLooper());
                Object string2 = extras.getString("cookie");
                if (!TextUtils.isEmpty(string2)) {
                    CookieSyncManager.createInstance(getApplicationContext()).sync();
                    CookieManager.getInstance().setCookie(string, string2);
                    CookieSyncManager.getInstance().sync();
                }
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.a = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.a.setVisibility(0);
                linearLayout.addView(this.a, layoutParams);
                WebSettings settings = this.a.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + k.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.a.setVerticalScrollbarOverlay(true);
                this.a.setWebViewClient(new a());
                this.a.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.a.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.a.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.a.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.a, new Object[]{"searchBoxJavaBridge_"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
Example 6
Project: letv   File: AuthActivity.java   Source Code and License Vote up 5 votes
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            this.d = extras.getString(b);
            String string = extras.getString("params");
            if (k.a(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.f = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.c = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.c.setVisibility(0);
                linearLayout.addView(this.c, layoutParams);
                WebSettings settings = this.c.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + k.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.c.setVerticalScrollbarOverlay(true);
                this.c.setWebViewClient(new b());
                this.c.setWebChromeClient(new a());
                this.c.setDownloadListener(new a(this));
                this.c.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.c.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.c.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.c.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.c, new Object[]{"searchBoxJavaBridge_"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
Example 7
Project: boohee_v5.6   File: j.java   Source Code and License Vote up 5 votes
public j(Activity activity, SocializeEntity socializeEntity, SHARE_MEDIA share_media,
         UMAuthListener uMAuthListener) {
    super(activity, ResContainer.getResourceId(activity.getApplicationContext(), ResType
            .STYLE, "umeng_socialize_popup_dialog"));
    this.k = activity.getApplicationContext();
    this.l = activity;
    this.c = uMAuthListener;
    this.m = share_media;
    this.i = UMServiceFactory.getUMSocialService(socializeEntity.mDescriptor);
    SocializeConfig config = this.i.getConfig();
    this.n = config.getFollowFids(share_media);
    this.o = config.getOauthDialogFollowListener();
    switch (s.a[share_media.ordinal()]) {
        case 1:
            this.j = p;
            break;
        case 2:
            this.j = q;
            break;
        case 3:
            this.j = r;
            break;
        case 4:
            this.j = s;
            break;
    }
    LayoutInflater layoutInflater = (LayoutInflater) this.l.getSystemService("layout_inflater");
    int resourceId = ResContainer.getResourceId(this.k, ResType.LAYOUT,
            "umeng_socialize_oauth_dialog");
    int resourceId2 = ResContainer.getResourceId(this.k, ResType.ID, "umeng_socialize_follow");
    int resourceId3 = ResContainer.getResourceId(this.k, ResType.ID,
            "umeng_socialize_follow_check");
    this.d = layoutInflater.inflate(resourceId, null);
    View findViewById = this.d.findViewById(resourceId2);
    this.f = (CheckBox) this.d.findViewById(resourceId3);
    Object obj = (this.n == null || this.n.size() <= 0) ? null : 1;
    Object obj2 = (share_media == SHARE_MEDIA.SINA || share_media == SHARE_MEDIA.TENCENT) ? 1
            : null;
    if (obj == null || obj2 == null) {
        findViewById.setVisibility(8);
    } else {
        findViewById.setVisibility(0);
    }
    int resourceId4 = ResContainer.getResourceId(this.k, ResType.ID, "progress_bar_parent");
    resourceId = ResContainer.getResourceId(this.k, ResType.ID,
            "umeng_socialize_title_bar_leftBt");
    resourceId2 = ResContainer.getResourceId(this.k, ResType.ID,
            "umeng_socialize_title_bar_rightBt");
    resourceId3 = ResContainer.getResourceId(this.k, ResType.ID,
            "umeng_socialize_title_bar_middleTv");
    int resourceId5 = ResContainer.getResourceId(this.k, ResType.ID,
            "umeng_socialize_titlebar");
    this.e = this.d.findViewById(resourceId4);
    this.e.setVisibility(0);
    ((Button) this.d.findViewById(resourceId)).setOnClickListener(new l(this));
    this.d.findViewById(resourceId2).setVisibility(8);
    ((TextView) this.d.findViewById(resourceId3)).setText("授权" + SocialSNSHelper.getShowWord
            (this.k, share_media));
    b();
    View mVar = new m(this, this.k, findViewById, this.d.findViewById(resourceId5),
            SocializeUtils.dip2Px(this.k, 200.0f));
    mVar.addView(this.d, -1, -1);
    setContentView(mVar);
    LayoutParams attributes = getWindow().getAttributes();
    if (SocializeUtils.isFloatWindowStyle(this.k)) {
        int[] floatWindowSize = SocializeUtils.getFloatWindowSize(this.k);
        attributes.width = floatWindowSize[0];
        attributes.height = floatWindowSize[1];
        resourceId4 = ResContainer.getResourceId(getContext(), ResType.STYLE,
                "umeng_socialize_dialog_anim_fade");
    } else {
        attributes.height = -1;
        attributes.width = -1;
        resourceId4 = ResContainer.getResourceId(getContext(), ResType.STYLE,
                "umeng_socialize_dialog_animations");
    }
    attributes.gravity = 17;
    getWindow().getAttributes().windowAnimations = resourceId4;
}
 
Example 8
Project: boohee_v5.6   File: H5AuthActivity.java   Source Code and License Vote up 5 votes
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            String string = extras.getString("url");
            if (i.b(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.c = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.a = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.a.setVisibility(0);
                linearLayout.addView(this.a, layoutParams);
                WebSettings settings = this.a.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + i.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.a.setVerticalScrollbarOverlay(true);
                this.a.setWebViewClient(new a());
                this.a.setDownloadListener(new b(this));
                this.a.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.a.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.a.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.a.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.a, new Object[]{"searchBoxJavaBridge_"});
                        method.invoke(this.a, new Object[]{"accessibility"});
                        method.invoke(this.a, new Object[]{"accessibilityTraversal"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
Example 9
Project: boohee_v5.6   File: H5PayActivity.java   Source Code and License Vote up 5 votes
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            String string = extras.getString("url");
            if (i.b(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.c = new Handler(getMainLooper());
                Object string2 = extras.getString("cookie");
                if (!TextUtils.isEmpty(string2)) {
                    CookieSyncManager.createInstance(getApplicationContext()).sync();
                    CookieManager.getInstance().setCookie(string, string2);
                    CookieSyncManager.getInstance().sync();
                }
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.a = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.a.setVisibility(0);
                linearLayout.addView(this.a, layoutParams);
                WebSettings settings = this.a.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + i.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.a.setVerticalScrollbarOverlay(true);
                this.a.setWebViewClient(new a());
                this.a.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.a.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.a.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.a.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.a, new Object[]{"searchBoxJavaBridge_"});
                        method.invoke(this.a, new Object[]{"accessibility"});
                        method.invoke(this.a, new Object[]{"accessibilityTraversal"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
Example 10
Project: boohee_v5.6   File: AuthActivity.java   Source Code and License Vote up 5 votes
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    try {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            finish();
            return;
        }
        try {
            this.d = extras.getString(b);
            String string = extras.getString("params");
            if (i.b(string)) {
                Method method;
                super.requestWindowFeature(1);
                this.f = new Handler(getMainLooper());
                View linearLayout = new LinearLayout(getApplicationContext());
                LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
                linearLayout.setOrientation(1);
                setContentView(linearLayout, layoutParams);
                this.c = new WebView(getApplicationContext());
                layoutParams.weight = 1.0f;
                this.c.setVisibility(0);
                linearLayout.addView(this.c, layoutParams);
                WebSettings settings = this.c.getSettings();
                settings.setUserAgentString(settings.getUserAgentString() + i.c(getApplicationContext()));
                settings.setRenderPriority(RenderPriority.HIGH);
                settings.setSupportMultipleWindows(true);
                settings.setJavaScriptEnabled(true);
                settings.setSavePassword(false);
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
                settings.setAllowFileAccess(false);
                settings.setTextSize(TextSize.NORMAL);
                this.c.setVerticalScrollbarOverlay(true);
                this.c.setWebViewClient(new b());
                this.c.setWebChromeClient(new a());
                this.c.setDownloadListener(new a(this));
                this.c.loadUrl(string);
                if (VERSION.SDK_INT >= 7) {
                    try {
                        method = this.c.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
                        if (method != null) {
                            method.invoke(this.c.getSettings(), new Object[]{Boolean.valueOf(true)});
                        }
                    } catch (Exception e) {
                    }
                }
                try {
                    method = this.c.getClass().getMethod("removeJavascriptInterface", new Class[0]);
                    if (method != null) {
                        method.invoke(this.c, new Object[]{"searchBoxJavaBridge_"});
                        method.invoke(this.c, new Object[]{"accessibility"});
                        method.invoke(this.c, new Object[]{"accessibilityTraversal"});
                        return;
                    }
                    return;
                } catch (Exception e2) {
                    return;
                }
            }
            finish();
        } catch (Exception e3) {
            finish();
        }
    } catch (Exception e4) {
        finish();
    }
}
 
Example 11
Project: boohee_v5.6   File: FollowListPage.java   Source Code and License Vote up 5 votes
public View getView(int position, View convertView, ViewGroup parent) {
    FollowListItem item;
    boolean simpleMode = "FacebookMessenger".equals(this.platform.getName());
    if (convertView == null) {
        View llItem = new LinearLayout(parent.getContext());
        item = new FollowListItem();
        llItem.setTag(item);
        convertView = llItem;
        int dp_52 = R.dipToPx(getContext(), 52);
        int dp_10 = R.dipToPx(parent.getContext(), 10);
        int dp_5 = R.dipToPx(parent.getContext(), 5);
        if (!simpleMode) {
            item.aivIcon = new AsyncImageView(getContext());
            LayoutParams lpIcon = new LayoutParams(dp_52, dp_52);
            lpIcon.gravity = 16;
            lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
            item.aivIcon.setLayoutParams(lpIcon);
            llItem.addView(item.aivIcon);
        }
        LinearLayout llText = new LinearLayout(parent.getContext());
        llText.setPadding(0, dp_10, dp_10, dp_10);
        llText.setOrientation(1);
        LayoutParams lpText = new LayoutParams(-2, -2);
        lpText.gravity = 16;
        lpText.weight = 1.0f;
        llText.setLayoutParams(lpText);
        llItem.addView(llText);
        item.tvName = new TextView(parent.getContext());
        item.tvName.setTextColor(-16777216);
        item.tvName.setTextSize(1, 18.0f);
        item.tvName.setSingleLine();
        if (simpleMode) {
            item.tvName.setPadding(dp_10, 0, 0, 0);
        }
        llText.addView(item.tvName);
        if (!simpleMode) {
            item.tvSign = new TextView(parent.getContext());
            item.tvSign.setTextColor(2130706432);
            item.tvSign.setTextSize(1, 14.0f);
            item.tvSign.setSingleLine();
            llText.addView(item.tvSign);
        }
        item.ivCheck = new ImageView(parent.getContext());
        item.ivCheck.setPadding(0, 0, dp_10, 0);
        LayoutParams lpCheck = new LayoutParams(-2, -2);
        lpCheck.gravity = 16;
        item.ivCheck.setLayoutParams(lpCheck);
        llItem.addView(item.ivCheck);
    } else {
        item = (FollowListItem) convertView.getTag();
    }
    Following following = getItem(position);
    item.tvName.setText(following.screenName);
    if (!simpleMode) {
        item.tvSign.setText(following.description);
    }
    item.ivCheck.setImageBitmap(following.checked ? this.bmChd : this.bmUnch);
    if (!simpleMode) {
        if (isFling()) {
            Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
            if (bm == null || bm.isRecycled()) {
                item.aivIcon.execute(null, 0);
            } else {
                item.aivIcon.setImageBitmap(bm);
            }
        } else {
            item.aivIcon.execute(following.icon, 0);
        }
    }
    if (position == getCount() - 1) {
        next();
    }
    return convertView;
}
 
Example 12
Project: boohee_v5.6   File: FollowListPage.java   Source Code and License Vote up 5 votes
public View getView(int position, View convertView, ViewGroup parent) {
    FollowListItem item;
    boolean simpleMode = "FacebookMessenger".equals(this.platform.getName());
    if (convertView == null) {
        View llItem = new LinearLayout(parent.getContext());
        item = new FollowListItem();
        llItem.setTag(item);
        convertView = llItem;
        int dp_52 = R.dipToPx(getContext(), 52);
        int dp_10 = R.dipToPx(parent.getContext(), 10);
        int dp_5 = R.dipToPx(parent.getContext(), 5);
        if (!simpleMode) {
            item.aivIcon = new AsyncImageView(getContext());
            LayoutParams lpIcon = new LayoutParams(dp_52, dp_52);
            lpIcon.gravity = 16;
            lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
            item.aivIcon.setLayoutParams(lpIcon);
            llItem.addView(item.aivIcon);
        }
        LinearLayout llText = new LinearLayout(parent.getContext());
        llText.setPadding(0, dp_10, dp_10, dp_10);
        llText.setOrientation(1);
        LayoutParams lpText = new LayoutParams(-2, -2);
        lpText.gravity = 16;
        lpText.weight = 1.0f;
        llText.setLayoutParams(lpText);
        llItem.addView(llText);
        item.tvName = new TextView(parent.getContext());
        item.tvName.setTextColor(-16777216);
        item.tvName.setTextSize(1, 18.0f);
        item.tvName.setSingleLine();
        if (simpleMode) {
            item.tvName.setPadding(dp_10, 0, 0, 0);
        }
        llText.addView(item.tvName);
        if (!simpleMode) {
            item.tvSign = new TextView(parent.getContext());
            item.tvSign.setTextColor(2130706432);
            item.tvSign.setTextSize(1, 14.0f);
            item.tvSign.setSingleLine();
            llText.addView(item.tvSign);
        }
        item.ivCheck = new ImageView(parent.getContext());
        item.ivCheck.setPadding(0, 0, dp_10, 0);
        LayoutParams lpCheck = new LayoutParams(-2, -2);
        lpCheck.gravity = 16;
        item.ivCheck.setLayoutParams(lpCheck);
        llItem.addView(item.ivCheck);
    } else {
        item = (FollowListItem) convertView.getTag();
    }
    Following following = getItem(position);
    item.tvName.setText(following.screenName);
    if (!simpleMode) {
        item.tvSign.setText(following.description);
    }
    item.ivCheck.setImageBitmap(following.checked ? this.bmChd : this.bmUnch);
    if (!simpleMode) {
        if (isFling()) {
            Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
            if (bm == null || bm.isRecycled()) {
                item.aivIcon.execute(null, 0);
            } else {
                item.aivIcon.setImageBitmap(bm);
            }
        } else {
            item.aivIcon.execute(following.icon, 0);
        }
    }
    if (position == getCount() - 1) {
        next();
    }
    return convertView;
}