Skip to content

Commit

Permalink
Add Github shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
Florianisme committed Oct 8, 2023
1 parent d45d4a6 commit 5acad1b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
13 changes: 13 additions & 0 deletions app/src/main/java/de/florianisme/wakeonlan/ui/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.florianisme.wakeonlan.ui;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.TextView;

Expand Down Expand Up @@ -62,6 +64,17 @@ private void initializeNavController() {
appBarConfiguration = new AppBarConfiguration.Builder(getMenuIds()).setOpenableLayout(binding.drawerLayout).build();
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(binding.navigationView, navController);

setGithubShortcut();
}

private void setGithubShortcut() {
binding.navigationView.getMenu().findItem(R.id.githubShortcut).setOnMenuItemClickListener(item -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Florianisme/WakeOnLan"));
startActivity(browserIntent);

return false;
});
}

private void initializeShortcuts() {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_github_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000000"
android:pathData="M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z" />
</vector>
12 changes: 11 additions & 1 deletion app/src/main/res/menu/activity_main_drawer.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<group android:checkableBehavior="single">
<group
android:id="@+id/drawer_base_categories"
android:checkableBehavior="single">
<item
android:id="@+id/deviceListFragment"
android:icon="@drawable/ic_device_list"
Expand All @@ -13,7 +15,15 @@
android:id="@+id/backupFragment"
android:icon="@drawable/ic_import_export"
android:title="@string/drawer_menu_item_backup" />
</group>

<group
android:id="@+id/drawer_other_categories"
android:checkableBehavior="single">
<item
android:id="@+id/githubShortcut"
android:icon="@drawable/ic_github_logo"
android:title="@string/drawer_menu_item_github" />
</group>

</menu>
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<string name="device_title_security">Sicherheit</string>
<string name="add_device_secure_on">SecureOn Passwort (optional)</string>
<string name="add_device_error_secure_on_password_invalid">Passwort muss entweder leer oder eine gültige MAC oder IP Adresse sein</string>
<string name="drawer_menu_item_github">Fehler melden</string>
<string name="drawer_menu_header_version">Version %1$s</string>
<string name="quick_access_device_subtitle">Gerät einschalten</string>
<string name="shortcut_wake_device_error">Gerät kann nicht geweckt werden</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<string name="drawer_menu_item_device_list" translatable="false">@string/title_fragment_device_list</string>
<string name="drawer_menu_item_scan" translatable="false">@string/title_fragment_network_scan</string>
<string name="drawer_menu_item_backup" translatable="false">@string/title_fragment_backup</string>
<string name="drawer_menu_item_github">Report Issues</string>
<string name="drawer_menu_header_version">Version %1$s</string>

<!-- Quick Access -->
Expand Down

0 comments on commit 5acad1b

Please sign in to comment.