Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Crashlytics issues feb 2014 #10

Merged
merged 5 commits into from

2 participants

@richsage
Owner

This PR fixes some Crashlytics issues from February 2014 - all based around the DataHelper class. Passing an explicit context when requesting the DataHelper will now automatically create a valid instance if required.

@Tocacar
Owner

Merging.

@Tocacar Tocacar merged commit bbe85f0 into joindin:master
@richsage richsage deleted the richsage:crashlytics-issues-feb-2014 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 25, 2014
  1. @richsage

    Add DataHelper helper methods.

    richsage authored
    This allows getting an instance by passing a context as well.
  2. @richsage

    Fix EventTalks to pass a context when getting the DataHelper.

    richsage authored
    Fixes Crashlytics issue #28.
  3. @richsage

    Fix TalkComments to pass a context when getting the DataHelper.

    richsage authored
    Fixes Crashlytics issue #26.
  4. @richsage

    Fix EventDetail to pass a context when getting the DataHelper.

    richsage authored
    Fixes Crashlytics issue #29.
  5. @richsage
This page is out of date. Refresh to see the latest.
View
12 source/src/in/joind/DataHelper.java
@@ -44,7 +44,9 @@ private DataHelper(Context context) {
}
public static DataHelper createInstance(Context context) {
- if (DHinstance == null) DHinstance = new DataHelper(context);
+ if (DHinstance == null) {
+ reinitialise(context);
+ }
return DHinstance;
}
@@ -54,6 +56,14 @@ public static DataHelper getInstance() {
return DHinstance;
}
+ public static DataHelper getInstance(Context context) {
+ return createInstance(context);
+ }
+
+ public static void reinitialise(Context context) {
+ DHinstance = new DataHelper(context);
+ }
+
// Updates a event
public long updateEvent(int eventRowID, JSONObject event) {
ContentValues values = new ContentValues();
View
4 source/src/in/joind/EventComments.java
@@ -119,7 +119,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
// Display all event comments in the event listview/adapter
public int displayEventComments (int event_id) {
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(this);
m_eventCommentAdapter.clear();
int count = dh.populateEventComments(event_id, m_eventCommentAdapter);
@@ -150,7 +150,7 @@ public void run() {
JSONObject metaObj = new JSONObject();
JIRest rest = new JIRest (EventComments.this);
boolean isFirst = true;
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(EventComments.this);
try {
do {
View
4 source/src/in/joind/EventDetail.java
@@ -87,7 +87,7 @@ public void onResume() {
}
public void displayDetails (int event_row_ID) {
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(this);
JSONObject event = dh.getEvent (event_row_ID);
if (event == null) return;
@@ -182,7 +182,7 @@ public void run () {
// Update event details
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(EventDetail.this);
dh.updateEvent (eventRowID, jsonEvent);
}
View
4 source/src/in/joind/EventListFragment.java
@@ -122,7 +122,7 @@ public int displayEvents(final String eventType) {
m_eventAdapter.clear();
// add events and return count
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(getActivity());
int count = dh.populateEvents(eventType, m_eventAdapter, eventSortOrder);
// Tell the adapter that our data set has changed so it can update it
@@ -192,7 +192,7 @@ public void run() {
JSONObject fullResponse;
JSONObject metaObj;
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(EventListFragment.this.getActivity());
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
boolean isFirst = true;
int error = JIRest.OK; // default
View
4 source/src/in/joind/EventTalks.java
@@ -108,7 +108,7 @@ public void onItemClick(AdapterView<?> parent, View view, int pos, long id) {
// Display talks in the talk list (adapter), depending on the track_id
public int displayTalks(int eventRowID, int track_id) {
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(this);
m_talkAdapter.clear();
int talkCount = dh.populateTalks(eventRowID, track_id, m_talkAdapter);
@@ -144,7 +144,7 @@ public void run() {
JSONObject metaObj = new JSONObject();
JIRest rest = new JIRest(EventTalks.this);
boolean isFirst = true;
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(EventTalks.this);
try {
do {
View
2  source/src/in/joind/EventTracks.java
@@ -72,7 +72,7 @@ public void onItemClick(AdapterView<?> parent, View view, int pos, long id) {
// Display all talks in the talk list (adapter)
public int displayTracks(int event_id) {
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(this);
m_trackAdapter.clear();
int trackCount = dh.populateTracks(event_id, m_trackAdapter);
View
2  source/src/in/joind/JIActivity.java
@@ -110,7 +110,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.clear_menu_item:
// Removes all items from the database
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(this);
dh.deleteAll();
Toast toast = Toast.makeText(getApplicationContext(), R.string.generalCacheCleared, Toast.LENGTH_LONG);
toast.show();
View
4 source/src/in/joind/TalkComments.java
@@ -111,7 +111,7 @@ public void onClick(View v) {
// This will add all comments for specified talk in the talkcomment listview / adapter
public int displayTalkComments(int talk_id) {
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(this);
m_talkCommentAdapter.clear();
int count = dh.populateTalkComments(talk_id, m_talkCommentAdapter);
@@ -142,7 +142,7 @@ public void run() {
JSONObject metaObj = new JSONObject();
JIRest rest = new JIRest(TalkComments.this);
boolean isFirst = true;
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(TalkComments.this);
try {
do {
View
2  source/src/in/joind/TalkDetail.java
@@ -152,7 +152,7 @@ protected void updateCommentCount(int talkID, String commentsUri) throws JSONExc
// error, we were expecting a single talk
}
- DataHelper dh = DataHelper.getInstance();
+ DataHelper dh = DataHelper.getInstance(this);
JSONObject thisTalk = json.getJSONObject(0);
dh.insertTalk (talkID, thisTalk);
this.talkJSON = thisTalk;
Something went wrong with that request. Please try again.