Browse Source

Version 1.3.1

master v1.3.1
Ezerous 8 years ago
parent
commit
ea0a575461
  1. 4
      .gitlab-ci.yml
  2. 2
      VERSION
  3. 20
      app/build.gradle
  4. 1
      app/src/main/AndroidManifest.xml
  5. 13
      app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java
  6. 5
      app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java
  7. 12
      app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java
  8. 17
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
  9. 30
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java
  10. 9
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
  11. 18
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java
  12. 32
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  13. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java
  14. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java
  15. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentAdapter.java
  16. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
  17. 28
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadAdapter.java
  18. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java
  19. 17
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
  20. 10
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java
  21. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java
  22. 10
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
  23. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java
  24. 60
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  25. 50
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  26. 11
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  27. 5
      app/src/main/java/gr/thmmy/mthmmy/base/BaseFragment.java
  28. 10
      app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java
  29. 12
      app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java
  30. 8
      app/src/main/java/gr/thmmy/mthmmy/services/DownloadService.java
  31. 5
      app/src/main/java/gr/thmmy/mthmmy/utils/CustomLinearLayoutManager.java
  32. 22
      app/src/main/java/gr/thmmy/mthmmy/utils/ScrollAwareFABBehavior.java
  33. 15
      app/src/main/java/gr/thmmy/mthmmy/utils/ScrollAwareLinearBehavior.java
  34. 9
      app/src/main/res/drawable/ic_file_download.xml
  35. 1
      app/src/main/res/layout/dialog_topic_info.xml
  36. 1
      app/src/main/res/layout/fragment_unread_mark_read_row.xml
  37. 1
      build.gradle

4
.gitlab-ci.yml

@ -1,8 +1,8 @@
image: openjdk:8-jdk
variables:
ANDROID_TARGET_SDK: "25"
ANDROID_BUILD_TOOLS: "25.0.3"
ANDROID_TARGET_SDK: "26"
ANDROID_BUILD_TOOLS: "26.0.1"
ANDROID_SDK_TOOLS: "25.2.5"
before_script:

2
VERSION

@ -1 +1 @@
1.3.0
1.3.1

20
app/build.gradle

@ -1,16 +1,16 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
vectorDrawables.useSupportLibrary = true
applicationId "gr.thmmy.mthmmy"
minSdkVersion 19
targetSdkVersion 25
versionCode 8
versionName "1.3.0"
targetSdkVersion 26
versionCode 9
versionName "1.3.1"
archivesBaseName = "mTHMMY-v$versionName"
}
@ -28,11 +28,11 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support:design:26.0.0'
compile 'com.android.support:support-v4:26.0.0'
compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:recyclerview-v7:26.0.0'
compile 'com.google.firebase:firebase-crash:10.2.6'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'

1
app/src/main/AndroidManifest.xml

@ -90,7 +90,6 @@
</activity>
<activity
android:name=".activities.downloads.DownloadsActivity"
android:launchMode="singleInstance"
android:parentActivityName=".activities.main.MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<meta-data

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

