Android Open Source - GameTimer Abstract Remove Item Adapter






From Project

Back to project page GameTimer.

License

The source code is released under:

Apache License

If you think the Android project GameTimer 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.solidnw.gametimer.adapter;
/*w  ww.j  av  a2s.  c om*/
import java.util.ArrayList;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.TextView;

import com.solidnw.gametimer.R;

public abstract class AbstractRemoveItemAdapter extends BaseAdapter implements OnClickListener{
  protected int mTheme;
    protected ArrayList<String> mContent;
    protected Context mContext;

    public AbstractRemoveItemAdapter(Context context, ArrayList<String> objects, int theme)
    {
        mTheme = theme;
        mContent = objects;
        mContext = context;
    }

    public View getCustomView(int position, View convertView, ViewGroup parent)
    {
        View row;
        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) mContext
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            row = inflater.inflate(R.layout.list_item_remove, parent, false);
        }
        else {
            row = convertView;
        }

        ImageButton btn = (ImageButton) row.findViewById(R.id.removeitem_button_remove);
        TextView name = (TextView) row.findViewById(R.id.removeitem_textview_content);
        
        btn.setOnClickListener(this);
        name.setText(this.getItem(position));

        if (mTheme == android.R.style.Theme_Holo)
        {
            btn.setImageResource(R.drawable.delete_light);
            name.setTextColor(Color.WHITE);
        }

        return row;
    }

    public int getCount()
    {
        return mContent.size();
    }

    public String getItem(int position)
    {
        return mContent.get(position);
    }

    public long getItemId(int position)
    {
        return position;
    }

    public View getDropDownView(int position, View convertView, ViewGroup parent)
    {
        return getCustomView(position, convertView, parent);
    }

    public View getView(int position, View convertView, ViewGroup parent)
    {
        return getCustomView(position, convertView, parent);
    }

    public void updateContent(ArrayList<String> objects)
    {
      mContent.clear();      
        mContent.addAll(objects);
        
        this.notifyDataSetChanged();
    }
}




Java Source Code List

com.solidnw.gametimer.activities.GameActivity.java
com.solidnw.gametimer.activities.GroupActivity.java
com.solidnw.gametimer.activities.GroupManagementActivity.java
com.solidnw.gametimer.activities.MainActivity.java
com.solidnw.gametimer.activities.PlayerActivity.java
com.solidnw.gametimer.activities.PlayerManagementActivity.java
com.solidnw.gametimer.adapter.AbstractRemoveItemAdapter.java
com.solidnw.gametimer.adapter.ColorAdapter.java
com.solidnw.gametimer.adapter.DrawerListAdapter.java
com.solidnw.gametimer.adapter.GameModePagerAdapter.java
com.solidnw.gametimer.adapter.GroupAdapter.java
com.solidnw.gametimer.adapter.RemoveGroupListAdapter.java
com.solidnw.gametimer.adapter.RemoveMemberListAdapter.java
com.solidnw.gametimer.adapter.RemovePlayerListAdapter.java
com.solidnw.gametimer.database.DatabaseHelper.java
com.solidnw.gametimer.database.DatabaseLayer.java
com.solidnw.gametimer.fragments.GameFragment.java
com.solidnw.gametimer.fragments.GameModeFragment.java
com.solidnw.gametimer.fragments.GameModePagerFragment.java
com.solidnw.gametimer.fragments.GroupFragment.java
com.solidnw.gametimer.fragments.GroupManagementFragment.java
com.solidnw.gametimer.fragments.PlayerFragment.java
com.solidnw.gametimer.fragments.PlayerManagementFragment.java
com.solidnw.gametimer.listener.DrawerItemClickListener.java
com.solidnw.gametimer.model.DrawerConstants.java
com.solidnw.gametimer.model.GameModeConstants.java
com.solidnw.gametimer.model.GradientHelper.java
com.solidnw.gametimer.model.Gradient.java
com.solidnw.gametimer.model.Group.java
com.solidnw.gametimer.model.IntentConstants.java
com.solidnw.gametimer.model.Player.java
com.solidnw.gametimer.model.PreferencesConstants.java
com.solidnw.gametimer.model.Time.java