Eric Kok
11 years ago
24 changed files with 86 additions and 205 deletions
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- File created by the Android Action Bar Style Generator |
||||
|
||||
Copyright (C) 2011 The Android Open Source Project |
||||
Copyright (C) 2012 readyState Software Ltd |
||||
|
||||
Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
Unless required by applicable law or agreed to in writing, software |
||||
distributed under the License is distributed on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
See the License for the specific language governing permissions and |
||||
limitations under the License. |
||||
--> |
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:exitFadeDuration="@android:integer/config_mediumAnimTime" > |
||||
<item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/list_focused_transdroid" /> |
||||
<item android:state_pressed="true" android:drawable="@drawable/pressed_background_transdroid" /> |
||||
<item android:state_activated="true" android:drawable="@drawable/list_focused_transdroid" /> |
||||
<item android:drawable="@android:color/transparent" /> |
||||
</selector> |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- File created by the Android Action Bar Style Generator |
||||
|
||||
Copyright (C) 2011 The Android Open Source Project |
||||
Copyright (C) 2012 readyState Software Ltd |
||||
|
||||
Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
Unless required by applicable law or agreed to in writing, software |
||||
distributed under the License is distributed on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
See the License for the specific language governing permissions and |
||||
limitations under the License. |
||||
--> |
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:exitFadeDuration="@android:integer/config_mediumAnimTime" > |
||||
<item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/list_focused_transdroid2" /> |
||||
<item android:state_pressed="true" android:drawable="@drawable/pressed_background_transdroid2" /> |
||||
<item android:state_activated="true" android:drawable="@drawable/list_focused_transdroid2" /> |
||||
<item android:drawable="@android:color/transparent" /> |
||||
</selector> |
@ -1,105 +0,0 @@
@@ -1,105 +0,0 @@
|
||||
/* |
||||
* Public Domain |
||||
* CheckableRelativeLayout.java by marvinlabs |
||||
* http://www.marvinlabs.com/2010/10/29/custom-listview-ability-check-items/
|
||||
*/ |
||||
package fr.marvinlabs.widget; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import android.content.Context; |
||||
import android.util.AttributeSet; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.Checkable; |
||||
import android.widget.RelativeLayout; |
||||
|
||||
/** |
||||
* Extension of a relative layout to provide a checkable behaviour |
||||
* |
||||
* @author marvinlabs |
||||
*/ |
||||
public class CheckableRelativeLayout extends RelativeLayout implements Checkable { |
||||
|
||||
private boolean isChecked; |
||||
private List<Checkable> checkableViews; |
||||
|
||||
public CheckableRelativeLayout(Context context, AttributeSet attrs, int defStyle) { |
||||
super(context, attrs, defStyle); |
||||
initialise(attrs); |
||||
} |
||||
|
||||
public CheckableRelativeLayout(Context context, AttributeSet attrs) { |
||||
super(context, attrs); |
||||
initialise(attrs); |
||||
} |
||||
|
||||
public CheckableRelativeLayout(Context context) { |
||||
super(context); |
||||
initialise(null); |
||||
} |
||||
|
||||
/* |
||||
* @see android.widget.Checkable#isChecked() |
||||
*/ |
||||
public boolean isChecked() { |
||||
return isChecked; |
||||
} |
||||
|
||||
/* |
||||
* @see android.widget.Checkable#setChecked(boolean) |
||||
*/ |
||||
public void setChecked(boolean isChecked) { |
||||
this.isChecked = isChecked; |
||||
for (Checkable c : checkableViews) { |
||||
c.setChecked(isChecked); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
* @see android.widget.Checkable#toggle() |
||||
*/ |
||||
public void toggle() { |
||||
this.isChecked = !this.isChecked; |
||||
for (Checkable c : checkableViews) { |
||||
c.toggle(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void onFinishInflate() { |
||||
super.onFinishInflate(); |
||||
|
||||
final int childCount = this.getChildCount(); |
||||
for (int i = 0; i < childCount; ++i) { |
||||
findCheckableChildren(this.getChildAt(i)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Read the custom XML attributes |
||||
*/ |
||||
private void initialise(AttributeSet attrs) { |
||||
this.isChecked = false; |
||||
this.checkableViews = new ArrayList<Checkable>(5); |
||||
} |
||||
|
||||
/** |
||||
* Add to our checkable list all the children of the view that implement the |
||||
* interface Checkable |
||||
*/ |
||||
private void findCheckableChildren(View v) { |
||||
if (v instanceof Checkable) { |
||||
this.checkableViews.add((Checkable) v); |
||||
} |
||||
|
||||
if (v instanceof ViewGroup) { |
||||
final ViewGroup vg = (ViewGroup) v; |
||||
final int childCount = vg.getChildCount(); |
||||
for (int i = 0; i < childCount; ++i) { |
||||
findCheckableChildren(vg.getChildAt(i)); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,75 +0,0 @@
@@ -1,75 +0,0 @@
|
||||
/* |
||||
* Public Domain |
||||
* InertCheckBox.java by marvinlabs |
||||
* http://www.marvinlabs.com/2010/10/29/custom-listview-ability-check-items/
|
||||
*/ |
||||
package fr.marvinlabs.widget; |
||||
|
||||
import android.content.Context; |
||||
import android.util.AttributeSet; |
||||
import android.view.KeyEvent; |
||||
import android.view.MotionEvent; |
||||
import android.widget.CheckBox; |
||||
|
||||
/** |
||||
* CheckBox that does not react to any user event in order to let the container handle them. |
||||
*/ |
||||
public class InertCheckBox extends CheckBox { |
||||
|
||||
// Provide the same constructors as the superclass
|
||||
public InertCheckBox(Context context, AttributeSet attrs, int defStyle) { |
||||
super(context, attrs, defStyle); |
||||
} |
||||
|
||||
// Provide the same constructors as the superclass
|
||||
public InertCheckBox(Context context, AttributeSet attrs) { |
||||
super(context, attrs); |
||||
} |
||||
|
||||
// Provide the same constructors as the superclass
|
||||
public InertCheckBox(Context context) { |
||||
super(context); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onTouchEvent(MotionEvent event) { |
||||
// Make the checkbox not respond to any user event
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onKeyDown(int keyCode, KeyEvent event) { |
||||
// Make the checkbox not respond to any user event
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { |
||||
// Make the checkbox not respond to any user event
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onKeyPreIme(int keyCode, KeyEvent event) { |
||||
// Make the checkbox not respond to any user event
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onKeyShortcut(int keyCode, KeyEvent event) { |
||||
// Make the checkbox not respond to any user event
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onKeyUp(int keyCode, KeyEvent event) { |
||||
// Make the checkbox not respond to any user event
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onTrackballEvent(MotionEvent event) { |
||||
// Make the checkbox not respond to any user event
|
||||
return false; |
||||
} |
||||
} |
Loading…
Reference in new issue