Search in sources :

Example 56 with TextView

use of android.widget.TextView in project ADWLauncher2 by boombuler.

the class Workspace method updateShortcuts.

void updateShortcuts(List<ShortcutInfo> apps) {
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final CellLayout layout = (CellLayout) getChildAt(i);
        int childCount = layout.getChildCount();
        for (int j = 0; j < childCount; j++) {
            final View view = layout.getChildAt(j);
            Object tag = view.getTag();
            if (tag instanceof ShortcutInfo) {
                ShortcutInfo info = (ShortcutInfo) tag;
                // We need to check for ACTION_MAIN otherwise getComponent() might
                // return null for some shortcuts (for instance, for shortcuts to
                // web pages.)
                final Intent intent = info.intent;
                final ComponentName name = intent.getComponent();
                if (Intent.ACTION_MAIN.equals(intent.getAction()) && name != null) {
                    final int appCount = apps.size();
                    for (int k = 0; k < appCount; k++) {
                        IconItemInfo app = apps.get(k);
                        ComponentName cname = null;
                        if (app instanceof ShortcutInfo)
                            cname = ((ShortcutInfo) app).intent.getComponent();
                        if (name.equals(cname)) {
                            ((TextView) view).setText(info.getTitle(mIconCache));
                            ((TextView) view).setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(info.getIcon(mIconCache)), null, null);
                        }
                    }
                }
            }
        }
    }
}
Also used : Intent(android.content.Intent) ComponentName(android.content.ComponentName) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView)

Example 57 with TextView

use of android.widget.TextView in project ADWLauncher2 by boombuler.

the class LiveFolderAdapter method newView.

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view;
    final ViewHolder holder = new ViewHolder();
    if (!mIsList) {
        view = mInflater.inflate(R.layout.application_boxed, parent, false);
    } else {
        view = mInflater.inflate(R.layout.application_list, parent, false);
        holder.description = (TextView) view.findViewById(R.id.description);
        holder.icon = (ImageView) view.findViewById(R.id.icon);
    }
    holder.name = (TextView) view.findViewById(R.id.name);
    holder.idIndex = cursor.getColumnIndexOrThrow(LiveFolders._ID);
    holder.nameIndex = cursor.getColumnIndexOrThrow(LiveFolders.NAME);
    holder.descriptionIndex = cursor.getColumnIndex(LiveFolders.DESCRIPTION);
    holder.intentIndex = cursor.getColumnIndex(LiveFolders.INTENT);
    holder.iconBitmapIndex = cursor.getColumnIndex(LiveFolders.ICON_BITMAP);
    holder.iconResourceIndex = cursor.getColumnIndex(LiveFolders.ICON_RESOURCE);
    holder.iconPackageIndex = cursor.getColumnIndex(LiveFolders.ICON_PACKAGE);
    view.setTag(holder);
    return view;
}
Also used : ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 58 with TextView

use of android.widget.TextView in project VirtualApp by asLody.

the class RemoteViewsFixer method fixTextView.

private void fixTextView(ViewGroup viewGroup) {
    int count = viewGroup.getChildCount();
    for (int i = 0; i < count; i++) {
        View v = viewGroup.getChildAt(i);
        if (v instanceof TextView) {
            TextView tv = (TextView) v;
            if (isSingleLine(tv)) {
                tv.setSingleLine(false);
                tv.setMaxLines(1);
            }
        } else if (v instanceof ViewGroup) {
            fixTextView((ViewGroup) v);
        }
    }
}
Also used : ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 59 with TextView

use of android.widget.TextView in project baker-android by bakerframework.

the class MagazineThumb method readOnline.

private void readOnline() {
    previewLoaded = true;
    findViewById(R.id.actions_ui).setVisibility(View.GONE);
    findViewById(R.id.download_container).setVisibility(View.GONE);
    findViewById(R.id.progress_ui).setVisibility(View.GONE);
    findViewById(R.id.txtProgress).setVisibility(View.VISIBLE);
    ((TextView) findViewById(R.id.txtProgress)).setText(R.string.loadingPreview);
    BookJsonParserTask parser = new BookJsonParserTask(this.getContext(), this.magazine, this, BOOK_JSON_PARSE_TASK);
    parser.execute("ONLINE");
}
Also used : BookJsonParserTask(com.baker.abaker.workers.BookJsonParserTask) TextView(android.widget.TextView)

