Skip to content

Commit

Permalink
Full project code formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
federicoiosue committed Jul 25, 2020
1 parent 0784c41 commit be2988e
Show file tree
Hide file tree
Showing 40 changed files with 2,041 additions and 2,031 deletions.
72 changes: 36 additions & 36 deletions checklistview/src/androidTest/java/ViewGroupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,52 @@
@SmallTest
public class ViewGroupTest extends InstrumentationTestCase {

private Context context;
private CheckListView checkListView;
private CheckListViewItem checkListViewItem;
private Context context;
private CheckListView checkListView;
private CheckListViewItem checkListViewItem;


@Before
protected void setUp() {
context = getInstrumentation().getContext();
checkListView = new CheckListView(context);
checkListViewItem = new CheckListViewItem(context, false, false);
}
@Before
protected void setUp () {
context = getInstrumentation().getContext();
checkListView = new CheckListView(context);
checkListViewItem = new CheckListViewItem(context, false, false);
}


@Test
public void testChildAddRemoval() {
checkListView.addView(checkListViewItem);
assertTrue(checkListView.indexOfChild(checkListViewItem) >= 0);
assertTrue(checkListViewItem.getParent().equals(checkListView));
@Test
public void testChildAddRemoval () {
checkListView.addView(checkListViewItem);
assertTrue(checkListView.indexOfChild(checkListViewItem) >= 0);
assertTrue(checkListViewItem.getParent().equals(checkListView));

checkListView.removeView(checkListViewItem);
assertFalse(checkListView.indexOfChild(checkListViewItem) >= 0);
assertFalse(checkListView.equals(checkListViewItem.getParent()));
assertTrue(checkListViewItem.getParent() == null);
}
checkListView.removeView(checkListViewItem);
assertFalse(checkListView.indexOfChild(checkListViewItem) >= 0);
assertFalse(checkListView.equals(checkListViewItem.getParent()));
assertTrue(checkListViewItem.getParent() == null);
}


@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Test
public void testChildMovementlWithLayoutTransition() {
checkListView.setLayoutTransition(new LayoutTransition());
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Test
public void testChildMovementlWithLayoutTransition () {
checkListView.setLayoutTransition(new LayoutTransition());

CheckListViewItem checkListViewItem1 = new CheckListViewItem(context, false, false);
checkListView.addView(checkListViewItem);
checkListView.addView(checkListViewItem1);
assertTrue(checkListView.indexOfChild(checkListViewItem) == 0);
assertTrue(checkListView.indexOfChild(checkListViewItem1) == 1);
assertTrue(checkListViewItem.getParent().equals(checkListView));
assertTrue(checkListViewItem1.getParent().equals(checkListView));
CheckListViewItem checkListViewItem1 = new CheckListViewItem(context, false, false);
checkListView.addView(checkListViewItem);
checkListView.addView(checkListViewItem1);
assertTrue(checkListView.indexOfChild(checkListViewItem) == 0);
assertTrue(checkListView.indexOfChild(checkListViewItem1) == 1);
assertTrue(checkListViewItem.getParent().equals(checkListView));
assertTrue(checkListViewItem1.getParent().equals(checkListView));

ChecklistViewItemOnDragListener checklistViewOnTouchListener = new ChecklistViewItemOnDragListener();
checkListView.setOnDragListener(checklistViewOnTouchListener);
checklistViewOnTouchListener.moveView(checkListViewItem, checkListViewItem1);
assertTrue(checkListView.indexOfChild(checkListViewItem) == 1);
assertTrue(checkListView.indexOfChild(checkListViewItem1) == 0);
ChecklistViewItemOnDragListener checklistViewOnTouchListener = new ChecklistViewItemOnDragListener();
checkListView.setOnDragListener(checklistViewOnTouchListener);
checklistViewOnTouchListener.moveView(checkListViewItem, checkListViewItem1);
assertTrue(checkListView.indexOfChild(checkListViewItem) == 1);
assertTrue(checkListView.indexOfChild(checkListViewItem1) == 0);


}
}

}
4 changes: 2 additions & 2 deletions checklistview/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="it.feio.android.checklistview" >
package="it.feio.android.checklistview">

<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.VIBRATE" />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

