Android Open Source - DVBViewerController Timer Adapter






From Project

Back to project page DVBViewerController.

License

The source code is released under:

Apache License

If you think the Android project DVBViewerController 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 de.bennir.DVBViewerController.timers;
//from  w  w w  .  j a  va 2s.c om
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import de.bennir.DVBViewerController.DVBViewerControllerActivity;
import de.bennir.DVBViewerController.R;

public class TimerAdapter extends ArrayAdapter<DVBTimer> {
    private static final String TAG = TimerAdapter.class.toString();

    static class TimerViewHolder {
        TextView name;
        ImageView indicator;
        TextView date;
        TextView time;
        TextView channel;
    }

    private Context mContext;
    private List<DVBTimer> timers;

    public TimerAdapter(List<DVBTimer> timers, Context context) {
        super(context, R.layout.timers_list_item, timers);
        this.mContext = context;
        this.timers = timers;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        TimerViewHolder viewHolder;

        if (view == null) {
            view = inflater.inflate(R.layout.timers_list_item, parent, false);

            viewHolder = new TimerViewHolder();
            viewHolder.name = (TextView) view.findViewById(R.id.timer_list_item_name);
            viewHolder.indicator = (ImageView) view.findViewById(R.id.timer_list_item_indicator);
            viewHolder.date = (TextView) view.findViewById(R.id.timer_list_item_date);
            viewHolder.time = (TextView) view.findViewById(R.id.timer_list_item_time);
            viewHolder.channel = (TextView) view.findViewById(R.id.timer_list_item_channel);

            view.setTag(viewHolder);
        } else {
            viewHolder = (TimerViewHolder) view.getTag();
        }


        DVBTimer timer = timers.get(position);

        viewHolder.name.setTypeface(DVBViewerControllerActivity.robotoLight);
        viewHolder.name.setText(timer.name);

        Drawable img;
        if (timer.enabled)
            img = mContext.getResources().getDrawable(R.drawable.indicator_enabled);
        else
            img = mContext.getResources().getDrawable(R.drawable.indicator_disabled);
        img.setBounds(0, 2, 30, 30);
        viewHolder.indicator.setImageDrawable(img);

        viewHolder.date.setTypeface(DVBViewerControllerActivity.robotoLight);
        viewHolder.date.setText(timer.date);

        viewHolder.time.setTypeface(DVBViewerControllerActivity.robotoLight);
        viewHolder.time.setText(timer.start.split(":")[0] +
                ":" + timer.start.split(":")[1] +
                " - " + timer.end.split(":")[0] +
                ":" + timer.end.split(":")[1]);

        String channelId = timer.channelId;
        viewHolder.channel.setTypeface(DVBViewerControllerActivity.robotoLight);
        viewHolder.channel.setText(channelId.substring(channelId.indexOf('|') + 1));

        return view;
    }

    @Override
    public int getCount() {
        return timers.size();
    }

    @Override
    public DVBTimer getItem(int position) {
        return timers.get(position);
    }

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




Java Source Code List

com.android.datetimepicker.AccessibleLinearLayout.java
com.android.datetimepicker.AccessibleTextView.java
com.android.datetimepicker.Utils.java
com.android.datetimepicker.date.AccessibleDateAnimator.java
com.android.datetimepicker.date.DatePickerController.java
com.android.datetimepicker.date.DatePickerDialog.java
com.android.datetimepicker.date.DayPickerView.java
com.android.datetimepicker.date.SimpleMonthAdapter.java
com.android.datetimepicker.date.SimpleMonthView.java
com.android.datetimepicker.date.TextViewWithCircularIndicator.java
com.android.datetimepicker.date.YearPickerView.java
com.android.datetimepicker.time.AmPmCirclesView.java
com.android.datetimepicker.time.CircleView.java
com.android.datetimepicker.time.RadialPickerLayout.java
com.android.datetimepicker.time.RadialSelectorView.java
com.android.datetimepicker.time.RadialTextsView.java
com.android.datetimepicker.time.TimePickerDialog.java
com.googlecode.eyesfree.utils.TouchExplorationHelper.java
de.bennir.DVBViewerController.ChannelFragment.java
de.bennir.DVBViewerController.ChannelGroupFragment.java
de.bennir.DVBViewerController.DVBViewerControllerActivity.java
de.bennir.DVBViewerController.DeviceSelectionActivity.java
de.bennir.DVBViewerController.EPGFragment.java
de.bennir.DVBViewerController.RemoteFragment.java
de.bennir.DVBViewerController.SettingsFragment.java
de.bennir.DVBViewerController.TimerFragment.java
de.bennir.DVBViewerController.TimerWizardActivity.java
de.bennir.DVBViewerController.TimerWizardModel.java
de.bennir.DVBViewerController.channels.ChanGroupAdapter.java
de.bennir.DVBViewerController.channels.DVBChannelAdapter.java
de.bennir.DVBViewerController.channels.DVBChannel.java
de.bennir.DVBViewerController.epg.EPGInfoAdapter.java
de.bennir.DVBViewerController.epg.EPGInfo.java
de.bennir.DVBViewerController.service.DVBServer.java
de.bennir.DVBViewerController.service.DVBService.java
de.bennir.DVBViewerController.timers.DVBTimer.java
de.bennir.DVBViewerController.timers.TimerAdapter.java
de.bennir.DVBViewerController.util.DateUtils.java
de.bennir.DVBViewerController.util.ThreadExecutor.java
de.bennir.DVBViewerController.view.QuickReturnListView.java
de.bennir.DVBViewerController.wizard.model.AbstractWizardModel.java
de.bennir.DVBViewerController.wizard.model.BranchPage.java
de.bennir.DVBViewerController.wizard.model.ModelCallbacks.java
de.bennir.DVBViewerController.wizard.model.MultipleFixedChoicePage.java
de.bennir.DVBViewerController.wizard.model.PageList.java
de.bennir.DVBViewerController.wizard.model.PageTreeNode.java
de.bennir.DVBViewerController.wizard.model.Page.java
de.bennir.DVBViewerController.wizard.model.ReviewItem.java
de.bennir.DVBViewerController.wizard.model.SingleFixedChoicePage.java
de.bennir.DVBViewerController.wizard.model.TimerDatePage.java
de.bennir.DVBViewerController.wizard.model.TimerInfoPage.java
de.bennir.DVBViewerController.wizard.ui.MultipleChoiceFragment.java
de.bennir.DVBViewerController.wizard.ui.PageFragmentCallbacks.java
de.bennir.DVBViewerController.wizard.ui.ReviewFragment.java
de.bennir.DVBViewerController.wizard.ui.SingleChoiceFragment.java
de.bennir.DVBViewerController.wizard.ui.StepPagerStrip.java
de.bennir.DVBViewerController.wizard.ui.TimerDateFragment.java
de.bennir.DVBViewerController.wizard.ui.TimerInfoFragment.java