Search in sources :

Example 31 with RelativeLayout

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);
        }
    }
}
Also used : RelativeLayout(android.widget.RelativeLayout) TextView(android.widget.TextView) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) LinearLayout(android.widget.LinearLayout) Date(java.util.Date)

Example 32 with RelativeLayout

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);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) Date(java.util.Date) Entry(java.util.Map.Entry) RelativeLayout(android.widget.RelativeLayout) TextView(android.widget.TextView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Example 33 with RelativeLayout

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);
}
Also used : FrameLayout(android.widget.FrameLayout) RelativeLayout(android.widget.RelativeLayout)

Example 34 with RelativeLayout

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;
}
Also used : RelativeLayout(android.widget.RelativeLayout) ViewPager(android.support.v4.view.ViewPager)

Example 35 with RelativeLayout

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();
    }
}
Also used : ListView(android.widget.ListView) RelativeLayout(android.widget.RelativeLayout) ArtistSearchAdapter(org.musicbrainz.mobile.adapter.list.ArtistSearchAdapter) TextView(android.widget.TextView)

Aggregations

RelativeLayout (android.widget.RelativeLayout)201 TextView (android.widget.TextView)89 View (android.view.View)84 ImageView (android.widget.ImageView)51 LinearLayout (android.widget.LinearLayout)37 ViewGroup (android.view.ViewGroup)32 ScrollView (android.widget.ScrollView)16 Intent (android.content.Intent)14 OnClickListener (android.view.View.OnClickListener)14 FrameLayout (android.widget.FrameLayout)13 SuppressLint (android.annotation.SuppressLint)12 LayoutInflater (android.view.LayoutInflater)12 ListView (android.widget.ListView)12 ImageButton (android.widget.ImageButton)11 Resources (android.content.res.Resources)10 Bundle (android.os.Bundle)10 Button (android.widget.Button)10 DialogInterface (android.content.DialogInterface)9 DisplayMetrics (android.util.DisplayMetrics)8 Builder (android.app.AlertDialog.Builder)7