From ab0b82e04fe2df27ee3300a687cfa6aad2f9ac2b Mon Sep 17 00:00:00 2001 From: Ezerous Date: Tue, 11 Jul 2017 19:02:29 +0300 Subject: [PATCH] Fixed TopicTitle ellipsizing, removed toolbar from MainActivity, minor tweaks --- .../gr/thmmy/mthmmy/activities/BookmarkActivity.java | 3 +++ .../gr/thmmy/mthmmy/activities/main/MainActivity.java | 7 ------- .../gr/thmmy/mthmmy/activities/topic/TopicActivity.java | 5 +++++ app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java | 4 +++- app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java | 2 +- app/src/main/res/drawable/ic_file_download.xml | 9 +++++++++ app/src/main/res/layout/activity_main.xml | 9 --------- app/src/main/res/layout/activity_topic.xml | 7 ------- 8 files changed, 21 insertions(+), 25 deletions(-) create mode 100644 app/src/main/res/drawable/ic_file_download.xml diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java index 1ff2c001..d010eb8f 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java @@ -21,6 +21,9 @@ import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_URL; import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_TITLE; import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL; +//TODO proper handling with adapter etc. +//TODO better UI +//TODO after clicking bookmark and then back button should return to this activity public class BookmarkActivity extends BaseActivity { private TextView boardsTitle; private TextView topicsTitle; 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 ddc604b4..dd57cba4 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 @@ -8,7 +8,6 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; -import android.support.v7.widget.Toolbar; import android.widget.Toast; import gr.thmmy.mthmmy.R; @@ -57,12 +56,6 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } - //Initialize toolbar - toolbar = (Toolbar) - - findViewById(R.id.toolbar); - - setSupportActionBar(toolbar); //Initialize drawer createDrawer(); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java index c959d091..e097f937 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java @@ -14,6 +14,7 @@ import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.text.Html; import android.text.SpannableStringBuilder; +import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.text.method.ScrollingMovementMethod; import android.text.style.ClickableSpan; @@ -143,7 +144,11 @@ public class TopicActivity extends BaseActivity { //Initializes graphics toolbar = (Toolbar) findViewById(R.id.toolbar); toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title); + toolbarTitle.setSingleLine(true); + toolbarTitle.setEllipsize(TextUtils.TruncateAt.MARQUEE); + toolbarTitle.setMarqueeRepeatLimit(-1); toolbarTitle.setText(topicTitle); + toolbarTitle.setSelected(true); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index 10516b05..a2c8877e 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java @@ -335,7 +335,9 @@ public abstract class BaseActivity extends AppCompatActivity { drawer = drawerBuilder.build(); - drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false); + if(!(BaseActivity.this instanceof MainActivity)) + drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false); + drawer.setOnDrawerNavigationListener(new Drawer.OnDrawerNavigationListener() { @Override public boolean onNavigationClickListener(View clickedView) { diff --git a/app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java b/app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java index 6b7f0c60..2ef4fdd4 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java +++ b/app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java @@ -49,7 +49,7 @@ public class Receiver extends BroadcastReceiver { .setContentText(text) .setTicker(ticker) .setAutoCancel(true) - .setSmallIcon(R.mipmap.ic_launcher); + .setSmallIcon(R.drawable.ic_file_download); if (state.equals(STARTED)) builder.setOngoing(true); diff --git a/app/src/main/res/drawable/ic_file_download.xml b/app/src/main/res/drawable/ic_file_download.xml new file mode 100644 index 00000000..80734766 --- /dev/null +++ b/app/src/main/res/drawable/ic_file_download.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index b032b9b9..d3c0fe27 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -13,17 +13,8 @@ android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="@dimen/appbar_padding_top" android:theme="@style/ToolbarTheme"> - - -