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);
}
}
}
}
}
}
}
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;
}
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);
}
}
}
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");
}
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();
}
});
}
}
Aggregations