Feat[launcher]: Add Discord button

This commit is contained in:
Maksim Belov 2024-08-30 23:32:40 +03:00 committed by Maksim Belov
parent fa482de030
commit 7dcad5f001
6 changed files with 66 additions and 16 deletions

View File

@ -34,6 +34,7 @@ public class MainMenuFragment extends Fragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
Button mNewsButton = view.findViewById(R.id.news_button);
Button mDiscordButton = view.findViewById(R.id.discord_button);
Button mCustomControlButton = view.findViewById(R.id.custom_control_button);
Button mInstallJarButton = view.findViewById(R.id.install_jar_button);
Button mShareLogsButton = view.findViewById(R.id.share_logs_button);
@ -43,6 +44,7 @@ public class MainMenuFragment extends Fragment {
mVersionSpinner = view.findViewById(R.id.mc_version_spinner);
mNewsButton.setOnClickListener(v -> Tools.openURL(requireActivity(), Tools.URL_HOME));
mDiscordButton.setOnClickListener(v -> Tools.openURL(requireActivity(), getString(R.string.discord_invite)));
mCustomControlButton.setOnClickListener(v -> startActivity(new Intent(requireContext(), CustomControlsActivity.class)));
mInstallJarButton.setOnClickListener(v -> runInstallerWithConfirmation(false));
mInstallJarButton.setOnLongClickListener(v->{

View File

@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="67dp" android:viewportHeight="96.36" android:viewportWidth="127.14" android:width="88.40162dp">
<path android:fillColor="#5865f2" android:pathData="M107.7,8.07A105.15,105.15 0,0 0,81.47 0a72.06,72.06 0,0 0,-3.36 6.83A97.68,97.68 0,0 0,49 6.83,72.37 72.37,0 0,0 45.64,0 105.89,105.89 0,0 0,19.39 8.09C2.79,32.65 -1.71,56.6 0.54,80.21h0A105.73,105.73 0,0 0,32.71 96.36,77.7 77.7,0 0,0 39.6,85.25a68.42,68.42 0,0 1,-10.85 -5.18c0.91,-0.66 1.8,-1.34 2.66,-2a75.57,75.57 0,0 0,64.32 0c0.87,0.71 1.76,1.39 2.66,2a68.68,68.68 0,0 1,-10.87 5.19,77 77,0 0,0 6.89,11.1A105.25,105.25 0,0 0,126.6 80.22h0C129.24,52.84 122.09,29.11 107.7,8.07ZM42.45,65.69C36.18,65.69 31,60 31,53s5,-12.74 11.43,-12.74S54,46 53.89,53 48.84,65.69 42.45,65.69ZM84.69,65.69C78.41,65.69 73.25,60 73.25,53s5,-12.74 11.44,-12.74S96.23,46 96.12,53 91.08,65.69 84.69,65.69Z"/>
</vector>

View File

@ -19,20 +19,39 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/center_guideline"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"/>
<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/news_button"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/ic_menu_news"
android:text="@string/mcl_tab_wiki" />
android:text="@string/mcl_tab_wiki"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/center_guideline"/>
<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/discord_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/ic_discord"
android:text="@string/mcl_button_discord"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/center_guideline"/>
<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/custom_control_button"
@ -42,7 +61,8 @@
android:layout_marginBottom="8dp"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/ic_menu_custom_controls"
android:text="@string/mcl_option_customcontrol" />
android:text="@string/mcl_option_customcontrol"
app:layout_constraintTop_toBottomOf="@id/news_button"/>
<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/install_jar_button"
@ -52,7 +72,8 @@
android:layout_marginBottom="8dp"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/ic_menu_install_jar"
android:text="@string/main_install_jar_file" />
android:text="@string/main_install_jar_file"
app:layout_constraintTop_toBottomOf="@id/custom_control_button"/>
<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/share_logs_button"
@ -62,8 +83,9 @@
android:layout_marginBottom="8dp"
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@android:drawable/ic_menu_share"
android:text="@string/main_share_logs" />
</LinearLayout>
android:text="@string/main_share_logs"
app:layout_constraintTop_toBottomOf="@id/install_jar_button"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -15,20 +15,38 @@
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/mc_version_spinner">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/center_guideline"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"/>
<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/news_button"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="@string/mcl_tab_wiki"
android:drawableStart="@drawable/ic_menu_news"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/center_guideline" />
<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/discord_button"
android:layout_width="0dp"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="@string/mcl_button_discord"
android:drawableStart="@drawable/ic_discord"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/center_guideline"
app:layout_constraintEnd_toEndOf="parent"/>
/>
<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/custom_control_button"
@ -62,7 +80,7 @@
app:layout_constraintTop_toBottomOf="@id/install_jar_button"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<com.kdt.mcgui.mcVersionSpinner

View File

@ -329,4 +329,5 @@
<string name="newdl_starting">Чтение метаданных игры…</string>
<string name="newdl_downloading_metadata">Загрузка метаданных игры (%s)</string>
<string name="newdl_downloading_game_files">Загрузка файлов… (%d/%d, %.2f МБ)</string>
<string name="discord_invite" translatable="false">https://discord.gg/pojavlauncher-sng-962263126647144449</string>
</resources>

View File

@ -413,4 +413,6 @@
<string name="controller_remapper_expand_entry">Expand to change keycodes</string>
<string name="preference_remap_controller_title">Change controller key bindings</string>
<string name="preference_remap_controller_description">Allows you to modify the keyboard keys bound to each controller button</string>
<string name="mcl_button_discord">Discord</string>
<string name="discord_invite" translatable="false">https://discord.gg/pojavlauncher-724163890803638273</string>
</resources>