diff --git a/res/layout/activity_new_goal.xml b/res/layout/activity_new_goal.xml
index 9cc079d..42ec06d 100644
--- a/res/layout/activity_new_goal.xml
+++ b/res/layout/activity_new_goal.xml
@@ -1,123 +1,20 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/res/layout/fragment_amount_input.xml b/res/layout/fragment_amount_input.xml
index ad4d790..743ffa6 100644
--- a/res/layout/fragment_amount_input.xml
+++ b/res/layout/fragment_amount_input.xml
@@ -31,6 +31,7 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/item_frequency.xml b/res/layout/item_frequency.xml
new file mode 100644
index 0000000..db2a0ec
--- /dev/null
+++ b/res/layout/item_frequency.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/res/layout/item_frequency_dropdown.xml b/res/layout/item_frequency_dropdown.xml
new file mode 100644
index 0000000..07a5a5c
--- /dev/null
+++ b/res/layout/item_frequency_dropdown.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 7c9b03f..f67563a 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -19,6 +19,10 @@
#80FFFFFF
@color/white
@color/darkgray
+
+
+ @color/white
+ @color/darkgray
#40000000
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8a3798b..949daa5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -78,7 +78,8 @@
Monthly
JUL 25
DUE IN 2 DAYS
- Vegas Trip
+ Vacation
+ Lunch
Logo
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e528dac..3eac325 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -67,7 +67,7 @@
- @color/white
-
+
+
+
+
+
+
+
+
diff --git a/src/org/missionassetfund/apps/android/activities/AddTransactionActivity.java b/src/org/missionassetfund/apps/android/activities/AddTransactionActivity.java
index 1ec7798..08e0257 100644
--- a/src/org/missionassetfund/apps/android/activities/AddTransactionActivity.java
+++ b/src/org/missionassetfund/apps/android/activities/AddTransactionActivity.java
@@ -31,6 +31,7 @@
import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;
import android.widget.ListView;
+import android.widget.RadioGroup;
import android.widget.Toast;
import com.parse.ParseException;
@@ -38,7 +39,7 @@
public class AddTransactionActivity extends FragmentActivity
implements OnInputFormListener, NameInputFragment.OnCreateViewListener,
- CategoryInputFragment.OnCreateViewListener {
+ CategoryInputFragment.OnCreateViewListener, AmountInputFragment.OnCreateViewListener {
private ListView lvSteps;
private ArrayList inputs;
@@ -63,11 +64,11 @@ protected void onCreate(Bundle savedInstanceState) {
// setup input steps
inputElements = new Input[] {
- new Input("Amount", 0, AmountInputFragment.class),
- new Input("Name", 1, NameInputFragment.class),
- new Input("Category", 2, CategoryInputFragment.class),
- new Input("Date", 3, DateInputFragment.class),
- new Input("Done", 4, DoneFragment.class)
+ new Input("Amount", "0", 0, AmountInputFragment.class),
+ new Input("Name", "Lunch", 1, NameInputFragment.class),
+ new Input("Category", "Food", 2, CategoryInputFragment.class),
+ new Input("Date", "Today", 3, DateInputFragment.class),
+ new Input("Done", "", 4, DoneFragment.class)
};
lvSteps.setAdapter(aInput);
@@ -112,6 +113,9 @@ private void showFragment(Class activeFragmentClass) {
Class klass = input.getFragmentClass();
Fragment fragment = mgr.findFragmentByTag(klass.getName());
if (klass == activeFragmentClass) {
+ // Change ActionBar title
+ setActionBarTitle(input);
+
if (fragment != null) {
transaction.show(fragment);
} else {
@@ -204,6 +208,15 @@ public void done(ParseException e) {
});
}
+ /**
+ * Set Action Bar title base on the step
+ *
+ * @param input
+ */
+ private void setActionBarTitle(Input input) {
+ setTitle(input.getName());
+ }
+
public void hideSoftKeyboard() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
@@ -231,10 +244,16 @@ public void setEditTextName(EditText editTextName) {
if (mTransactionName != null) {
editTextName.setText(mTransactionName);
}
+ editTextName.setHint(R.string.smaple_new_transaction_name);
}
@Override
public String getCategoryId() {
return mCategoryId == null ? null : mCategoryId;
}
+
+ @Override
+ public void setAmountCategoryVisibility(RadioGroup rgType) {
+ rgType.setVisibility(View.VISIBLE);
+ }
}
diff --git a/src/org/missionassetfund/apps/android/activities/NewGoalActivity.java b/src/org/missionassetfund/apps/android/activities/NewGoalActivity.java
index 25c2d37..5ae924b 100644
--- a/src/org/missionassetfund/apps/android/activities/NewGoalActivity.java
+++ b/src/org/missionassetfund/apps/android/activities/NewGoalActivity.java
@@ -1,106 +1,251 @@
package org.missionassetfund.apps.android.activities;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
-import java.util.Locale;
import org.missionassetfund.apps.android.R;
+import org.missionassetfund.apps.android.adapters.InputItemAdapter;
+import org.missionassetfund.apps.android.fragments.AmountInputFragment;
+import org.missionassetfund.apps.android.fragments.DateInputFragment;
+import org.missionassetfund.apps.android.fragments.DoneFragment;
+import org.missionassetfund.apps.android.fragments.FrequencyInputFragment;
+import org.missionassetfund.apps.android.fragments.NameInputFragment;
+import org.missionassetfund.apps.android.interfaces.OnInputFormListener;
import org.missionassetfund.apps.android.models.Goal;
import org.missionassetfund.apps.android.models.GoalPaymentInterval;
+import org.missionassetfund.apps.android.models.Input;
import org.missionassetfund.apps.android.models.User;
import org.missionassetfund.apps.android.utils.MAFDateUtils;
-import android.app.Activity;
+import android.app.ActionBar;
+import android.content.Context;
import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
import android.util.Log;
+import android.view.MenuItem;
import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;
-import android.widget.Spinner;
+import android.widget.ListView;
+import android.widget.RadioGroup;
import android.widget.Toast;
import com.parse.ParseException;
import com.parse.SaveCallback;
-public class NewGoalActivity extends Activity {
+public class NewGoalActivity extends FragmentActivity implements OnInputFormListener,
+ NameInputFragment.OnCreateViewListener, AmountInputFragment.OnCreateViewListener {
- private EditText etGoalName;
- private EditText etGoalAmount;
- private Spinner spinnerGoalFrequency;
- private EditText etGoalDate;
- private Button btnCreateGoal;
+ private ListView lvSteps;
+ private ArrayList inputs;
+ private InputItemAdapter aInput;
- private ArrayAdapter frequencyAdapter;
+ private Input[] inputElements;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_goal);
- frequencyAdapter = new ArrayAdapter(this,
- android.R.layout.simple_spinner_item, GoalPaymentInterval.values());
- frequencyAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ ActionBar actionBar = getActionBar();
+ actionBar.setDisplayHomeAsUpEnabled(true);
- setupViews();
- }
+ lvSteps = (ListView) findViewById(R.id.lvSteps);
- private void setupViews() {
- etGoalName = (EditText) findViewById(R.id.etNewGoalName);
- btnCreateGoal = (Button) findViewById(R.id.btnCreateGoal);
- etGoalAmount = (EditText) findViewById(R.id.etGoalAmount);
- spinnerGoalFrequency = (Spinner) findViewById(R.id.spinnerGoalFrequency);
- etGoalDate = (EditText) findViewById(R.id.etGoalDate);
+ inputs = new ArrayList();
+ aInput = new InputItemAdapter(this, inputs);
- spinnerGoalFrequency.setAdapter(frequencyAdapter);
+ // setup input steps
+ inputElements = new Input[] {
+ new Input("Amount", "0", 0, AmountInputFragment.class),
+ new Input("Name", "Travel Fund", 1, NameInputFragment.class),
+ new Input("Frequency", "Monthly", 2, FrequencyInputFragment.class),
+ new Input("Date", "Today", 3, DateInputFragment.class),
+ new Input("Add New Goal", "", 4, DoneFragment.class)
+ };
- btnCreateGoal.setOnClickListener(newGoalClickListener);
- }
+ lvSteps.setAdapter(aInput);
+
+ // setup listeners
+ lvSteps.setOnItemClickListener(new OnItemClickListener() {
- private OnClickListener newGoalClickListener = new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- Goal goal = new Goal();
- goal.setUser((User) User.getCurrentUser());
- goal.setName(etGoalName.getText().toString());
- Double amount = Double.parseDouble(etGoalAmount.getText().toString());
- goal.setAmount(amount);
- GoalPaymentInterval paymentInterval = (GoalPaymentInterval) spinnerGoalFrequency
- .getSelectedItem();
- goal.setPaymenyInterval(paymentInterval);
-
- // This will be replaced by date picker. Bear it for now.
- DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.US);
- // Default is 2 months after current date
- Date goalDate = MAFDateUtils.addDaysToDate(new Date(), 60);
- try {
- goalDate = dateFormat.parse(etGoalDate.getText().toString());
- } catch (java.text.ParseException e) {
- Log.e("error", getString(R.string.error_parse_date), e);
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ Input input = inputs.get(position);
+ int size = inputs.size();
+ for (int i = (size - 1); i >= position; i--) {
+ inputs.remove(i);
+ }
+ aInput.notifyDataSetChanged();
+ showFragment(input.getFragmentClass());
}
- goal.setGoalDate(goalDate);
+ });
- int numDaysToTargetDate = MAFDateUtils.getDaysTo(goalDate);
- Integer numPayments = numDaysToTargetDate / paymentInterval.toInt();
- goal.setNumPayments(numPayments);
+ showFragment(AmountInputFragment.class);
+ }
- goal.setPaymentAmount(amount / numPayments);
+ @Override
+ @SuppressWarnings("rawtypes")
+ public void OnNextSelected(Class activeFragmentClass, String value) {
+ @SuppressWarnings("unchecked")
+ Input input = inputElements[getInputPosition(activeFragmentClass)];
+ input.setValue(value);
+ inputs.add(input);
+ aInput.notifyDataSetChanged();
+ hideSoftKeyboard();
+ showFragment(getNextFragmentClass(input));
+ }
- goal.saveInBackground(new SaveCallback() {
+ @Override
+ @SuppressWarnings("rawtypes")
+ public void OnBackSelected(Class activeFragmentClass) {
+ @SuppressWarnings("unchecked")
+ Input input = inputElements[getInputPosition(activeFragmentClass)];
+ inputs.remove(input.getPos() - 1);
+ aInput.notifyDataSetChanged();
+ showFragment(getPreviousFragmentClass(input));
+ }
- @Override
- public void done(ParseException arg0) {
- Toast.makeText(getApplicationContext(),
- getString(R.string.toast_done_saving_goal), Toast.LENGTH_SHORT).show();
+ @Override
+ public void OnFinishSelected() {
+ FragmentManager mgr = getSupportFragmentManager();
+
+ // Get Amount data from fragment
+ AmountInputFragment amountFragment = (AmountInputFragment) mgr
+ .findFragmentByTag(AmountInputFragment.class.getName());
+ Double goalAmount = Double.parseDouble(amountFragment.getAmountSelected());
+
+ // Get Name data from fragment
+ NameInputFragment nameFragment = (NameInputFragment) mgr
+ .findFragmentByTag(NameInputFragment.class.getName());
+ String goalName = nameFragment.getNameSelected();
+
+ // Get Frequency selected from fragment
+ FrequencyInputFragment frequencyFragment = (FrequencyInputFragment) mgr
+ .findFragmentByTag(FrequencyInputFragment.class.getName());
+ GoalPaymentInterval paymentInterval = (GoalPaymentInterval) frequencyFragment
+ .getFrequencySelected();
+
+ // Get Date from fragment
+ DateInputFragment dateFragment = (DateInputFragment) mgr
+ .findFragmentByTag(DateInputFragment.class.getName());
+ Date goalDate = dateFragment.getDateSelected();
+
+ // Get Number of Payments
+ int numDaysToTargetDate = MAFDateUtils.getDaysTo(goalDate);
+ Integer numPayments = numDaysToTargetDate / paymentInterval.toInt();
+
+ // TODO(jose): Data validation
+ Goal goal = new Goal();
+ goal.setUser((User) User.getCurrentUser());
+ goal.setAmount(goalAmount);
+ goal.setName(goalName);
+ goal.setPaymenyInterval(paymentInterval);
+ goal.setNumPayments(numPayments);
+ goal.setPaymentAmount(goalAmount / numPayments);
+ goal.setGoalDate(goalDate);
+
+ goal.saveInBackground(new SaveCallback() {
+
+ @Override
+ public void done(ParseException e) {
+ if (e != null) {
+ Toast.makeText(getApplication(), getString(R.string.parse_error_saving),
+ Toast.LENGTH_LONG).show();
+ Log.d("DEBUG", e.getMessage());
+ } else {
setResult(RESULT_OK);
finish();
}
+ }
+ });
+ }
- });
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ // Respond to the action bar's Up/Home button
+ case android.R.id.home:
+ finish();
+ return true;
}
- };
+ return super.onOptionsItemSelected(item);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private void showFragment(Class activeFragmentClass) {
+ FragmentManager mgr = getSupportFragmentManager();
+ FragmentTransaction transaction = mgr.beginTransaction();
+ try {
+ for (Input input : inputElements) {
+ Class klass = input.getFragmentClass();
+ Fragment fragment = mgr.findFragmentByTag(klass.getName());
+ if (klass == activeFragmentClass) {
+
+ setActionBarTitle(input);
+
+ if (fragment != null) {
+ transaction.show(fragment);
+ } else {
+ transaction.add(R.id.flStepsContainer, (Fragment) klass.newInstance(),
+ klass.getName());
+ }
+ } else {
+ if (fragment != null) {
+ transaction.hide(fragment);
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ transaction.commit();
+ }
+
+ /**
+ * Set Action Bar title base on the step
+ *
+ * @param input
+ */
+ private void setActionBarTitle(Input input) {
+ setTitle(input.getName());
+ }
+
+ public void hideSoftKeyboard() {
+ InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
+ }
+
+ private int getInputPosition(Class extends Fragment> fragmentClass) {
+ for (Input i : inputElements) {
+ if (i.getFragmentClass() == fragmentClass) {
+ return i.getPos();
+ }
+ }
+ return 0;
+ }
+
+ private Class> getNextFragmentClass(Input input) {
+ return inputElements[input.getPos() + 1].getFragmentClass();
+ }
+
+ private Class> getPreviousFragmentClass(Input input) {
+ return inputElements[input.getPos() - 1].getFragmentClass();
+ }
+
+ @Override
+ public void setEditTextName(EditText editTextName) {
+ editTextName.setHint(R.string.sample_new_goal_name);
+ }
+
+ @Override
+ public void setAmountCategoryVisibility(RadioGroup rgType) {
+ rgType.setVisibility(View.INVISIBLE);
+ }
}
diff --git a/src/org/missionassetfund/apps/android/adapters/FrequencyAdapter.java b/src/org/missionassetfund/apps/android/adapters/FrequencyAdapter.java
new file mode 100644
index 0000000..6db5572
--- /dev/null
+++ b/src/org/missionassetfund/apps/android/adapters/FrequencyAdapter.java
@@ -0,0 +1,50 @@
+
+package org.missionassetfund.apps.android.adapters;
+
+import org.missionassetfund.apps.android.R;
+import org.missionassetfund.apps.android.models.GoalPaymentInterval;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.SpinnerAdapter;
+import android.widget.TextView;
+
+public class FrequencyAdapter extends ArrayAdapter implements SpinnerAdapter {
+
+ public FrequencyAdapter(Context context, GoalPaymentInterval[] paymentIntervals) {
+ super(context, R.layout.item_frequency, paymentIntervals);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ GoalPaymentInterval paymentInterval = getItem(position);
+
+ if (convertView == null) {
+ convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_frequency,
+ parent, false);
+ }
+ TextView tvFrequency = (TextView) convertView.findViewById(R.id.tvFrequency);
+
+ tvFrequency.setText(paymentInterval.toString());
+
+ return convertView;
+ }
+
+ @Override
+ public View getDropDownView(int position, View convertView, ViewGroup parent) {
+ GoalPaymentInterval paymentInterval = getItem(position);
+
+ if (convertView == null) {
+ LayoutInflater inflator = LayoutInflater.from(getContext());
+ convertView = inflator.inflate(R.layout.item_frequency_dropdown, parent, false);
+ }
+
+ TextView tvFrequency = (TextView) convertView.findViewById(R.id.tvFrequency);
+ tvFrequency.setText(paymentInterval.toString());
+
+ return convertView;
+ }
+}
diff --git a/src/org/missionassetfund/apps/android/fragments/AmountInputFragment.java b/src/org/missionassetfund/apps/android/fragments/AmountInputFragment.java
index 491f09e..96fae9f 100644
--- a/src/org/missionassetfund/apps/android/fragments/AmountInputFragment.java
+++ b/src/org/missionassetfund/apps/android/fragments/AmountInputFragment.java
@@ -15,15 +15,22 @@
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RadioButton;
+import android.widget.RadioGroup;
import android.widget.Toast;
public class AmountInputFragment extends Fragment {
private OnInputFormListener listener;
+ private OnCreateViewListener onCreateViewListener;
private EditText etAmount;
private RadioButton rbExpense;
private ImageButton btnNext;
+ private RadioGroup rgType;
+
+ public interface OnCreateViewListener {
+ public void setAmountCategoryVisibility(RadioGroup rgType);
+ }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -33,6 +40,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
etAmount = (EditText) view.findViewById(R.id.etAmount);
rbExpense = (RadioButton) view.findViewById(R.id.rbExpense);
btnNext = (ImageButton) view.findViewById(R.id.btnNext);
+ rgType = (RadioGroup) view.findViewById(R.id.rgType);
// Setup listener
btnNext.setOnClickListener(new OnClickListener() {
@@ -52,6 +60,8 @@ public void onClick(View v) {
}
});
+ onCreateViewListener.setAmountCategoryVisibility(rgType);
+
return view;
}
@@ -62,7 +72,11 @@ public void onAttach(Activity activity) {
listener = (OnInputFormListener) activity;
} else {
throw new ClassCastException(activity.toString()
- + " must implement OnNextSelectedListener");
+ + " must implement OnInputFormListener");
+ }
+
+ if (activity instanceof OnCreateViewListener) {
+ onCreateViewListener = (OnCreateViewListener) activity;
}
}
diff --git a/src/org/missionassetfund/apps/android/fragments/FrequencyInputFragment.java b/src/org/missionassetfund/apps/android/fragments/FrequencyInputFragment.java
new file mode 100644
index 0000000..bd7f5c6
--- /dev/null
+++ b/src/org/missionassetfund/apps/android/fragments/FrequencyInputFragment.java
@@ -0,0 +1,87 @@
+
+package org.missionassetfund.apps.android.fragments;
+
+import org.missionassetfund.apps.android.R;
+import org.missionassetfund.apps.android.adapters.FrequencyAdapter;
+import org.missionassetfund.apps.android.interfaces.OnInputFormListener;
+import org.missionassetfund.apps.android.models.GoalPaymentInterval;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.ImageButton;
+import android.widget.Spinner;
+import android.widget.Toast;
+
+public class FrequencyInputFragment extends Fragment {
+ private OnInputFormListener onInputFormListener;
+
+ private Spinner spFrequency;
+ private ImageButton btnBack;
+ private ImageButton btnNext;
+
+ private FrequencyAdapter frequencyAdapter;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.fragment_frequency_input, container, false);
+
+ // Setup view
+ spFrequency = (Spinner) view.findViewById(R.id.spFrequency);
+ btnBack = (ImageButton) view.findViewById(R.id.btnBack);
+ btnNext = (ImageButton) view.findViewById(R.id.btnNext);
+
+ // Populate spinner
+ frequencyAdapter = new FrequencyAdapter(getActivity(), GoalPaymentInterval.values());
+
+ spFrequency.setAdapter(frequencyAdapter);
+
+ // Setup listener
+ btnNext.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ // TODO(jose): Have next button disable until spFrequency has
+ // value
+ if (spFrequency.getSelectedItem() != null) {
+ GoalPaymentInterval frequency = (GoalPaymentInterval) spFrequency
+ .getSelectedItem();
+ onInputFormListener.OnNextSelected(FrequencyInputFragment.class,
+ frequency.toString());
+ } else {
+ Toast.makeText(getActivity(), getString(R.string.error_category_require),
+ Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
+
+ btnBack.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ onInputFormListener.OnBackSelected(FrequencyInputFragment.class);
+ }
+ });
+
+ return view;
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ if (activity instanceof OnInputFormListener) {
+ onInputFormListener = (OnInputFormListener) activity;
+ } else {
+ throw new ClassCastException(activity.toString()
+ + " must implement OnInputFormListener");
+ }
+ }
+
+ public GoalPaymentInterval getFrequencySelected() {
+ return (GoalPaymentInterval) spFrequency.getSelectedItem();
+ }
+}
diff --git a/src/org/missionassetfund/apps/android/fragments/NameInputFragment.java b/src/org/missionassetfund/apps/android/fragments/NameInputFragment.java
index 568208b..da465f6 100644
--- a/src/org/missionassetfund/apps/android/fragments/NameInputFragment.java
+++ b/src/org/missionassetfund/apps/android/fragments/NameInputFragment.java
@@ -23,7 +23,7 @@ public class NameInputFragment extends Fragment {
private EditText etName;
private ImageButton btnBack;
private ImageButton btnNext;
-
+
public interface OnCreateViewListener {
public void setEditTextName(EditText editTextName);
}
@@ -60,7 +60,7 @@ public void onClick(View v) {
onInputFormListener.OnBackSelected(NameInputFragment.class);
}
});
-
+
onCreateViewListener.setEditTextName(etName);
return view;
@@ -75,7 +75,7 @@ public void onAttach(Activity activity) {
throw new ClassCastException(activity.toString()
+ " must implement OnInputFormListener");
}
-
+
if (activity instanceof OnCreateViewListener) {
onCreateViewListener = (OnCreateViewListener) activity;
}
diff --git a/src/org/missionassetfund/apps/android/models/Input.java b/src/org/missionassetfund/apps/android/models/Input.java
index 31cea5f..83a03dc 100644
--- a/src/org/missionassetfund/apps/android/models/Input.java
+++ b/src/org/missionassetfund/apps/android/models/Input.java
@@ -1,15 +1,23 @@
package org.missionassetfund.apps.android.models;
-public class Input {
+import java.io.Serializable;
+
+public class Input implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final String INPUT_KEY = "input";
+
private String name;
private String value;
+ private String hint;
private int pos;
- private Class fragmentClass;
+ private Class> fragmentClass;
- public Input(String name, int pos, Class fragmentClass) {
+ public Input(String name, String hint, int pos, Class> fragmentClass) {
super();
this.name = name;
+ this.hint = hint;
this.pos = pos;
this.fragmentClass = fragmentClass;
}
@@ -30,6 +38,14 @@ public void setValue(String value) {
this.value = value;
}
+ public String getHint() {
+ return hint;
+ }
+
+ public void setHint(String hint) {
+ this.hint = hint;
+ }
+
public int getPos() {
return pos;
}
@@ -38,11 +54,11 @@ public void setPos(int pos) {
this.pos = pos;
}
- public Class getFragmentClass() {
+ public Class> getFragmentClass() {
return fragmentClass;
}
- public void setFragmentClass(Class fragmentClass) {
+ public void setFragmentClass(Class> fragmentClass) {
this.fragmentClass = fragmentClass;
}
}