Browse Source

Code cleanup

pull/24/head
Ezerous 8 years ago
parent
commit
1cac15844c
  1. 13
      app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java
  2. 5
      app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java
  3. 12
      app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java
  4. 9
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
  5. 30
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java
  6. 9
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
  7. 18
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java
  8. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  9. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java
  10. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java
  11. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentAdapter.java
  12. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
  13. 10
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadAdapter.java
  14. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java
  15. 17
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
  16. 10
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java
  17. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java
  18. 10
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
  19. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java
  20. 27
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  21. 50
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

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) {

9
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.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.util.Log;
import android.view.View;
import android.widget.ImageButton;
@ -76,7 +75,7 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
}
//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 +88,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 +123,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);

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);
}
}
}

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

@ -73,10 +73,10 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
//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);

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

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

@ -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,7 +137,7 @@ 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);
}
}

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);
}
}
}

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

@ -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;

27
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);
@ -243,10 +242,10 @@ public class TopicActivity extends BaseActivity {
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());

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);
}
}

Loading…
Cancel
Save