Browse Source

Merge branch 'shoutbox' into develop

# Conflicts:
#	app/build.gradle
#	app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java
#	app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BoardBookmarksFragment.java
#	app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
#	app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
#	app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
#	app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
#	app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java
#	app/src/main/res/layout/activity_downloads.xml
#	app/src/main/res/xml/app_preferences_user.xml
#	build.gradle
pull/61/merge
Thodoris1999 6 years ago
parent
commit
9e8321b62e
  1. 20
      app/build.gradle
  2. 10
      app/src/main/AndroidManifest.xml
  3. 9
      app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java
  4. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java
  5. 10
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
  6. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java
  7. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BoardBookmarksFragment.java
  8. 13
      app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarkActivity.java
  9. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/TopicBookmarksFragment.java
  10. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/create_content/CreateContentActivity.java
  11. 12
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
  12. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java
  13. 44
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  14. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java
  15. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java
  16. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentAdapter.java
  17. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
  18. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadAdapter.java
  19. 8
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java
  20. 16
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
  21. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java
  22. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java
  23. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
  24. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java
  25. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java
  26. 8
      app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java
  27. 50
      app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/SendShoutTask.java
  28. 154
      app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutAdapter.java
  29. 39
      app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxActivity.java
  30. 182
      app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java
  31. 61
      app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxTask.java
  32. 14
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  33. 17
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  34. 10
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java
  35. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java
  36. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadsHelper.java
  37. 41
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  38. 4
      app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
  39. 4
      app/src/main/java/gr/thmmy/mthmmy/base/BaseFragment.java
  40. 109
      app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java
  41. 6
      app/src/main/java/gr/thmmy/mthmmy/editorview/EmojiKeyboard.java
  42. 6
      app/src/main/java/gr/thmmy/mthmmy/editorview/EmojiKeyboardAdapter.java
  43. 6
      app/src/main/java/gr/thmmy/mthmmy/editorview/FormatButtonsAdapter.java
  44. 4
      app/src/main/java/gr/thmmy/mthmmy/model/Bookmark.java
  45. 2
      app/src/main/java/gr/thmmy/mthmmy/model/Post.java
  46. 34
      app/src/main/java/gr/thmmy/mthmmy/model/Shout.java
  47. 42
      app/src/main/java/gr/thmmy/mthmmy/model/Shoutbox.java
  48. 8
      app/src/main/java/gr/thmmy/mthmmy/services/NotificationService.java
  49. 5
      app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
  50. 2
      app/src/main/java/gr/thmmy/mthmmy/utils/AppCompatSpinnerWithoutDefault.java
  51. 2
      app/src/main/java/gr/thmmy/mthmmy/utils/CenterVerticalSpan.java
  52. 4
      app/src/main/java/gr/thmmy/mthmmy/utils/CustomLinearLayoutManager.java
  53. 6
      app/src/main/java/gr/thmmy/mthmmy/utils/CustomRecyclerView.java
  54. 2
      app/src/main/java/gr/thmmy/mthmmy/utils/FileUtils.java
  55. 10
      app/src/main/java/gr/thmmy/mthmmy/utils/ScrollAwareFABBehavior.java
  56. 10
      app/src/main/java/gr/thmmy/mthmmy/utils/ScrollAwareLinearBehavior.java
  57. 6
      app/src/main/java/gr/thmmy/mthmmy/viewmodel/BaseViewModel.java
  58. 58
      app/src/main/java/gr/thmmy/mthmmy/viewmodel/ShoutboxViewModel.java
  59. 2
      app/src/main/java/gr/thmmy/mthmmy/viewmodel/TopicViewModel.java
  60. 6
      app/src/main/res/color/activity_main_tabs_selector.xml
  61. 5
      app/src/main/res/drawable/ic_access_time_white_24dp.xml
  62. 7
      app/src/main/res/drawable/ic_announcement.xml
  63. 5
      app/src/main/res/drawable/ic_fiber_new_white_24dp.xml
  64. 5
      app/src/main/res/drawable/ic_forum_white_24dp.xml
  65. 5
      app/src/main/res/drawable/ic_refresh_white_24dp.xml
  66. 22
      app/src/main/res/layout-v21/activity_profile.xml
  67. 4
      app/src/main/res/layout-v21/activity_topic_post_row.xml
  68. 10
      app/src/main/res/layout/activity_about.xml
  69. 18
      app/src/main/res/layout/activity_board.xml
  70. 16
      app/src/main/res/layout/activity_bookmark.xml
  71. 18
      app/src/main/res/layout/activity_create_content.xml
  72. 21
      app/src/main/res/layout/activity_downloads.xml
  73. 12
      app/src/main/res/layout/activity_login.xml
  74. 16
      app/src/main/res/layout/activity_main.xml
  75. 22
      app/src/main/res/layout/activity_profile.xml
  76. 10
      app/src/main/res/layout/activity_settings.xml
  77. 31
      app/src/main/res/layout/activity_shoutbox.xml
  78. 16
      app/src/main/res/layout/activity_topic.xml
  79. 4
      app/src/main/res/layout/activity_topic_edit_row.xml
  80. 8
      app/src/main/res/layout/activity_topic_poll.xml
  81. 7
      app/src/main/res/layout/activity_topic_post_row.xml
  82. 4
      app/src/main/res/layout/activity_topic_quick_reply_row.xml
  83. 32
      app/src/main/res/layout/activity_upload.xml
  84. 28
      app/src/main/res/layout/activity_upload_fields_builder.xml
  85. 12
      app/src/main/res/layout/dialog_create_link.xml
  86. 12
      app/src/main/res/layout/editor_view.xml
  87. 4
      app/src/main/res/layout/emoji_keyboard.xml
  88. 2
      app/src/main/res/layout/emoji_keyboard_grid_cell.xml
  89. 2
      app/src/main/res/layout/format_button_grid_cell.xml
  90. 4
      app/src/main/res/layout/fragment_bookmarks.xml
  91. 4
      app/src/main/res/layout/fragment_forum.xml
  92. 4
      app/src/main/res/layout/fragment_latest_posts.xml
  93. 5
      app/src/main/res/layout/fragment_recent.xml
  94. 40
      app/src/main/res/layout/fragment_shoutbox.xml
  95. 72
      app/src/main/res/layout/fragment_shoutbox_shout_row.xml
  96. 4
      app/src/main/res/layout/fragment_stats.xml
  97. 4
      app/src/main/res/layout/fragment_summary.xml
  98. 4
      app/src/main/res/layout/fragment_unread.xml
  99. 10
      app/src/main/res/menu/shoutbox_menu.xml
  100. 1
      app/src/main/res/values/dimens.xml

20
app/build.gradle

