Browse Source

StatsFragment crash fix, up libs & version

pull/61/merge
Ezerous 6 years ago
parent
commit
ec5af3c18c
No known key found for this signature in database GPG Key ID: 262B2954BBA319E3
  1. 8
      app/build.gradle
  2. 15
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java

8
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'

15
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<Entry> postingActivityByTime = new ArrayList<>();
final private List<BarEntry> mostPopularBoardsByPosts = new ArrayList<>(), mostPopularBoardsByActivity = new ArrayList<>();
final private ArrayList<String> mostPopularBoardsByPostsLabels = new ArrayList<>(), mostPopularBoardsByActivityLabels = new ArrayList<>();
private final List<Entry> postingActivityByTime = new ArrayList<>();
private final List<BarEntry> mostPopularBoardsByPosts = new ArrayList<>(), mostPopularBoardsByActivity = new ArrayList<>();
private final ArrayList<String> 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 {

Loading…
Cancel
Save