Example 60 with TextView

use of android.widget.TextView in project baker-android by bakerframework.

the class MagazineThumb method init.

/**
     * Initialize the view
     *
     * @param context Application Context
     * @param attrs   Attributes to pass to the view.
     */
public void init(final Context context, AttributeSet attrs) {
    setOrientation(LinearLayout.HORIZONTAL);
    //Creating the view from the XML
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.magazine_thumb_options, this, true);
    // Load the cover if the file exists.
    if ((new File(Configuration.getCacheDirectory(this.getContext()) + File.separator + this.magazine.getName())).exists()) {
        this.renderCover();
    }
    //Set texts and values into the layout
    ((TextView) findViewById(R.id.txtTitle)).setText(this.magazine.getTitle());
    ((TextView) findViewById(R.id.txtInfo)).setText(this.magazine.getInfo());
    ((TextView) findViewById(R.id.txtDate)).setText(this.magazine.getDate());
    if (this.magazine.getSize() == 0) {
        //Hide the size if not set
        findViewById(R.id.txtSize).setVisibility(View.GONE);
    } else {
        //Calculating size in MB
        this.magazine.setSizeMB(this.magazine.getSize() / 1048576);
        ((TextView) findViewById(R.id.txtSize)).setText(this.magazine.getSizeMB() + " MB");
    }
    ((TextView) findViewById(R.id.txtProgress)).setText("0 MB / " + this.magazine.getSizeMB() + " MB");
    //Click on the thumbs image
    findViewById(R.id.imgCover).setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            if (!readable && MagazineThumb.this.magazine.getLiveUrl() != null) {
                MagazineThumb.this.checkInternetAccess();
            } else {
                if (readable && !MagazineThumb.this.isDownloading()) {
                    readIssue();
                } else if (!MagazineThumb.this.isDownloading()) {
                    TASK = TASKS_AFTER_CHECK_INTERNET.DOWNLOAD_ISSUE;
                    MagazineThumb.this.checkInternetAccess();
                }
            }
        }
    });
    //Click on download button
    findViewById(R.id.btnDownload).setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            TASK = TASKS_AFTER_CHECK_INTERNET.DOWNLOAD_ISSUE;
            MagazineThumb.this.checkInternetAccess();
        }
    });
    // Click on the Read button.
    findViewById(R.id.btnRead).setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            readIssue();
        }
    });
    // Click on the ARCHIVE button.
    findViewById(R.id.btnArchive).setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            deleteIssue();
        }
    });
    // magazine online.
    if (this.magazine.getLiveUrl() != null) {
        // If the space is enable in the booleans.xml we use the spacer.
        if (this.getContext().getResources().getBoolean(R.bool.space_between_preview_and_download)) {
            findViewById(R.id.btnPreviewSpacer).setVisibility(View.VISIBLE);
        }
        findViewById(R.id.btnPreview).setVisibility(View.VISIBLE);
        findViewById(R.id.btnPreview).setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                TASK = TASKS_AFTER_CHECK_INTERNET.READ_ONLINE;
                MagazineThumb.this.checkInternetAccess();
            }
        });
    }
}
Also used : LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) File(java.io.File) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Aggregations

TextView (android.widget.TextView)4994 View (android.view.View)2680 ImageView (android.widget.ImageView)1137 Button (android.widget.Button)442 LinearLayout (android.widget.LinearLayout)439 LayoutInflater (android.view.LayoutInflater)425 Intent (android.content.Intent)397 ListView (android.widget.ListView)389 AdapterView (android.widget.AdapterView)372 ViewGroup (android.view.ViewGroup)322 OnClickListener (android.view.View.OnClickListener)304 RecyclerView (android.support.v7.widget.RecyclerView)197 Test (org.junit.Test)197 ScrollView (android.widget.ScrollView)166 DialogInterface (android.content.DialogInterface)162 Context (android.content.Context)156 Drawable (android.graphics.drawable.Drawable)155 EditText (android.widget.EditText)149 AlertDialog (android.app.AlertDialog)144 Bundle (android.os.Bundle)144