Android Open Source - logcat-activity-android Log Entry Adapter






From Project

Back to project page logcat-activity-android.

License

The source code is released under:

Apache License

If you think the Android project logcat-activity-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package io.leftshift.logcat;
/*ww w.j  a  va 2s .  c  om*/
import java.util.Collections;
import java.util.List;

import android.app.Activity;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class LogEntryAdapter extends ArrayAdapter<LogEntry> {
  private Activity mActivity;
  private List<LogEntry> entries;
  private Prefs mPrefs;

  public LogEntryAdapter(Activity activity, int resourceId,
      List<LogEntry> entries) {
    super(activity, resourceId, entries);
    this.mActivity = activity;
    this.entries = entries;
    this.mPrefs = new Prefs(activity);
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LogEntry entry = entries.get(position);
    TextView tv;
    if (convertView == null) {
      LayoutInflater inflater = mActivity.getLayoutInflater();
      tv = (TextView) inflater.inflate(R.layout.logcat_entry, null);
    } else {
      tv = (TextView) convertView;
    }

    tv.setText(entry.getText());
    tv.setTextColor(entry.getLevel().getColor());
    tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);

    return tv;
  }

  public void remove(int position) {
    LogEntry entry = entries.get(position);
    remove(entry);
  }

  public boolean areAllItemsEnabled() {
    return false;
  }

  public boolean isEnabled(int position) {
    return false;
  }

  public LogEntry get(int position) {
    return entries.get(position);
  }
  
  public List<LogEntry> getEntries() {
    return Collections.unmodifiableList(entries);
  }
}




Java Source Code List

io.leftshift.logcat.Buffer.java
io.leftshift.logcat.Buffer.java
io.leftshift.logcat.FilterDialog.java
io.leftshift.logcat.FilterDialog.java
io.leftshift.logcat.Format.java
io.leftshift.logcat.Format.java
io.leftshift.logcat.Level.java
io.leftshift.logcat.Level.java
io.leftshift.logcat.LogEntryAdapter.java
io.leftshift.logcat.LogEntryAdapter.java
io.leftshift.logcat.LogEntry.java
io.leftshift.logcat.LogEntry.java
io.leftshift.logcat.LogcatActivity.java
io.leftshift.logcat.LogcatActivity.java
io.leftshift.logcat.Logcat.java
io.leftshift.logcat.Logcat.java
io.leftshift.logcat.Prefs.java
io.leftshift.logcat.Prefs.java
io.leftshift.logcatsample.MainActivity.java