@ -41,7 +41,7 @@ tasks.whenTaskAdded { task ->
task.getDependsOn().add({ task.getDependsOn().add({
def inputFile = new File("app/google-services.json") def inputFile = new File("app/google-services.json")
def json = new JsonSlurper().parseText(inputFile.text) def json = new JsonSlurper().parseText(inputFile.text)
if(json.project_info.project_id != "mthmmy-release-3aef0") if (json.project_info.project_id != "mthmmy-release-3aef0")
throw new GradleException('Please supply the correct google-services.json for release or manually change the id above!') throw new GradleException('Please supply the correct google-services.json for release or manually change the id above!')
}) })
} }
@ -49,13 +49,13 @@ tasks.whenTaskAdded { task ->
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.android.support:design:28.0.0' implementation 'com.google.android.material:material:1.0.0'
implementation 'com.android.support:preference-v7:28.0.0' implementation 'androidx.preference:preference:1.0.0'
implementation 'com.android.support:preference-v14:28.0.0' implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'com.android.support:support-v4:28.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:cardview-v7:28.0.0' implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.firebase:firebase-core:16.0.4' implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3' implementation 'com.google.firebase:firebase-messaging:17.3.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5' implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
@ -77,7 +77,9 @@ dependencies {
implementation "ru.noties:markwon:2.0.0" implementation "ru.noties:markwon:2.0.0"
implementation 'net.gotev:uploadservice:3.4.2' implementation 'net.gotev:uploadservice:3.4.2'
implementation 'net.gotev:uploadservice-okhttp:3.4.2' implementation 'net.gotev:uploadservice-okhttp:3.4.2'
implementation 'android.arch.lifecycle:extensions:1.1.1' implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'

10
app/src/main/AndroidManifest.xml

@ -136,7 +136,7 @@
</activity> </activity>
<provider <provider
android:name="android.support.v4.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider" android:authorities="${applicationId}.provider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
@ -158,6 +158,14 @@
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:parentActivityName=".activities.main.MainActivity" android:parentActivityName=".activities.main.MainActivity"
android:theme="@style/AppTheme.NoActionBar" /> android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".activities.shoutbox.ShoutboxActivity"
android:parentActivityName=".activities.main.MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity" />
</activity>
</application> </application>
</manifest> </manifest>

9
app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java

@ -2,10 +2,11 @@ package gr.thmmy.mthmmy.activities;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import android.support.design.widget.CoordinatorLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout;
import android.support.v4.widget.DrawerLayout; import androidx.drawerlayout.widget.DrawerLayout;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.text.style.UnderlineSpan; import android.text.style.UnderlineSpan;

4
app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java

@ -3,8 +3,8 @@ package gr.thmmy.mthmmy.activities;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import android.support.v7.widget.AppCompatButton; import androidx.appcompat.widget.AppCompatButton;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;

10
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

@ -4,11 +4,11 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.support.v7.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.Toast; import android.widget.Toast;

2
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java

@ -5,7 +5,7 @@ import android.content.Intent;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

6
app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BoardBookmarksFragment.java

@ -5,9 +5,8 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.graphics.drawable.VectorDrawableCompat; import androidx.fragment.app.Fragment;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -17,6 +16,7 @@ import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.model.Bookmark; import gr.thmmy.mthmmy.model.Bookmark;

13
app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/BookmarkActivity.java

@ -2,11 +2,12 @@ package gr.thmmy.mthmmy.activities.bookmarks;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.TabLayout; import com.google.android.material.tabs.TabLayout;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.support.v4.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter; import androidx.fragment.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager; import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.widget.Toast; import android.widget.Toast;
import java.util.ArrayList; import java.util.ArrayList;
@ -110,7 +111,7 @@ public class BookmarkActivity extends BaseActivity {
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages. If it becomes too memory intensive, * one of the sections/tabs/pages. If it becomes too memory intensive,
* it may be best to switch to a * it may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}. * {@link FragmentStatePagerAdapter}.
*/ */
private class SectionsPagerAdapter extends FragmentPagerAdapter { private class SectionsPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> fragmentList = new ArrayList<>(); private final List<Fragment> fragmentList = new ArrayList<>();

6
app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/TopicBookmarksFragment.java

@ -5,9 +5,9 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.graphics.drawable.VectorDrawableCompat; import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

2
app/src/main/java/gr/thmmy/mthmmy/activities/create_content/CreateContentActivity.java

@ -4,7 +4,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.design.widget.TextInputLayout; import com.google.android.material.textfield.TextInputLayout;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;

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

@ -1,14 +1,8 @@
package gr.thmmy.mthmmy.activities.downloads; package gr.thmmy.mthmmy.activities.downloads;
import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.Toast; import android.widget.Toast;
@ -19,8 +13,10 @@ import org.jsoup.select.Elements;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.upload.UploadActivity;
import gr.thmmy.mthmmy.base.BaseActivity; import gr.thmmy.mthmmy.base.BaseActivity;
import gr.thmmy.mthmmy.base.BaseApplication; import gr.thmmy.mthmmy.base.BaseApplication;
import gr.thmmy.mthmmy.model.Download; import gr.thmmy.mthmmy.model.Download;
@ -33,8 +29,6 @@ import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
import timber.log.Timber; import timber.log.Timber;
import static gr.thmmy.mthmmy.activities.upload.UploadActivity.BUNDLE_UPLOAD_CATEGORY;
public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.OnLoadMoreListener { public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.OnLoadMoreListener {
/** /**
* The key to use when putting download's url String to {@link DownloadsActivity}'s Bundle. * The key to use when putting download's url String to {@link DownloadsActivity}'s Bundle.

2
app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java

@ -5,7 +5,7 @@ import android.content.Intent;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

44
app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java

@ -4,17 +4,19 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.preference.PreferenceManager;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.tabs.TabLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.preference.PreferenceManager;
import androidx.viewpager.widget.ViewPager;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.LoginActivity; import gr.thmmy.mthmmy.activities.LoginActivity;
import gr.thmmy.mthmmy.activities.board.BoardActivity; import gr.thmmy.mthmmy.activities.board.BoardActivity;
@ -23,6 +25,7 @@ import gr.thmmy.mthmmy.activities.main.forum.ForumFragment;
import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; import gr.thmmy.mthmmy.activities.main.recent.RecentFragment;
import gr.thmmy.mthmmy.activities.main.unread.UnreadFragment; import gr.thmmy.mthmmy.activities.main.unread.UnreadFragment;
import gr.thmmy.mthmmy.activities.profile.ProfileActivity; import gr.thmmy.mthmmy.activities.profile.ProfileActivity;
import gr.thmmy.mthmmy.activities.settings.SettingsActivity;
import gr.thmmy.mthmmy.activities.topic.TopicActivity; import gr.thmmy.mthmmy.activities.topic.TopicActivity;
import gr.thmmy.mthmmy.base.BaseActivity; import gr.thmmy.mthmmy.base.BaseActivity;
import gr.thmmy.mthmmy.model.Board; import gr.thmmy.mthmmy.model.Board;
@ -37,7 +40,6 @@ import static gr.thmmy.mthmmy.activities.downloads.DownloadsActivity.BUNDLE_DOWN
import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_THUMBNAIL_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_THUMBNAIL_URL;
import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_URL;
import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_USERNAME; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_USERNAME;
import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.DEFAULT_HOME_TAB;
import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_TITLE; 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.activities.topic.TopicActivity.BUNDLE_TOPIC_URL;
@ -50,6 +52,7 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
private long mBackPressed; private long mBackPressed;
private SectionsPagerAdapter sectionsPagerAdapter; private SectionsPagerAdapter sectionsPagerAdapter;
private ViewPager viewPager; private ViewPager viewPager;
private TabLayout tabLayout;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -82,15 +85,23 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
//Set up the ViewPager with the sections adapter. //Set up the ViewPager with the sections adapter.
viewPager = findViewById(R.id.container); viewPager = findViewById(R.id.container);
viewPager.setAdapter(sectionsPagerAdapter); viewPager.setAdapter(sectionsPagerAdapter);
tabLayout = findViewById(R.id.tabs);
TabLayout tabLayout = findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
int preferredTab = Integer.parseInt(sharedPrefs.getString(DEFAULT_HOME_TAB, "0")); int preferredTab = Integer.parseInt(sharedPrefs.getString(SettingsActivity.DEFAULT_HOME_TAB, "0"));
if (preferredTab != 3 || sessionManager.isLoggedIn()) { if ((preferredTab != 3 && preferredTab != 4) || sessionManager.isLoggedIn()) {
tabLayout.getTabAt(preferredTab).select(); tabLayout.getTabAt(preferredTab).select();
} }
for (int i = 0; i < tabLayout.getTabCount(); i++) {
if (i == 0) {
tabLayout.getTabAt(i).setIcon(getResources().getDrawable(R.drawable.ic_access_time_white_24dp));
} else if (i == 1) {
tabLayout.getTabAt(i).setIcon(getResources().getDrawable(R.drawable.ic_forum_white_24dp));
}else if (i == 2) {
tabLayout.getTabAt(i).setIcon(getResources().getDrawable(R.drawable.ic_fiber_new_white_24dp));
}
}
setMainActivity(this); setMainActivity(this);
} }
@ -105,7 +116,7 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
@Override @Override
protected void onResume() { protected void onResume() {
drawer.setSelection(HOME_ID); drawer.setSelection(HOME_ID);
if(!sharedPrefs.getBoolean(DRAWER_INTRO, false)){ if (!sharedPrefs.getBoolean(DRAWER_INTRO, false)) {
drawer.openDrawer(); drawer.openDrawer();
sharedPrefs.edit().putBoolean(DRAWER_INTRO, true).apply(); sharedPrefs.edit().putBoolean(DRAWER_INTRO, true).apply();
} }
@ -161,7 +172,7 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages. If it becomes too memory intensive, * one of the sections/tabs/pages. If it becomes too memory intensive,
* it may be best to switch to a * it may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}. * {@link FragmentStatePagerAdapter}.
*/ */
private class SectionsPagerAdapter extends FragmentPagerAdapter { private class SectionsPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> fragmentList = new ArrayList<>(); private final List<Fragment> fragmentList = new ArrayList<>();
@ -209,10 +220,13 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
} }
public void updateTabs() { public void updateTabs() {
if (!sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 3) if (!sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 3) {
sectionsPagerAdapter.removeFragment(2); sectionsPagerAdapter.removeFragment(2);
else if (sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 2) }
else if (sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 2) {
sectionsPagerAdapter.addFragment(UnreadFragment.newInstance(3), "UNREAD"); sectionsPagerAdapter.addFragment(UnreadFragment.newInstance(3), "UNREAD");
tabLayout.getTabAt(2).setIcon(R.drawable.ic_fiber_new_white_24dp);
}
} }
//-------------------------------FragmentPagerAdapter END------------------------------------------- //-------------------------------FragmentPagerAdapter END-------------------------------------------

4
app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java

@ -1,8 +1,8 @@
package gr.thmmy.mthmmy.activities.main.forum; package gr.thmmy.mthmmy.activities.main.forum;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

6
app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java

@ -2,9 +2,9 @@ package gr.thmmy.mthmmy.activities.main.forum;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.support.v7.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

4
app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentAdapter.java

@ -1,8 +1,8 @@
package gr.thmmy.mthmmy.activities.main.recent; package gr.thmmy.mthmmy.activities.main.recent;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

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

@ -2,9 +2,9 @@ package gr.thmmy.mthmmy.activities.main.recent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.support.v7.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

4
app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadAdapter.java

@ -1,7 +1,7 @@
package gr.thmmy.mthmmy.activities.main.unread; package gr.thmmy.mthmmy.activities.main.unread;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

8
app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java

@ -2,10 +2,10 @@ package gr.thmmy.mthmmy.activities.main.unread;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v4.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.support.v7.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

16
app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java

@ -7,14 +7,14 @@ import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import android.support.design.widget.TabLayout; import com.google.android.material.tabs.TabLayout;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.support.v4.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter; import androidx.fragment.app.FragmentPagerAdapter;
import android.support.v4.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import android.support.v4.view.ViewPager; import androidx.viewpager.widget.ViewPager;
import android.support.v7.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;

2
app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java

@ -1,6 +1,6 @@
package gr.thmmy.mthmmy.activities.profile.latestPosts; package gr.thmmy.mthmmy.activities.profile.latestPosts;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

6
app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java

@ -2,9 +2,9 @@ package gr.thmmy.mthmmy.activities.profile.latestPosts;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

2
app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java

@ -4,7 +4,7 @@ import android.graphics.Color;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

2
app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java

@ -4,7 +4,7 @@ import android.graphics.Color;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import android.text.Html; import android.text.Html;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater; import android.view.LayoutInflater;

2
app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java

@ -1,7 +1,7 @@
package gr.thmmy.mthmmy.activities.settings; package gr.thmmy.mthmmy.activities.settings;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.base.BaseActivity; import gr.thmmy.mthmmy.base.BaseActivity;

8
app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java

@ -8,10 +8,10 @@ import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.preference.ListPreference; import androidx.preference.ListPreference;
import android.support.v7.preference.Preference; import androidx.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;

50
app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/SendShoutTask.java

@ -0,0 +1,50 @@
package gr.thmmy.mthmmy.activities.shoutbox;
import org.jsoup.nodes.Document;
import java.io.IOException;
import gr.thmmy.mthmmy.utils.NetworkResultCodes;
import gr.thmmy.mthmmy.utils.NetworkTask;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class SendShoutTask extends NetworkTask<Void> {
public SendShoutTask(OnTaskStartedListener onTaskStartedListener, OnNetworkTaskFinishedListener<Void> onNetworkTaskFinishedListener) {
super(onTaskStartedListener, onNetworkTaskFinishedListener);
}
@Override
protected Response sendRequest(OkHttpClient client, String... input) throws IOException {
MultipartBody.Builder postBodyBuilder = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("sc", input[2])
.addFormDataPart("tp-shout", input[1])
.addFormDataPart("tp-shout-name", input[3])
.addFormDataPart("shout_send", input[4])
.addFormDataPart("tp-shout-url", input[5]);
Request voteRequest = new Request.Builder()
.url(input[0])
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36")
.post(postBodyBuilder.build())
.build();
client.newCall(voteRequest).execute();
return client.newCall(voteRequest).execute();
}
@Override
protected Void performTask(Document document, Response response) {
return null;
}
@Override
protected int getResultCode(Response response, Void data) {
return NetworkResultCodes.SUCCESSFUL;
}
}

154
app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutAdapter.java

@ -0,0 +1,154 @@
package gr.thmmy.mthmmy.activities.shoutbox;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
import androidx.annotation.NonNull;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.board.BoardActivity;
import gr.thmmy.mthmmy.activities.profile.ProfileActivity;
import gr.thmmy.mthmmy.activities.topic.TopicActivity;
import gr.thmmy.mthmmy.model.Shout;
import gr.thmmy.mthmmy.model.ThmmyPage;
import gr.thmmy.mthmmy.utils.CustomRecyclerView;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_TITLE;
import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_URL;
import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_THUMBNAIL_URL;
import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_URL;
import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_USERNAME;
import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL;
public class ShoutAdapter extends CustomRecyclerView.Adapter<ShoutAdapter.ShoutViewHolder> {
private Context context;
private Shout[] shouts;
public ShoutAdapter(Context context, Shout[] shouts) {
this.context = context;
this.shouts = shouts;
}
public void setShouts(Shout[] shouts) {
this.shouts = shouts;
}
@NonNull
@Override
public ShoutViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.fragment_shoutbox_shout_row, parent, false);
return new ShoutViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ShoutViewHolder holder, int position) {
Shout currentShout = shouts[position];
holder.author.setText(currentShout.getShouter());
if (currentShout.isMemberOfTheMonth()) holder.author.setTextColor(context.getResources().getColor(R.color.member_of_the_month));
else holder.author.setTextColor(context.getResources().getColor(R.color.accent));
holder.author.setOnClickListener(view -> {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle extras = new Bundle();
extras.putString(BUNDLE_PROFILE_URL, shouts[holder.getAdapterPosition()].getShouterProfileURL());
extras.putString(BUNDLE_PROFILE_THUMBNAIL_URL, "");
extras.putString(BUNDLE_PROFILE_USERNAME, "");
intent.putExtras(extras);
intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
});
holder.dateTime.setText(currentShout.getDate());
holder.shoutContent.setClickable(true);
holder.shoutContent.setWebViewClient(new LinkLauncher());
holder.shoutContent.loadDataWithBaseURL("file:///android_asset/", currentShout.getShout(),
"text/html", "UTF-8", null);
}
@Override
public int getItemCount() {
return shouts.length;
}
static class ShoutViewHolder extends CustomRecyclerView.ViewHolder {
TextView author, dateTime;
WebView shoutContent;
ShoutViewHolder(@NonNull View itemView) {
super(itemView);
author = itemView.findViewById(R.id.author_textview);
dateTime = itemView.findViewById(R.id.date_time_textview);
shoutContent = itemView.findViewById(R.id.shout_content);
}
}
class LinkLauncher extends WebViewClient {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
final Uri uri = request.getUrl();
return handleUri(uri);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
final Uri uri = Uri.parse(url);
return handleUri(uri);
}
private boolean handleUri(Uri uri) {
final String uriString = uri.toString();
ThmmyPage.PageCategory target = ThmmyPage.resolvePageCategory(uri);
if (target.is(ThmmyPage.PageCategory.TOPIC)) {
//This url points to a topic
Intent intent = new Intent(context, TopicActivity.class);
Bundle extras = new Bundle();
extras.putString(BUNDLE_TOPIC_URL, uriString);
intent.putExtras(extras);
intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return true;
} else if (target.is(ThmmyPage.PageCategory.BOARD)) {
Intent intent = new Intent(context, BoardActivity.class);
Bundle extras = new Bundle();
extras.putString(BUNDLE_BOARD_URL, uriString);
extras.putString(BUNDLE_BOARD_TITLE, "");
intent.putExtras(extras);
intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return true;
} else if (target.is(ThmmyPage.PageCategory.PROFILE)) {
Intent intent = new Intent(context, ProfileActivity.class);
Bundle extras = new Bundle();
extras.putString(BUNDLE_PROFILE_URL, uriString);
extras.putString(BUNDLE_PROFILE_THUMBNAIL_URL, "");
extras.putString(BUNDLE_PROFILE_USERNAME, "");
intent.putExtras(extras);
intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return true;
}
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
//Method always returns true as no url should be loaded in the WebViews
return true;
}
}
}

39
app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxActivity.java

@ -0,0 +1,39 @@
package gr.thmmy.mthmmy.activities.shoutbox;
import android.os.Bundle;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.base.BaseActivity;
public class ShoutboxActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shoutbox);
//Initialize toolbar
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle("Shoutbox");
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
createDrawer();
drawer.setSelection(SHOUTBOX_ID);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, ShoutboxFragment.newInstance())
.commitNow();
}
}
@Override
protected void onResume() {
drawer.setSelection(SHOUTBOX_ID);
super.onResume();
}
}

