Eric Kok
11 years ago
167 changed files with 2873 additions and 234 deletions
@ -1,5 +1,21 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?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> |
<resources> |
||||||
<!-- Used to determine if a device is 'small', i.e. a phone; for reference: a Nexus 7's smallest width is 533dip --> |
<!-- 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> |
<bool name="show_dialog_fullscreen">false</bool> |
||||||
</resources> |
</resources> |
||||||
|
@ -1,5 +1,21 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?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> |
<resources> |
||||||
<!-- Used to determine if a device is 'small', i.e. a phone; for reference: a Nexus 7's smallest width is 533dip --> |
<!-- 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> |
<bool name="show_dialog_fullscreen">true</bool> |
||||||
</resources> |
</resources> |
||||||
|
@ -1,100 +1,105 @@ |
|||||||
package fr.marvinlabs.widget; |
/* |
||||||
|
* Public Domain |
||||||
import java.util.ArrayList; |
* CheckableRelativeLayout.java by marvinlabs |
||||||
import java.util.List; |
* http://www.marvinlabs.com/2010/10/29/custom-listview-ability-check-items/
|
||||||
|
*/ |
||||||
import android.content.Context; |
package fr.marvinlabs.widget; |
||||||
import android.util.AttributeSet; |
|
||||||
import android.view.View; |
import java.util.ArrayList; |
||||||
import android.view.ViewGroup; |
import java.util.List; |
||||||
import android.widget.Checkable; |
|
||||||
import android.widget.RelativeLayout; |
import android.content.Context; |
||||||
|
import android.util.AttributeSet; |
||||||
/** |
import android.view.View; |
||||||
* Extension of a relative layout to provide a checkable behaviour |
import android.view.ViewGroup; |
||||||
* |
import android.widget.Checkable; |
||||||
* @author marvinlabs |
import android.widget.RelativeLayout; |
||||||
*/ |
|
||||||
public class CheckableRelativeLayout extends RelativeLayout implements Checkable { |
/** |
||||||
|
* Extension of a relative layout to provide a checkable behaviour |
||||||
private boolean isChecked; |
* |
||||||
private List<Checkable> checkableViews; |
* @author marvinlabs |
||||||
|
*/ |
||||||
public CheckableRelativeLayout(Context context, AttributeSet attrs, int defStyle) { |
public class CheckableRelativeLayout extends RelativeLayout implements Checkable { |
||||||
super(context, attrs, defStyle); |
|
||||||
initialise(attrs); |
private boolean isChecked; |
||||||
} |
private List<Checkable> checkableViews; |
||||||
|
|
||||||
public CheckableRelativeLayout(Context context, AttributeSet attrs) { |
public CheckableRelativeLayout(Context context, AttributeSet attrs, int defStyle) { |
||||||
super(context, attrs); |
super(context, attrs, defStyle); |
||||||
initialise(attrs); |
initialise(attrs); |
||||||
} |
} |
||||||
|
|
||||||
public CheckableRelativeLayout(Context context) { |
public CheckableRelativeLayout(Context context, AttributeSet attrs) { |
||||||
super(context); |
super(context, attrs); |
||||||
initialise(null); |
initialise(attrs); |
||||||
} |
} |
||||||
|
|
||||||
/* |
public CheckableRelativeLayout(Context context) { |
||||||
* @see android.widget.Checkable#isChecked() |
super(context); |
||||||
*/ |
initialise(null); |
||||||
public boolean isChecked() { |
} |
||||||
return isChecked; |
|
||||||
} |
/* |
||||||
|
* @see android.widget.Checkable#isChecked() |
||||||
/* |
*/ |
||||||
* @see android.widget.Checkable#setChecked(boolean) |
public boolean isChecked() { |
||||||
*/ |
return isChecked; |
||||||
public void setChecked(boolean isChecked) { |
} |
||||||
this.isChecked = isChecked; |
|
||||||
for (Checkable c : checkableViews) { |
/* |
||||||
c.setChecked(isChecked); |
* @see android.widget.Checkable#setChecked(boolean) |
||||||
} |
*/ |
||||||
} |
public void setChecked(boolean isChecked) { |
||||||
|
this.isChecked = isChecked; |
||||||
/* |
for (Checkable c : checkableViews) { |
||||||
* @see android.widget.Checkable#toggle() |
c.setChecked(isChecked); |
||||||
*/ |
} |
||||||
public void toggle() { |
} |
||||||
this.isChecked = !this.isChecked; |
|
||||||
for (Checkable c : checkableViews) { |
/* |
||||||
c.toggle(); |
* @see android.widget.Checkable#toggle() |
||||||
} |
*/ |
||||||
} |
public void toggle() { |
||||||
|
this.isChecked = !this.isChecked; |
||||||
@Override |
for (Checkable c : checkableViews) { |
||||||
protected void onFinishInflate() { |
c.toggle(); |
||||||
super.onFinishInflate(); |
} |
||||||
|
} |
||||||
final int childCount = this.getChildCount(); |
|
||||||
for (int i = 0; i < childCount; ++i) { |
@Override |
||||||
findCheckableChildren(this.getChildAt(i)); |
protected void onFinishInflate() { |
||||||
} |
super.onFinishInflate(); |
||||||
} |
|
||||||
|
final int childCount = this.getChildCount(); |
||||||
/** |
for (int i = 0; i < childCount; ++i) { |
||||||
* Read the custom XML attributes |
findCheckableChildren(this.getChildAt(i)); |
||||||
*/ |
} |
||||||
private void initialise(AttributeSet attrs) { |
} |
||||||
this.isChecked = false; |
|
||||||
this.checkableViews = new ArrayList<Checkable>(5); |
/** |
||||||
} |
* Read the custom XML attributes |
||||||
|
*/ |
||||||
/** |
private void initialise(AttributeSet attrs) { |
||||||
* Add to our checkable list all the children of the view that implement the |
this.isChecked = false; |
||||||
* interface Checkable |
this.checkableViews = new ArrayList<Checkable>(5); |
||||||
*/ |
} |
||||||
private void findCheckableChildren(View v) { |
|
||||||
if (v instanceof Checkable) { |
/** |
||||||
this.checkableViews.add((Checkable) v); |
* Add to our checkable list all the children of the view that implement the |
||||||
} |
* interface Checkable |
||||||
|
*/ |
||||||
if (v instanceof ViewGroup) { |
private void findCheckableChildren(View v) { |
||||||
final ViewGroup vg = (ViewGroup) v; |
if (v instanceof Checkable) { |
||||||
final int childCount = vg.getChildCount(); |
this.checkableViews.add((Checkable) v); |
||||||
for (int i = 0; i < childCount; ++i) { |
} |
||||||
findCheckableChildren(vg.getChildAt(i)); |
|
||||||
} |
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 @@ |
|||||||
package fr.marvinlabs.widget; |
/* |
||||||
|
* Public Domain |
||||||
import android.content.Context; |
* InertCheckBox.java by marvinlabs |
||||||
import android.util.AttributeSet; |
* http://www.marvinlabs.com/2010/10/29/custom-listview-ability-check-items/
|
||||||
import android.view.KeyEvent; |
*/ |
||||||
import android.view.MotionEvent; |
package fr.marvinlabs.widget; |
||||||
import android.widget.CheckBox; |
|
||||||
|
import android.content.Context; |
||||||
/** |
import android.util.AttributeSet; |
||||||
* CheckBox that does not react to any user event in order to let the container handle them. |
import android.view.KeyEvent; |
||||||
*/ |
import android.view.MotionEvent; |
||||||
public class InertCheckBox extends CheckBox { |
import android.widget.CheckBox; |
||||||
|
|
||||||
// Provide the same constructors as the superclass
|
/** |
||||||
public InertCheckBox(Context context, AttributeSet attrs, int defStyle) { |
* CheckBox that does not react to any user event in order to let the container handle them. |
||||||
super(context, attrs, defStyle); |
*/ |
||||||
} |
public class InertCheckBox extends CheckBox { |
||||||
|
|
||||||
// Provide the same constructors as the superclass
|
// Provide the same constructors as the superclass
|
||||||
public InertCheckBox(Context context, AttributeSet attrs) { |
public InertCheckBox(Context context, AttributeSet attrs, int defStyle) { |
||||||
super(context, attrs); |
super(context, attrs, defStyle); |
||||||
} |
} |
||||||
|
|
||||||
// Provide the same constructors as the superclass
|
// Provide the same constructors as the superclass
|
||||||
public InertCheckBox(Context context) { |
public InertCheckBox(Context context, AttributeSet attrs) { |
||||||
super(context); |
super(context, attrs); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
// Provide the same constructors as the superclass
|
||||||
public boolean onTouchEvent(MotionEvent event) { |
public InertCheckBox(Context context) { |
||||||
// Make the checkbox not respond to any user event
|
super(context); |
||||||
return false; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public boolean onTouchEvent(MotionEvent event) { |
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) { |
// Make the checkbox not respond to any user event
|
||||||
// Make the checkbox not respond to any user event
|
return false; |
||||||
return false; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public boolean onKeyDown(int keyCode, KeyEvent event) { |
||||||
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { |
// Make the checkbox not respond to any user event
|
||||||
// Make the checkbox not respond to any user event
|
return false; |
||||||
return false; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { |
||||||
public boolean onKeyPreIme(int keyCode, KeyEvent event) { |
// Make the checkbox not respond to any user event
|
||||||
// Make the checkbox not respond to any user event
|
return false; |
||||||
return false; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public boolean onKeyPreIme(int keyCode, KeyEvent event) { |
||||||
public boolean onKeyShortcut(int keyCode, KeyEvent event) { |
// Make the checkbox not respond to any user event
|
||||||
// Make the checkbox not respond to any user event
|
return false; |
||||||
return false; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public boolean onKeyShortcut(int keyCode, KeyEvent event) { |
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) { |
// Make the checkbox not respond to any user event
|
||||||
// Make the checkbox not respond to any user event
|
return false; |
||||||
return false; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
@Override |
public boolean onKeyUp(int keyCode, KeyEvent event) { |
||||||
public boolean onTrackballEvent(MotionEvent event) { |
// Make the checkbox not respond to any user event
|
||||||
// Make the checkbox not respond to any user event
|
return false; |
||||||
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