Browse Source

refactor: minor refactoring

develop
Ezerous 2 years ago
parent
commit
610b0fc594
  1. 17
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  2. 2
      app/src/main/res/layout/activity_bookmarks.xml
  3. 1
      app/src/main/res/layout/activity_topic.xml
  4. 2
      app/src/main/res/menu/downloads_menu.xml
  5. 2
      app/src/main/res/menu/shoutbox_menu.xml
  6. 6
      app/src/main/res/menu/topic_menu.xml
  7. 2
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  8. 2
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  9. 4
      app/src/main/res/values/ic_launcher_background.xml
  10. 1
      app/src/main/res/values/strings.xml

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

@ -228,11 +228,12 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items // Handle presses on the action bar items
switch (item.getItemId()) { int itemId = item.getItemId();
case R.id.menu_bookmark: if (itemId == R.id.menu_bookmark) {
topicMenuBookmarkClick(); topicMenuBookmarkClick();
return true; return true;
case R.id.menu_info: }
else if (itemId == R.id.menu_info) {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyleAccent); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyleAccent);
LayoutInflater inflater = this.getLayoutInflater(); LayoutInflater inflater = this.getLayoutInflater();
LinearLayout infoDialog = (LinearLayout) inflater.inflate(R.layout.dialog_topic_info LinearLayout infoDialog = (LinearLayout) inflater.inflate(R.layout.dialog_topic_info
@ -255,15 +256,15 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo
topicInfoDialog = builder.create(); topicInfoDialog = builder.create();
topicInfoDialog.show(); topicInfoDialog.show();
return true; return true;
case R.id.menu_share: }
Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND); else if (itemId == R.id.menu_share) {
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain"); sendIntent.setType("text/plain");
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, viewModel.getTopicUrl()); sendIntent.putExtra(Intent.EXTRA_TEXT, viewModel.getTopicUrl());
startActivity(Intent.createChooser(sendIntent, "Share via")); startActivity(Intent.createChooser(sendIntent, "Share via"));
return true; //invalidateOptionsMenu(); return true; //invalidateOptionsMenu();
default:
return super.onOptionsItemSelected(item);
} }
return super.onOptionsItemSelected(item);
} }
@Override @Override

2
app/src/main/res/layout/activity_bookmarks.xml

@ -21,7 +21,7 @@
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
android:gravity="center" android:gravity="center"
app:popupTheme="@style/ToolbarTheme"></androidx.appcompat.widget.Toolbar> app:popupTheme="@style/ToolbarTheme" />
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/bookmark_tabs" android:id="@+id/bookmark_tabs"

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

@ -148,6 +148,7 @@
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_marginEnd="@dimen/fab_margins" android:layout_marginEnd="@dimen/fab_margins"
android:layout_marginBottom="50dp" android:layout_marginBottom="50dp"
android:contentDescription="@string/reply_button"
app:layout_behavior="gr.thmmy.mthmmy.utils.ui.ScrollAwareFABBehavior" app:layout_behavior="gr.thmmy.mthmmy.utils.ui.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_reply" /> app:srcCompat="@drawable/ic_reply" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

2
app/src/main/res/menu/downloads_menu.xml

@ -5,5 +5,5 @@
android:id="@+id/menu_upload" android:id="@+id/menu_upload"
android:icon="@drawable/ic_file_upload_white_24dp" android:icon="@drawable/ic_file_upload_white_24dp"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="@string/upload_button"></item> android:title="@string/upload_button" />
</menu> </menu>

2
app/src/main/res/menu/shoutbox_menu.xml

@ -5,5 +5,5 @@
android:id="@+id/menu_refresh" android:id="@+id/menu_refresh"
android:icon="@drawable/ic_refresh_white_24dp" android:icon="@drawable/ic_refresh_white_24dp"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="@string/refresh"></item> android:title="@string/refresh" />
</menu> </menu>

6
app/src/main/res/menu/topic_menu.xml

@ -5,15 +5,15 @@
android:id="@+id/menu_bookmark" android:id="@+id/menu_bookmark"
android:icon="@drawable/ic_bookmark_false_accent_24dp" android:icon="@drawable/ic_bookmark_false_accent_24dp"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="@string/bookmark"></item> android:title="@string/bookmark" />
<item <item
android:id="@+id/menu_share" android:id="@+id/menu_share"
android:icon="@drawable/ic_share_white_24dp" android:icon="@drawable/ic_share_white_24dp"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="@string/share"></item> android:title="@string/share" />
<item <item
android:id="@+id/menu_info" android:id="@+id/menu_info"
android:icon="@drawable/ic_info_outline_white_24dp" android:icon="@drawable/ic_info_outline_white_24dp"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="@string/info"></item> android:title="@string/info" />
</menu> </menu>

2
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" /> <background android:drawable="@color/primary_light" />
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon> </adaptive-icon>

2
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" /> <background android:drawable="@color/primary_light" />
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon> </adaptive-icon>

4
app/src/main/res/values/ic_launcher_background.xml

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#333333</color>
</resources>

1
app/src/main/res/values/strings.xml

@ -76,6 +76,7 @@
</plurals> </plurals>
<string name="show_vote_options_button">hide results</string> <string name="show_vote_options_button">hide results</string>
<string name="pref_topic_drafts_key">preference-topic-drafts-key</string> <string name="pref_topic_drafts_key">preference-topic-drafts-key</string>
<string name="reply_button">Reply</string>
<!--Profile Activity--> <!--Profile Activity-->
<string name="username">Username</string> <string name="username">Username</string>

Loading…
Cancel
Save