Android Open Source - smsAndCallFilter Checkable Linear Layout






From Project

Back to project page smsAndCallFilter.

License

The source code is released under:

/* * Author: Hasib Al Muhaimin. * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the L...

If you think the Android project smsAndCallFilter 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

/*
 * Author: Hasib Al Muhaimin./* w  w  w.  j a v a  2  s. c  o m*/
 * 
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * ***courtesy to Jelle Geerts***
 * Author: Jelle Geerts

 * Usage of the works is permitted provided that this instrument is
 * retained with the works, so that any entity that uses the works is
 * notified of this instrument.
 *
 * DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
*/

package com.sadakhata.smsandcallfilter;

import com.sadakhata.smsandcallfilter.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.LinearLayout;
import android.widget.TextView;

public class CheckableLinearLayout extends LinearLayout implements Checkable
{
    private Checkable mCheckable;

    public CheckableLinearLayout(Context context)
    {
        super(context);
    }

    public CheckableLinearLayout(Context context, AttributeSet attrs)
    {
        super(context, attrs);
    }

    public static CheckableLinearLayout build(Context context, int id, String title, String summary)
    {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        CheckableLinearLayout v = (CheckableLinearLayout) inflater.inflate(R.layout.checkable_list_item_2, null);
        v.setId(id);
        TextView textView;
        textView = (TextView) v.findViewById(android.R.id.title);
        textView.setText(title);
        textView = (TextView) v.findViewById(android.R.id.summary);
        textView.setText(summary);
        return v;
    }

    public boolean isChecked()
    {
        return mCheckable.isChecked();
    }

    public void setChecked(boolean isChecked)
    {
        mCheckable.setChecked(isChecked);
    }

    public void toggle()
    {
        mCheckable.toggle();
    }

    @Override
    protected void onFinishInflate()
    {
        super.onFinishInflate();

        findCheckableView(this);
    }

    private boolean findCheckableView(ViewGroup vg)
    {
        for (int i = 0; i < vg.getChildCount(); ++i)
        {
            View child = vg.getChildAt(i);
            if (child instanceof ViewGroup)
            {
                if (findCheckableView((ViewGroup) child))
                    return true;
            }
            if (child instanceof Checkable)
            {
                mCheckable = (Checkable) child;
                return true;
            }
        }
        return false;
    }
}




Java Source Code List

com.sadakhata.banglatoenglishrupantor.Rupantor.java
com.sadakhata.ml.NeuralNetwork.java
com.sadakhata.ml.NeuronLayer.java
com.sadakhata.ml.Neuron.java
com.sadakhata.ml.SKNeuralNetwork.java
com.sadakhata.smsandcallfilter.About.java
com.sadakhata.smsandcallfilter.C.java
com.sadakhata.smsandcallfilter.CheckableLinearLayout.java
com.sadakhata.smsandcallfilter.FilterForm.java
com.sadakhata.smsandcallfilter.FilterList.java
com.sadakhata.smsandcallfilter.Filter.java
com.sadakhata.smsandcallfilter.MessageList.java
com.sadakhata.smsandcallfilter.MessageViewer.java
com.sadakhata.smsandcallfilter.Message.java
com.sadakhata.smsandcallfilter.Notifier.java
com.sadakhata.smsandcallfilter.SMSReceiver.java
com.sadakhata.smsandcallfilter.Settings.java
com.sadakhata.smsandcallfilter.SimpleListItem2.java
com.sadakhata.smsandcallfilter.TimeFormatter.java
com.sadakhata.smsandcallfilter.UI.java
com.sadakhata.smsandcallfilter.ViewsAdapter.java
com.sadakhata.smsandcallfilter.callReceiver.java
com.sadakhata.spamsmsblocker.SKSpamBlocker.java