Eric Kok
11 years ago
167 changed files with 2873 additions and 234 deletions
@ -1,5 +1,21 @@
@@ -1,5 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
Copyright 2010-2013 Eric Kok et al. |
||||
|
||||
Transdroid 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. |
||||
|
||||
Transdroid 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 Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||
--> |
||||
<resources> |
||||
<!-- Used to determine if a device is 'small', i.e. a phone; for reference: a Nexus 7's smallest width is 533dip --> |
||||
<bool name="show_dialog_fullscreen">false</bool> |
||||
</resources> |
||||
</resources> |
||||
|
@ -1,5 +1,21 @@
@@ -1,5 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
Copyright 2010-2013 Eric Kok et al. |
||||
|
||||
Transdroid 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. |
||||
|
||||
Transdroid 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 Transdroid. If not, see <http://www.gnu.org/licenses/>. |
||||
--> |
||||
<resources> |
||||
<!-- Used to determine if a device is 'small', i.e. a phone; for reference: a Nexus 7's smallest width is 533dip --> |
||||
<bool name="show_dialog_fullscreen">true</bool> |
||||
</resources> |
||||
</resources> |
||||
|
@ -1,100 +1,105 @@
@@ -1,100 +1,105 @@
|
||||
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)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
/* |
||||
* 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,70 +1,75 @@
@@ -1,70 +1,75 @@
|
||||
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; |
||||
} |
||||
} |
||||
/* |
||||
* 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; |
||||
} |
||||
} |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue