From 8e007dc9109e8e2a4366a47046e55644a7491182 Mon Sep 17 00:00:00 2001 From: Ezerous Date: Wed, 30 Nov 2016 17:58:16 +0200 Subject: [PATCH] Package changes, added drawer to more activities --- app/src/main/AndroidManifest.xml | 11 +++--- .../mthmmy/activities/AboutActivity.java | 15 +++++++- .../mthmmy/activities/LoginActivity.java | 1 + .../mthmmy/activities/TopicActivity.java | 2 ++ .../activities/{ => main}/MainActivity.java | 9 +++-- .../main}/forum/ForumAdapter.java | 4 +-- .../main}/forum/ForumFragment.java | 2 +- .../main}/recent/RecentAdapter.java | 2 +- .../main}/recent/RecentFragment.java | 2 +- app/src/main/res/layout/activity_about.xml | 35 ++++++++++++++++--- app/src/main/res/layout/activity_main.xml | 2 +- app/src/main/res/layout/activity_topic.xml | 2 +- app/src/main/res/layout/fragment_recent.xml | 2 +- 13 files changed, 68 insertions(+), 21 deletions(-) rename app/src/main/java/gr/thmmy/mthmmy/activities/{ => main}/MainActivity.java (92%) rename app/src/main/java/gr/thmmy/mthmmy/{sections => activities/main}/forum/ForumAdapter.java (96%) rename app/src/main/java/gr/thmmy/mthmmy/{sections => activities/main}/forum/ForumFragment.java (99%) rename app/src/main/java/gr/thmmy/mthmmy/{sections => activities/main}/recent/RecentAdapter.java (98%) rename app/src/main/java/gr/thmmy/mthmmy/{sections => activities/main}/recent/RecentFragment.java (99%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a4a2cfa0..6d90bd10 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ android:theme="@style/AppTheme"> + android:parentActivityName=".activities.main.MainActivity" + android:theme="@style/AppTheme.NoActionBar"> + android:value=".activities.main.MainActivity"/> + android:value=".activities.main.MainActivity"/> diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java index 1959f891..426c2dad 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/AboutActivity.java @@ -1,18 +1,31 @@ package gr.thmmy.mthmmy.activities; import android.os.Bundle; +import android.support.v7.widget.Toolbar; import android.widget.TextView; import gr.thmmy.mthmmy.BuildConfig; import gr.thmmy.mthmmy.R; -public class AboutActivity extends BaseActivity { +public class AboutActivity extends BaseActivity +{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); String versionName = BuildConfig.VERSION_NAME; + + //Initialize toolbar + toolbar = (Toolbar) findViewById(R.id.toolbar); + toolbar.setTitle(R.string.about); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + createDrawer(); + + TextView tv = (TextView) findViewById(R.id.version); if (tv != null) tv.setText(getString(R.string.version, versionName)); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java index 89cda821..3f16f9bc 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java @@ -11,6 +11,7 @@ import android.widget.EditText; import android.widget.Toast; import gr.thmmy.mthmmy.R; +import gr.thmmy.mthmmy.activities.main.MainActivity; import static gr.thmmy.mthmmy.session.SessionManager.CONNECTION_ERROR; import static gr.thmmy.mthmmy.session.SessionManager.EXCEPTION; diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/TopicActivity.java index cfe2bbde..60dea0b3 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/TopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/TopicActivity.java @@ -109,6 +109,8 @@ public class TopicActivity extends BaseActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); + createDrawer(); + //Variables initialization postsLinearLayout = (LinearLayout) findViewById(R.id.posts_list); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/MainActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java similarity index 92% rename from app/src/main/java/gr/thmmy/mthmmy/activities/MainActivity.java rename to app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java index 25b4dd70..8988e1b2 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/MainActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java @@ -1,4 +1,4 @@ -package gr.thmmy.mthmmy.activities; +package gr.thmmy.mthmmy.activities.main; import android.content.Intent; import android.os.Bundle; @@ -10,9 +10,12 @@ import android.support.v4.view.ViewPager; import android.support.v7.widget.Toolbar; import gr.thmmy.mthmmy.R; +import gr.thmmy.mthmmy.activities.BaseActivity; +import gr.thmmy.mthmmy.activities.LoginActivity; +import gr.thmmy.mthmmy.activities.TopicActivity; import gr.thmmy.mthmmy.data.TopicSummary; -import gr.thmmy.mthmmy.sections.forum.ForumFragment; -import gr.thmmy.mthmmy.sections.recent.RecentFragment; +import gr.thmmy.mthmmy.activities.main.forum.ForumFragment; +import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; import static gr.thmmy.mthmmy.session.SessionManager.LOGGED_OUT; diff --git a/app/src/main/java/gr/thmmy/mthmmy/sections/forum/ForumAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java similarity index 96% rename from app/src/main/java/gr/thmmy/mthmmy/sections/forum/ForumAdapter.java rename to app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java index bfd72204..d01b9e08 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/sections/forum/ForumAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java @@ -1,4 +1,4 @@ -package gr.thmmy.mthmmy.sections.forum; +package gr.thmmy.mthmmy.activities.main.forum; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -10,7 +10,7 @@ import java.util.List; import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.data.TopicSummary; -import gr.thmmy.mthmmy.sections.recent.RecentFragment; +import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; /** diff --git a/app/src/main/java/gr/thmmy/mthmmy/sections/forum/ForumFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java similarity index 99% rename from app/src/main/java/gr/thmmy/mthmmy/sections/forum/ForumFragment.java rename to app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java index 02e40d17..37d14f37 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/sections/forum/ForumFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java @@ -1,4 +1,4 @@ -package gr.thmmy.mthmmy.sections.forum; +package gr.thmmy.mthmmy.activities.main.forum; import android.content.Context; import android.os.AsyncTask; diff --git a/app/src/main/java/gr/thmmy/mthmmy/sections/recent/RecentAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentAdapter.java similarity index 98% rename from app/src/main/java/gr/thmmy/mthmmy/sections/recent/RecentAdapter.java rename to app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentAdapter.java index 80f7fb89..2a2f3602 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/sections/recent/RecentAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentAdapter.java @@ -1,4 +1,4 @@ -package gr.thmmy.mthmmy.sections.recent; +package gr.thmmy.mthmmy.activities.main.recent; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; diff --git a/app/src/main/java/gr/thmmy/mthmmy/sections/recent/RecentFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java similarity index 99% rename from app/src/main/java/gr/thmmy/mthmmy/sections/recent/RecentFragment.java rename to app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java index 864ee202..49456bfb 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/sections/recent/RecentFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java @@ -1,4 +1,4 @@ -package gr.thmmy.mthmmy.sections.recent; +package gr.thmmy.mthmmy.activities.main.recent; import android.content.Context; import android.os.AsyncTask; diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index d2049d84..7c4e3ada 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -1,8 +1,34 @@ - + + + android:layout_height="wrap_content" + android:paddingTop="@dimen/appbar_padding_top" + android:theme="@style/ToolbarTheme"> + + + + + + + + - \ No newline at end of file + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index f374eccd..108e85c4 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -7,7 +7,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" - tools:context=".activities.MainActivity"> + tools:context=".activities.main.MainActivity"> + tools:context=".activities.main.MainActivity">