@ -6,7 +6,6 @@ import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.WebView;
@ -36,10 +35,10 @@ public class AboutActivity extends BaseActivity {
String versionName = BuildConfig.VERSION_NAME;
//Initialize appbar
appBar = (AppBarLayout) findViewById(R.id.appbar);
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.main_content);
appBar = findViewById(R.id.appbar);
coordinatorLayout = findViewById(R.id.main_content);
//Initialize toolbar
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(R.string.about);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
@ -50,10 +49,10 @@ public class AboutActivity extends BaseActivity {
createDrawer();
drawer.setSelection(ABOUT_ID);
final ScrollView mainContent = (ScrollView) findViewById(R.id.scrollview);
trollGif = (FrameLayout) findViewById(R.id.trollPicFrame);
final ScrollView mainContent = findViewById(R.id.scrollview);
trollGif = findViewById(R.id.trollPicFrame);
TextView tv = (TextView) findViewById(R.id.version);
TextView tv = findViewById(R.id.version);
if (tv != null)
tv.setText(getString(R.string.version, versionName));

5
app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java

@ -4,7 +4,6 @@ import android.content.Intent;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
@ -34,7 +33,7 @@ public class BookmarkActivity extends BaseActivity {
setContentView(R.layout.activity_bookmark);
//Initialize toolbar
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle("Bookmarks");
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
@ -45,7 +44,7 @@ public class BookmarkActivity extends BaseActivity {
createDrawer();
drawer.setSelection(BOOKMARKS_ID);
LinearLayout bookmarksLinearView = (LinearLayout) findViewById(R.id.bookmarks_container);
LinearLayout bookmarksLinearView = findViewById(R.id.bookmarks_container);
LayoutInflater layoutInflater = getLayoutInflater();
if(!getBoardsBookmarked().isEmpty()) {

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

@ -42,10 +42,10 @@ public class LoginActivity extends BaseActivity {
setContentView(R.layout.activity_login);
//Variables initialization
inputUsername = (EditText) findViewById(R.id.username);
inputPassword = (EditText) findViewById(R.id.password);
btnLogin = (AppCompatButton) findViewById(R.id.btnLogin);
AppCompatButton btnGuest = (AppCompatButton) findViewById(R.id.btnContinueAsGuest);
inputUsername = findViewById(R.id.username);
inputPassword = findViewById(R.id.password);
btnLogin = findViewById(R.id.btnLogin);
AppCompatButton btnGuest = findViewById(R.id.btnContinueAsGuest);
//Login button Click Event
btnLogin.setOnClickListener(new View.OnClickListener() {
@ -138,8 +138,8 @@ public class LoginActivity extends BaseActivity {
protected void onPreExecute() { //Show a progress dialog until done
btnLogin.setEnabled(false); //Login button shouldn't be pressed during this
spinner = (LinearLayout) findViewById(R.id.login_progress_bar);
loginContent = (ScrollView) findViewById(R.id.inner_scroll_view);
spinner = findViewById(R.id.login_progress_bar);
loginContent = findViewById(R.id.inner_scroll_view);
View view = getCurrentFocus();
if (view != null) {

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

@ -7,8 +7,6 @@ import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ProgressBar;
@ -74,9 +72,15 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
Toast.makeText(this, "An error has occurred\nAborting.", Toast.LENGTH_SHORT).show();
finish();
}
//Fixes url
{
String tmpUrlSbstr = boardUrl.replaceAll("(.+)(board=)([0-9]*)(\\.*[0-9]*).*", "$1$2$3");
if (!tmpUrlSbstr.substring(tmpUrlSbstr.indexOf("board=")).contains("."))
boardUrl = tmpUrlSbstr + ".0";
}
//Initializes graphics
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar = findViewById(R.id.toolbar);
if (boardTitle != null && !Objects.equals(boardTitle, "")) toolbar.setTitle(boardTitle);
else toolbar.setTitle("Board");
setSupportActionBar(toolbar);
@ -89,8 +93,8 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
setBoardBookmark((ImageButton) findViewById(R.id.bookmark));
createDrawer();
progressBar = (MaterialProgressBar) findViewById(R.id.progressBar);
newTopicFAB = (FloatingActionButton) findViewById(R.id.board_fab);
progressBar = findViewById(R.id.progressBar);
newTopicFAB = findViewById(R.id.board_fab);
newTopicFAB.setEnabled(false);
newTopicFAB.hide();
/*if (!sessionManager.isLoggedIn()) newTopicFAB.hide();
@ -124,7 +128,7 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
}*/
boardAdapter = new BoardAdapter(getApplicationContext(), parsedSubBoards, parsedTopics);
RecyclerView mainContent = (RecyclerView) findViewById(R.id.board_recycler_view);
RecyclerView mainContent = findViewById(R.id.board_recycler_view);
mainContent.setAdapter(boardAdapter);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
mainContent.setLayoutManager(layoutManager);
@ -165,7 +169,6 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
@Override
public void onResume() {
super.onResume();
Log.d("Boardaa", "onResume called!");
refreshBoardBookmark((ImageButton) findViewById(R.id.bookmark));
}

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

@ -275,13 +275,13 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
SubBoardViewHolder(View board) {
super(board);
boardRow = (LinearLayout) board.findViewById(R.id.child_board_row);
boardExpandable = (LinearLayout) board.findViewById(R.id.child_board_expandable);
showHideExpandable = (ImageButton) board.findViewById(R.id.child_board_expand_collapse_button);
boardTitle = (TextView) board.findViewById(R.id.child_board_title);
boardMods = (TextView) board.findViewById(R.id.child_board_mods);
boardStats = (TextView) board.findViewById(R.id.child_board_stats);
boardLastPost = (TextView) board.findViewById(R.id.child_board_last_post);
boardRow = board.findViewById(R.id.child_board_row);
boardExpandable = board.findViewById(R.id.child_board_expandable);
showHideExpandable = board.findViewById(R.id.child_board_expand_collapse_button);
boardTitle = board.findViewById(R.id.child_board_title);
boardMods = board.findViewById(R.id.child_board_mods);
boardStats = board.findViewById(R.id.child_board_stats);
boardLastPost = board.findViewById(R.id.child_board_last_post);
}
}
@ -292,13 +292,13 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
TopicViewHolder(View topic) {
super(topic);
topicRow = (LinearLayout) topic.findViewById(R.id.topic_row_linear);
topicExpandable = (LinearLayout) topic.findViewById(R.id.topic_expandable);
showHideExpandable = (ImageButton) topic.findViewById(R.id.topic_expand_collapse_button);
topicSubject = (TextView) topic.findViewById(R.id.topic_subject);
topicStartedBy = (TextView) topic.findViewById(R.id.topic_started_by);
topicStats = (TextView) topic.findViewById(R.id.topic_stats);
topicLastPost = (TextView) topic.findViewById(R.id.topic_last_post);
topicRow = topic.findViewById(R.id.topic_row_linear);
topicExpandable = topic.findViewById(R.id.topic_expandable);
showHideExpandable = topic.findViewById(R.id.topic_expand_collapse_button);
topicSubject = topic.findViewById(R.id.topic_subject);
topicStartedBy = topic.findViewById(R.id.topic_started_by);
topicStats = topic.findViewById(R.id.topic_stats);
topicLastPost = topic.findViewById(R.id.topic_last_post);
}
}
@ -313,7 +313,7 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
LoadingViewHolder(View itemView) {
super(itemView);
progressBar = (MaterialProgressBar) itemView.findViewById(R.id.recycler_progress_bar);
progressBar = itemView.findViewById(R.id.recycler_progress_bar);
}
}
}

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

@ -7,7 +7,6 @@ import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
@ -75,7 +74,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
} else downloadsUrl = downloadsIndexUrl;
//Initialize toolbar
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar = findViewById(R.id.toolbar);
if (downloadsTitle == null || Objects.equals(downloadsTitle, ""))
toolbar.setTitle("Downloads");
toolbar.setTitle(downloadsTitle);
@ -88,9 +87,9 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
createDrawer();
drawer.setSelection(DOWNLOADS_ID);
progressBar = (MaterialProgressBar) findViewById(R.id.progressBar);
progressBar = findViewById(R.id.progressBar);
recyclerView = (RecyclerView) findViewById(R.id.downloads_recycler_view);
recyclerView = findViewById(R.id.downloads_recycler_view);
recyclerView.setHasFixedSize(true);
final LinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(layoutManager);
@ -113,7 +112,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
}
});
uploadFAB = (FloatingActionButton) findViewById(R.id.download_fab);
uploadFAB = findViewById(R.id.download_fab);
uploadFAB.setEnabled(false);
uploadFAB.hide();

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

@ -174,14 +174,14 @@ class DownloadsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
DownloadViewHolder(View download) {
super(download);
upperLinear = (LinearLayout) download.findViewById(R.id.upper_linear);
downloadRow = (LinearLayout) download.findViewById(R.id.download_row);
informationExpandable = (LinearLayout) download.findViewById(R.id.child_board_expandable);
title = (TextView) download.findViewById(R.id.download_title);
subTitle = (TextView) download.findViewById(R.id.download_sub_title);
uploaderDate = (TextView) download.findViewById(R.id.download_extra_info);
extraInfo = (TextView) download.findViewById(R.id.download_uploader_date);
informationExpandableBtn = (ImageButton) download.findViewById(R.id.download_information_button);
upperLinear = download.findViewById(R.id.upper_linear);
downloadRow = download.findViewById(R.id.download_row);
informationExpandable = download.findViewById(R.id.child_board_expandable);
title = download.findViewById(R.id.download_title);
subTitle = download.findViewById(R.id.download_sub_title);
uploaderDate = download.findViewById(R.id.download_extra_info);
extraInfo = download.findViewById(R.id.download_uploader_date);
informationExpandableBtn = download.findViewById(R.id.download_information_button);
}
}
@ -190,7 +190,7 @@ class DownloadsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
LoadingViewHolder(View itemView) {
super(itemView);
progressBar = (MaterialProgressBar) itemView.findViewById(R.id.recycler_progress_bar);
progressBar = itemView.findViewById(R.id.recycler_progress_bar);
}
}
}

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

