Skip to content

Commit

Permalink
Fix: Colors are set for the wrong calendar #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalfree committed Apr 30, 2015
1 parent 98e6fc3 commit 312e85e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId 'ch.ihdg.calendarcolor'
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName '0.1'
versionCode 2
versionName '0.2'
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;

import java.util.Vector;
import java.util.HashMap;


public class CalendarListActivity extends ListActivity implements LoaderManager.LoaderCallbacks<Cursor> {

SimpleCursorAdapter mAdapter;

Vector<Integer> calIds = new Vector<Integer>();
HashMap<Integer, Integer> calIds = new HashMap<Integer, Integer>();

static final String[] CALENDAR_PROJECTION = new String[] {
CalendarContract.Calendars._ID, // 0
Expand Down Expand Up @@ -95,7 +95,7 @@ public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
return true;
}
else if (CalendarContract.Calendars._ID.equals(name)) {
calIds.add(cursor.getPosition(), cursor.getInt(columnIndex));
calIds.put(cursor.getPosition(), cursor.getInt(columnIndex));
return true;
}
return false;
Expand Down Expand Up @@ -135,7 +135,7 @@ public void onListItemClick(ListView l, View v, int position, long id) {
// open color picker
int color = ((ColorDrawable) v.findViewById(R.id.color).getBackground()).getColor();
String name = ((TextView) v.findViewById(R.id.displayname)).getText().toString();
int cal_id = calIds.elementAt( position );
int cal_id = calIds.get(position);

Intent intent = new Intent(this, ColorPickerActivity.class);

Expand Down

0 comments on commit 312e85e

Please sign in to comment.