Android Open Source - task-timer-legacy Group List Item






From Project

Back to project page task-timer-legacy.

License

The source code is released under:

GNU General Public License

If you think the Android project task-timer-legacy 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 com.gawdl3y.android.tasktimer.layout;
//from   w  w  w.  java 2s.c  o  m
import android.content.Context;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.Checkable;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gawdl3y.android.tasktimer.R;
import com.gawdl3y.android.tasktimer.TaskTimerApplication;
import com.gawdl3y.android.tasktimer.pojos.Group;
import com.gawdl3y.android.tasktimer.util.Log;

/**
 * The view for group list items
 * @author Schuyler Cebulskie
 */
public class GroupListItem extends LinearLayout implements Checkable {
    private static final String TAG = "GroupListItem";

    // Data
    private Group mGroup;
    private boolean mChecked = false;

    // Views
    private TextView mNameView, mTaskCountView;

    /**
     * Constructor
     * @param context The context that the view is in
     * @param attrs   The AttributeSet
     * @param group   The Group to display
     */
    public GroupListItem(Context context, AttributeSet attrs, Group group) {
        super(context, attrs);
        this.mGroup = group;
        LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        layoutInflater.inflate(R.layout.group_list_item, this);
        if(mNameView == null) onFinishInflate(); // onFinishInflate isn't ever being called by the LayoutInflater for some reason
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mNameView = (TextView) findViewById(R.id.group_name);
        mTaskCountView = (TextView) findViewById(R.id.group_task_count);
        mNameView.setText(mGroup.getName());
        mNameView.setTypeface(TaskTimerApplication.Typefaces.ROBOTO_LIGHT);
        Log.v(TAG, "Inflated");
    }

    @Override
    protected Parcelable onSaveInstanceState() {
        Bundle bundle = (Bundle) super.onSaveInstanceState();
        bundle.putParcelable("group", mGroup);
        return bundle;
    }

    @Override
    protected void onRestoreInstanceState(Parcelable state) {
        super.onRestoreInstanceState(state);
        mGroup = ((Bundle) state).getParcelable("group");
        invalidate();
    }

    @Override
    public void invalidate() {
        super.invalidate();
        mNameView.setText(mGroup.getName());
    }

    @Override
    public void setChecked(boolean checked) {
        this.mChecked = checked;
    }

    @Override
    public boolean isChecked() {
        return mChecked;
    }

    @Override
    public void toggle() {
        mChecked = !mChecked;
    }


    /**
     * Sets the Group
     * @param group The Group this list item is for
     */
    public void setGroup(Group group) {
        mGroup = group;
    }

    /**
     * Gets the Group
     * @return The Group this list item is for
     */
    public Group getGroup() {
        return mGroup;
    }
}




Java Source Code List

com.gawdl3y.android.actionablelistview.ActionItem.java
com.gawdl3y.android.actionablelistview.ActionableAdapter.java
com.gawdl3y.android.actionablelistview.ActionableListFragment.java
com.gawdl3y.android.actionablelistview.ActionableListView.java
com.gawdl3y.android.actionablelistview.Actionable.java
com.gawdl3y.android.actionablelistview.CheckableAdapter.java
com.gawdl3y.android.actionablelistview.CheckableListView.java
com.gawdl3y.android.actionablelistview.OnListItemCheckStateChangeListener.java
com.gawdl3y.android.tasktimer.TaskTimerApplication.java
com.gawdl3y.android.tasktimer.activities.MainActivity.java
com.gawdl3y.android.tasktimer.activities.SettingsActivity.java
com.gawdl3y.android.tasktimer.adapters.GroupListAdapter.java
com.gawdl3y.android.tasktimer.adapters.NewFragmentStatePagerAdapter.java
com.gawdl3y.android.tasktimer.adapters.TaskListAdapter.java
com.gawdl3y.android.tasktimer.adapters.TaskListFragmentAdapter.java
com.gawdl3y.android.tasktimer.data.TaskTimerDatabaseHelper.java
com.gawdl3y.android.tasktimer.data.TaskTimerProvider.java
com.gawdl3y.android.tasktimer.data.TaskTimerReceiver.java
com.gawdl3y.android.tasktimer.layout.GroupEditDialogFragment.java
com.gawdl3y.android.tasktimer.layout.GroupListItem.java
com.gawdl3y.android.tasktimer.layout.GroupsFragment.java
com.gawdl3y.android.tasktimer.layout.SettingsFragment.java
com.gawdl3y.android.tasktimer.layout.TaskEditDialogFragment.java
com.gawdl3y.android.tasktimer.layout.TaskListFragment.java
com.gawdl3y.android.tasktimer.layout.TaskListItem.java
com.gawdl3y.android.tasktimer.layout.TasksFragment.java
com.gawdl3y.android.tasktimer.pojos.Group.java
com.gawdl3y.android.tasktimer.pojos.TaskTimerEvents.java
com.gawdl3y.android.tasktimer.pojos.TaskTimerThread.java
com.gawdl3y.android.tasktimer.pojos.Task.java
com.gawdl3y.android.tasktimer.pojos.TimeAmount.java
com.gawdl3y.android.tasktimer.util.DialogPreference.java
com.gawdl3y.android.tasktimer.util.Log.java
com.gawdl3y.android.tasktimer.util.Utilities.java