use of android.widget.RelativeLayout in project c-geo by just-radovan.
the class cgeotrackable method displayLogs.
private void displayLogs() {
// trackable logs
LinearLayout listView = (LinearLayout) findViewById(R.id.log_list);
listView.removeAllViews();
RelativeLayout rowView;
if (trackable != null && trackable.logs != null) {
for (cgLog log : trackable.logs) {
rowView = (RelativeLayout) inflater.inflate(R.layout.trackable_logitem, null);
if (log.date > 0) {
final Date logDate = new Date(log.date);
((TextView) rowView.findViewById(R.id.added)).setText(cgBase.dateOutShort.format(logDate));
}
if (cgBase.logTypes1.containsKey(log.type) == true) {
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(log.type));
} else {
// note if type is unknown
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(4));
}
((TextView) rowView.findViewById(R.id.author)).setText(Html.fromHtml(log.author), TextView.BufferType.SPANNABLE);
if (log.cacheName == null || log.cacheName.length() == 0) {
((TextView) rowView.findViewById(R.id.location)).setVisibility(View.GONE);
} else {
((TextView) rowView.findViewById(R.id.location)).setText(Html.fromHtml(log.cacheName));
final String cacheGuid = log.cacheGuid;
final String cacheName = log.cacheName;
((TextView) rowView.findViewById(R.id.location)).setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent cacheIntent = new Intent(activity, cgeodetail.class);
cacheIntent.putExtra("guid", (String) cacheGuid);
cacheIntent.putExtra("name", (String) Html.fromHtml(cacheName).toString());
activity.startActivity(cacheIntent);
}
});
}
((TextView) rowView.findViewById(R.id.log)).setText(Html.fromHtml(log.log, new cgHtmlImg(activity, settings, null, false, 0, false), null), TextView.BufferType.SPANNABLE);
((TextView) rowView.findViewById(R.id.author)).setOnClickListener(new userActions());
listView.addView(rowView);
}
if (trackable.logs.size() > 0) {
((LinearLayout) findViewById(R.id.log_box)).setVisibility(View.VISIBLE);
}
}
}
use of android.widget.RelativeLayout in project c-geo by just-radovan.
the class cgeodetail method displayLogs.
private void displayLogs() {
// cache logs
TextView textView = (TextView) findViewById(R.id.logcount);
int logCounter = 0;
if (cache != null && cache.logCounts != null) {
final StringBuffer buff = new StringBuffer();
buff.append(res.getString(R.string.cache_log_types));
buff.append(": ");
// sort the log counts by type id ascending. that way the FOUND, DNF log types are the first and most visible ones
ArrayList<Entry<Integer, Integer>> sortedLogCounts = new ArrayList<Entry<Integer, Integer>>();
sortedLogCounts.addAll(cache.logCounts.entrySet());
Collections.sort(sortedLogCounts, new Comparator<Entry<Integer, Integer>>() {
@Override
public int compare(Entry<Integer, Integer> logCountItem1, Entry<Integer, Integer> logCountItem2) {
return logCountItem1.getKey().compareTo(logCountItem2.getKey());
}
});
for (Entry<Integer, Integer> pair : sortedLogCounts) {
int logTypeId = pair.getKey().intValue();
String logTypeLabel = cgBase.logTypes1.get(logTypeId);
// it may happen that the label is unknown -> then avoid any output for this type
if (logTypeLabel != null) {
if (logCounter > 0) {
buff.append(", ");
}
buff.append(pair.getValue().intValue());
buff.append("× ");
buff.append(logTypeLabel);
}
logCounter++;
}
textView.setText(buff.toString());
}
// therefore check again for the number of counted logs
if (logCounter > 0) {
textView.setVisibility(View.VISIBLE);
} else {
textView.setVisibility(View.GONE);
}
// cache logs
LinearLayout listView = (LinearLayout) findViewById(R.id.log_list);
listView.removeAllViews();
RelativeLayout rowView;
if (cache != null && cache.logs != null) {
for (cgLog log : cache.logs) {
rowView = (RelativeLayout) inflater.inflate(R.layout.log_item, null);
if (log.date > 0) {
final Date logDate = new Date(log.date);
((TextView) rowView.findViewById(R.id.added)).setText(cgBase.dateOutShort.format(logDate));
}
if (cgBase.logTypes1.containsKey(log.type) == true) {
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(log.type));
} else {
// note if type is unknown
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(4));
}
// avoid parsing HTML if not necessary
if (log.author.indexOf('<') >= 0 || log.author.indexOf('&') >= 0) {
((TextView) rowView.findViewById(R.id.author)).setText(Html.fromHtml(log.author), TextView.BufferType.SPANNABLE);
} else {
((TextView) rowView.findViewById(R.id.author)).setText(log.author);
}
if (log.found == -1) {
((TextView) rowView.findViewById(R.id.count)).setVisibility(View.GONE);
} else if (log.found == 0) {
((TextView) rowView.findViewById(R.id.count)).setText(res.getString(R.string.cache_count_no));
} else if (log.found == 1) {
((TextView) rowView.findViewById(R.id.count)).setText(res.getString(R.string.cache_count_one));
} else {
((TextView) rowView.findViewById(R.id.count)).setText(log.found + " " + res.getString(R.string.cache_count_more));
}
// avoid parsing HTML if not necessary
if (log.log.indexOf('<') >= 0 || log.log.indexOf('&') >= 0) {
((TextView) rowView.findViewById(R.id.log)).setText(Html.fromHtml(log.log, new cgHtmlImg(activity, settings, null, false, cache.reason, false), null), TextView.BufferType.SPANNABLE);
} else {
((TextView) rowView.findViewById(R.id.log)).setText(log.log);
}
final ImageView markFound = (ImageView) rowView.findViewById(R.id.found_mark);
final ImageView markDNF = (ImageView) rowView.findViewById(R.id.dnf_mark);
final ImageView markDisabled = (ImageView) rowView.findViewById(R.id.disabled_mark);
if (log.type == 2 || log.type == 9 || log.type == 10) {
// found, will attend, attended
markFound.setVisibility(View.VISIBLE);
markDNF.setVisibility(View.GONE);
markDisabled.setVisibility(View.GONE);
} else if (log.type == 3) {
// did not find
markFound.setVisibility(View.GONE);
markDNF.setVisibility(View.VISIBLE);
markDisabled.setVisibility(View.GONE);
} else if (log.type == 7 || log.type == 8) {
// disabled, archived
markFound.setVisibility(View.GONE);
markDNF.setVisibility(View.GONE);
markDisabled.setVisibility(View.VISIBLE);
} else {
markFound.setVisibility(View.GONE);
markDNF.setVisibility(View.GONE);
markDisabled.setVisibility(View.GONE);
}
((TextView) rowView.findViewById(R.id.author)).setOnClickListener(new userActions());
((TextView) rowView.findViewById(R.id.log)).setOnClickListener(new decryptLog());
listView.addView(rowView);
}
if (cache.logs.size() > 0) {
((LinearLayout) findViewById(R.id.log_box)).setVisibility(View.VISIBLE);
}
}
}
use of android.widget.RelativeLayout in project SmartAndroidSource by jaychou2012.
the class WebDialog method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RelativeLayout layout = new RelativeLayout(getContext());
layout.setBackgroundColor(0xFFFFFFFF);
setupWebView(layout);
setupProgress(layout);
FrameLayout.LayoutParams FILL = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
addContentView(layout, FILL);
}
use of android.widget.RelativeLayout in project musicbrainz-android by jdamcd.
the class SearchPagerAdapter method instantiateItem.
@Override
public Object instantiateItem(View container, int position) {
switch(position) {
case 0:
RelativeLayout artists = (RelativeLayout) context.getLayoutInflater().inflate(R.layout.layout_search_artists, null);
((ViewPager) container).addView(artists, 0);
return artists;
case 1:
RelativeLayout releases = (RelativeLayout) context.getLayoutInflater().inflate(R.layout.layout_search_release_groups, null);
((ViewPager) container).addView(releases, 0);
return releases;
}
return null;
}
use of android.widget.RelativeLayout in project musicbrainz-android by jdamcd.
the class SearchActivity method displayArtistResultsView.
private void displayArtistResultsView() {
ListView artistResultsView = (ListView) findViewById(R.id.searchres_artist_list);
artistResultsView.setAdapter(new ArtistSearchAdapter(SearchActivity.this, artistSearchResults));
artistResultsView.setOnItemClickListener(new ArtistItemClickListener());
artistResultsView.setVisibility(View.VISIBLE);
if (artistSearchResults.isEmpty()) {
RelativeLayout artistResults = (RelativeLayout) findViewById(R.id.artist_results_container);
TextView noRes = (TextView) artistResults.findViewById(R.id.noresults);
noRes.setVisibility(View.VISIBLE);
} else {
saveQueryAsSuggestion();
}
}
Aggregations