Browse Source

Version 1.3.2

master v1.3.2
Ezerous 7 years ago
parent
commit
e01efc1308
  1. 24
      .gitlab/issue_templates/Bug.md
  2. 5
      .gitlab/issue_templates/Improvement.md
  3. 2
      VERSION
  4. 6
      app/build.gradle
  5. 5
      app/proguard-rules.pro
  6. 64
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
  7. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
  8. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  9. 1
      app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java
  10. 4
      app/src/main/java/gr/thmmy/mthmmy/utils/ParseTask.java
  11. 34
      app/src/main/res/layout-sw600dp/activity_main.xml
  12. 2
      app/src/main/res/layout-v21/activity_topic_post_row.xml
  13. 33
      app/src/main/res/layout/activity_about.xml
  14. 3
      app/src/main/res/layout/activity_main.xml
  15. 1
      app/src/main/res/layout/activity_topic.xml
  16. 2
      app/src/main/res/layout/activity_topic_post_row.xml
  17. 16
      app/src/main/res/values/strings.xml

24
.gitlab/issue_templates/Bug.md

@ -1,24 +0,0 @@
### Summary
(Summarize the bug encountered concisely)
### Steps to reproduce
(How one can reproduce the issue)
### Expected behavior
(What should normally happen)
### Actual behavior
(What actually happens instead)
### Relevant logs and/or screenshots
(Paste any relevant logs using code blocks (```) to format console output,
logs, and code)
### Possible fixes
(If you can, link to the line of code that might be responsible for the problem)

5
.gitlab/issue_templates/Improvement.md

@ -1,5 +0,0 @@
### Description
### Proposal
### Links / references

2
VERSION

@ -1 +1 @@
1.3.1
1.3.2

6
app/build.gradle

@ -9,8 +9,8 @@ android {
applicationId "gr.thmmy.mthmmy"
minSdkVersion 19
targetSdkVersion 26
versionCode 9
versionName "1.3.1"
versionCode 10
versionName "1.3.2"
archivesBaseName = "mTHMMY-v$versionName"
}
@ -45,7 +45,7 @@ dependencies {
}
compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1' //Deprecated!
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1' //TODO: Deprecated - needs replacement!
compile 'me.zhanghai.android.materialprogressbar:library:1.4.1'
compile 'com.jakewharton.timber:timber:4.5.1'
}

5
app/proguard-rules.pro

@ -16,6 +16,9 @@
# public *;
#}
# Don't obfuscate code (due to issues in Firebase)
-dontobfuscate
# OkHttp
-dontwarn okio.**
-dontwarn javax.annotation.Nullable
@ -33,5 +36,5 @@
# android-gif-drawable
-keep public class pl.droidsonroids.gif.GifIOException{<init>(int, java.lang.String);}
#JSoup
# JSoup
-keep class org.jsoup.**

64
app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java

@ -11,7 +11,6 @@ import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
@ -19,15 +18,13 @@ import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.Objects;
import javax.net.ssl.SSLHandshakeException;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.base.BaseActivity;
import gr.thmmy.mthmmy.model.Download;
import gr.thmmy.mthmmy.model.ThmmyPage;
import gr.thmmy.mthmmy.utils.ParseTask;
import gr.thmmy.mthmmy.utils.exceptions.ParseException;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
import okhttp3.Request;
import okhttp3.Response;
import timber.log.Timber;
public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.OnLoadMoreListener {
@ -159,16 +156,14 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
}
/**
* An {@link AsyncTask} that handles asynchronous fetching of a downloads page and parsing it's
* data. {@link AsyncTask#onPostExecute(Object) OnPostExecute} method calls {@link RecyclerView#swapAdapter}
* An {@link ParseTask} that handles asynchronous fetching of a downloads page and parsing it's
* data. {@link ParseTask#postParsing(ResultCode) postParsing} method calls {@link RecyclerView#swapAdapter}
* to build graphics.
* <p>
* <p>Calling TopicTask's {@link AsyncTask#execute execute} method needs to have profile's url
* <p>Calling TopicTask's {@link ParseTask#execute execute} method needs to have profile's url
* as String parameter!</p>
*/
class ParseDownloadPageTask extends AsyncTask<String, Void, Void> {
private String thisPageUrl;
private class ParseDownloadPageTask extends ParseTask {
@Override
protected void onPreExecute() {
if (!isLoadingMore) progressBar.setVisibility(ProgressBar.VISIBLE);
@ -176,36 +171,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
}
@Override
protected Void doInBackground(String... downloadsUrl) {
thisPageUrl = downloadsUrl[0];
Request request = new Request.Builder()
.url(downloadsUrl[0])
.build();
try {
Response response = client.newCall(request).execute();
parseDownloads(Jsoup.parse(response.body().string()));
} catch (SSLHandshakeException e) {
Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
Timber.e(e, "Exception");
}
return null;
}
@Override
protected void onPostExecute(Void voids) {
if (downloadsTitle != null && !Objects.equals(downloadsTitle, "") &&
toolbar.getTitle() != downloadsTitle)
toolbar.setTitle(downloadsTitle);
++pagesLoaded;
if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(true);
progressBar.setVisibility(ProgressBar.INVISIBLE);
downloadsAdapter.notifyDataSetChanged();
isLoadingMore = false;
}
private void parseDownloads(Document downloadPage) {
protected void parse(Document downloadPage) throws ParseException {
if (downloadsTitle == null || Objects.equals(downloadsTitle, ""))
downloadsTitle = downloadPage.select("div.nav>b>a.nav").last().text();
@ -215,7 +181,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
}
Download.DownloadItemType type;
if (ThmmyPage.resolvePageCategory(Uri.parse(thisPageUrl)).is(ThmmyPage.
if (ThmmyPage.resolvePageCategory(Uri.parse(url)).is(ThmmyPage.
PageCategory.DOWNLOADS_CATEGORY))
type = Download.DownloadItemType.DOWNLOADS_CATEGORY;
else type = Download.DownloadItemType.DOWNLOADS_FILE;
@ -265,5 +231,19 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
rows.select("span:has(a)").first().text()));
}
}
@Override
protected void postParsing(ResultCode result) {
if (downloadsTitle != null && !Objects.equals(downloadsTitle, "") &&
toolbar.getTitle() != downloadsTitle)
toolbar.setTitle(downloadsTitle);
++pagesLoaded;
if (uploadFAB.getVisibility() != View.GONE) uploadFAB.setEnabled(true);
progressBar.setVisibility(ProgressBar.INVISIBLE);
downloadsAdapter.notifyDataSetChanged();
isLoadingMore = false;
}
}
}

1
app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java

@ -138,6 +138,7 @@ public class RecentFragment extends BaseFragment {
//---------------------------------------ASYNC TASK-----------------------------------
private class RecentTask extends ParseTask {
@Override
protected void onPreExecute() {
progressBar.setVisibility(ProgressBar.VISIBLE);
}

1
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -181,7 +181,6 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
//Post's WebView parameters
holder.post.setClickable(true);
holder.post.setWebViewClient(new LinkLauncher());
holder.post.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//Avoids errors about layout having 0 width/height
holder.thumbnail.setMinimumWidth(1);

1
app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java

@ -13,7 +13,6 @@ import android.webkit.MimeTypeMap;
import java.io.File;
import gr.thmmy.mthmmy.R;
import timber.log.Timber;
import static gr.thmmy.mthmmy.services.DownloadService.ACTION_DOWNLOAD;

4
app/src/main/java/gr/thmmy/mthmmy/utils/ParseTask.java

@ -21,6 +21,7 @@ import timber.log.Timber;
* and modify prepareRequest() as needed.
*/
public abstract class ParseTask extends AsyncTask<String, Void, ParseTask.ResultCode> {
protected String url;
protected enum ResultCode {
SUCCESS, PARSING_ERROR, NETWORK_ERROR, OTHER_ERROR
}
@ -29,8 +30,9 @@ public abstract class ParseTask extends AsyncTask<String, Void, ParseTask.Result
protected abstract void postParsing (ParseTask.ResultCode result); //ResultCode.NETWORK_ERROR is handled automatically
protected Request prepareRequest(String... params) {
url = params[0];
return new Request.Builder()
.url(params[0])
.url(url)
.build();
}

34
app/src/main/res/layout-sw600dp/activity_main.xml

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activities.main.MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ToolbarTheme">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMaxWidth="0dp"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/white"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

2
app/src/main/res/layout-v21/activity_topic_post_row.xml

@ -189,7 +189,7 @@
<View
android:id="@+id/header_body_devider"
android:id="@+id/header_body_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="9dp"

33
app/src/main/res/layout/activity_about.xml

@ -70,20 +70,43 @@
android:textStyle="italic"/>
<TextView
android:id="@+id/header_1"
android:id="@+id/open_source_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/libraries"
android:text="@string/open_source"
android:textColor="@color/accent"
android:layout_below="@+id/version"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:id="@+id/open_source_text"
android:layout_below="@+id/open_source_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
android:text="@string/open_source_text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/iron"
android:layout_alignParentStart="true" />
<TextView
android:id="@+id/libraries_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/libraries"
android:textColor="@color/accent"
android:layout_below="@+id/open_source_text"
android:layout_alignParentStart="true"
android:textStyle="bold" />
<TextView
android:id="@+id/libraries_text"
android:layout_below="@+id/header_1"
android:layout_below="@+id/libraries_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/libraries_text"
@ -113,7 +136,7 @@
<TextView
android:id="@+id/header_2"
android:id="@+id/contact_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
@ -126,7 +149,7 @@
<TextView
android:id="@+id/contact_text"
android:layout_below="@+id/header_2"
android:layout_below="@+id/contact_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="email|web"

3
app/src/main/res/layout/activity_main.xml

@ -19,6 +19,9 @@
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMaxWidth="0dp"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/white"/>
</android.support.design.widget.AppBarLayout>

1
app/src/main/res/layout/activity_topic.xml

@ -39,6 +39,7 @@
android:layout_gravity="top|start"
android:background="@color/background"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:clipToPadding="false"
android:scrollbars="none"
tools:context="gr.thmmy.mthmmy.activities.topic.TopicActivity"

2
app/src/main/res/layout/activity_topic_post_row.xml

@ -188,7 +188,7 @@
<View
android:id="@+id/header_body_devider"
android:id="@+id/header_body_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="9dp"

16
app/src/main/res/values/strings.xml

@ -60,20 +60,20 @@
<!--About Activity-->
<string name="version">v%1$s</string>
<string name="logo">Logo</string>
<string name="trollPic">You should see a funny pic!</string>
<!--Bookmarks-->
<string name="remove_bookmark">Remove</string>
<string name="board_bookmarks_title">Boards</string>
<string name="topic_bookmarks_title">Topics</string>
<!--Licences-->
<string name="libraries">Libraries</string>
<string name="libraries_text">mTHMMY uses the following open-source libraries:</string>
<string name="apache_v2_0_libraries"><u>Apache v2.0 License libraries</u></string>
<string name="the_mit_libraries"><u>The MIT License libraries</u></string>
<string name="contact">Contact</string>
<string name="contact_text">Do not hesitate to contact us for any matter either by email at thmmynolife@gmail.com, or by joining our discord server at https://discord.gg/CVt3yrn.</string>
<string name="open_source">Open Source</string>
<string name="open_source_text">The source code of mTHMMY can be found on GitLab (https://gitlab.com/ThmmyNoLife/mTHMMY) along with further details of how one can contribute.</string>
<string name="trollPic">You should see a funny pic!</string>
<!--Bookmarks-->
<string name="remove_bookmark">Remove</string>
<string name="board_bookmarks_title">Boards</string>
<string name="topic_bookmarks_title">Topics</string>
<!--FontAwesome strings-->
<string name="fa_icon_star">&#xf005;</string>

Loading…
Cancel
Save