@ -26,6 +26,7 @@ import gr.thmmy.mthmmy.base.BaseActivity;
import gr.thmmy.mthmmy.model.Board;
import gr.thmmy.mthmmy.model.ThmmyPage;
import gr.thmmy.mthmmy.model.TopicSummary;
import timber.log.Timber;
import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_TITLE;
import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_URL;
@ -39,7 +40,7 @@ import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL;
public class MainActivity extends BaseActivity implements RecentFragment.RecentFragmentInteractionListener, ForumFragment.ForumFragmentInteractionListener, UnreadFragment.UnreadFragmentInteractionListener {
//-----------------------------------------CLASS VARIABLES------------------------------------------
//-----------------------------------------CLASS VARIABLES------------------------------------------
private static final int TIME_INTERVAL = 2000;
private long mBackPressed;
private SectionsPagerAdapter sectionsPagerAdapter;
@ -52,8 +53,7 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
redirectToActivityFromIntent(intentFilter);
setContentView(R.layout.activity_main);
if (sessionManager.isLoginScreenDefault())
{
if (sessionManager.isLoginScreenDefault()) {
//Go to login
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
@ -68,15 +68,15 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
sectionsPagerAdapter.addFragment(RecentFragment.newInstance(1), "RECENT");
sectionsPagerAdapter.addFragment(ForumFragment.newInstance(2), "FORUM");
if(sessionManager.isLoggedIn())
if (sessionManager.isLoggedIn())
sectionsPagerAdapter.addFragment(UnreadFragment.newInstance(3), "UNREAD");
//Set up the ViewPager with the sections adapter.
viewPager = (ViewPager) findViewById(R.id.container);
viewPager = findViewById(R.id.container);
viewPager.setAdapter(sectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
TabLayout tabLayout = findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
setMainActivity(this);
@ -129,13 +129,13 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
@Override
public void onUnreadFragmentInteraction(TopicSummary topicSummary) {
if (topicSummary.getLastUser() == null && topicSummary.getDateTimeModified() == null) {
return; //TODO!
}
if (topicSummary.getTopicUrl() != null) {
Intent i = new Intent(MainActivity.this, TopicActivity.class);
i.putExtra(BUNDLE_TOPIC_URL, topicSummary.getTopicUrl());
i.putExtra(BUNDLE_TOPIC_TITLE, topicSummary.getSubject());
startActivity(i);
} else
Timber.e("onUnreadFragmentInteraction TopicSummary came without a link");
}
//---------------------------------FragmentPagerAdapter---------------------------------------------
@ -164,8 +164,8 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
fragmentList.remove(position);
fragmentTitleList.remove(position);
notifyDataSetChanged();
if(viewPager.getCurrentItem()==position)
viewPager.setCurrentItem(position-1);
if (viewPager.getCurrentItem() == position)
viewPager.setCurrentItem(position - 1);
}
@Override
@ -185,16 +185,16 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
@Override
public int getItemPosition(Object object) {
int position = fragmentList.indexOf(object);
@SuppressWarnings("RedundantCast")
int position = fragmentList.indexOf((Fragment) object);
return position == -1 ? POSITION_NONE : position;
}
}
public void updateTabs()
{
if(!sessionManager.isLoggedIn()&&sectionsPagerAdapter.getCount()==3)
public void updateTabs() {
if (!sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 3)
sectionsPagerAdapter.removeFragment(2);
else if(sessionManager.isLoggedIn()&&sectionsPagerAdapter.getCount()==2)
else if (sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 2)
sectionsPagerAdapter.addFragment(UnreadFragment.newInstance(3), "UNREAD");
}
//-------------------------------FragmentPagerAdapter END-------------------------------------------

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

@ -70,7 +70,7 @@ class ForumAdapter extends ExpandableRecyclerAdapter<Category, Board, ForumAdapt
CategoryViewHolder(View itemView) {
super(itemView);
categoryTextview = (TextView) itemView.findViewById(R.id.category);
categoryTextview = itemView.findViewById(R.id.category);
}
void bind(Category category) {
@ -86,7 +86,7 @@ class ForumAdapter extends ExpandableRecyclerAdapter<Category, Board, ForumAdapt
BoardViewHolder(View itemView) {
super(itemView);
boardTextView = (TextView) itemView.findViewById(R.id.board);
boardTextView = itemView.findViewById(R.id.board);
}
void bind(final Board board) {

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

@ -98,7 +98,7 @@ public class ForumFragment extends BaseFragment {
// Set the adapter
if (rootView instanceof RelativeLayout) {
progressBar = (MaterialProgressBar) rootView.findViewById(R.id.progressBar);
progressBar = rootView.findViewById(R.id.progressBar);
forumAdapter = new ForumAdapter(getContext(), categories, fragmentInteractionListener);
forumAdapter.setExpandCollapseListener(new ExpandableRecyclerAdapter.ExpandCollapseListener() {
@Override
@ -124,7 +124,7 @@ public class ForumFragment extends BaseFragment {
}
});
CustomRecyclerView recyclerView = (CustomRecyclerView) rootView.findViewById(R.id.list);
CustomRecyclerView recyclerView = rootView.findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(rootView.findViewById(R.id.list).getContext());
recyclerView.setLayoutManager(linearLayoutManager);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
@ -132,7 +132,7 @@ public class ForumFragment extends BaseFragment {
recyclerView.addItemDecoration(dividerItemDecoration);
recyclerView.setAdapter(forumAdapter);
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swiperefresh);
swipeRefreshLayout = rootView.findViewById(R.id.swiperefresh);
swipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override

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

@ -77,9 +77,9 @@ class RecentAdapter extends RecyclerView.Adapter<RecentAdapter.ViewHolder> {
ViewHolder(View view) {
super(view);
mView = view;
mTitleView = (TextView) view.findViewById(R.id.title);
mUserView = (TextView) view.findViewById(R.id.lastUser);
mDateTimeView = (TextView) view.findViewById(R.id.dateTime);
mTitleView = view.findViewById(R.id.title);
mUserView = view.findViewById(R.id.lastUser);
mDateTimeView = view.findViewById(R.id.dateTime);
}
}
}

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

@ -95,10 +95,10 @@ public class RecentFragment extends BaseFragment {
// Set the adapter
if (rootView instanceof RelativeLayout) {
progressBar = (MaterialProgressBar) rootView.findViewById(R.id.progressBar);
progressBar = rootView.findViewById(R.id.progressBar);
recentAdapter = new RecentAdapter(getActivity(), topicSummaries, fragmentInteractionListener);
CustomRecyclerView recyclerView = (CustomRecyclerView) rootView.findViewById(R.id.list);
CustomRecyclerView recyclerView = rootView.findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(rootView.findViewById(R.id.list).getContext());
recyclerView.setLayoutManager(linearLayoutManager);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
@ -106,7 +106,7 @@ public class RecentFragment extends BaseFragment {
recyclerView.addItemDecoration(dividerItemDecoration);
recyclerView.setAdapter(recentAdapter);
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swiperefresh);
swipeRefreshLayout = rootView.findViewById(R.id.swiperefresh);
swipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override

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

@ -58,18 +58,18 @@ class UnreadAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
if (holder instanceof UnreadAdapter.EmptyViewHolder) {
final UnreadAdapter.EmptyViewHolder emptyViewHolder = (UnreadAdapter.EmptyViewHolder) holder;
emptyViewHolder.text.setText(unreadList.get(position).getDateTimeModified());
emptyViewHolder.text.setText(unreadList.get(holder.getAdapterPosition()).getDateTimeModified());
} else if (holder instanceof UnreadAdapter.ViewHolder) {
final UnreadAdapter.ViewHolder viewHolder = (UnreadAdapter.ViewHolder) holder;
viewHolder.mTitleView.setText(unreadList.get(position).getSubject());
viewHolder.mDateTimeView.setText(unreadList.get(position).getDateTimeModified());
viewHolder.mTitleView.setText(unreadList.get(holder.getAdapterPosition()).getSubject());
viewHolder.mDateTimeView.setText(unreadList.get(holder.getAdapterPosition()).getDateTimeModified());
viewHolder.mUserView.setText(context.getString(R.string.byUser, unreadList.get(position).getLastUser()));
viewHolder.topic = unreadList.get(position);
viewHolder.topic = unreadList.get(holder.getAdapterPosition());
viewHolder.mView.setOnClickListener(new View.OnClickListener() {
@Override
@ -83,8 +83,8 @@ class UnreadAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
});
} else if (holder instanceof UnreadAdapter.MarkReadViewHolder) {
final UnreadAdapter.MarkReadViewHolder markReadViewHolder = (UnreadAdapter.MarkReadViewHolder) holder;
markReadViewHolder.text.setText(unreadList.get(position).getSubject());
markReadViewHolder.topic = unreadList.get(position);
markReadViewHolder.text.setText(unreadList.get(holder.getAdapterPosition()).getSubject());
markReadViewHolder.topic = unreadList.get(holder.getAdapterPosition());
markReadViewHolder.mView.setOnClickListener(new View.OnClickListener() {
@Override
@ -92,7 +92,7 @@ class UnreadAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
if (null != mListener) {
// Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that an item has been selected.
markReadListener.onMarkReadInteraction(unreadList.get(position).getTopicUrl());
markReadListener.onMarkReadInteraction(unreadList.get(holder.getAdapterPosition()).getTopicUrl());
}
}
});
@ -114,9 +114,9 @@ class UnreadAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
ViewHolder(View view) {
super(view);
mView = view;
mTitleView = (TextView) view.findViewById(R.id.title);
mUserView = (TextView) view.findViewById(R.id.lastUser);
mDateTimeView = (TextView) view.findViewById(R.id.dateTime);
mTitleView = view.findViewById(R.id.title);
mUserView = view.findViewById(R.id.lastUser);
mDateTimeView = view.findViewById(R.id.dateTime);
}
}
@ -125,7 +125,7 @@ class UnreadAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
EmptyViewHolder(View view) {
super(view);
text = (TextView) view.findViewById(R.id.text);
text = view.findViewById(R.id.text);
}
}
@ -137,11 +137,11 @@ class UnreadAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
MarkReadViewHolder(View view) {
super(view);
mView = view;
text = (TextView) view.findViewById(R.id.mark_read);
text = view.findViewById(R.id.mark_read);
}
}
public interface MarkReadInteractionListener {
interface MarkReadInteractionListener {
void onMarkReadInteraction(String markReadLinkUrl);
}
}

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

@ -98,7 +98,7 @@ public class UnreadFragment extends BaseFragment {
// Set the adapter
if (rootView instanceof RelativeLayout) {
progressBar = (MaterialProgressBar) rootView.findViewById(R.id.progressBar);
progressBar = rootView.findViewById(R.id.progressBar);
unreadAdapter = new UnreadAdapter(getActivity(), topicSummaries,
fragmentInteractionListener, new UnreadAdapter.MarkReadInteractionListener() {
@Override
@ -110,7 +110,7 @@ public class UnreadFragment extends BaseFragment {
}
});
CustomRecyclerView recyclerView = (CustomRecyclerView) rootView.findViewById(R.id.list);
CustomRecyclerView recyclerView = rootView.findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(rootView.findViewById(R.id.list).getContext());
recyclerView.setLayoutManager(linearLayoutManager);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
@ -118,7 +118,7 @@ public class UnreadFragment extends BaseFragment {
recyclerView.addItemDecoration(dividerItemDecoration);
recyclerView.setAdapter(unreadAdapter);
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swiperefresh);
swipeRefreshLayout = rootView.findViewById(R.id.swiperefresh);
swipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override

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

@ -13,7 +13,6 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
@ -105,7 +104,7 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
profileUrl = extras.getString(BUNDLE_PROFILE_URL);
//Initializes graphic elements
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(null);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
@ -115,9 +114,9 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
createDrawer();
progressBar = (MaterialProgressBar) findViewById(R.id.progressBar);
progressBar = findViewById(R.id.progressBar);
thumbnailView = (ImageView) findViewById(R.id.user_thumbnail);
thumbnailView = findViewById(R.id.user_thumbnail);
if (!Objects.equals(thumbnailUrl, ""))
//noinspection ConstantConditions
Picasso.with(this)
@ -130,15 +129,15 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
, R.drawable.ic_default_user_thumbnail, null))
.transform(new CircleTransform())
.into(thumbnailView);
usernameView = (TextView) findViewById(R.id.profile_activity_username);
usernameView = findViewById(R.id.profile_activity_username);
usernameView.setTypeface(Typeface.createFromAsset(this.getAssets()
, "fonts/fontawesome-webfont.ttf"));
if (username != null && !Objects.equals(username, "")) usernameView.setText(username);
personalTextView = (TextView) findViewById(R.id.profile_activity_personal_text);
personalTextView = findViewById(R.id.profile_activity_personal_text);
viewPager = (ViewPager) findViewById(R.id.profile_tab_container);
viewPager = findViewById(R.id.profile_tab_container);
pmFAB = (FloatingActionButton) findViewById(R.id.profile_fab);
pmFAB = findViewById(R.id.profile_fab);
pmFAB.setEnabled(false);
pmFAB.hide();
/*if (!sessionManager.isLoggedIn()) pmFAB.hide();
@ -311,7 +310,7 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
}
setupViewPager(viewPager, profilePage);
TabLayout tabLayout = (TabLayout) findViewById(R.id.profile_tabs);
TabLayout tabLayout = findViewById(R.id.profile_tabs);
tabLayout.setupWithViewPager(viewPager);
if (tabSelect != 0) {
TabLayout.Tab tab = tabLayout.getTabAt(tabSelect);

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

@ -97,10 +97,10 @@ class LatestPostsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
LatestPostViewHolder(View itemView) {
super(itemView);
latestPostsRow = (RelativeLayout) itemView.findViewById(R.id.latest_posts_row);
postTitle = (TextView) itemView.findViewById(R.id.title);
postDate = (TextView) itemView.findViewById(R.id.date);
post = (WebView) itemView.findViewById(R.id.post);
latestPostsRow = itemView.findViewById(R.id.latest_posts_row);
postTitle = itemView.findViewById(R.id.title);
postDate = itemView.findViewById(R.id.date);
post = itemView.findViewById(R.id.post);
}
}
@ -109,7 +109,7 @@ class LatestPostsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
LoadingViewHolder(View itemView) {
super(itemView);
progressBar = (MaterialProgressBar) itemView.findViewById(R.id.recycler_progress_bar);
progressBar = itemView.findViewById(R.id.recycler_progress_bar);
}
}
}

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

@ -33,7 +33,7 @@ import timber.log.Timber;
/**
* Use the {@link LatestPostsFragment#newInstance} factory method to create an instance of this fragment.
*/
public class LatestPostsFragment extends BaseFragment implements LatestPostsAdapter.OnLoadMoreListener{
public class LatestPostsFragment extends BaseFragment implements LatestPostsAdapter.OnLoadMoreListener {
/**
* The key to use when putting profile's url String to {@link LatestPostsFragment}'s Bundle.
*/
@ -84,7 +84,7 @@ public class LatestPostsFragment extends BaseFragment implements LatestPostsAdap
Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_latest_posts, container, false);
latestPostsAdapter = new LatestPostsAdapter(fragmentInteractionListener, parsedTopicSummaries);
RecyclerView mainContent = (RecyclerView) rootView.findViewById(R.id.profile_latest_posts_recycler);
RecyclerView mainContent = rootView.findViewById(R.id.profile_latest_posts_recycler);
mainContent.setAdapter(latestPostsAdapter);
final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
mainContent.setLayoutManager(layoutManager);
@ -106,7 +106,7 @@ public class LatestPostsFragment extends BaseFragment implements LatestPostsAdap
}
}
});
progressBar = (MaterialProgressBar) rootView.findViewById(R.id.progressBar);
progressBar = rootView.findViewById(R.id.progressBar);
return rootView;
}

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

@ -90,8 +90,8 @@ public class StatsFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_stats, container, false);
mainContent = (LinearLayout) rootView.findViewById(R.id.main_content);
progressBar = (MaterialProgressBar) rootView.findViewById(R.id.progressBar);
mainContent = rootView.findViewById(R.id.main_content);
progressBar = rootView.findViewById(R.id.progressBar);
if (haveParsed)
populateLayout();
return rootView;
@ -224,7 +224,7 @@ public class StatsFragment extends Fragment {
((TextView) mainContent.findViewById(R.id.posting_activity_by_time_title))
.setText(postingActivityByTimeTitle);
LineChart postingActivityByTimeChart = (LineChart) mainContent
LineChart postingActivityByTimeChart = mainContent
.findViewById(R.id.posting_activity_by_time_chart);
postingActivityByTimeChart.setDescription(null);
postingActivityByTimeChart.getLegend().setEnabled(false);
@ -257,7 +257,7 @@ public class StatsFragment extends Fragment {
((TextView) mainContent.findViewById(R.id.most_popular_boards_by_posts_title))
.setText(mostPopularBoardsByPostsTitle);
HorizontalBarChart mostPopularBoardsByPostsChart = (HorizontalBarChart) mainContent.
HorizontalBarChart mostPopularBoardsByPostsChart = mainContent.
findViewById(R.id.most_popular_boards_by_posts_chart);
mostPopularBoardsByPostsChart.setDescription(null);
mostPopularBoardsByPostsChart.getLegend().setEnabled(false);
@ -298,7 +298,7 @@ public class StatsFragment extends Fragment {
((TextView) mainContent.findViewById(R.id.most_popular_boards_by_activity_title))
.setText(mostPopularBoardsByActivityTitle);
HorizontalBarChart mostPopularBoardsByActivityChart = (HorizontalBarChart) mainContent.
HorizontalBarChart mostPopularBoardsByActivityChart = mainContent.
findViewById(R.id.most_popular_boards_by_activity_chart);
mostPopularBoardsByActivityChart.setDescription(null);
mostPopularBoardsByActivityChart.getLegend().setEnabled(false);

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

@ -77,7 +77,7 @@ public class SummaryFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_summary, container, false);
mainContent = (LinearLayout) rootView.findViewById(R.id.profile_activity_content);
mainContent = rootView.findViewById(R.id.profile_activity_content);
if (!parsedProfileSummaryData.isEmpty() && isAdded())
populateLayout();
return rootView;

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

@ -11,7 +11,6 @@ import android.os.Handler;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@ -143,8 +142,8 @@ public class TopicActivity extends BaseActivity {
thisPageBookmark = new Bookmark(topicTitle, ThmmyPage.getTopicId(topicPageUrl));
//Initializes graphics
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
toolbar = findViewById(R.id.toolbar);
toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
toolbarTitle.setSingleLine(true);
toolbarTitle.setEllipsize(TextUtils.TruncateAt.MARQUEE);
toolbarTitle.setMarqueeRepeatLimit(-1);
@ -162,11 +161,11 @@ public class TopicActivity extends BaseActivity {
createDrawer();
progressBar = (MaterialProgressBar) findViewById(R.id.progressBar);
progressBar = findViewById(R.id.progressBar);
postsList = new ArrayList<>();
recyclerView = (RecyclerView) findViewById(R.id.topic_recycler_view);
recyclerView = findViewById(R.id.topic_recycler_view);
recyclerView.setHasFixedSize(true);
recyclerView.setOnTouchListener(
new View.OnTouchListener() {
@ -183,9 +182,9 @@ public class TopicActivity extends BaseActivity {
topicAdapter = new TopicAdapter(this, postsList, topicTask);
recyclerView.setAdapter(topicAdapter);
replyFAB = (FloatingActionButton) findViewById(R.id.topic_fab);
replyFAB = findViewById(R.id.topic_fab);
replyFAB.setEnabled(false);
bottomNavBar = (LinearLayout) findViewById(R.id.bottom_navigation_bar);
bottomNavBar = findViewById(R.id.bottom_navigation_bar);
if (!sessionManager.isLoggedIn()) replyFAB.hide();
else {
replyFAB.setOnClickListener(new View.OnClickListener() {
@ -204,11 +203,11 @@ public class TopicActivity extends BaseActivity {
}
//Sets bottom navigation bar
firstPage = (ImageButton) findViewById(R.id.page_first_button);
previousPage = (ImageButton) findViewById(R.id.page_previous_button);
pageIndicator = (TextView) findViewById(R.id.page_indicator);
nextPage = (ImageButton) findViewById(R.id.page_next_button);
lastPage = (ImageButton) findViewById(R.id.page_last_button);
firstPage = findViewById(R.id.page_first_button);
previousPage = findViewById(R.id.page_previous_button);
pageIndicator = findViewById(R.id.page_indicator);
nextPage = findViewById(R.id.page_next_button);
lastPage = findViewById(R.id.page_last_button);
initDecrementButton(firstPage, LARGE_STEP);
initDecrementButton(previousPage, SMALL_STEP);
@ -242,11 +241,10 @@ public class TopicActivity extends BaseActivity {
LayoutInflater inflater = this.getLayoutInflater();
LinearLayout infoDialog = (LinearLayout) inflater.inflate(R.layout.dialog_topic_info
, null);
((TextView) infoDialog.findViewById(R.id.dialog_title)).setText("Info");
TextView treeAndMods = (TextView) infoDialog.findViewById(R.id.topic_tree_and_mods);
TextView treeAndMods = infoDialog.findViewById(R.id.topic_tree_and_mods);
treeAndMods.setText(topicTreeAndMods);
treeAndMods.setMovementMethod(LinkMovementMethod.getInstance());
TextView usersViewing = (TextView) infoDialog.findViewById(R.id.users_viewing);
TextView usersViewing = infoDialog.findViewById(R.id.users_viewing);
usersViewing.setText(topicViewers);
usersViewing.setMovementMethod(LinkMovementMethod.getInstance());
@ -318,25 +316,25 @@ public class TopicActivity extends BaseActivity {
lastPage.setEnabled(enabled);
}
private void paginationEnabledExcept(boolean enabled, View exception) {
private void paginationDisable(View exception) {
if (exception == firstPage) {
previousPage.setEnabled(enabled);
nextPage.setEnabled(enabled);
lastPage.setEnabled(enabled);
previousPage.setEnabled(false);
nextPage.setEnabled(false);
lastPage.setEnabled(false);
} else if (exception == previousPage) {
firstPage.setEnabled(enabled);
nextPage.setEnabled(enabled);
lastPage.setEnabled(enabled);
firstPage.setEnabled(false);
nextPage.setEnabled(false);
lastPage.setEnabled(false);
} else if (exception == nextPage) {
firstPage.setEnabled(enabled);
previousPage.setEnabled(enabled);
lastPage.setEnabled(enabled);
firstPage.setEnabled(false);
previousPage.setEnabled(false);
lastPage.setEnabled(false);
} else if (exception == lastPage) {
firstPage.setEnabled(enabled);
previousPage.setEnabled(enabled);
nextPage.setEnabled(enabled);
firstPage.setEnabled(false);
previousPage.setEnabled(false);
nextPage.setEnabled(false);
} else {
paginationEnabled(enabled);
paginationEnabled(false);
}
}
@ -357,7 +355,7 @@ public class TopicActivity extends BaseActivity {
increment.setOnLongClickListener(
new View.OnLongClickListener() {
public boolean onLongClick(View arg0) {
paginationEnabledExcept(false, arg0);
paginationDisable(arg0);
autoIncrement = true;
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), INITIAL_DELAY);
return false;
@ -405,7 +403,7 @@ public class TopicActivity extends BaseActivity {
decrement.setOnLongClickListener(
new View.OnLongClickListener() {
public boolean onLongClick(View arg0) {
paginationEnabledExcept(false, arg0);
paginationDisable(arg0);
autoDecrement = true;
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), INITIAL_DELAY);
return false;

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

@ -139,7 +139,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
inflate(R.layout.activity_topic_quick_reply_row, parent, false);
view.findViewById(R.id.quick_reply_submit).setEnabled(true);
final EditText quickReplyText = (EditText) view.findViewById(R.id.quick_reply_text);
final EditText quickReplyText = view.findViewById(R.id.quick_reply_text);
quickReplyText.setFocusableInTouchMode(true);
quickReplyText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
@ -511,29 +511,29 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
super(view);
//Initializes layout's graphic elements
//Standard stuff
cardView = (CardView) view.findViewById(R.id.card_view);
cardChildLinear = (LinearLayout) view.findViewById(R.id.card_child_linear);
postDateAndNumber = (FrameLayout) view.findViewById(R.id.post_date_and_number_exp);
postDate = (TextView) view.findViewById(R.id.post_date);
postNum = (TextView) view.findViewById(R.id.post_number);
thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
username = (TextView) view.findViewById(R.id.username);
subject = (TextView) view.findViewById(R.id.subject);
post = (WebView) view.findViewById(R.id.post);
cardView = view.findViewById(R.id.card_view);
cardChildLinear = view.findViewById(R.id.card_child_linear);
postDateAndNumber = view.findViewById(R.id.post_date_and_number_exp);
postDate = view.findViewById(R.id.post_date);
postNum = view.findViewById(R.id.post_number);
thumbnail = view.findViewById(R.id.thumbnail);
username = view.findViewById(R.id.username);
subject = view.findViewById(R.id.subject);
post = view.findViewById(R.id.post);
post.setBackgroundColor(Color.argb(1, 255, 255, 255));
quoteToggle = (ImageButton) view.findViewById(R.id.toggle_quote_button);
quoteToggle = view.findViewById(R.id.toggle_quote_button);
bodyFooterDivider = view.findViewById(R.id.body_footer_divider);
postFooter = (LinearLayout) view.findViewById(R.id.post_footer);
postFooter = view.findViewById(R.id.post_footer);
//User's extra info
header = (RelativeLayout) view.findViewById(R.id.header);
userExtraInfo = (LinearLayout) view.findViewById(R.id.user_extra_info);
specialRank = (TextView) view.findViewById(R.id.special_rank);
rank = (TextView) view.findViewById(R.id.rank);
gender = (TextView) view.findViewById(R.id.gender);
numberOfPosts = (TextView) view.findViewById(R.id.number_of_posts);
personalText = (TextView) view.findViewById(R.id.personal_text);
stars = (TextView) view.findViewById(R.id.stars);
header = view.findViewById(R.id.header);
userExtraInfo = view.findViewById(R.id.user_extra_info);
specialRank = view.findViewById(R.id.special_rank);
rank = view.findViewById(R.id.rank);
gender = view.findViewById(R.id.gender);
numberOfPosts = view.findViewById(R.id.number_of_posts);
personalText = view.findViewById(R.id.personal_text);
stars = view.findViewById(R.id.stars);
}
}
@ -550,15 +550,15 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
QuickReplyViewHolder(View quickReply, CustomEditTextListener replySubject
, CustomEditTextListener replyText) {
super(quickReply);
thumbnail = (ImageView) quickReply.findViewById(R.id.thumbnail);
username = (TextView) quickReply.findViewById(R.id.username);
this.quickReply = (EditText) quickReply.findViewById(R.id.quick_reply_text);
thumbnail = quickReply.findViewById(R.id.thumbnail);
username = quickReply.findViewById(R.id.username);
this.quickReply = quickReply.findViewById(R.id.quick_reply_text);
this.replyText = replyText;
this.quickReply.addTextChangedListener(replyText);
quickReplySubject = (EditText) quickReply.findViewById(R.id.quick_reply_subject);
quickReplySubject = quickReply.findViewById(R.id.quick_reply_subject);
this.replySubject = replySubject;
quickReplySubject.addTextChangedListener(replySubject);
submitButton = (AppCompatImageButton) quickReply.findViewById(R.id.quick_reply_submit);
submitButton = quickReply.findViewById(R.id.quick_reply_submit);
}
}

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

@ -138,10 +138,8 @@ public abstract class BaseActivity extends AppCompatActivity {
private AccountHeader accountHeader;
private ProfileDrawerItem profileDrawerItem;
private PrimaryDrawerItem homeItem, downloadsItem, bookmarksItem, loginLogoutItem, aboutItem;
private IconicsDrawable homeIcon, homeIconSelected, downloadsIcon, downloadsIconSelected,
bookmarksIcon, bookmarksIconSelected, loginIcon, logoutIcon, aboutIcon,
aboutIconSelected;
private PrimaryDrawerItem downloadsItem, loginLogoutItem;
private IconicsDrawable loginIcon, logoutIcon;
/**
* Call only after initializing Toolbar
@ -151,6 +149,11 @@ public abstract class BaseActivity extends AppCompatActivity {
final int selectedPrimaryColor = ContextCompat.getColor(this, R.color.primary_dark);
final int selectedSecondaryColor = ContextCompat.getColor(this, R.color.accent);
PrimaryDrawerItem homeItem, bookmarksItem, aboutItem;
IconicsDrawable homeIcon, homeIconSelected, downloadsIcon, downloadsIconSelected,
bookmarksIcon, bookmarksIconSelected, aboutIcon,
aboutIconSelected;
//Drawer Icons
homeIcon = new IconicsDrawable(this)
.icon(FontAwesome.Icon.faw_home)

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

@ -13,15 +13,12 @@ public abstract class BaseFragment extends Fragment {
protected FragmentInteractionListener fragmentInteractionListener;
private String TAG;
private int sectionNumber;
protected static OkHttpClient client;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TAG = getArguments().getString(ARG_TAG);
sectionNumber = getArguments().getInt(ARG_SECTION_NUMBER);
//int sectionNumber = getArguments().getInt(ARG_SECTION_NUMBER);
if (client == null)
client = BaseApplication.getInstance().getClient(); //must check every time - e.g.
// becomes null when app restarts after crash

10
app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java

@ -162,7 +162,7 @@ public class ThmmyPage {
|| Objects.equals(uriString, "https://www.thmmy.gr")
|| Objects.equals(uriString, "https://www.thmmy.gr/smf/index.php"))
return PageCategory.INDEX;
Timber.v("Unknown thmmy link found, link: %s" , uriString);
Timber.v("Unknown thmmy link found, link: %s", uriString);
return PageCategory.UNKNOWN_THMMY;
}
return PageCategory.NOT_THMMY;
@ -172,7 +172,7 @@ public class ThmmyPage {
if (resolvePageCategory(Uri.parse(boardUrl)) == PageCategory.BOARD) {
String returnString = boardUrl.substring(boardUrl.indexOf("board=") + 6);
if (returnString.contains("."))
returnString = boardUrl.substring(boardUrl.indexOf("board=") + 6, boardUrl.lastIndexOf("."));
returnString = returnString.substring(0, returnString.indexOf("."));
return returnString;
}
return null;
@ -180,8 +180,10 @@ public class ThmmyPage {
public static String getTopicId(String topicUrl) {
if (resolvePageCategory(Uri.parse(topicUrl)) == PageCategory.TOPIC) {
String tmp = topicUrl.substring(topicUrl.indexOf("topic=") + 6);
return tmp.substring(0, tmp.indexOf("."));
String returnString = topicUrl.substring(topicUrl.indexOf("topic=") + 6);
if (returnString.contains("."))
returnString = returnString.substring(0, returnString.indexOf("."));
return returnString;
}
return null;
}

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

@ -29,8 +29,7 @@ import static gr.thmmy.mthmmy.services.DownloadService.STARTED;
public class Receiver extends BroadcastReceiver {
public Receiver() {
}
public Receiver() {}
@Override
public void onReceive(Context context, Intent intent) {
@ -48,11 +47,11 @@ public class Receiver extends BroadcastReceiver {
builder.setContentTitle(title)
.setContentText(text)
.setTicker(ticker)
.setAutoCancel(true)
.setSmallIcon(R.drawable.ic_file_download);
.setAutoCancel(true);
if (state.equals(STARTED))
builder.setOngoing(true);
builder.setOngoing(true)
.setSmallIcon(android.R.drawable.stat_sys_download);
else if (state.equals(COMPLETED)) {
String fileName = extras.getString(EXTRA_FILE_NAME, "NONE");
@ -68,7 +67,8 @@ public class Receiver extends BroadcastReceiver {
Intent chooser = Intent.createChooser(chooserIntent, "Open With...");
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, chooser, PendingIntent.FLAG_CANCEL_CURRENT);
builder.setContentIntent(pendingIntent);
builder.setContentIntent(pendingIntent)
.setSmallIcon(android.R.drawable.stat_sys_download_done);
} else
Timber.w("File doesn't exist.");

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

@ -106,9 +106,9 @@ public class DownloadService extends IntentService {
Request request = new Request.Builder().url(downloadLink).build();
Response response = client.newCall(request).execute();
String contentType = response.headers("Content-Type").toString(); //check if link provides a binary file
if (contentType.equals("[application/octet-stream]")) {
fileName = response.headers("Content-Disposition").toString().split("\"")[1];
String contentDisposition = response.headers("Content-Disposition").toString(); //check if link provides an attachment
if (contentDisposition.contains("attachment")){
fileName = contentDisposition.split("\"")[1];
File dirPath = new File(SAVE_DIR);
if (!dirPath.isDirectory()) {
@ -150,7 +150,7 @@ public class DownloadService extends IntentService {
Timber.i("Download OK!");
sendNotification(downloadId, COMPLETED, fileName);
} else
Timber.e("Response not a binary file!");
Timber.e("No attachment in response!");
} catch (FileNotFoundException e) {
Timber.i("Download failed...");
Timber.e(e, "FileNotFound");

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

@ -3,12 +3,11 @@ package gr.thmmy.mthmmy.utils;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import timber.log.Timber;
public class CustomLinearLayoutManager extends LinearLayoutManager {
private String pageUrl;
private final String pageUrl;
public CustomLinearLayoutManager(Context context, String pageUrl) {
super(context);
@ -21,8 +20,6 @@ public class CustomLinearLayoutManager extends LinearLayoutManager {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
Timber.wtf(e, "Inconsistency detected: topic_requested = \"" + pageUrl + "\"");
Log.d("CustomLinearLayoutMan", "Inconsistency detected: topic_requested = \""
+ pageUrl + "\"", e);
}
}

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

@ -1,6 +1,7 @@
package gr.thmmy.mthmmy.utils;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.view.ViewCompat;
@ -11,27 +12,28 @@ import android.view.View;
* Extends FloatingActionButton's behavior so the button will hide when scrolling down and show
* otherwise.
*/
@SuppressWarnings("WeakerAccess")
@SuppressWarnings("unused")
public class ScrollAwareFABBehavior extends CoordinatorLayout.Behavior<FloatingActionButton> {
String TAG = "ScrollAwareFABBehavior";
@SuppressWarnings("UnusedParameters")
public ScrollAwareFABBehavior(Context context, AttributeSet attrs) {
super();
}
@Override
public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
final View directTargetChild, final View target, final int nestedScrollAxes) {
public boolean onStartNestedScroll(@NonNull final CoordinatorLayout coordinatorLayout,
@NonNull final FloatingActionButton child,
@NonNull final View directTargetChild, @NonNull final View target,
final int nestedScrollAxes, int type) {
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout,
final FloatingActionButton child,
final View target, final int dxConsumed, final int dyConsumed,
final int dxUnconsumed, final int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
public void onNestedScroll(@NonNull final CoordinatorLayout coordinatorLayout,
@NonNull final FloatingActionButton child,
@NonNull final View target, final int dxConsumed, final int dyConsumed,
final int dxUnconsumed, final int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
dyUnconsumed, type);
if ((dyConsumed > 0 || (!target.canScrollVertically(-1) && dyConsumed == 0
&& dyUnconsumed < 40)) && child.getVisibility() == View.VISIBLE) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {

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

@ -2,6 +2,7 @@ package gr.thmmy.mthmmy.utils;
import android.animation.Animator;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
@ -14,7 +15,7 @@ import android.view.ViewPropertyAnimator;
* <p>When a nested ScrollView is scrolled down, the view will disappear.
* When the ScrollView is scrolled back up, the view will reappear.</p>
*/
@SuppressWarnings("WeakerAccess")
@SuppressWarnings("unused")
public class ScrollAwareLinearBehavior extends CoordinatorLayout.Behavior<View> {
private static final int ANIMATION_DURATION = 100;
@ -23,15 +24,19 @@ public class ScrollAwareLinearBehavior extends CoordinatorLayout.Behavior<View>
}
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, View child, View directTargetChild, View target, int nestedScrollAxes) {
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
@NonNull View child, @NonNull View directTargetChild,
@NonNull View target, int nestedScrollAxes, int type) {
return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
}
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, View bottomNavBar, View target,
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
@NonNull View bottomNavBar, @NonNull View target,
int dxConsumed, int dyConsumed,
int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, bottomNavBar, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
int dxUnconsumed, int dyUnconsumed, int type) {
super.onNestedScroll(coordinatorLayout, bottomNavBar, target, dxConsumed, dyConsumed,
dxUnconsumed, dyUnconsumed, type);
if ((dyConsumed > 0 || (!target.canScrollVertically(-1) && dyConsumed == 0
&& dyUnconsumed < 40)) && bottomNavBar.getVisibility() == View.VISIBLE) {
hide(bottomNavBar);

9
app/src/main/res/drawable/ic_file_download.xml

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#ffffff"
android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
</vector>

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

@ -8,6 +8,7 @@
<TextView
android:id="@+id/dialog_title"
android:text="@string/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"

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

@ -4,6 +4,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="10dp"
android:paddingStart="10dp"
android:paddingTop="7dp">
<TextView

1
build.gradle

@ -17,6 +17,7 @@ allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}

Loading…
Cancel
Save