From 0aae9fca161f7adbbf665c9eeb2b08c2893ec41c Mon Sep 17 00:00:00 2001 From: oogee Date: Tue, 18 Dec 2018 15:44:40 +0200 Subject: [PATCH 1/3] fixes: selected vote indicator, shoutbox crash on back press with changed orientation, reloading data when changing orientation in shoutbox --- .../activities/shoutbox/ShoutboxActivity.java | 10 ++++------ .../activities/shoutbox/ShoutboxFragment.java | 12 ++++-------- .../thmmy/mthmmy/activities/topic/TopicAdapter.java | 13 +++++++------ .../thmmy/mthmmy/viewmodel/ShoutboxViewModel.java | 12 +++++++----- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxActivity.java index bdd026ad..9c78198c 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxActivity.java @@ -26,12 +26,10 @@ public class ShoutboxActivity extends BaseActivity { createDrawer(); drawer.setSelection(SHOUTBOX_ID); - if (savedInstanceState == null) { - shoutboxFragment = ShoutboxFragment.newInstance(); - getSupportFragmentManager().beginTransaction() - .replace(R.id.container, shoutboxFragment) - .commitNow(); - } + shoutboxFragment = ShoutboxFragment.newInstance(); + getSupportFragmentManager().beginTransaction() + .replace(R.id.container, shoutboxFragment) + .commitNow(); } @Override diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java index 0c2d8ae5..848baa9d 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java @@ -1,7 +1,6 @@ package gr.thmmy.mthmmy.activities.shoutbox; import android.app.Activity; -import android.os.AsyncTask; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; @@ -22,7 +21,6 @@ import gr.thmmy.mthmmy.editorview.EditorView; import gr.thmmy.mthmmy.editorview.EmojiKeyboard; import gr.thmmy.mthmmy.model.Shout; import gr.thmmy.mthmmy.model.Shoutbox; -import gr.thmmy.mthmmy.session.SessionManager; import gr.thmmy.mthmmy.utils.CustomRecyclerView; import gr.thmmy.mthmmy.utils.NetworkResultCodes; import gr.thmmy.mthmmy.viewmodel.ShoutboxViewModel; @@ -32,7 +30,6 @@ import timber.log.Timber; public class ShoutboxFragment extends Fragment { private MaterialProgressBar progressBar; - private ShoutboxTask shoutboxTask; private ShoutAdapter shoutAdapter; private EmojiKeyboard emojiKeyboard; private EditorView editorView; @@ -90,7 +87,7 @@ public class ShoutboxFragment extends Fragment { @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.menu_refresh) { - shoutboxViewModel.loadShoutbox(); + shoutboxViewModel.loadShoutbox(true); return true; } else { return false; @@ -100,7 +97,7 @@ public class ShoutboxFragment extends Fragment { @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - shoutboxViewModel = ViewModelProviders.of(this).get(ShoutboxViewModel.class); + shoutboxViewModel = ViewModelProviders.of(getActivity()).get(ShoutboxViewModel.class); shoutboxViewModel.getShoutboxMutableLiveData().observe(this, shoutbox -> { if (shoutbox != null) { Timber.i("Shoutbox loaded successfully"); @@ -113,7 +110,7 @@ public class ShoutboxFragment extends Fragment { shoutboxViewModel.setOnSendShoutTaskStarted(this::onSendShoutTaskStarted); shoutboxViewModel.setOnSendShoutTaskFinished(this::onSendShoutTaskFinished); - shoutboxViewModel.loadShoutbox(); + shoutboxViewModel.loadShoutbox(false); } private void onShoutboxTaskSarted() { @@ -137,8 +134,7 @@ public class ShoutboxFragment extends Fragment { if (resultCode == NetworkResultCodes.SUCCESSFUL) { Timber.i("Shout was sent successfully"); editorView.getEditText().getText().clear(); - shoutboxTask = new ShoutboxTask(ShoutboxFragment.this::onShoutboxTaskSarted, ShoutboxFragment.this::onShoutboxTaskFinished); - shoutboxTask.execute(SessionManager.shoutboxUrl.toString()); + shoutboxViewModel.loadShoutbox(true); } else if (resultCode == NetworkResultCodes.NETWORK_ERROR) { Timber.w("Failed to send shout"); Toast.makeText(getContext(), "NetworkError", Toast.LENGTH_SHORT).show(); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index 345fa9e2..dba15a45 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -275,6 +275,13 @@ class TopicAdapter extends RecyclerView.Adapter { } else { // Showing results holder.optionsLayout.setVisibility(View.GONE); + + if (poll.getSelectedEntryIndex() != -1) { + holder.selectedEntry.setText("You voted \"" + + poll.getEntries()[poll.getSelectedEntryIndex()].getEntryName() + "\""); + holder.selectedEntry.setVisibility(View.VISIBLE); + } + Arrays.sort(entries, (p1, p2) -> p1.getVotes() - p2.getVotes()); List valuesToCompare = new ArrayList<>(); int totalVotes = 0; @@ -320,12 +327,6 @@ class TopicAdapter extends RecyclerView.Adapter { holder.voteChart.setMinimumHeight((int) (chartHeightDp * (metrics.densityDpi / 160f))); holder.voteChart.invalidate(); holder.voteChart.setVisibility(View.VISIBLE); - - if (poll.getSelectedEntryIndex() != -1) { - holder.selectedEntry.setText("You voted \"" + - poll.getEntries()[poll.getSelectedEntryIndex()].getEntryName() + "\""); - holder.selectedEntry.setVisibility(View.VISIBLE); - } } if (poll.getRemoveVoteUrl() != null) { holder.removeVotesButton.setOnClickListener(v -> viewModel.removeVote()); diff --git a/app/src/main/java/gr/thmmy/mthmmy/viewmodel/ShoutboxViewModel.java b/app/src/main/java/gr/thmmy/mthmmy/viewmodel/ShoutboxViewModel.java index 5aa92f65..25092578 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/viewmodel/ShoutboxViewModel.java +++ b/app/src/main/java/gr/thmmy/mthmmy/viewmodel/ShoutboxViewModel.java @@ -17,11 +17,13 @@ public class ShoutboxViewModel extends ViewModel { private SendShoutTask.OnTaskStartedListener onSendShoutTaskStarted; private SendShoutTask.OnNetworkTaskFinishedListener onSendShoutTaskFinished; - public void loadShoutbox() { - if (shoutboxTask != null && shoutboxTask.getStatus() == AsyncTask.Status.RUNNING) - shoutboxTask.cancel(true); - shoutboxTask = new ShoutboxTask(onShoutboxTaskStarted, onShoutboxTaskFinished); - shoutboxTask.execute(SessionManager.shoutboxUrl.toString()); + public void loadShoutbox(boolean force) { + if (shoutboxMutableLiveData.getValue() == null || force) { + if (shoutboxTask != null && shoutboxTask.getStatus() == AsyncTask.Status.RUNNING) + shoutboxTask.cancel(true); + shoutboxTask = new ShoutboxTask(onShoutboxTaskStarted, onShoutboxTaskFinished); + shoutboxTask.execute(SessionManager.shoutboxUrl.toString()); + } } public void sendShout(String shout) { From 46de365f7b77df9ef56d3b324a9b4c4bda5f183f Mon Sep 17 00:00:00 2001 From: Ezerous Date: Fri, 21 Dec 2018 14:25:29 +0200 Subject: [PATCH 2/3] Double board notifications bug fix --- .../bookmarks/BookmarksActivity.java | 4 +- .../bookmarks/BookmarksBoardFragment.java | 2 +- .../bookmarks/BookmarksTopicFragment.java | 2 +- .../gr/thmmy/mthmmy/base/BaseActivity.java | 10 ++--- .../java/gr/thmmy/mthmmy/model/Bookmark.java | 4 +- .../mthmmy/services/NotificationService.java | 44 ++++++++++++++++--- 6 files changed, 49 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksActivity.java index 0a65da94..b42a8caf 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksActivity.java @@ -47,8 +47,8 @@ public class BookmarksActivity extends BaseActivity { //Creates the adapter that will return a fragment for each section of the activity SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); - sectionsPagerAdapter.addFragment(BookmarksTopicFragment.newInstance(1, Bookmark.arrayToString(getTopicsBookmarked())), "Topics"); - sectionsPagerAdapter.addFragment(BookmarksBoardFragment.newInstance(2, Bookmark.arrayToString(getBoardsBookmarked())), "Boards"); + sectionsPagerAdapter.addFragment(BookmarksTopicFragment.newInstance(1, Bookmark.arrayListToString(getTopicsBookmarked())), "Topics"); + sectionsPagerAdapter.addFragment(BookmarksBoardFragment.newInstance(2, Bookmark.arrayListToString(getBoardsBookmarked())), "Boards"); //Sets up the ViewPager with the sections adapter. ViewPager viewPager = findViewById(R.id.bookmarks_container); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksBoardFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksBoardFragment.java index a73bbe6a..5b8c8d01 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksBoardFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksBoardFragment.java @@ -62,7 +62,7 @@ public class BookmarksBoardFragment extends Fragment { if (getArguments() != null) { String bundledBoardBookmarks = getArguments().getString(ARG_BOARD_BOOKMARKS); if (bundledBoardBookmarks != null) { - boardBookmarks = Bookmark.arrayFromString(bundledBoardBookmarks); + boardBookmarks = Bookmark.stringToArrayList(bundledBoardBookmarks); } } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksTopicFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksTopicFragment.java index 5c6232b7..4316db4b 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksTopicFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarksTopicFragment.java @@ -63,7 +63,7 @@ public class BookmarksTopicFragment extends Fragment { if (getArguments() != null) { String bundledTopicBookmarks = getArguments().getString(ARG_TOPIC_BOOKMARKS); if (bundledTopicBookmarks != null) { - topicBookmarks = Bookmark.arrayFromString(bundledTopicBookmarks); + topicBookmarks = Bookmark.stringToArrayList(bundledTopicBookmarks); } } diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index b953c032..d8019545 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java @@ -85,7 +85,7 @@ public abstract class BaseActivity extends AppCompatActivity { //Bookmarks public static final String BOOKMARKS_SHARED_PREFS = "bookmarksSharedPrefs"; public static final String BOOKMARKED_TOPICS_KEY = "bookmarkedTopicsKey"; - private static final String BOOKMARKED_BOARDS_KEY = "bookmarkedBoardsKey"; + public static final String BOOKMARKED_BOARDS_KEY = "bookmarkedBoardsKey"; protected Bookmark thisPageBookmark; private MenuItem thisPageBookmarkMenuButton; private SharedPreferences sharedPreferences; @@ -584,13 +584,13 @@ public abstract class BaseActivity extends AppCompatActivity { private void loadSavedBookmarks() { String tmpString = bookmarksFile.getString(BOOKMARKED_TOPICS_KEY, null); if (tmpString != null) - topicsBookmarked = Bookmark.arrayFromString(tmpString); + topicsBookmarked = Bookmark.stringToArrayList(tmpString); else topicsBookmarked = new ArrayList<>(); tmpString = bookmarksFile.getString(BOOKMARKED_BOARDS_KEY, null); if (tmpString != null) - boardsBookmarked = Bookmark.arrayFromString(tmpString); + boardsBookmarked = Bookmark.stringToArrayList(tmpString); else { boardsBookmarked = new ArrayList<>(); } @@ -622,14 +622,14 @@ public abstract class BaseActivity extends AppCompatActivity { private void updateBoardBookmarks() { String tmpString; - tmpString = Bookmark.arrayToString(boardsBookmarked); + tmpString = Bookmark.arrayListToString(boardsBookmarked); SharedPreferences.Editor editor = bookmarksFile.edit(); editor.putString(BOOKMARKED_BOARDS_KEY, tmpString).apply(); } private void updateTopicBookmarks() { String tmpString; - tmpString = Bookmark.arrayToString(topicsBookmarked); + tmpString = Bookmark.arrayListToString(topicsBookmarked); SharedPreferences.Editor editor = bookmarksFile.edit(); editor.putString(BOOKMARKED_TOPICS_KEY, tmpString).apply(); } diff --git a/app/src/main/java/gr/thmmy/mthmmy/model/Bookmark.java b/app/src/main/java/gr/thmmy/mthmmy/model/Bookmark.java index de35e0d0..ac622a64 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/model/Bookmark.java +++ b/app/src/main/java/gr/thmmy/mthmmy/model/Bookmark.java @@ -69,7 +69,7 @@ public class Bookmark implements java.io.Serializable { } @Nullable - public static String arrayToString(@NonNull ArrayList arrayList) { + public static String arrayListToString(@NonNull ArrayList arrayList) { String returnString = ""; for (Bookmark bookmark : arrayList) { if (bookmark != null) { @@ -82,7 +82,7 @@ public class Bookmark implements java.io.Serializable { else return null; } - public static ArrayList arrayFromString(@NonNull String string) { + public static ArrayList stringToArrayList(@NonNull String string) { ArrayList returnArray = new ArrayList<>(); String[] lines = string.split("\n"); for (String line : lines) { diff --git a/app/src/main/java/gr/thmmy/mthmmy/services/NotificationService.java b/app/src/main/java/gr/thmmy/mthmmy/services/NotificationService.java index 6d254021..5631b325 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/services/NotificationService.java +++ b/app/src/main/java/gr/thmmy/mthmmy/services/NotificationService.java @@ -19,6 +19,10 @@ import com.google.firebase.messaging.RemoteMessage; import org.json.JSONException; import org.json.JSONObject; +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import androidx.annotation.RequiresApi; import androidx.core.app.NotificationCompat; import androidx.preference.PreferenceManager; @@ -36,6 +40,7 @@ import static gr.thmmy.mthmmy.activities.settings.SettingsFragment.SELECTED_RING import static gr.thmmy.mthmmy.activities.settings.SettingsFragment.SETTINGS_SHARED_PREFS; import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_TITLE; import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL; +import static gr.thmmy.mthmmy.base.BaseActivity.BOOKMARKED_BOARDS_KEY; import static gr.thmmy.mthmmy.base.BaseActivity.BOOKMARKED_TOPICS_KEY; import static gr.thmmy.mthmmy.base.BaseActivity.BOOKMARKS_SHARED_PREFS; import static gr.thmmy.mthmmy.model.Bookmark.matchExistsById; @@ -61,15 +66,27 @@ public class NotificationService extends FirebaseMessagingService { Timber.i("FCM BOARD type message detected."); SharedPreferences bookmarksFile = getSharedPreferences(BOOKMARKS_SHARED_PREFS, Context.MODE_PRIVATE); - String tmpString = bookmarksFile.getString(BOOKMARKED_TOPICS_KEY, null); - if (tmpString != null){ - if(matchExistsById(Bookmark.arrayFromString(tmpString), topicId)){ - Timber.i("Board notification suppressed (already subscribed to topic)."); - return; - } + String bookmarkedTopicsString = bookmarksFile.getString(BOOKMARKED_TOPICS_KEY, null); + if (bookmarkedTopicsString != null && matchExistsById(Bookmark.stringToArrayList(bookmarkedTopicsString), topicId)){ + Timber.i("Board notification suppressed (already subscribed to topic)."); + return; } boardId = Integer.parseInt(json.getString("boardId")); + + String bookmarkedBoardsString = bookmarksFile.getString(BOOKMARKED_BOARDS_KEY, null); + if (bookmarkedBoardsString != null){ + ArrayList boardBookmarks = Bookmark.stringToArrayList(bookmarkedBoardsString); + ArrayList subBoardIds = getSubBoardIds(json.getString("boardIds"), boardId); + //TODO: Also suppress if user has chosen to be notified only for direct children of boardId && !subBoardIds.isEmpty() + for(int subId:subBoardIds){ + if(matchExistsById(boardBookmarks, subId)){ + Timber.i("Board notification suppressed (already subscribed to a subBoard)."); + return; + } + } + } + boardTitle = json.getString("boardTitle"); } else @@ -88,6 +105,21 @@ public class NotificationService extends FirebaseMessagingService { } } + private static ArrayList getSubBoardIds(String boardIdsString, int boardId){ + ArrayList subBoardIds = new ArrayList<>(); + Pattern p = Pattern.compile("(\\d+)"); + Matcher m = p.matcher(boardIdsString); + boolean boardIdfound=false; + while (m.find()){ + int subBoardId = Integer.parseInt(m.group()); + if(boardIdfound) + subBoardIds.add(subBoardId); + else if(boardId==subBoardId) + boardIdfound=true; + } + return subBoardIds; + } + private static final String CHANNEL_ID = "Posts"; private static final String CHANNEL_NAME = "New Posts"; private static final String GROUP_KEY = "PostsGroup"; From ec5af3c18c069f1942563b5626dfb1dc92625651 Mon Sep 17 00:00:00 2001 From: Ezerous Date: Mon, 31 Dec 2018 14:43:34 +0200 Subject: [PATCH 3/3] StatsFragment crash fix, up libs & version --- app/build.gradle | 8 ++++---- .../activities/profile/stats/StatsFragment.java | 15 +++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a1c8c82c..12853e57 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "gr.thmmy.mthmmy" minSdkVersion 19 targetSdkVersion 28 - versionCode 15 - versionName "1.6.0" + versionCode 16 + versionName "1.6.1" archivesBaseName = "mTHMMY-v$versionName" buildConfigField "String", "CURRENT_BRANCH", "\"" + getCurrentBranch() + "\"" buildConfigField "String", "COMMIT_HASH", "\"" + getCommitHash() + "\"" @@ -62,7 +62,7 @@ tasks.whenTaskAdded { task -> dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'androidx.preference:preference:1.1.0-alpha01' + implementation 'androidx.preference:preference:1.1.0-alpha02' implementation 'androidx.legacy:legacy-preference-v14:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' @@ -72,7 +72,7 @@ dependencies { implementation 'com.google.android.material:material:1.0.0' implementation 'com.google.firebase:firebase-core:16.0.6' implementation 'com.google.firebase:firebase-messaging:17.3.4' - implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7' + implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8' implementation 'com.squareup.okhttp3:okhttp:3.12.0' implementation 'com.squareup.picasso:picasso:2.5.2' implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0' diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java index fbf498c5..8ecf48bd 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java @@ -56,13 +56,12 @@ public class StatsFragment extends Fragment { private ProfileStatsTask profileStatsTask; private LinearLayout mainContent; private MaterialProgressBar progressBar; - private boolean haveParsed = false; private boolean userHasPosts = true; private String generalStatisticsTitle = "", generalStatistics = "", postingActivityByTimeTitle = "", mostPopularBoardsByPostsTitle = "", mostPopularBoardsByActivityTitle = ""; - final private List postingActivityByTime = new ArrayList<>(); - final private List mostPopularBoardsByPosts = new ArrayList<>(), mostPopularBoardsByActivity = new ArrayList<>(); - final private ArrayList mostPopularBoardsByPostsLabels = new ArrayList<>(), mostPopularBoardsByActivityLabels = new ArrayList<>(); + private final List postingActivityByTime = new ArrayList<>(); + private final List mostPopularBoardsByPosts = new ArrayList<>(), mostPopularBoardsByActivity = new ArrayList<>(); + private final ArrayList mostPopularBoardsByPostsLabels = new ArrayList<>(), mostPopularBoardsByActivityLabels = new ArrayList<>(); public StatsFragment() { // Required empty public constructor @@ -95,7 +94,7 @@ public class StatsFragment extends Fragment { final View rootView = inflater.inflate(R.layout.fragment_stats, container, false); mainContent = rootView.findViewById(R.id.main_content); progressBar = rootView.findViewById(R.id.progressBar); - if (haveParsed) + if (profileStatsTask!=null && profileStatsTask.getStatus() == AsyncTask.Status.FINISHED) populateLayout(); return rootView; } @@ -103,7 +102,7 @@ public class StatsFragment extends Fragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - if (!haveParsed) { + if (profileStatsTask==null) { profileStatsTask = new ProfileStatsTask(); profileStatsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, profileUrl + ";sa=statPanel"); } @@ -130,7 +129,6 @@ public class StatsFragment extends Fragment { @Override protected void onPreExecute() { progressBar.setVisibility(ProgressBar.VISIBLE); - haveParsed = true; } @Override @@ -159,7 +157,6 @@ public class StatsFragment extends Fragment { getActivity().finish(); } //Parse was successful - progressBar.setVisibility(ProgressBar.INVISIBLE); populateLayout(); } @@ -233,6 +230,7 @@ public class StatsFragment extends Fragment { } private void populateLayout() { + progressBar.setVisibility(ProgressBar.VISIBLE); ((TextView) mainContent.findViewById(R.id.general_statistics_title)) .setText(generalStatisticsTitle); ((TextView) mainContent.findViewById(R.id.general_statistics)) @@ -358,6 +356,7 @@ public class StatsFragment extends Fragment { mostPopularBoardsByActivityData.setValueTextColor(Color.WHITE); mostPopularBoardsByActivityChart.setData(mostPopularBoardsByActivityData); mostPopularBoardsByActivityChart.invalidate(); + progressBar.setVisibility(ProgressBar.INVISIBLE); } private class MyXAxisValueFormatter implements IAxisValueFormatter {