diff options
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java | 63 |
1 files changed, 4 insertions, 59 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java index 462324db..f6a2d822 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java @@ -11,13 +11,9 @@ import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListAdapter; -import android.widget.RelativeLayout; import android.widget.TextView; - -import com.zeapo.pwdstore.dummy.DummyContent; - -import java.util.List; +import java.util.ArrayList; /** * A fragment representing a list of Items. @@ -25,8 +21,6 @@ import java.util.List; * Large screen devices (such as tablets) are supported by replacing the ListView * with a GridView. * <p /> - * Activities containing this fragment MUST implement the {@link Callbacks} - * interface. */ public class PasswordFragment extends Fragment implements AbsListView.OnItemClickListener { @@ -43,31 +37,17 @@ public class PasswordFragment extends Fragment implements AbsListView.OnItemClic */ private ListAdapter mAdapter; - // TODO: Rename and change types of parameters - public static PasswordFragment newInstance(String param1, String param2) { - PasswordFragment fragment = new PasswordFragment(); - Bundle args = new Bundle(); - fragment.setArguments(args); - return fragment; - } - /** * Mandatory empty constructor for the fragment manager to instantiate the * fragment (e.g. upon screen orientation changes). */ - public PasswordFragment() { - } + public PasswordFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (getArguments() != null) { - } - String[] values = new String[] { "NOT", "YET", "IMPLEMENTED" }; - - // TODO: Change Adapter to display your content - mAdapter = new MySimpleArrayAdapter(getActivity(), values); + mAdapter = new PasswordAdapter(getActivity(), new ArrayList<String>()); } @Override @@ -76,7 +56,7 @@ public class PasswordFragment extends Fragment implements AbsListView.OnItemClic View view = inflater.inflate(R.layout.fragment_password, container, false); // Set the adapter - mListView = (AbsListView) view.findViewById(android.R.id.list); + mListView = (AbsListView) view.findViewById(R.id.pass_list); ((AdapterView<ListAdapter>) mListView).setAdapter(mAdapter); // Set OnItemClickListener so we can be notified on item clicks @@ -112,44 +92,9 @@ public class PasswordFragment extends Fragment implements AbsListView.OnItemClic } } - /** - * The default content for this Fragment has a TextView that is shown when - * the list is empty. If you would like to change the text, call this method - * to supply the text it should use. - */ - public void setEmptyText(CharSequence emptyText) { - View emptyView = mListView.getEmptyView(); - - if (emptyText instanceof TextView) { - ((TextView) emptyView).setText(emptyText); - } - } - public interface OnFragmentInteractionListener { // TODO: Update argument type and name public void onFragmentInteraction(String id); } - - public class MySimpleArrayAdapter extends ArrayAdapter<String> { - private final Context context; - private final String[] values; - - public MySimpleArrayAdapter(Context context, String[] values) { - super(context, R.layout.password_row_layout, values); - this.context = context; - this.values = values; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - LayoutInflater inflater = (LayoutInflater) context - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View rowView = inflater.inflate(R.layout.password_row_layout, parent, false); - TextView textView = (TextView) rowView.findViewById(R.id.label); - textView.setText(values[position]); - - return rowView; - } - } } |
