~trb143/openlp/android_fixes

« back to all changes in this revision

Viewing changes to app/src/main/java/org/openlp/android2/fragments/ServiceListFragment.java

  • Committer: Tim Bentley
  • Date: 2016-10-21 19:24:55 UTC
  • Revision ID: tim.bentley@gmail.com-20161021192455-jrycump41cymbfjd
fix layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
        }
139
139
 
140
140
        // Keys used in Hashmap
141
 
        String[] from = {"icon", "title"};
 
141
        String[] from = {"line","icon", "title"};
142
142
 
143
143
        // Ids of views in service_list_fragment
144
 
        int[] to = {R.id.icon, R.id.serviceListText};
 
144
        int[] to = {R.id.servicelistLine, R.id.icon, R.id.serviceListText};
145
145
 
146
146
        SharedPreferences prefs = context.getSharedPreferences(
147
147
                context.getString(R.string.key_shared_preferences),
155
155
        // Instantiating an adapter to store each items
156
156
        ListAdapter adapter = new SimpleAdapter(getActivity().getBaseContext(), aList,
157
157
                R.layout.fragment_service_list, from, to) {
 
158
 
158
159
            public View getView(int position, View convertView, ViewGroup parent) {
 
160
 
159
161
                View view = super.getView(position, convertView, parent);
 
162
 
 
163
                TextView line = (TextView) view.findViewById(R.id.servicelistLine);
160
164
                TextView text1 = (TextView) view.findViewById(R.id.serviceListText);
161
165
                text1.setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
 
166
                Log.i(LOG_TAG, "bbb " + selected +" "+ position);
 
167
 
162
168
                if (selected == position) {
163
169
                    text1.setTextColor(Color.parseColor("#000000"));
164
170
                    text1.setTypeface(null, Typeface.BOLD_ITALIC);
165
171
                } else{
166
172
                    text1.setTypeface(null, Typeface.NORMAL);
 
173
                    line.setBackgroundColor(0xffffff);
167
174
                }
168
175
                return view;
169
176
            }
170
177
        };
 
178
 
171
179
        setListAdapter(adapter);
172
180
 
173
181
        SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);