182
app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxFragment.java

@ -0,0 +1,182 @@
package gr.thmmy.mthmmy.activities.shoutbox;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import gr.thmmy.mthmmy.R;
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;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
import timber.log.Timber;
public class ShoutboxFragment extends Fragment implements EmojiKeyboard.EmojiKeyboardOwner {
private MaterialProgressBar progressBar;
private ShoutboxTask shoutboxTask;
private ShoutAdapter shoutAdapter;
private EmojiKeyboard emojiKeyboard;
private EditorView editorView;
private ShoutboxViewModel shoutboxViewModel;
public static ShoutboxFragment newInstance() {
return new ShoutboxFragment();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_shoutbox, container, false);
setHasOptionsMenu(true);
progressBar = rootView.findViewById(R.id.progressBar);
CustomRecyclerView recyclerView = rootView.findViewById(R.id.shoutbox_recyclerview);
shoutAdapter = new ShoutAdapter(getContext(), new Shout[0]);
recyclerView.setAdapter(shoutAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setReverseLayout(true);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setOnTouchListener((view, motionEvent) -> {
editorView.hideMarkdown();
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editorView.getWindowToken(), 0);
return false;
});
emojiKeyboard = rootView.findViewById(R.id.emoji_keyboard);
editorView = rootView.findViewById(R.id.edior_view);
editorView.setEmojiKeyboardOwner(this);
InputConnection ic = editorView.getInputConnection();
setEmojiKeyboardInputConnection(ic);
editorView.setOnSubmitListener(view -> {
if (shoutboxViewModel.getShoutboxMutableLiveData().getValue() == null) return;
if (editorView.getText().toString().isEmpty()) {
editorView.setError("Required");
return;
}
shoutboxViewModel.sendShout(editorView.getText().toString());
});
editorView.hideMarkdown();
editorView.setOnTouchListener((view, motionEvent) -> {
editorView.showMarkdown();
return false;
});
editorView.setMarkdownVisible(false);
editorView.showMarkdownOnfocus();
return rootView;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.shoutbox_menu, menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_refresh) {
shoutboxViewModel.loadShoutbox();
return true;
} else {
return false;
}
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
shoutboxViewModel = ViewModelProviders.of(this).get(ShoutboxViewModel.class);
shoutboxViewModel.getShoutboxMutableLiveData().observe(this, shoutbox -> {
if (shoutbox != null) {
Timber.i("Shoutbox loaded successfully");
shoutAdapter.setShouts(shoutbox.getShouts());
shoutAdapter.notifyDataSetChanged();
}
});
shoutboxViewModel.setOnShoutboxTaskStarted(this::onShoutboxTaskSarted);
shoutboxViewModel.setOnShoutboxTaskFinished(this::onShoutboxTaskFinished);
shoutboxViewModel.setOnSendShoutTaskStarted(this::onSendShoutTaskStarted);
shoutboxViewModel.setOnSendShoutTaskFinished(this::onSendShoutTaskFinished);
shoutboxViewModel.loadShoutbox();
}
private void onShoutboxTaskSarted() {
Timber.i("Starting shoutbox task...");
progressBar.setVisibility(View.VISIBLE);
}
private void onSendShoutTaskStarted() {
Timber.i("Start sending a shout...");
editorView.setAlpha(0.5f);
editorView.setEnabled(false);
setEmojiKeyboardVisible(false);
progressBar.setVisibility(View.VISIBLE);
}
private void onSendShoutTaskFinished(int resultCode, Void ignored) {
editorView.setAlpha(1f);
editorView.setEnabled(true);
progressBar.setVisibility(View.INVISIBLE);
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());
} else if (resultCode == NetworkResultCodes.NETWORK_ERROR) {
Timber.w("Failed to send shout");
Toast.makeText(getContext(), "NetworkError", Toast.LENGTH_SHORT).show();
}
}
private void onShoutboxTaskFinished(int resultCode, Shoutbox shoutbox) {
progressBar.setVisibility(View.INVISIBLE);
if (resultCode == NetworkResultCodes.SUCCESSFUL) {
shoutboxViewModel.setShoutbox(shoutbox);
if (shoutbox.getShoutSend() != null)
editorView.setVisibility(View.VISIBLE);
} else if (resultCode == NetworkResultCodes.NETWORK_ERROR) {
Timber.w("Failed to retreive shoutbox due to network error");
Toast.makeText(getContext(), "NetworkError", Toast.LENGTH_SHORT).show();
} else {
Timber.wtf("Failed to retreive shoutbox due to unknown error");
Toast.makeText(getContext(), "Failed to retrieve shoutbox, please contact mthmmy developer team", Toast.LENGTH_LONG).show();
}
}
@Override
public void setEmojiKeyboardVisible(boolean visible) {
emojiKeyboard.setVisibility(visible ? View.VISIBLE : View.GONE);
}
@Override
public boolean isEmojiKeyboardVisible() {
return emojiKeyboard.getVisibility() == View.VISIBLE;
}
@Override
public void setEmojiKeyboardInputConnection(InputConnection ic) {
emojiKeyboard.setInputConnection(ic);
}
}

61
app/src/main/java/gr/thmmy/mthmmy/activities/shoutbox/ShoutboxTask.java

@ -0,0 +1,61 @@
package gr.thmmy.mthmmy.activities.shoutbox;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import java.util.ArrayList;
import gr.thmmy.mthmmy.model.Shout;
import gr.thmmy.mthmmy.model.Shoutbox;
import gr.thmmy.mthmmy.utils.NetworkResultCodes;
import gr.thmmy.mthmmy.utils.parsing.NewParseTask;
import gr.thmmy.mthmmy.utils.parsing.ParseException;
import gr.thmmy.mthmmy.utils.parsing.ParseHelpers;
import okhttp3.Response;
public class ShoutboxTask extends NewParseTask<Shoutbox> {
public ShoutboxTask(OnTaskStartedListener onTaskStartedListener, OnNetworkTaskFinishedListener<Shoutbox> onParseTaskFinishedListener) {
super(onTaskStartedListener, onParseTaskFinishedListener);
}
@Override
protected Shoutbox parse(Document document, Response response) throws ParseException {
// fragment_shoutbox_shout_row container: document.select("div[class=smalltext]" && div.text().contains("Τελευταίες 75 φωνές:") η στα αγγλικα
Element shoutboxContainer = document.select("table.windowbg").first();
ArrayList<Shout> shouts = new ArrayList<>();
for (Element shout : shoutboxContainer.select("div[style=margin: 4px;]")) {
Element user = shout.child(0);
Element link = user.select("a").first();
String profileUrl = link.attr("href");
String profileName = link.text();
boolean memberOfTheMonth = link.attr("style").contains("#EA00FF");
Element date = shout.child(1);
String dateString = date.text();
Element content = shout.child(2);
content.removeAttr("style");
String shoutContent = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" +
ParseHelpers.youtubeEmbeddedFix(content);
shouts.add(new Shout(profileName, profileUrl, dateString, shoutContent, memberOfTheMonth));
}
Element shoutboxForm = document.select("form[name=tp-shoutbox]").first();
String formUrl = shoutboxForm.attr("action");
String sc = shoutboxForm.select("input[name=sc]").first().attr("value");
String shoutName = shoutboxForm.select("input[name=tp-shout-name]").first().attr("value");
// TODO: make shout send nullable and disable shouting
Element shoutSendInput = shoutboxForm.select("input[name=shout_send]").first();
String shoutSend = null;
if (shoutSendInput != null)
shoutSend = shoutSendInput.attr("value");
String shoutUrl = shoutboxForm.select("input[name=tp-shout-url]").first().attr("value");
return new Shoutbox(shouts.toArray(new Shout[0]), sc, formUrl, shoutName, shoutSend, shoutUrl);
}
@Override
protected int getResultCode(Response response, Shoutbox data) {
return NetworkResultCodes.SUCCESSFUL;
}
}

