diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 35b6c054..43b4d1ce 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -49,11 +49,19 @@ android:name="android.support.PARENT_ACTIVITY" android:value=".activities.main.MainActivity"/> - + + + \ No newline at end of file diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java new file mode 100644 index 00000000..3dd6fed8 --- /dev/null +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java @@ -0,0 +1,48 @@ +package gr.thmmy.mthmmy.activities.board; + +import android.os.Bundle; +import android.support.v7.widget.Toolbar; + +import gr.thmmy.mthmmy.R; +import gr.thmmy.mthmmy.activities.base.BaseActivity; +import me.zhanghai.android.materialprogressbar.MaterialProgressBar; + +public class BoardActivity extends BaseActivity { + /** + * Debug Tag for logging debug output to LogCat + */ + private static final String TAG = "BoardActivity"; + /** + * The key to use when putting board's url String to {@link BoardActivity}'s Bundle. + */ + public static final String EXTRAS_BOARD_URL = "BOARD_URL"; + /** + * The key to use when putting board's title String to {@link BoardActivity}'s Bundle. + */ + public static final String EXTRAS_BOARD_TITLE = "BOARD_TITLE"; + + private MaterialProgressBar progressBar; + private String boardTitle; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_board); + + Bundle extras = getIntent().getExtras(); + boardTitle = extras.getString("BOARD_TITLE"); + + //Initializes graphics + toolbar = (Toolbar) findViewById(R.id.toolbar); + toolbar.setTitle(boardTitle); + setSupportActionBar(toolbar); + if (getSupportActionBar() != null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + } + + createDrawer(); + + progressBar = (MaterialProgressBar) findViewById(R.id.progressBar); + } +} diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java index 24f4278a..7be5d9f9 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java @@ -13,11 +13,15 @@ import android.widget.Toast; import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.activities.LoginActivity; import gr.thmmy.mthmmy.activities.base.BaseActivity; +import gr.thmmy.mthmmy.activities.board.BoardActivity; import gr.thmmy.mthmmy.activities.main.forum.ForumFragment; import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; import gr.thmmy.mthmmy.activities.topic.TopicActivity; +import gr.thmmy.mthmmy.data.Board; import gr.thmmy.mthmmy.data.TopicSummary; +import static gr.thmmy.mthmmy.activities.board.BoardActivity.EXTRAS_BOARD_TITLE; +import static gr.thmmy.mthmmy.activities.board.BoardActivity.EXTRAS_BOARD_URL; import static gr.thmmy.mthmmy.activities.topic.TopicActivity.EXTRAS_TOPIC_TITLE; import static gr.thmmy.mthmmy.activities.topic.TopicActivity.EXTRAS_TOPIC_URL; import static gr.thmmy.mthmmy.session.SessionManager.LOGGED_OUT; @@ -83,13 +87,21 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF } @Override - public void onFragmentInteraction(TopicSummary topicSummary) { + public void onRecentFragmentInteraction(TopicSummary topicSummary) { Intent i = new Intent(MainActivity.this, TopicActivity.class); i.putExtra(EXTRAS_TOPIC_URL, topicSummary.getTopicUrl()); i.putExtra(EXTRAS_TOPIC_TITLE, topicSummary.getTitle()); startActivity(i); } + @Override + public void onForumFragmentInteraction(Board board) { + Intent i = new Intent(MainActivity.this, BoardActivity.class); + i.putExtra(EXTRAS_BOARD_URL, board.getBoardURL()); + i.putExtra(EXTRAS_BOARD_TITLE, board.getTitle()); + startActivity(i); + } + //---------------------------------FragmentPagerAdapter--------------------------------------------- /** diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java index 894f4bdf..d455f8be 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java @@ -6,7 +6,6 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.TextView; import com.bignerdranch.expandablerecyclerview.ChildViewHolder; @@ -62,6 +61,7 @@ class ForumAdapter extends ExpandableRecyclerAdapter { if (null != mListener) { // Notify the active callbacks interface (the activity, if the // fragment is attached to one) that an item has been selected. - mListener.onFragmentInteraction(holder.topic); //? + mListener.onRecentFragmentInteraction(holder.topic); //? } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java index d0330849..5cbfd621 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java @@ -135,7 +135,7 @@ public class RecentFragment extends BaseFragment { public interface RecentFragmentInteractionListener extends FragmentInteractionListener { - void onFragmentInteraction(TopicSummary topicSummary); + void onRecentFragmentInteraction(TopicSummary topicSummary); } //---------------------------------------ASYNC TASK----------------------------------- diff --git a/app/src/main/java/gr/thmmy/mthmmy/data/Board.java b/app/src/main/java/gr/thmmy/mthmmy/data/Board.java index 2ed0c1e2..35bf9986 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/data/Board.java +++ b/app/src/main/java/gr/thmmy/mthmmy/data/Board.java @@ -3,21 +3,21 @@ package gr.thmmy.mthmmy.data; import java.util.ArrayList; public class Board { - private final String name; + private final String title; private final String boardURL; private ArrayList subBoards; private ArrayList topicSummaries; - public Board(String name, String boardURL) { - this.name = name; + public Board(String title, String boardURL) { + this.title = title; this.boardURL = boardURL; subBoards = new ArrayList<>(); topicSummaries = new ArrayList<>(); } - public String getName() { - return name; + public String getTitle() { + return title; } public String getBoardURL() { diff --git a/app/src/main/java/gr/thmmy/mthmmy/data/Category.java b/app/src/main/java/gr/thmmy/mthmmy/data/Category.java index 9f0e22a6..e66b2f41 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/data/Category.java +++ b/app/src/main/java/gr/thmmy/mthmmy/data/Category.java @@ -9,13 +9,13 @@ import static android.R.attr.id; public class Category implements Parent { - private final String name; + private final String title; private final String categoryURL; private boolean expanded = false; private List boards; - public Category(String name, String categoryURL) { - this.name = name; + public Category(String title, String categoryURL) { + this.title = title; this.categoryURL = categoryURL; boards = new ArrayList<>(); } @@ -24,8 +24,8 @@ public class Category implements Parent return id; } - public String getName() { - return name; + public String getTitle() { + return title; } public String getCategoryURL() { diff --git a/app/src/main/res/layout/activity_board.xml b/app/src/main/res/layout/activity_board.xml new file mode 100644 index 00000000..6685f2e3 --- /dev/null +++ b/app/src/main/res/layout/activity_board.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_recent.xml b/app/src/main/res/layout/fragment_recent.xml index 4ebe43bb..47de9586 100644 --- a/app/src/main/res/layout/fragment_recent.xml +++ b/app/src/main/res/layout/fragment_recent.xml @@ -17,6 +17,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" + android:paddingBottom="4dp" + android:paddingTop="4dp" app:layoutManager="LinearLayoutManager" tools:context=".activities.main.recent.RecentFragment" tools:listitem="@layout/fragment_recent_row"/> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 8fa836d0..acb97405 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -27,7 +27,7 @@ #2B2B2B #333333 #3C3C3C - #454545 + #494949 #26A69A #E7E7E7 #757575