Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added filelist setting to agenda.

  • Loading branch information...
commit 046ff297d6d6072f33183c49a30749c56af424f8 1 parent 02c7626
@hdweiss hdweiss authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 src/com/matburt/mobileorg/Gui/Agenda/AgendaEntrySetting.java
View
35 src/com/matburt/mobileorg/Gui/Agenda/AgendaEntrySetting.java
@@ -6,11 +6,13 @@
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.EditText;
+import android.widget.LinearLayout;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.matburt.mobileorg.R;
+import com.matburt.mobileorg.OrgData.OrgProviderUtils;
public class AgendaEntrySetting extends SherlockActivity {
public static final String AGENDA_NUMBER = "agenda_number";
@@ -25,7 +27,9 @@
private EditText priorityView;
private EditText tagsView;
private CheckBox filterHabitsView;
+
private CheckBox activeTodosView;
+ private LinearLayout fileListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -44,6 +48,8 @@ protected void onCreate(Bundle savedInstanceState) {
this.agendaPos = getIntent().getIntExtra(AGENDA_NUMBER, -1);
this.entryPos = getIntent().getIntExtra(ENTRY_NUMBER, -1);
+ this.fileListView = (LinearLayout) findViewById(R.id.agenda_entry_files);
+
setupSettings(OrgAgenda.getAgendaEntry(agendaPos, entryPos, this));
}
@@ -55,6 +61,8 @@ public void setupSettings(OrgQueryBuilder agenda) {
tagsView.setText(combineToString(agenda.tags));
filterHabitsView.setChecked(agenda.filterHabits);
activeTodosView.setChecked(agenda.activeTodos);
+
+ setupFileList(agenda);
}
public OrgQueryBuilder getQueryFromSettings() {
@@ -67,6 +75,8 @@ public OrgQueryBuilder getQueryFromSettings() {
agenda.filterHabits = filterHabitsView.isChecked();
agenda.activeTodos = activeTodosView.isChecked();
+ agenda.files = getFileList();
+
return agenda;
}
@@ -91,6 +101,31 @@ private String combineToString(ArrayList<String> list) {
String[] split = string.split(":");
return new ArrayList<String>(Arrays.asList(split));
}
+
+ private void setupFileList(OrgQueryBuilder agenda) {
+ ArrayList<String> filenames = OrgProviderUtils
+ .getFilenames(getContentResolver());
+ for (String filename : filenames) {
+ CheckBox checkBox = new CheckBox(this);
+ checkBox.setText(filename);
+ checkBox.setChecked(agenda.files.contains(filename));
+
+ fileListView.addView(checkBox);
+ }
+ }
+
+ private ArrayList<String> getFileList() {
+ ArrayList<String> files = new ArrayList<String>();
+
+ int fileSize = fileListView.getChildCount();
+ for (int i = 0; i < fileSize; i++) {
+ CheckBox checkBox = (CheckBox) fileListView.getChildAt(i);
+ if (checkBox.isChecked())
+ files.add(checkBox.getText().toString());
+ }
+
+ return files;
+ }
@Override
Please sign in to comment.
Something went wrong with that request. Please try again.