14
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java

@ -2,7 +2,7 @@ package gr.thmmy.mthmmy.activities.topic;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.arch.lifecycle.ViewModelProviders; import androidx.lifecycle.ViewModelProviders;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Rect; import android.graphics.Rect;
@ -10,12 +10,12 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.design.widget.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import android.support.design.widget.Snackbar; import com.google.android.material.snackbar.Snackbar;
import android.support.v4.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.support.v7.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;

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

@ -2,7 +2,7 @@ package gr.thmmy.mthmmy.activities.topic;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.arch.lifecycle.ViewModelProviders; import androidx.lifecycle.ViewModelProviders;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
@ -11,12 +11,13 @@ import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v4.content.res.ResourcesCompat; import androidx.core.content.res.ResourcesCompat;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.support.v7.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import android.support.v7.widget.AppCompatButton; import androidx.appcompat.widget.AppCompatButton;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.Html; import android.text.Html;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
@ -81,7 +82,7 @@ import static gr.thmmy.mthmmy.activities.topic.TopicParser.USER_COLOR_YELLOW;
import static gr.thmmy.mthmmy.base.BaseActivity.getSessionManager; import static gr.thmmy.mthmmy.base.BaseActivity.getSessionManager;
/** /**
* Custom {@link android.support.v7.widget.RecyclerView.Adapter} used for topics. * Custom {@link RecyclerView.Adapter} used for topics.
*/ */
class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
/** /**

10
app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadActivity.java

@ -11,11 +11,11 @@ import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import android.support.v7.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import android.support.v7.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import android.support.v7.widget.AppCompatButton; import androidx.appcompat.widget.AppCompatButton;
import android.support.v7.widget.AppCompatTextView; import androidx.appcompat.widget.AppCompatTextView;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;

6
app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadFieldsBuilderActivity.java

@ -3,9 +3,9 @@ package gr.thmmy.mthmmy.activities.upload;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.View; import android.view.View;

4
app/src/main/java/gr/thmmy/mthmmy/activities/upload/UploadsHelper.java

@ -10,8 +10,8 @@ import android.media.ExifInterface;
import android.net.Uri; import android.net.Uri;
import android.os.Environment; import android.os.Environment;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.widget.Toast; import android.widget.Toast;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;

41
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -2,7 +2,6 @@ package gr.thmmy.mthmmy.base;
import android.Manifest; import android.Manifest;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -11,14 +10,6 @@ import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetDialog;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
@ -26,6 +17,7 @@ import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.firebase.messaging.FirebaseMessaging; import com.google.firebase.messaging.FirebaseMessaging;
import com.mikepenz.fontawesome_typeface_library.FontAwesome; import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.google_material_typeface_library.GoogleMaterial; import com.mikepenz.google_material_typeface_library.GoogleMaterial;
@ -43,6 +35,14 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.lifecycle.ViewModelProviders;
import androidx.preference.PreferenceManager;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.AboutActivity; import gr.thmmy.mthmmy.activities.AboutActivity;
import gr.thmmy.mthmmy.activities.LoginActivity; import gr.thmmy.mthmmy.activities.LoginActivity;
@ -51,6 +51,7 @@ import gr.thmmy.mthmmy.activities.downloads.DownloadsActivity;
import gr.thmmy.mthmmy.activities.main.MainActivity; import gr.thmmy.mthmmy.activities.main.MainActivity;
import gr.thmmy.mthmmy.activities.profile.ProfileActivity; import gr.thmmy.mthmmy.activities.profile.ProfileActivity;
import gr.thmmy.mthmmy.activities.settings.SettingsActivity; import gr.thmmy.mthmmy.activities.settings.SettingsActivity;
import gr.thmmy.mthmmy.activities.shoutbox.ShoutboxActivity;
import gr.thmmy.mthmmy.model.Bookmark; import gr.thmmy.mthmmy.model.Bookmark;
import gr.thmmy.mthmmy.model.ThmmyFile; import gr.thmmy.mthmmy.model.ThmmyFile;
import gr.thmmy.mthmmy.services.DownloadHelper; import gr.thmmy.mthmmy.services.DownloadHelper;
@ -156,6 +157,7 @@ public abstract class BaseActivity extends AppCompatActivity {
protected static final int LOG_ID = 4; protected static final int LOG_ID = 4;
protected static final int ABOUT_ID = 5; protected static final int ABOUT_ID = 5;
protected static final int SETTINGS_ID = 6; protected static final int SETTINGS_ID = 6;
protected static final int SHOUTBOX_ID = 7;
private AccountHeader accountHeader; private AccountHeader accountHeader;
private ProfileDrawerItem profileDrawerItem; private ProfileDrawerItem profileDrawerItem;
@ -170,7 +172,7 @@ public abstract class BaseActivity extends AppCompatActivity {
final int selectedPrimaryColor = ContextCompat.getColor(this, R.color.primary_dark); final int selectedPrimaryColor = ContextCompat.getColor(this, R.color.primary_dark);
final int selectedSecondaryColor = ContextCompat.getColor(this, R.color.accent); final int selectedSecondaryColor = ContextCompat.getColor(this, R.color.accent);
PrimaryDrawerItem homeItem, bookmarksItem, settingsItem, aboutItem; PrimaryDrawerItem homeItem, bookmarksItem, settingsItem, aboutItem, shoutboxItem;
IconicsDrawable homeIcon, homeIconSelected, downloadsIcon, downloadsIconSelected, uploadIcon, uploadIconSelected, settingsIcon, IconicsDrawable homeIcon, homeIconSelected, downloadsIcon, downloadsIconSelected, uploadIcon, uploadIconSelected, settingsIcon,
settingsIconSelected, bookmarksIcon, bookmarksIconSelected, aboutIcon, aboutIconSelected; settingsIconSelected, bookmarksIcon, bookmarksIconSelected, aboutIcon, aboutIconSelected;
@ -258,6 +260,16 @@ public abstract class BaseActivity extends AppCompatActivity {
// .withIcon(uploadIcon) // .withIcon(uploadIcon)
// .withSelectedIcon(uploadIconSelected); // .withSelectedIcon(uploadIconSelected);
shoutboxItem = new PrimaryDrawerItem()
.withTextColor(primaryColor)
.withSelectedColor(selectedPrimaryColor)
.withSelectedTextColor(selectedSecondaryColor)
.withIdentifier(SHOUTBOX_ID)
.withName(R.string.shoutbox)
.withIcon(R.drawable.ic_announcement)
.withIconColor(primaryColor)
.withSelectedIconColor(selectedSecondaryColor);
if (sessionManager.isLoggedIn()) //When logged in if (sessionManager.isLoggedIn()) //When logged in
{ {
loginLogoutItem = new PrimaryDrawerItem() loginLogoutItem = new PrimaryDrawerItem()
@ -346,6 +358,11 @@ public abstract class BaseActivity extends AppCompatActivity {
Intent intent = new Intent(BaseActivity.this, MainActivity.class); Intent intent = new Intent(BaseActivity.this, MainActivity.class);
startActivity(intent); startActivity(intent);
} }
} else if (drawerItem.equals(SHOUTBOX_ID)) {
if (!(BaseActivity.this instanceof ShoutboxActivity)) {
Intent intent = new Intent(BaseActivity.this, ShoutboxActivity.class);
startActivity(intent);
}
} else if (drawerItem.equals(DOWNLOADS_ID)) { } else if (drawerItem.equals(DOWNLOADS_ID)) {
if (!(BaseActivity.this instanceof DownloadsActivity)) { if (!(BaseActivity.this instanceof DownloadsActivity)) {
Intent intent = new Intent(BaseActivity.this, DownloadsActivity.class); Intent intent = new Intent(BaseActivity.this, DownloadsActivity.class);
@ -390,9 +407,9 @@ public abstract class BaseActivity extends AppCompatActivity {
}); });
if (sessionManager.isLoggedIn()) if (sessionManager.isLoggedIn())
drawerBuilder.addDrawerItems(homeItem, bookmarksItem, downloadsItem, settingsItem, loginLogoutItem, aboutItem); drawerBuilder.addDrawerItems(homeItem, shoutboxItem, bookmarksItem, downloadsItem, settingsItem, loginLogoutItem, aboutItem);
else else
drawerBuilder.addDrawerItems(homeItem, bookmarksItem, settingsItem, loginLogoutItem, aboutItem); drawerBuilder.addDrawerItems(homeItem, shoutboxItem, bookmarksItem, settingsItem, loginLogoutItem, aboutItem);
drawer = drawerBuilder.build(); drawer = drawerBuilder.build();

4
app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java

@ -6,8 +6,7 @@ import android.content.SharedPreferences;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import androidx.core.content.ContextCompat;
import android.support.v4.content.ContextCompat;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.widget.ImageView; import android.widget.ImageView;
@ -30,6 +29,7 @@ import net.gotev.uploadservice.okhttp.OkHttpStack;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import androidx.preference.PreferenceManager;
import gr.thmmy.mthmmy.BuildConfig; import gr.thmmy.mthmmy.BuildConfig;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.session.SessionManager; import gr.thmmy.mthmmy.session.SessionManager;

4
app/src/main/java/gr/thmmy/mthmmy/base/BaseFragment.java

@ -2,8 +2,8 @@ package gr.thmmy.mthmmy.base;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v4.app.Fragment; import androidx.fragment.app.Fragment;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;

109
app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java

@ -1,23 +1,20 @@
package gr.thmmy.mthmmy.editorview; package gr.thmmy.mthmmy.editorview;
import android.animation.Animator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v7.widget.AppCompatImageButton;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewPropertyAnimator;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
@ -27,12 +24,21 @@ import android.widget.PopupWindow;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import java.util.Objects; import java.util.Objects;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
public class EditorView extends LinearLayout implements EmojiInputField { public class EditorView extends LinearLayout implements EmojiInputField {
private static final int ANIMATION_DURATION = 100;
private SparseArray<String> colors = new SparseArray<>(); private SparseArray<String> colors = new SparseArray<>();
private TextInputLayout edittextWrapper; private TextInputLayout edittextWrapper;
@ -40,6 +46,7 @@ public class EditorView extends LinearLayout implements EmojiInputField {
private AppCompatImageButton emojiButton; private AppCompatImageButton emojiButton;
private AppCompatImageButton submitButton; private AppCompatImageButton submitButton;
private IEmojiKeyboard emojiKeyboard; private IEmojiKeyboard emojiKeyboard;
private RecyclerView formatButtonsRecyclerview;
public EditorView(Context context) { public EditorView(Context context) {
super(context); super(context);
@ -61,6 +68,7 @@ public class EditorView extends LinearLayout implements EmojiInputField {
LayoutInflater.from(context).inflate(R.layout.editor_view, this, true); LayoutInflater.from(context).inflate(R.layout.editor_view, this, true);
setOrientation(VERTICAL); setOrientation(VERTICAL);
formatButtonsRecyclerview = findViewById(R.id.buttons_recyclerview);
edittextWrapper = findViewById(R.id.editor_edittext_wrapper); edittextWrapper = findViewById(R.id.editor_edittext_wrapper);
editText = findViewById(R.id.editor_edittext); editText = findViewById(R.id.editor_edittext);
editText.setOnFocusChangeListener((view, focused) -> { editText.setOnFocusChangeListener((view, focused) -> {
@ -79,6 +87,7 @@ public class EditorView extends LinearLayout implements EmojiInputField {
requestEditTextFocus(); requestEditTextFocus();
} }
}); });
editText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.EditorView, 0, 0); TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.EditorView, 0, 0);
try { try {
@ -110,7 +119,6 @@ public class EditorView extends LinearLayout implements EmojiInputField {
colors.append(R.id.maroon, "maroon"); colors.append(R.id.maroon, "maroon");
colors.append(R.id.lime_green, "limegreen"); colors.append(R.id.lime_green, "limegreen");
RecyclerView formatButtonsRecyclerview = findViewById(R.id.buttons_recyclerview);
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
float itemWidth = getResources().getDimension(R.dimen.editor_format_button_size) + float itemWidth = getResources().getDimension(R.dimen.editor_format_button_size) +
getResources().getDimension(R.dimen.editor_format_button_margin_between); getResources().getDimension(R.dimen.editor_format_button_margin_between);
@ -300,6 +308,93 @@ public class EditorView extends LinearLayout implements EmojiInputField {
this.emojiKeyboard = emojiKeyboard; this.emojiKeyboard = emojiKeyboard;
} }
public void setMarkdownVisible(boolean visible) {
formatButtonsRecyclerview.setVisibility(visible ? VISIBLE : GONE);
}
public void showMarkdownOnfocus() {
edittextWrapper.setOnClickListener(view -> {
showMarkdown();
});
editText.setOnClickListener(view -> {
showMarkdown();
});
edittextWrapper.setOnFocusChangeListener((view, b) -> {
if (b) showMarkdown();
else hideMarkdown();
});
editText.setOnFocusChangeListener((view, b) -> {
if (b) showMarkdown();
else hideMarkdown();
});
}
/**
* Animates the hiding of the markdown options.
*
*/
public void hideMarkdown() {
if (formatButtonsRecyclerview.getVisibility() == GONE) return;
ViewPropertyAnimator animator = formatButtonsRecyclerview.animate()
.translationY(formatButtonsRecyclerview.getHeight())
.setInterpolator(new FastOutSlowInInterpolator())
.setDuration(ANIMATION_DURATION);
animator.setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
formatButtonsRecyclerview.setVisibility(View.GONE);
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
animator.start();
}
/**
* Animates the showing of the markdown options.
*
*/
public void showMarkdown() {
if (formatButtonsRecyclerview.getVisibility() == VISIBLE) return;
ViewPropertyAnimator animator = formatButtonsRecyclerview.animate()
.translationY(0)
.setInterpolator(new FastOutSlowInInterpolator())
.setDuration(ANIMATION_DURATION);
animator.setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
formatButtonsRecyclerview.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animator animator) {
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
animator.start();
}
public TextInputEditText getEditText() { public TextInputEditText getEditText() {
return editText; return editText;
} }

