Android Open Source - AppInspector Checkable Linear Layout






From Project

Back to project page AppInspector.

License

The source code is released under:

GNU General Public License

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

/*
 * Copyright (C) 2012  Projectoria Ltd./*w w  w  .  ja v a  2 s  . c o  m*/
 * This file is part of App Inspector.
 *
 * App Inspector is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Foobar is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */

package bg.projectoria.appinspector;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.LinearLayout;

public class CheckableLinearLayout extends LinearLayout implements Checkable {
    private boolean isChecked;
    private final ColorDrawable selected = new ColorDrawable(getResources().getColor(R.color.selected));

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

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

    @Override    
    public void setChecked(boolean checked) {
        isChecked = checked;
        setBackgroundDrawable(checked ? selected : null);
    }

    @Override
    public boolean isChecked() {
      return isChecked;
    }
    
  @Override
  public void toggle() {
    setChecked(!isChecked);
  }

}




Java Source Code List

bg.projectoria.appinspector.About.java
bg.projectoria.appinspector.AppDetailsFragment.java
bg.projectoria.appinspector.AppDetails.java
bg.projectoria.appinspector.AppsListFragment.java
bg.projectoria.appinspector.CheckableLinearLayout.java
bg.projectoria.appinspector.Main.java