|
|
@@ -72,23 +72,46 @@ public class CustomizeFieldsActivity extends Activity implements
|
|
|
public boolean dragListViewCanMoveItem(DragListView dragListView, int from, int to) {
|
|
|
|
|
|
int hidePosition = adapter.getPosition(mHideField);
|
|
|
- // hide -> display && displayCount >= maxDisplayCount
|
|
|
- if (from > hidePosition && to < hidePosition && hidePosition > maxDisplayCount) {
|
|
|
+ if(forNewResult)
|
|
|
+ {
|
|
|
+ if (from > hidePosition && to <= hidePosition && hidePosition > maxDisplayCount) {
|
|
|
+
|
|
|
+ new AlertDialog.Builder(this)
|
|
|
+ .setTitle("Warning")
|
|
|
+ .setMessage("the maximums count of display items is " + maxDisplayCount)
|
|
|
+ .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .show();
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (from < hidePosition && to >= hidePosition && hidePosition <3) {
|
|
|
|
|
|
- new AlertDialog.Builder(this)
|
|
|
- .setTitle("Warning")
|
|
|
- .setMessage("the maximums count of display items is " + maxDisplayCount)
|
|
|
- .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
+ new AlertDialog.Builder(this)
|
|
|
+ .setTitle("Warning")
|
|
|
+ .setMessage("You must set at least 1 field visiable! ")
|
|
|
+ .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
- .show();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .show();
|
|
|
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ // hide -> display && displayCount >= maxDisplayCount
|
|
|
+
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -131,10 +154,10 @@ public class CustomizeFieldsActivity extends Activity implements
|
|
|
|
|
|
DragListView dragListView = (DragListView) findViewById(R.id.drag_list);
|
|
|
|
|
|
- if (forNewResult) {
|
|
|
+// if (forNewResult) {
|
|
|
|
|
|
dragListView.setDelegate(this);
|
|
|
- }
|
|
|
+// }
|
|
|
|
|
|
adapter = new DragListAdapter(this, list);
|
|
|
dragListView.setAdapter(adapter);
|
|
|
@@ -230,18 +253,20 @@ public class CustomizeFieldsActivity extends Activity implements
|
|
|
// {
|
|
|
// navList.add("Aѡ��" + i);
|
|
|
// }
|
|
|
-// if (forNewResult) {
|
|
|
-// mDisplayField = new fieldedit("Additional Fields To Display", -1);
|
|
|
-// } else {
|
|
|
-// mDisplayField = new fieldedit(getString(R.string.str_displayitem), -1);
|
|
|
-// }
|
|
|
+ if (forNewResult) {
|
|
|
+ mDisplayField= new JSONObject("{\"name\":\""+getString(R.string.str_display_addational)+"\",\"id\":-1}");
|
|
|
+ mHideField = new JSONObject("{\"name\":\""+getString(R.string.str_hide_addational)+"\",\"id\":-2}");
|
|
|
+ } else {
|
|
|
+ mDisplayField= new JSONObject("{\"name\":\""+getString(R.string.str_displayitem)+"\",\"id\":-1}");
|
|
|
+ mHideField = new JSONObject("{\"name\":\""+getString(R.string.str_hideitem)+"\",\"id\":-2}");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
- mDisplayField= new JSONObject("{\"name\":\"Additional Fields To Display\",\"id\":-1}");
|
|
|
list.add(mDisplayField);
|
|
|
list.addAll(showList);
|
|
|
- mHideField = new JSONObject("{\"name\":\"Additional Fields\",\"id\":-2}");
|
|
|
+
|
|
|
list.add(mHideField);
|
|
|
list.addAll(hideList);
|
|
|
} catch (Exception e)
|