public class App extends Application {

private static Settings settings;
private static Settings settings;


public static Settings getSettings() {
if (settings == null) {
settings = new Settings();
}
return settings;
}
public static Settings getSettings () {
if (settings == null) {
settings = new Settings();
}
return settings;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,128 +4,128 @@

public class Settings {

/**
* Checked items behavior: hold on place.
*/
public static final int CHECKED_HOLD = 0;
/**
* Checked items behavior: move on bottom of list.
*/
public static final int CHECKED_ON_BOTTOM = 1;
/**
* Checked items behavior: move on bottom of unchecked but on top of checked.
*/
public static final int CHECKED_ON_TOP_OF_CHECKED = 2;
/**
* Checked items behavior: hold on place.
*/
public static final int CHECKED_HOLD = 0;
/**
* Checked items behavior: move on bottom of list.
*/
public static final int CHECKED_ON_BOTTOM = 1;
/**
* Checked items behavior: move on bottom of unchecked but on top of checked.
*/
public static final int CHECKED_ON_TOP_OF_CHECKED = 2;

private String linesSeparator = Constants.LINES_SEPARATOR;
private boolean showDeleteIcon = Constants.SHOW_DELETE_ICON;
private boolean keepChecked = Constants.KEEP_CHECKED;
private boolean showChecks = Constants.SHOW_CHECKS;
private boolean showHintItem = Constants.SHOW_HINT_ITEM;
private String newEntryHint = "";
private int moveCheckedOnBottom = CHECKED_HOLD;
private boolean dragEnabled = Constants.DRAG_ENABLED;
private boolean dragVibrationEnabled = Constants.DRAG_VIBRATION_ENABLED;
private int dragVibrationDuration = Constants.DRAG_VIBRATION_DURATION;
private String linesSeparator = Constants.LINES_SEPARATOR;
private boolean showDeleteIcon = Constants.SHOW_DELETE_ICON;
private boolean keepChecked = Constants.KEEP_CHECKED;
private boolean showChecks = Constants.SHOW_CHECKS;
private boolean showHintItem = Constants.SHOW_HINT_ITEM;
private String newEntryHint = "";
private int moveCheckedOnBottom = CHECKED_HOLD;
private boolean dragEnabled = Constants.DRAG_ENABLED;
private boolean dragVibrationEnabled = Constants.DRAG_VIBRATION_ENABLED;
private int dragVibrationDuration = Constants.DRAG_VIBRATION_DURATION;


public String getLinesSeparator() {
return linesSeparator;
}
public String getLinesSeparator () {
return linesSeparator;
}


public void setLinesSeparator(String linesSeparator) {
this.linesSeparator = linesSeparator;
}
public void setLinesSeparator (String linesSeparator) {
this.linesSeparator = linesSeparator;
}


public boolean getShowDeleteIcon() {
return showDeleteIcon;
}
public boolean getShowDeleteIcon () {
return showDeleteIcon;
}


public void setShowDeleteIcon(boolean showDeleteIcon) {
this.showDeleteIcon = showDeleteIcon;
}
public void setShowDeleteIcon (boolean showDeleteIcon) {
this.showDeleteIcon = showDeleteIcon;
}


public boolean getKeepChecked() {
return keepChecked;
}
public boolean getKeepChecked () {
return keepChecked;
}


public void setKeepChecked(boolean keepChecked) {
this.keepChecked = keepChecked;
}
public void setKeepChecked (boolean keepChecked) {
this.keepChecked = keepChecked;
}


public boolean getShowChecks() {
return showChecks;
}
public boolean getShowChecks () {
return showChecks;
}


public void setShowChecks(boolean showChecks) {
this.showChecks = showChecks;
}
public void setShowChecks (boolean showChecks) {
this.showChecks = showChecks;
}


public boolean getShowHintItem() {
return showHintItem;
}
public boolean getShowHintItem () {
return showHintItem;
}


public void setShowHintItem(boolean showHintItem) {
this.showHintItem = showHintItem;
}
public void setShowHintItem (boolean showHintItem) {
this.showHintItem = showHintItem;
}


public String getNewEntryHint() {
return newEntryHint;
}
public String getNewEntryHint () {
return newEntryHint;
}


public void setNewEntryHint(String newEntryHint) {
this.newEntryHint = newEntryHint;
}
public void setNewEntryHint (String newEntryHint) {
this.newEntryHint = newEntryHint;
}


public int getMoveCheckedOnBottom() {
return moveCheckedOnBottom;
}
public int getMoveCheckedOnBottom () {
return moveCheckedOnBottom;
}


public void setMoveCheckedOnBottom(int moveCheckedOnBottom) {
this.moveCheckedOnBottom = moveCheckedOnBottom;
}
public void setMoveCheckedOnBottom (int moveCheckedOnBottom) {
this.moveCheckedOnBottom = moveCheckedOnBottom;
}


public boolean getDragEnabled() {
return dragEnabled;
}
public boolean getDragEnabled () {
return dragEnabled;
}


public void setDragEnabled(boolean dragEnabled) {
this.dragEnabled = dragEnabled;
}
public void setDragEnabled (boolean dragEnabled) {
this.dragEnabled = dragEnabled;
}


public boolean getDragVibrationEnabled() {
return dragVibrationEnabled;
}
public boolean getDragVibrationEnabled () {
return dragVibrationEnabled;
}


public void setDragVibrationEnabled(boolean dragVibrationEnabled) {
this.dragVibrationEnabled = dragVibrationEnabled;
}
public void setDragVibrationEnabled (boolean dragVibrationEnabled) {
this.dragVibrationEnabled = dragVibrationEnabled;
}


public int getDragVibrationDuration() {
return dragVibrationDuration;
}
public int getDragVibrationDuration () {
return dragVibrationDuration;
}


public void setDragVibrationDuration(int dragVibrationDuration) {
this.dragVibrationDuration = dragVibrationDuration;
}
public void setDragVibrationDuration (int dragVibrationDuration) {
this.dragVibrationDuration = dragVibrationDuration;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
class ChecklistViewDragShadowBuilder extends DragShadowBuilder {


ChecklistViewDragShadowBuilder(View view) {
super(view);
}
ChecklistViewDragShadowBuilder (View view) {
super(view);
}


public void onProvideShadowMetrics(Point size, Point touch) {
int width = getView().getWidth();
int height = getView().getHeight();
size.set(width, height);
touch.set(10, 20);
}
public void onProvideShadowMetrics (Point size, Point touch) {
int width = getView().getWidth();
int height = getView().getHeight();
size.set(width, height);
touch.set(10, 20);
}

}
Loading

0 comments on commit be2988e

Please sign in to comment.