6
app/src/main/java/gr/thmmy/mthmmy/editorview/EmojiKeyboard.java

@ -2,9 +2,9 @@ package gr.thmmy.mthmmy.editorview;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.support.v7.widget.AppCompatImageButton; import androidx.appcompat.widget.AppCompatImageButton;
import android.support.v7.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;

6
app/src/main/java/gr/thmmy/mthmmy/editorview/EmojiKeyboardAdapter.java

@ -1,9 +1,9 @@
package gr.thmmy.mthmmy.editorview; package gr.thmmy.mthmmy.editorview;
import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.AnimationDrawable;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.widget.AppCompatImageButton; import androidx.appcompat.widget.AppCompatImageButton;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

6
app/src/main/java/gr/thmmy/mthmmy/editorview/FormatButtonsAdapter.java

@ -1,8 +1,8 @@
package gr.thmmy.mthmmy.editorview; package gr.thmmy.mthmmy.editorview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.v7.widget.AppCompatImageButton; import androidx.appcompat.widget.AppCompatImageButton;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

4
app/src/main/java/gr/thmmy/mthmmy/model/Bookmark.java

@ -1,7 +1,7 @@
package gr.thmmy.mthmmy.model; package gr.thmmy.mthmmy.model;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;

2
app/src/main/java/gr/thmmy/mthmmy/model/Post.java

@ -1,6 +1,6 @@
package gr.thmmy.mthmmy.model; package gr.thmmy.mthmmy.model;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;

34
app/src/main/java/gr/thmmy/mthmmy/model/Shout.java

@ -0,0 +1,34 @@
package gr.thmmy.mthmmy.model;
public class Shout {
private final String shouter, shouterProfileURL, date, shout;
private final boolean memberOfTheMonth;
public Shout(String shouter, String shouterProfileURL, String date, String shout, boolean memberOfTheMonth) {
this.shouter = shouter;
this.shouterProfileURL = shouterProfileURL;
this.date = date;
this.shout = shout;
this.memberOfTheMonth = memberOfTheMonth;
}
public String getShouter() {
return shouter;
}
public String getShouterProfileURL() {
return shouterProfileURL;
}
public String getDate() {
return date;
}
public String getShout() {
return shout;
}
public boolean isMemberOfTheMonth() {
return memberOfTheMonth;
}
}

42
app/src/main/java/gr/thmmy/mthmmy/model/Shoutbox.java

@ -0,0 +1,42 @@
package gr.thmmy.mthmmy.model;
import androidx.annotation.NonNull;
import timber.log.Timber;
public class Shoutbox {
private Shout[] shouts;
private String sc, sendShoutUrl, shoutName, shoutSend, shoutUrl;
public Shoutbox(Shout[] shouts, String sc, String sendShoutUrl, String shoutName, String shoutSend, String shoutUrl) {
this.shouts = shouts;
this.sc = sc;
this.sendShoutUrl = sendShoutUrl;
this.shoutName = shoutName;
this.shoutSend = shoutSend;
this.shoutUrl = shoutUrl;
}
public Shout[] getShouts() {
return shouts;
}
public String getSc() {
return sc;
}
public String getSendShoutUrl() {
return sendShoutUrl;
}
public String getShoutName() {
return shoutName;
}
public String getShoutSend() {
return shoutSend;
}
public String getShoutUrl() {
return shoutUrl;
}
}

8
app/src/main/java/gr/thmmy/mthmmy/services/NotificationService.java

@ -12,9 +12,9 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import android.support.v7.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage; import com.google.firebase.messaging.RemoteMessage;
@ -29,7 +29,7 @@ import gr.thmmy.mthmmy.model.Bookmark;
import gr.thmmy.mthmmy.model.PostNotification; import gr.thmmy.mthmmy.model.PostNotification;
import timber.log.Timber; import timber.log.Timber;
import static android.support.v4.app.NotificationCompat.PRIORITY_MAX; import static androidx.core.app.NotificationCompat.PRIORITY_MAX;
import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.NOTIFICATION_LED_KEY; import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.NOTIFICATION_LED_KEY;
import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.NOTIFICATION_VIBRATION_KEY; import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.NOTIFICATION_VIBRATION_KEY;
import static gr.thmmy.mthmmy.activities.settings.SettingsFragment.SELECTED_RINGTONE; import static gr.thmmy.mthmmy.activities.settings.SettingsFragment.SELECTED_RINGTONE;

5
app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java

@ -1,8 +1,8 @@
package gr.thmmy.mthmmy.session; package gr.thmmy.mthmmy.session;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import com.franmontiel.persistentcookiejar.PersistentCookieJar; import com.franmontiel.persistentcookiejar.PersistentCookieJar;
import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor; import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor;
@ -37,6 +37,7 @@ public class SessionManager {
public static final HttpUrl forumUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=forum;theme=4"); public static final HttpUrl forumUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=forum;theme=4");
private static final HttpUrl loginUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=login2"); private static final HttpUrl loginUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=login2");
public static final HttpUrl unreadUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=unread;all;start=0;theme=4"); public static final HttpUrl unreadUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=unread;all;start=0;theme=4");
public static final HttpUrl shoutboxUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=tpmod;sa=shoutbox;theme=4");
private static final String guestName = "Guest"; private static final String guestName = "Guest";
//Response Codes //Response Codes

2
app/src/main/java/gr/thmmy/mthmmy/utils/AppCompatSpinnerWithoutDefault.java

@ -2,7 +2,7 @@ package gr.thmmy.mthmmy.utils;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.support.v7.widget.AppCompatSpinner; import androidx.appcompat.widget.AppCompatSpinner;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;

2
app/src/main/java/gr/thmmy/mthmmy/utils/CenterVerticalSpan.java

