Skip to content

Commit

Permalink
Properly overide methods in the asynctasks
Browse files Browse the repository at this point in the history
  • Loading branch information
markwinter committed Jun 4, 2014
1 parent 052d279 commit 669f728
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
18 changes: 12 additions & 6 deletions app/src/main/java/im/tox/antox/fragments/ContactsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public void onClick(DialogInterface dialog, int index) {
switch (index) {
case 0:
class AcceptFriendRequest extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
AntoxDB db = new AntoxDB(getActivity().getApplicationContext());
db.addFriend(item.first, "Friend Accepted", "", "");
Expand Down Expand Up @@ -212,7 +213,8 @@ protected Void doInBackground(Void... params) {
return null;
}

protected void onPostExecute() {
@Override
protected void onPostExecute(Void result) {
main_act.updateLeftPane();
}
}
Expand All @@ -222,6 +224,7 @@ protected void onPostExecute() {
break;
case 1:
class RejectFriendRequest extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
AntoxDB antoxDB = new AntoxDB(getActivity().getApplicationContext());
antoxDB.deleteFriendRequest(item.first);
Expand All @@ -241,7 +244,8 @@ protected Void doInBackground(Void... params) {
return null;
}

protected void onPostExecute(Long result) {
@Override
protected void onPostExecute(Void result) {
main_act.updateLeftPane();
}

Expand Down Expand Up @@ -341,6 +345,7 @@ public void showAlertDialog(Context context, String fkey) {
public void onClick(DialogInterface dialog,
int id) {
class DeleteFriendAndChat extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
AntoxDB db = new AntoxDB(getActivity());
db.deleteChat(key);
Expand All @@ -367,8 +372,8 @@ protected Void doInBackground(Void... params) {

return null;
}

protected void onPostExecute() {
@Override
protected void onPostExecute(Void result) {
main_act.updateLeftPane();
}
}
Expand All @@ -382,6 +387,7 @@ protected void onPostExecute() {
public void onClick(DialogInterface dialog,
int id) {
class DeleteFriend extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
AntoxDB db = new AntoxDB(getActivity());
db.deleteFriend(key);
Expand All @@ -407,8 +413,8 @@ protected Void doInBackground(Void... params) {

return null;
}

protected void onPostExecute() {
@Override
protected void onPostExecute(Void result) {
main_act.updateLeftPane();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Override
public void onClick(View view) {
class AcceptFriendRequest extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
AntoxDB db = new AntoxDB(getActivity().getApplicationContext());
db.addFriend(key, "Friend Accepted", "", "");
Expand Down Expand Up @@ -102,8 +103,8 @@ protected Void doInBackground(Void... params) {

return null;
}

protected void onPostExecute() {
@Override
protected void onPostExecute(Void result) {
((MainActivity) getActivity()).pane.openPane();
((MainActivity) getActivity()).updateLeftPane();
}
Expand All @@ -119,6 +120,7 @@ public void onClick(View view) {
((MainActivity) getActivity()).pane.openPane();

class RejectFriendRequest extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
AntoxDB antoxDB = new AntoxDB(getActivity().getApplicationContext());
antoxDB.deleteFriendRequest(key);
Expand All @@ -137,8 +139,8 @@ protected Void doInBackground(Void... params) {

return null;
}

protected void onPostExecute(Long result) {
@Override
protected void onPostExecute(Void result) {
((MainActivity) getActivity()).updateLeftPane();
}

Expand Down
6 changes: 2 additions & 4 deletions app/src/main/java/im/tox/antox/utils/DHTNodeDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public DHTNodeDetails(Context ctx) {
protected Void doInBackground(Void... params) {
try {
// Connect to the web site
Document document = Jsoup.connect("http://wiki.tox.im/Nodes").timeout(10000).get();
Document document = Jsoup.connect("https://wiki.tox.im/Nodes").timeout(10000).get();
Elements nodeRows = document.getElementsByTag("tr");

File folder = new File(Environment.getExternalStorageDirectory() + "/Antox");
Expand Down Expand Up @@ -130,9 +130,7 @@ protected Void doInBackground(Void... params) {
}

Log.d(TAG, "DhtNode size: " + DhtNode.ipv4.size());
/**
* Ping servers to find quickest connection - Threading this would be goood
*/

int times[][] = new int[DhtNode.ipv4.size()][1];

// Initialise array
Expand Down

0 comments on commit 669f728

Please sign in to comment.