Skip to content

Commit

Permalink
Browser : Redesign top menu
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbWatershed committed Apr 1, 2023
1 parent cbf1f9f commit bb405a0
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 41 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
<activity
android:name=".activities.PrefsActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_preferences"
android:label="@string/title_activity_settings"
android:parentActivityName=".activities.LibraryActivity"
android:theme="@style/Theme.Light.Prefs"
tools:ignore="UnusedAttribute">
Expand All @@ -160,7 +160,7 @@
<activity
android:name=".activities.ToolsActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_preferences"
android:label="@string/title_activity_settings"
android:parentActivityName=".activities.LibraryActivity"
android:theme="@style/Theme.Light.Prefs"
tools:ignore="UnusedAttribute">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import io.reactivex.schedulers.Schedulers;
import me.devsaki.hentoid.BuildConfig;
import me.devsaki.hentoid.R;
import me.devsaki.hentoid.activities.AboutActivity;
import me.devsaki.hentoid.activities.BaseActivity;
import me.devsaki.hentoid.activities.LibraryActivity;
import me.devsaki.hentoid.activities.MissingWebViewActivity;
Expand Down Expand Up @@ -263,6 +264,7 @@ protected void onCreate(Bundle savedInstanceState) {
// Toolbar
// Top toolbar
Toolbar toolbar = findViewById(R.id.toolbar);
Helper.tryShowMenuIcons(this, toolbar.getMenu());
toolbar.setOnMenuItemClickListener(this::onMenuItemSelected);
toolbar.setTitle(getStartSite().getDescription());
refreshStopMenu = toolbar.getMenu().findItem(R.id.web_menu_refresh_stop);
Expand Down Expand Up @@ -342,6 +344,9 @@ private boolean onMenuItemSelected(MenuItem item) {
case R.id.web_menu_settings:
this.onSettingsClick();
break;
case R.id.web_menu_about:
this.onAboutClick();
break;
default:
return false;
}
Expand Down Expand Up @@ -1460,7 +1465,7 @@ private String formatAlertMessage(@NonNull final UpdateInfo.SourceAlert alert) {
}

/**
* Show the viewer settings dialog
* Show the browser settings dialog
*/
private void onSettingsClick() {
Intent intent = new Intent(this, PrefsActivity.class);
Expand All @@ -1472,6 +1477,13 @@ private void onSettingsClick() {
startActivity(intent);
}

/**
* Show the About page
*/
private void onAboutClick() {
startActivity(new Intent(this, AboutActivity.class));
}

@Override
public List<String> getAllSiteUrls() {
return new ArrayList<>(downloadedBooksUrls); // Work on a copy to avoid any thread-synch issue
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/me/devsaki/hentoid/util/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import androidx.annotation.Nullable;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.core.util.Pair;
import androidx.core.view.MenuCompat;
import androidx.documentfile.provider.DocumentFile;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleObserver;
Expand Down Expand Up @@ -402,6 +403,7 @@ public static void tryShowMenuIcons(@NonNull Context context, @NonNull Menu menu
} catch (Exception e) {
Timber.i(e);
}
MenuCompat.setGroupDividerEnabled(menu, true);
}

/**
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_link.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#DEFFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z" />
</vector>
4 changes: 2 additions & 2 deletions app/src/main/res/menu/queue_and_error_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<item
android:id="@+id/action_queue_prefs"
android:icon="@drawable/ic_settings"
android:title="@string/title_activity_preferences"
android:tooltipText="@string/title_activity_preferences"
android:title="@string/title_activity_settings"
android:tooltipText="@string/title_activity_settings"
android:visible="true"
app:showAsAction="ifRoom" />
<item
Expand Down
62 changes: 37 additions & 25 deletions app/src/main/res/menu/web_menu_top.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,41 @@
tools:context=".activities.sources.BaseWebActivity"
tools:ignore="AlwaysShowAction"
tools:targetApi="o">
<item
android:id="@+id/web_menu_refresh_stop"
android:icon="@drawable/ic_action_refresh"
android:title="@string/web_refresh_stop"
android:tooltipText="@string/web_refresh_stop"
app:showAsAction="always" />
<item
android:id="@+id/web_menu_bookmark"
android:icon="@drawable/ic_bookmark"
android:title="@string/web_bookmarks"
android:tooltipText="@string/web_bookmarks"
app:showAsAction="always" />
<item
android:id="@+id/web_menu_copy"
android:icon="@drawable/ic_action_copy"
android:title="@string/web_copy_url"
android:tooltipText="@string/web_copy_url"
app:showAsAction="always" />
<item
android:id="@+id/web_menu_settings"
android:icon="@drawable/ic_settings"
android:title="@string/title_activity_preferences"
android:tooltipText="@string/title_activity_preferences"
android:visible="true"
app:showAsAction="ifRoom" />
<group android:id="@+id/web_menu_top_1">
<item
android:id="@+id/web_menu_refresh_stop"
android:icon="@drawable/ic_action_refresh"
android:title="@string/web_refresh_stop"
android:tooltipText="@string/web_refresh_stop"
app:showAsAction="always" />
</group>
<group android:id="@+id/web_menu_top_2">
<item
android:id="@+id/web_menu_bookmark"
android:icon="@drawable/ic_bookmark"
android:title="@string/web_bookmarks"
android:tooltipText="@string/web_bookmarks"
app:showAsAction="never" />
</group>
<group android:id="@+id/web_menu_top_3">
<item
android:id="@+id/web_menu_settings"
android:icon="@drawable/ic_settings"
android:title="@string/title_activity_settings"
android:tooltipText="@string/title_activity_settings"
android:visible="true"
app:showAsAction="never" />
<item
android:id="@+id/web_menu_copy"
android:icon="@drawable/ic_link"
android:title="@string/web_copy_url"
android:tooltipText="@string/web_copy_url"
app:showAsAction="never" />
<item
android:id="@+id/web_menu_about"
android:icon="@drawable/ic_info"
android:title="@string/title_activity_about"
android:tooltipText="@string/title_activity_about"
app:showAsAction="never" />
</group>
</menu>
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<string name="remove_generic">Eliminar</string>
<string name="title_activity_downloads">Biblioteca</string>
<string name="title_activity_queue">Cola de descargas</string>
<string name="title_activity_preferences">Ajustes</string>
<string name="title_activity_settings">Ajustes</string>
<string name="title_activity_about">Acerca de</string>
<string name="title_activity_app_lock">Bloqueo de la aplicación</string>
<string name="title_activity_search">Búsqueda Avanzada</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<string name="remove_generic">Törlés</string>
<string name="title_activity_downloads">Könyvtár</string>
<string name="title_activity_queue">Várólista</string>
<string name="title_activity_preferences">Beállítások</string>
<string name="title_activity_settings">Beállítások</string>
<string name="title_activity_about">Névjegy</string>
<string name="title_activity_app_lock">Alkalmazás Zárolása</string>
<string name="title_activity_search">Haladó keresés</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<string name="remove_generic">Rimuovi</string>
<string name="title_activity_downloads">Libreria</string>
<string name="title_activity_queue">Coda</string>
<string name="title_activity_preferences">Preferenze</string>
<string name="title_activity_settings">Preferenze</string>
<string name="title_activity_about">Informazioni</string>
<string name="title_activity_app_lock">Blocco app</string>
<string name="title_activity_search">Ricerca avanzata</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<string name="remove_generic">削除する</string>
<string name="title_activity_downloads">ライブラリー</string>
<string name="title_activity_queue">キュー</string>
<string name="title_activity_preferences">環境設定</string>
<string name="title_activity_settings">環境設定</string>
<string name="title_activity_about">Hentoidについて</string>
<string name="title_activity_app_lock">アプリをロック</string>
<string name="title_activity_search">高度な検索</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<string name="remove_generic">제거</string>
<string name="title_activity_downloads">라이브러리</string>
<string name="title_activity_queue">대기열</string>
<string name="title_activity_preferences">설정</string>
<string name="title_activity_settings">설정</string>
<string name="title_activity_about">정보</string>
<string name="title_activity_app_lock">앱 잠금</string>
<string name="title_activity_search">고급 검색</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


<string name="title_activity_downloads">Biblioteca</string>
<string name="title_activity_preferences">Configurações</string>
<string name="title_activity_settings">Configurações</string>



Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<!-- Activities -->
<string name="title_activity_downloads">Библиотека</string>
<string name="title_activity_queue">Очередь</string>
<string name="title_activity_preferences">Настройки</string>
<string name="title_activity_settings">Настройки</string>
<string name="title_activity_about">О Hentoid</string>
<string name="title_activity_app_lock">Код-пароль</string>
<string name="title_activity_search">Расширенный поиск</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<!-- Activities -->
<string name="title_activity_downloads">Бібліотека</string>
<string name="title_activity_queue">Черга</string>
<string name="title_activity_preferences">Налаштування</string>
<string name="title_activity_settings">Налаштування</string>
<string name="title_activity_about">Про Hentoid</string>
<string name="title_activity_app_lock">Код-пароль</string>
<string name="title_activity_search">Розширений пошук</string>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<!-- Activities -->
<string name="title_activity_downloads">Library</string>
<string name="title_activity_queue">Queue</string>
<string name="title_activity_preferences">Preferences</string>
<string name="title_activity_settings">Settings</string>
<string name="title_activity_about">About</string>
<string name="title_activity_app_lock">App Lock</string>
<string name="title_activity_search">Advanced Search</string>
Expand Down Expand Up @@ -269,7 +269,7 @@
<string name="refresh_location_internal_1">Primary library 1</string>
<string name="refresh_location_internal_2">Primary library 2</string>
<string name="refresh_location_external">External library</string>
<string name="refresh_options_rename">Rename all folders according to the current naming and max length preference</string>
<string name="refresh_options_rename">Rename all folders according to the current naming and max length settings</string>
<string name="refresh_options_remove_placeholders">Remove placeholder books imported through metadata</string>
<string name="refresh_options_renumber_pages">Renumber pages</string>
<string name="refresh_renumber_warning">This will check all books and correct any mistaken page counts.\nBe aware this option WILL slow down the process significantly.</string>
Expand Down Expand Up @@ -679,7 +679,7 @@
<string name="web_forward">Forward</string>
<string name="web_bookmarks">Bookmarks</string>
<string name="web_refresh_stop">Refresh/stop</string>
<string name="web_copy_url">Copy current URL to clipboard</string>
<string name="web_copy_url">Get link</string>
<string name="web_download">Download</string>
<string name="web_unparsable">This content cannot be downloaded. Sorry~</string>
<string name="web_url_clipboard">URL copied to clipboard</string>
Expand Down

0 comments on commit bb405a0

Please sign in to comment.