@ -3,7 +3,7 @@ package gr.thmmy.mthmmy.utils;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Rect; import android.graphics.Rect;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.text.style.ReplacementSpan; import android.text.style.ReplacementSpan;
public class CenterVerticalSpan extends ReplacementSpan { public class CenterVerticalSpan extends ReplacementSpan {

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

@ -1,8 +1,8 @@
package gr.thmmy.mthmmy.utils; package gr.thmmy.mthmmy.utils;
import android.content.Context; import android.content.Context;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import timber.log.Timber; import timber.log.Timber;

6
app/src/main/java/gr/thmmy/mthmmy/utils/CustomRecyclerView.java

@ -1,9 +1,9 @@
package gr.thmmy.mthmmy.utils; package gr.thmmy.mthmmy.utils;
import android.content.Context; import android.content.Context;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.util.AttributeSet; import android.util.AttributeSet;
//Custom RecyclerView, so EdgeEffect and SwipeRefresh both work //Custom RecyclerView, so EdgeEffect and SwipeRefresh both work

2
app/src/main/java/gr/thmmy/mthmmy/utils/FileUtils.java

@ -1,6 +1,6 @@
package gr.thmmy.mthmmy.utils; package gr.thmmy.mthmmy.utils;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.webkit.MimeTypeMap; import android.webkit.MimeTypeMap;
import java.io.File; import java.io.File;

10
app/src/main/java/gr/thmmy/mthmmy/utils/ScrollAwareFABBehavior.java

@ -1,11 +1,11 @@
package gr.thmmy.mthmmy.utils; package gr.thmmy.mthmmy.utils;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.design.widget.CoordinatorLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import android.support.design.widget.Snackbar; import com.google.android.material.snackbar.Snackbar;
import android.support.v4.view.ViewCompat; import androidx.core.view.ViewCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;

10
app/src/main/java/gr/thmmy/mthmmy/utils/ScrollAwareLinearBehavior.java

@ -2,11 +2,11 @@ package gr.thmmy.mthmmy.utils;
import android.animation.Animator; import android.animation.Animator;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.design.widget.CoordinatorLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar; import com.google.android.material.snackbar.Snackbar;
import android.support.v4.view.ViewCompat; import androidx.core.view.ViewCompat;
import android.support.v4.view.animation.FastOutSlowInInterpolator; import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.ViewPropertyAnimator; import android.view.ViewPropertyAnimator;

6
app/src/main/java/gr/thmmy/mthmmy/viewmodel/BaseViewModel.java

@ -1,8 +1,8 @@
package gr.thmmy.mthmmy.viewmodel; package gr.thmmy.mthmmy.viewmodel;
import android.arch.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import android.arch.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
import gr.thmmy.mthmmy.model.Bookmark; import gr.thmmy.mthmmy.model.Bookmark;

58
app/src/main/java/gr/thmmy/mthmmy/viewmodel/ShoutboxViewModel.java

@ -0,0 +1,58 @@
package gr.thmmy.mthmmy.viewmodel;
import android.os.AsyncTask;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import gr.thmmy.mthmmy.activities.shoutbox.SendShoutTask;
import gr.thmmy.mthmmy.activities.shoutbox.ShoutboxTask;
import gr.thmmy.mthmmy.model.Shoutbox;
import gr.thmmy.mthmmy.session.SessionManager;
public class ShoutboxViewModel extends ViewModel {
private MutableLiveData<Shoutbox> shoutboxMutableLiveData = new MutableLiveData<>();
private ShoutboxTask shoutboxTask;
private ShoutboxTask.OnTaskStartedListener onShoutboxTaskStarted;
private ShoutboxTask.OnNetworkTaskFinishedListener<Shoutbox> onShoutboxTaskFinished;
private SendShoutTask.OnTaskStartedListener onSendShoutTaskStarted;
private SendShoutTask.OnNetworkTaskFinishedListener<Void> 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 sendShout(String shout) {
if (shoutboxMutableLiveData.getValue() == null) throw new IllegalStateException("Shoutbox task has not finished yet!");
Shoutbox shoutbox = shoutboxMutableLiveData.getValue();
new SendShoutTask(onSendShoutTaskStarted, onSendShoutTaskFinished)
.execute(shoutbox.getSendShoutUrl(), shout, shoutbox.getSc(),
shoutbox.getShoutName(), shoutbox.getShoutSend(), shoutbox.getShoutUrl());
}
public void setShoutbox(Shoutbox shoutbox) {
shoutboxMutableLiveData.setValue(shoutbox);
}
public MutableLiveData<Shoutbox> getShoutboxMutableLiveData() {
return shoutboxMutableLiveData;
}
public void setOnSendShoutTaskFinished(SendShoutTask.OnNetworkTaskFinishedListener<Void> onSendShoutTaskFinished) {
this.onSendShoutTaskFinished = onSendShoutTaskFinished;
}
public void setOnSendShoutTaskStarted(SendShoutTask.OnTaskStartedListener onSendShoutTaskStarted) {
this.onSendShoutTaskStarted = onSendShoutTaskStarted;
}
public void setOnShoutboxTaskFinished(ShoutboxTask.OnNetworkTaskFinishedListener<Shoutbox> onShoutboxTaskFinished) {
this.onShoutboxTaskFinished = onShoutboxTaskFinished;
}
public void setOnShoutboxTaskStarted(ShoutboxTask.OnTaskStartedListener onShoutboxTaskStarted) {
this.onShoutboxTaskStarted = onShoutboxTaskStarted;
}
}

2
app/src/main/java/gr/thmmy/mthmmy/viewmodel/TopicViewModel.java

@ -1,6 +1,6 @@
package gr.thmmy.mthmmy.viewmodel; package gr.thmmy.mthmmy.viewmodel;
import android.arch.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;

6
app/src/main/res/color/activity_main_tabs_selector.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/accent" android:state_selected="true" />
<item android:color="@color/white" android:state_selected="false" />
</selector>

5
app/src/main/res/drawable/ic_access_time_white_24dp.xml

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
</vector>

7
app/src/main/res/drawable/ic_announcement.xml

@ -0,0 +1,7 @@
<vector android:height="24dp" android:viewportHeight="297"
android:viewportWidth="297" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="#FFFFFF">
<path android:fillColor="#FF000000"
android:pathData="M282.82,107.559h-25.792V10.025c0,-4.056 -2.443,-7.711 -6.19,-9.261c-3.745,-1.555 -8.059,-0.693 -10.925,2.177C195.46,47.434 157.039,68.643 132.635,78.6C106.33,89.333 90.261,89.635 90.159,89.637H14.18c-5.536,0 -10.023,4.488 -10.023,10.024v89.631c0,5.536 4.487,10.023 10.023,10.023h10.2l37.887,91.497c1.551,3.746 5.206,6.189 9.261,6.189h55.538c0.006,-0.001 0.012,-0.001 0.02,0c5.536,0 10.023,-4.488 10.023,-10.023c0,-1.588 -0.37,-3.09 -1.025,-4.424l-33.809,-81.646c22.4,4.443 73.884,21.285 137.641,85.1c1.917,1.921 4.483,2.939 7.094,2.939c0.055,0 0.109,0 0.164,0c5.468,-0.079 9.877,-4.536 9.877,-10.023c0,-0.214 -0.006,-0.428 -0.02,-0.639l-0.002,-96.896h25.792c5.536,0 10.023,-4.488 10.023,-10.024v-53.779C292.844,112.048 288.356,107.559 282.82,107.559zM24.204,109.683h55.932v69.584H24.204V109.683zM78.226,276.952l-31.139,-75.196h33.839l31.138,75.196H78.226zM100.183,180.201v-71.452c20.889,-3.123 72.28,-16.674 136.797,-75.301v84.121v0.015v53.779c0,0.008 0,0.017 0,0.025l0.002,84.111C172.466,196.876 121.072,183.326 100.183,180.201zM272.796,161.34h-15.768v-33.732h15.768V161.34z"
android:strokeColor="#ffffff" android:strokeWidth="1"/>
</vector>

5
app/src/main/res/drawable/ic_fiber_new_white_24dp.xml

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M20,4L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,6c0,-1.11 -0.89,-2 -2,-2zM8.5,15L7.3,15l-2.55,-3.5L4.75,15L3.5,15L3.5,9h1.25l2.5,3.5L7.25,9L8.5,9v6zM13.5,10.26L11,10.26v1.12h2.5v1.26L11,12.64v1.11h2.5L13.5,15h-4L9.5,9h4v1.26zM20.5,14c0,0.55 -0.45,1 -1,1h-4c-0.55,0 -1,-0.45 -1,-1L14.5,9h1.25v4.51h1.13L16.88,9.99h1.25v3.51h1.12L19.25,9h1.25v5z"/>
</vector>

5
app/src/main/res/drawable/ic_forum_white_24dp.xml

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M21,6h-2v9L6,15v2c0,0.55 0.45,1 1,1h11l4,4L22,7c0,-0.55 -0.45,-1 -1,-1zM17,12L17,3c0,-0.55 -0.45,-1 -1,-1L3,2c-0.55,0 -1,0.45 -1,1v14l4,-4h10c0.55,0 1,-0.45 1,-1z"/>
</vector>

5
app/src/main/res/drawable/ic_refresh_white_24dp.xml

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
</vector>

22
app/src/main/res/layout-v21/activity_profile.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@ -9,14 +9,14 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.profile.ProfileActivity"> tools:context=".activities.profile.ProfileActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.design.widget.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/main_collapsing" android:id="@+id/main_collapsing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -53,9 +53,9 @@
android:textColor="@color/primary_text" android:textColor="@color/primary_text"
android:visibility="gone"/> android:visibility="gone"/>
</LinearLayout> </LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout> </com.google.android.material.appbar.CollapsingToolbarLayout>
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
@ -72,9 +72,9 @@
android:text="@string/username" android:text="@string/username"
android:textColor="@color/accent" android:textColor="@color/accent"
android:textSize="25sp"/> android:textSize="25sp"/>
</android.support.v7.widget.Toolbar> </androidx.appcompat.widget.Toolbar>
<android.support.design.widget.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/profile_tabs" android:id="@+id/profile_tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -83,9 +83,9 @@
app:tabMode="fixed" app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent" app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/white"/> app:tabTextColor="@color/white"/>
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<android.support.v4.view.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/profile_tab_container" android:id="@+id/profile_tab_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -107,7 +107,7 @@
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal"/> app:mpb_progressStyle="horizontal"/>
<android.support.design.widget.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/profile_fab" android:id="@+id/profile_fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -115,6 +115,6 @@
android:layout_margin="@dimen/fab_margins" android:layout_margin="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior" app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_pm_fab"/> app:srcCompat="@drawable/ic_pm_fab"/>
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

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

@ -9,7 +9,7 @@
android:paddingStart="4dp" android:paddingStart="4dp"
tools:ignore="SmallSp"> tools:ignore="SmallSp">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" <androidx.cardview.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -260,5 +260,5 @@
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" /> android:paddingRight="16dp" />
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </androidx.cardview.widget.CardView>
</LinearLayout> </LinearLayout>

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content" android:id="@+id/main_content"
@ -8,20 +8,20 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.AboutActivity"> tools:context=".activities.AboutActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:popupTheme="@style/ToolbarTheme" /> app:popupTheme="@style/ToolbarTheme" />
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<ScrollView <ScrollView
@ -193,4 +193,4 @@
android:foregroundGravity="center" android:foregroundGravity="center"
android:src="@drawable/fun" /> android:src="@drawable/fun" />
</FrameLayout> </FrameLayout>
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

18
app/src/main/res/layout/activity_board.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@ -9,14 +9,14 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.topic.TopicActivity"> tools:context=".activities.topic.TopicActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
@ -32,10 +32,10 @@
android:background="@null" android:background="@null"
android:contentDescription="@string/bookmark" android:contentDescription="@string/bookmark"
app:srcCompat="@drawable/ic_bookmark_false_accent_24dp"/> app:srcCompat="@drawable/ic_bookmark_false_accent_24dp"/>
</android.support.v7.widget.Toolbar> </androidx.appcompat.widget.Toolbar>
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/board_recycler_view" android:id="@+id/board_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -44,7 +44,7 @@
android:background="@color/background" android:background="@color/background"
android:scrollbars="none" android:scrollbars="none"
tools:context="gr.thmmy.mthmmy.activities.topic.TopicActivity"> tools:context="gr.thmmy.mthmmy.activities.topic.TopicActivity">
</android.support.v7.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"
@ -58,7 +58,7 @@
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal"/> app:mpb_progressStyle="horizontal"/>
<android.support.design.widget.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/board_fab" android:id="@+id/board_fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -66,6 +66,6 @@
android:layout_margin="@dimen/fab_margins" android:layout_margin="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior" app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_add_fab"/> app:srcCompat="@drawable/ic_add_fab"/>
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

16
app/src/main/res/layout/activity_bookmark.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@ -9,23 +9,23 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.topic.TopicActivity"> tools:context=".activities.topic.TopicActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:gravity="center" android:gravity="center"
app:popupTheme="@style/ToolbarTheme"> app:popupTheme="@style/ToolbarTheme">
</android.support.v7.widget.Toolbar> </androidx.appcompat.widget.Toolbar>
<android.support.design.widget.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/bookmark_tabs" android:id="@+id/bookmark_tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -35,9 +35,9 @@
app:tabMode="fixed" app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent" app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/white"/> app:tabTextColor="@color/white"/>
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<android.support.v4.view.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/bookmarks_container" android:id="@+id/bookmarks_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -54,4 +54,4 @@
app:layout_anchorGravity="bottom|center" app:layout_anchorGravity="bottom|center"
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal"/> app:mpb_progressStyle="horizontal"/>
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

18
app/src/main/res/layout/activity_create_content.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@ -12,24 +12,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:gravity="center" android:gravity="center"
app:popupTheme="@style/ToolbarTheme"> app:popupTheme="@style/ToolbarTheme">
</android.support.v7.widget.Toolbar> </androidx.appcompat.widget.Toolbar>
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/subject_input" android:id="@+id/subject_input"
android:layout_width="240dp" android:layout_width="240dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -37,14 +37,14 @@
android:layout_margin="16dp" android:layout_margin="16dp"
android:hint="@string/subject"> android:hint="@string/subject">
<android.support.design.widget.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:inputType="text"/> android:inputType="text"/>
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<gr.thmmy.mthmmy.editorview.EditorView <gr.thmmy.mthmmy.editorview.EditorView
android:id="@+id/main_content_editorview" android:id="@+id/main_content_editorview"
@ -75,4 +75,4 @@
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal" /> app:mpb_progressStyle="horizontal" />
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

21
app/src/main/res/layout/activity_downloads.xml

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@ -9,23 +10,23 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.downloads.DownloadsActivity"> tools:context=".activities.downloads.DownloadsActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:popupTheme="@style/ToolbarTheme"> app:popupTheme="@style/ToolbarTheme">
</android.support.v7.widget.Toolbar> </androidx.appcompat.widget.Toolbar>
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/downloads_recycler_view" android:id="@+id/downloads_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -34,7 +35,7 @@
android:scrollbars="none" android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="gr.thmmy.mthmmy.activities.downloads.DownloadsActivity"> tools:context="gr.thmmy.mthmmy.activities.downloads.DownloadsActivity">
</android.support.v7.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"
@ -48,7 +49,7 @@
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal"/> app:mpb_progressStyle="horizontal"/>
<!--<android.support.design.widget.FloatingActionButton <!--<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/upload_fab" android:id="@+id/upload_fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -57,6 +58,4 @@
android:layout_marginEnd="@dimen/fab_margins" android:layout_marginEnd="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior" app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_file_upload_white_24dp"/>--> app:srcCompat="@drawable/ic_file_upload_white_24dp"/>-->
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

12
app/src/main/res/layout/activity_login.xml

@ -41,7 +41,7 @@
android:layout_weight="0.45"/> android:layout_weight="0.45"/>
<!-- Username Label --> <!-- Username Label -->
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -51,7 +51,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/hint_username" android:hint="@string/hint_username"
android:inputType="textPersonName"/> android:inputType="textPersonName"/>
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<Space <Space
android:layout_width="match_parent" android:layout_width="match_parent"
@ -59,7 +59,7 @@
android:layout_weight="0.16"/> android:layout_weight="0.16"/>
<!-- Password Label --> <!-- Password Label -->
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:passwordToggleEnabled="true"> app:passwordToggleEnabled="true">
@ -70,7 +70,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/hint_password" android:hint="@string/hint_password"
android:inputType="textPassword"/> android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<Space <Space
android:layout_width="match_parent" android:layout_width="match_parent"
@ -78,7 +78,7 @@
android:layout_weight="0.5"/> android:layout_weight="0.5"/>
<!-- Login Button --> <!-- Login Button -->
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnLogin" android:id="@+id/btnLogin"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -92,7 +92,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="0.2"/> android:layout_weight="0.2"/>
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnContinueAsGuest" android:id="@+id/btnContinueAsGuest"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@ -9,13 +9,12 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.main.MainActivity"> tools:context=".activities.main.MainActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<com.google.android.material.tabs.TabLayout
<android.support.design.widget.TabLayout
android:id="@+id/tabs" android:id="@+id/tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -23,12 +22,13 @@
app:tabGravity="fill" app:tabGravity="fill"
app:tabMode="fixed" app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent" app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/white"/> app:tabTextColor="@color/white"
</android.support.design.widget.AppBarLayout> app:tabIconTint="@color/activity_main_tabs_selector" />
</com.google.android.material.appbar.AppBarLayout>
<android.support.v4.view.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

22
app/src/main/res/layout/activity_profile.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
@ -9,14 +9,14 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.profile.ProfileActivity"> tools:context=".activities.profile.ProfileActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.design.widget.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/main_collapsing" android:id="@+id/main_collapsing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -52,9 +52,9 @@
android:textColor="@color/primary_text" android:textColor="@color/primary_text"
android:visibility="gone"/> android:visibility="gone"/>
</LinearLayout> </LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout> </com.google.android.material.appbar.CollapsingToolbarLayout>
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
@ -71,9 +71,9 @@
android:text="@string/username" android:text="@string/username"
android:textColor="@color/accent" android:textColor="@color/accent"
android:textSize="25sp"/> android:textSize="25sp"/>
</android.support.v7.widget.Toolbar> </androidx.appcompat.widget.Toolbar>
<android.support.design.widget.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/profile_tabs" android:id="@+id/profile_tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -82,9 +82,9 @@
app:tabMode="fixed" app:tabMode="fixed"
app:tabSelectedTextColor="@color/accent" app:tabSelectedTextColor="@color/accent"
app:tabTextColor="@color/white"/> app:tabTextColor="@color/white"/>
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<android.support.v4.view.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/profile_tab_container" android:id="@+id/profile_tab_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -106,7 +106,7 @@
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal"/> app:mpb_progressStyle="horizontal"/>
<android.support.design.widget.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/profile_fab" android:id="@+id/profile_fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -114,6 +114,6 @@
android:layout_margin="@dimen/fab_margins" android:layout_margin="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior" app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_pm_fab"/> app:srcCompat="@drawable/ic_pm_fab"/>
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

10
app/src/main/res/layout/activity_settings.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content" android:id="@+id/main_content"
@ -8,21 +8,21 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.settings.SettingsActivity"> tools:context=".activities.settings.SettingsActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:gravity="center" android:gravity="center"
app:popupTheme="@style/ToolbarTheme" /> app:popupTheme="@style/ToolbarTheme" />
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<FrameLayout <FrameLayout
android:id="@+id/pref_container" android:id="@+id/pref_container"
@ -31,4 +31,4 @@
android:background="@color/primary_light" android:background="@color/primary_light"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

31
app/src/main/res/layout/activity_shoutbox.xml

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ToolbarTheme">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:gravity="center"
app:popupTheme="@style/ToolbarTheme" />
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ShoutboxActivity" />
</LinearLayout>

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content" android:id="@+id/main_content"
@ -13,14 +13,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
@ -34,10 +34,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:textColor="@color/white" /> android:textColor="@color/white" />
</android.support.v7.widget.Toolbar> </androidx.appcompat.widget.Toolbar>
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/topic_recycler_view" android:id="@+id/topic_recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -141,7 +141,7 @@
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal" /> app:mpb_progressStyle="horizontal" />
<android.support.design.widget.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/topic_fab" android:id="@+id/topic_fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -150,6 +150,6 @@
android:layout_marginEnd="@dimen/fab_margins" android:layout_marginEnd="@dimen/fab_margins"
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior" app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_reply" /> app:srcCompat="@drawable/ic_reply" />
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

4
app/src/main/res/layout/activity_topic_edit_row.xml

@ -8,7 +8,7 @@
android:paddingEnd="4dp" android:paddingEnd="4dp"
android:paddingStart="4dp"> android:paddingStart="4dp">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" <androidx.cardview.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -87,5 +87,5 @@
android:background="@color/card_background" android:background="@color/card_background"
card_view:hint="Post message"/> card_view:hint="Post message"/>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </androidx.cardview.widget.CardView>
</FrameLayout> </FrameLayout>

8
app/src/main/res/layout/activity_topic_poll.xml

@ -41,7 +41,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"/> android:layout_weight="1"/>
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/remove_vote_button" android:id="@+id/remove_vote_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -49,7 +49,7 @@
android:visibility="gone" android:visibility="gone"
android:layout_marginEnd="16dp"/> android:layout_marginEnd="16dp"/>
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/show_poll_results_button" android:id="@+id/show_poll_results_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -57,7 +57,7 @@
android:text="@string/show_vote_results_button" android:text="@string/show_vote_results_button"
android:visibility="gone" /> android:visibility="gone" />
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/show_poll_options_button" android:id="@+id/show_poll_options_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -65,7 +65,7 @@
android:text="@string/show_vote_options_button" android:text="@string/show_vote_options_button"
android:visibility="gone" /> android:visibility="gone" />
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/submit_button" android:id="@+id/submit_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

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

@ -9,7 +9,7 @@
android:paddingStart="4dp" android:paddingStart="4dp"
tools:ignore="SmallSp"> tools:ignore="SmallSp">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" <androidx.cardview.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -198,7 +198,8 @@
android:gravity="start" android:gravity="start"
android:text="" android:text=""
android:textColor="@color/accent" android:textColor="@color/accent"
android:textSize="11sp" /> android:textSize="11sp"
tools:text="date"/>
<TextView <TextView
android:id="@+id/post_number" android:id="@+id/post_number"
@ -259,5 +260,5 @@
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" /> android:paddingRight="16dp" />
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </androidx.cardview.widget.CardView>
</LinearLayout> </LinearLayout>

4
app/src/main/res/layout/activity_topic_quick_reply_row.xml

@ -8,7 +8,7 @@
android:paddingEnd="4dp" android:paddingEnd="4dp"
android:paddingStart="4dp"> android:paddingStart="4dp">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" <androidx.cardview.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -89,5 +89,5 @@
android:background="@color/card_background" android:background="@color/card_background"
card_view:hint="Post message" /> card_view:hint="Post message" />
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </androidx.cardview.widget.CardView>
</FrameLayout> </FrameLayout>

32
app/src/main/res/layout/activity_upload.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content" android:id="@+id/main_content"
@ -8,22 +8,22 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.upload.UploadActivity"> tools:context=".activities.upload.UploadActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:popupTheme="@style/ToolbarTheme" /> app:popupTheme="@style/ToolbarTheme" />
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<android.support.v4.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/upload_outer_scrollview" android:id="@+id/upload_outer_scrollview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -58,7 +58,7 @@
android:prompt="@string/upload_spinners_hint" /> android:prompt="@string/upload_spinners_hint" />
</LinearLayout> </LinearLayout>
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="6dp" android:layout_marginBottom="6dp"
@ -71,9 +71,9 @@
android:hint="@string/upload_title_hint" android:hint="@string/upload_title_hint"
android:inputType="text" android:inputType="text"
android:maxLength="500" /> android:maxLength="500" />
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="6dp" android:layout_marginBottom="6dp"
@ -85,9 +85,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/upload_description_hint" android:hint="@string/upload_description_hint"
android:inputType="textMultiLine" /> android:inputType="textMultiLine" />
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/upload_title_description_builder" android:id="@+id/upload_title_description_builder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -97,7 +97,7 @@
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/accent" /> android:textColor="@color/accent" />
<android.support.v7.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/upload_filename" android:id="@+id/upload_filename"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -118,7 +118,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_weight="1" />
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/upload_select_file_button" android:id="@+id/upload_select_file_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -134,7 +134,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_weight="1" />
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/upload_take_photo_button" android:id="@+id/upload_take_photo_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -146,7 +146,7 @@
android:textColor="@color/primary_text" /> android:textColor="@color/primary_text" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"
@ -160,7 +160,7 @@
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal" /> app:mpb_progressStyle="horizontal" />
<android.support.design.widget.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/upload_fab" android:id="@+id/upload_fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -170,4 +170,4 @@
app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior" app:layout_behavior="gr.thmmy.mthmmy.utils.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_file_upload_white_24dp" /> app:srcCompat="@drawable/ic_file_upload_white_24dp" />
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

28
app/src/main/res/layout/activity_upload_fields_builder.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -7,21 +7,21 @@
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
tools:context=".activities.upload.UploadFieldsBuilderActivity"> tools:context=".activities.upload.UploadFieldsBuilderActivity">
<android.support.design.widget.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top" android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolbarTheme"> android:theme="@style/ToolbarTheme">
<android.support.v7.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:gravity="center" android:gravity="center"
app:popupTheme="@style/ToolbarTheme" /> app:popupTheme="@style/ToolbarTheme" />
</android.support.design.widget.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -58,7 +58,7 @@
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.AppCompatRadioButton <androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/upload_fields_builder_radio_button_exams" android:id="@+id/upload_fields_builder_radio_button_exams"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -67,7 +67,7 @@
android:text="@string/upload_fields_builder_radio_button_exams" android:text="@string/upload_fields_builder_radio_button_exams"
android:textColor="@color/primary_text" /> android:textColor="@color/primary_text" />
<android.support.v7.widget.AppCompatRadioButton <androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/upload_fields_builder_radio_button_exam_solutions" android:id="@+id/upload_fields_builder_radio_button_exam_solutions"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -76,7 +76,7 @@
android:text="@string/upload_fields_builder_radio_button_exam_solutions" android:text="@string/upload_fields_builder_radio_button_exam_solutions"
android:textColor="@color/primary_text" /> android:textColor="@color/primary_text" />
<android.support.v7.widget.AppCompatRadioButton <androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/upload_fields_builder_radio_button_notes" android:id="@+id/upload_fields_builder_radio_button_notes"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -110,7 +110,7 @@
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.AppCompatRadioButton <androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/upload_fields_builder_radio_button_feb" android:id="@+id/upload_fields_builder_radio_button_feb"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -119,7 +119,7 @@
android:text="@string/upload_fields_builder_radio_button_feb" android:text="@string/upload_fields_builder_radio_button_feb"
android:textColor="@color/primary_text" /> android:textColor="@color/primary_text" />
<android.support.v7.widget.AppCompatRadioButton <androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/upload_fields_builder_radio_button_jun" android:id="@+id/upload_fields_builder_radio_button_jun"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -128,7 +128,7 @@
android:text="@string/upload_fields_builder_radio_button_exam_jun" android:text="@string/upload_fields_builder_radio_button_exam_jun"
android:textColor="@color/primary_text" /> android:textColor="@color/primary_text" />
<android.support.v7.widget.AppCompatRadioButton <androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/upload_fields_builder_radio_button_sept" android:id="@+id/upload_fields_builder_radio_button_sept"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -150,7 +150,7 @@
android:textColor="@color/accent" /> android:textColor="@color/accent" />
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="6dp" android:layout_marginBottom="6dp"
@ -163,9 +163,9 @@
android:ems="4" android:ems="4"
android:hint="@string/upload_fields_builder_year_hint" android:hint="@string/upload_fields_builder_year_hint"
android:inputType="number" /> android:inputType="number" />
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<android.support.v7.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/upload_fields_builder_submit" android:id="@+id/upload_fields_builder_submit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -174,4 +174,4 @@
android:textColor="@color/accent" /> android:textColor="@color/accent" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

12
app/src/main/res/layout/dialog_create_link.xml

@ -5,23 +5,23 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/link_url_input" android:id="@+id/link_url_input"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/dialog_link_url_hint"> android:hint="@string/dialog_link_url_hint">
<android.support.design.widget.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:layout_width="256dp" android:layout_width="256dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/link_text_input" android:id="@+id/link_text_input"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/dialog_link_text_hint"> android:hint="@string/dialog_link_text_hint">
<android.support.design.widget.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:layout_width="256dp" android:layout_width="256dp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
</LinearLayout> </LinearLayout>

12
app/src/main/res/layout/editor_view.xml

@ -4,7 +4,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/buttons_recyclerview" android:id="@+id/buttons_recyclerview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
@ -15,7 +15,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_marginTop="4dp"> android:layout_marginTop="4dp">
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/editor_edittext_wrapper" android:id="@+id/editor_edittext_wrapper"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -23,14 +23,14 @@
android:orientation="vertical" android:orientation="vertical"
app:hintEnabled="false"> app:hintEnabled="false">
<android.support.design.widget.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/editor_edittext" android:id="@+id/editor_edittext"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="textMultiLine" /> android:inputType="textMultiLine" />
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<android.support.v7.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/emoji_keyboard_button" android:id="@+id/emoji_keyboard_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -39,7 +39,7 @@
app:srcCompat="@drawable/ic_tag_faces_24dp" app:srcCompat="@drawable/ic_tag_faces_24dp"
android:background="?android:selectableItemBackground"/> android:background="?android:selectableItemBackground"/>
<android.support.v7.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/submit_button" android:id="@+id/submit_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

4
app/src/main/res/layout/emoji_keyboard.xml

@ -10,7 +10,7 @@
android:layout_height="1dp" android:layout_height="1dp"
android:background="#000000" /> android:background="#000000" />
<android.support.v7.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/backspace_button" android:id="@+id/backspace_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -19,7 +19,7 @@
android:padding="6dp" android:padding="6dp"
app:srcCompat="@drawable/ic_backspace_black_24dp" /> app:srcCompat="@drawable/ic_backspace_black_24dp" />
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/emoji_recyclerview" android:id="@+id/emoji_recyclerview"
android:scrollbars="vertical" android:scrollbars="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bold_button" android:id="@+id/bold_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"

4
app/src/main/res/layout/fragment_bookmarks.xml

@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/bookmarks_nested_scroll" android:id="@+id/bookmarks_nested_scroll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -21,5 +21,5 @@
android:showDividers="middle" android:showDividers="middle"
android:divider="?android:listDivider" android:divider="?android:listDivider"
android:dividerPadding="16dp"/> android:dividerPadding="16dp"/>
</android.support.v4.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</RelativeLayout> </RelativeLayout>

4
app/src/main/res/layout/fragment_forum.xml

@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh" android:id="@+id/swiperefresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -21,7 +21,7 @@
android:paddingTop="4dp" android:paddingTop="4dp"
app:layoutManager="LinearLayoutManager" app:layoutManager="LinearLayoutManager"
tools:context=".activities.main.forum.ForumFragment" /> tools:context=".activities.main.forum.ForumFragment" />
</android.support.v4.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"

4
app/src/main/res/layout/fragment_latest_posts.xml

@ -5,13 +5,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/profile_latest_posts_recycler" android:id="@+id/profile_latest_posts_recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/background" android:background="@color/background"
android:scrollbars="none"> android:scrollbars="none">
</android.support.v7.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"

5
app/src/main/res/layout/fragment_recent.xml

@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh" android:id="@+id/swiperefresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -22,7 +22,7 @@
app:layoutManager="LinearLayoutManager" app:layoutManager="LinearLayoutManager"
tools:context=".activities.main.recent.RecentFragment" tools:context=".activities.main.recent.RecentFragment"
tools:listitem="@layout/fragment_recent_row"/> tools:listitem="@layout/fragment_recent_row"/>
</android.support.v4.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"
@ -34,5 +34,4 @@
android:visibility="invisible" android:visibility="invisible"
app:mpb_indeterminateTint="@color/accent" app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal"/> app:mpb_progressStyle="horizontal"/>
</RelativeLayout> </RelativeLayout>

40
app/src/main/res/layout/fragment_shoutbox.xml

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding"
android:layout_width="match_parent"
android:layout_height="@dimen/progress_bar_height"
android:indeterminate="true"
android:visibility="invisible"
app:mpb_indeterminateTint="@color/accent"
app:mpb_progressStyle="horizontal" />
<gr.thmmy.mthmmy.utils.CustomRecyclerView
android:id="@+id/shoutbox_recyclerview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
tools:listitem="@layout/fragment_shoutbox_shout_row" />
<gr.thmmy.mthmmy.editorview.EditorView
android:id="@+id/edior_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:paddingTop="8dp"
android:visibility="gone"/>
<gr.thmmy.mthmmy.editorview.EmojiKeyboard
android:id="@+id/emoji_keyboard"
android:layout_width="match_parent"
android:layout_height="180dp"
android:visibility="gone" />
</LinearLayout>

72
app/src/main/res/layout/fragment_shoutbox_shout_row.xml

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="vertical"
card_view:cardBackgroundColor="@color/card_background"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="2dp"
card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/author_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:maxLines="1"
android:paddingTop="9dp"
android:textColor="@color/accent"
android:textStyle="bold"
tools:text="author" />
<TextView
android:id="@+id/date_time_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:textColor="@color/primary_text"
android:textSize="11sp"
tools:text="date &amp; time" />
<View
android:id="@+id/header_body_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="5dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="9dp"
android:background="@color/divider" />
<WebView
android:id="@+id/shout_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@color/card_background"
android:clickable="true"
android:focusable="true"
android:scrollbars="none"
android:text="@string/post"
tools:ignore="WebViewLayout" />
<View
android:layout_width="match_parent"
android:layout_height="9dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>

4
app/src/main/res/layout/fragment_stats.xml

@ -5,7 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
@ -85,7 +85,7 @@
android:layout_height="250dp" android:layout_height="250dp"
android:layout_marginBottom="4dp"/> android:layout_marginBottom="4dp"/>
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"

4
app/src/main/res/layout/fragment_summary.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView <androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/nested_scroll" android:id="@+id/nested_scroll"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -16,4 +16,4 @@
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

4
app/src/main/res/layout/fragment_unread.xml

@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh" android:id="@+id/swiperefresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -22,7 +22,7 @@
app:layoutManager="LinearLayoutManager" app:layoutManager="LinearLayoutManager"
tools:context=".activities.main.unread.UnreadFragment" tools:context=".activities.main.unread.UnreadFragment"
tools:listitem="@layout/fragment_unread_row"/> tools:listitem="@layout/fragment_unread_row"/>
</android.support.v4.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progressBar" android:id="@+id/progressBar"

10
app/src/main/res/menu/shoutbox_menu.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_refresh"
android:icon="@drawable/ic_refresh_white_24dp"
app:showAsAction="ifRoom"
android:title="@string/refresh">
</item>
</menu>

1
app/src/main/res/values/dimens.xml

@ -11,4 +11,5 @@
<dimen name="big_text">24sp</dimen> <dimen name="big_text">24sp</dimen>
<dimen name="editor_format_button_size">24dp</dimen> <dimen name="editor_format_button_size">24dp</dimen>
<dimen name="editor_format_button_margin_between">6dp</dimen> <dimen name="editor_format_button_margin_between">6dp</dimen>
<dimen name="refresh_label_border_radius">12dp</dimen>
</resources> </resources>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save