Skip to content

Commit

Permalink
Feat[Launcher]: Add about launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Vera-Firefly committed Oct 1, 2024
1 parent 06e594d commit 4e2a35a
Show file tree
Hide file tree
Showing 13 changed files with 319 additions and 72 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
if: github.repository_owner == 'Vera-Firefly' && github.ref_name == 'main_v3'
uses: actions/upload-artifact@v4
with:
name: Pojav Glow·Worm-release-${{matrix.arch}}
name: PGW-release-${{matrix.arch}}
path: app_pojavlauncher/build/outputs/apk/release/*

- name: Upload Debug
uses: actions/upload-artifact@v4
with:
name: Pojav Glow·Worm-debug-${{matrix.arch}}
name: PGW-debug-${{matrix.arch}}
path: app_pojavlauncher/build/outputs/apk/debug/*

buildnoruntime:
Expand Down Expand Up @@ -104,5 +104,5 @@ jobs:
- name: Upload Debug
uses: actions/upload-artifact@v4
with:
name: Pojav Glow·Worm-debug-${{matrix.arch}}-noruntime
name: PGW-debug-${{matrix.arch}}-noruntime
path: app_pojavlauncher/build/outputs/apk/debug/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.firefly.ui.button;

import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import net.kdt.pojavlaunch.R;

import fr.spse.extended_view.ExtendedButton;

public class LauncherMenuButton extends ExtendedButton {

public LauncherMenuButton(@NonNull Context context) {
super(context);
setSettings();
}

public LauncherMenuButton(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
setSettings();
}

private void setSettings() {
Resources resources = getContext().getResources();

int padding = resources.getDimensionPixelSize(R.dimen._22sdp);
setCompoundDrawablePadding(padding);
setPaddingRelative(padding, 0, 0, 0);
setGravity(Gravity.CENTER_VERTICAL);

setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen._12ssp));
setAllCaps(false);

int[] sizes = getExtendedViewData().getSizeCompounds();
sizes[0] = resources.getDimensionPixelSize(R.dimen._30sdp);
getExtendedViewData().setSizeCompounds(sizes);
postProcessDrawables();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public static String[] getMinecraftClientArgs(MinecraftAccount profile, JMinecra
varArgMap.put("user_properties", "{}");
varArgMap.put("user_type", userType);
varArgMap.put("version_name", versionName);
varArgMap.put("version_type", "Pojav Glow·Worm");
varArgMap.put("version_type", "PGW");

List<String> minecraftArgs = new ArrayList<>();
if (versionInfo.arguments != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.kdt.pojavlaunch.fragments;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import net.kdt.pojavlaunch.R;
import net.kdt.pojavlaunch.Tools;
import net.kdt.pojavlaunch.extra.ExtraConstants;
import net.kdt.pojavlaunch.extra.ExtraCore;

import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class AboutFragment extends Fragment {
public static final String TAG = "ABOUT_FRAGMENT";
public AboutFragment() {
super(R.layout.fragment_about);
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public MainMenuFragment() {

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
Button mNewsButton = view.findViewById(R.id.news_button);
Button mAboutLauncherButton = view.findViewById(R.id.about_launcher_button);
Button mCustomControlButton = view.findViewById(R.id.custom_control_button);
Button mInstallJarButton = view.findViewById(R.id.install_jar_button);
Button mStartTerminalButton = view.findViewById(R.id.start_terminal_button);
Expand All @@ -59,8 +59,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
Button mPlayButton = view.findViewById(R.id.play_button);
mVersionSpinner = view.findViewById(R.id.mc_version_spinner);

mNewsButton.setOnClickListener(v -> Tools.openURL(requireActivity(), Tools.URL_HOME));
mNewsButton.setOnLongClickListener((v) -> {
mAboutLauncherButton.setOnClickListener(v -> Tools.swapFragment(requireActivity(), AboutFragment.class, AboutFragment.TAG, null));
mAboutLauncherButton.setOnLongClickListener((v) -> {
Tools.swapFragment(requireActivity(), SearchModFragment.class, SearchModFragment.TAG, null);
return true;
});
Expand Down
5 changes: 0 additions & 5 deletions app_pojavlauncher/src/main/res/drawable/ic_discord.xml

This file was deleted.

33 changes: 4 additions & 29 deletions app_pojavlauncher/src/main/res/layout-land/fragment_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,17 @@
app:layout_constraintGuide_percent="0.5"/>

<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/news_button"
android:id="@+id/about_launcher_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_menu_news"
android:text="@string/mcl_tab_wiki"
android:text="@string/mcl_tab_about_launcher"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/social_divider" />

<View
android:id="@+id/social_divider"
android:layout_width="@dimen/padding_tiny"
android:layout_height="0dp"
android:background="@color/divider"
android:layout_marginVertical="@dimen/padding_heavy"
app:layout_constraintTop_toTopOf="@id/news_button"
app:layout_constraintStart_toStartOf="@id/center_guideline"
app:layout_constraintEnd_toEndOf="@id/center_guideline"
app:layout_constraintBottom_toBottomOf="@id/news_button"/>

<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"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/social_divider"/>
app:layout_constraintEnd_toEndOf="parent" />

<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/custom_control_button"
Expand All @@ -77,7 +52,7 @@
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/ic_menu_custom_controls"
android:text="@string/mcl_option_customcontrol"
app:layout_constraintTop_toBottomOf="@id/news_button" />
app:layout_constraintTop_toBottomOf="@id/about_launcher_button" />

<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/install_jar_button"
Expand Down
126 changes: 126 additions & 0 deletions app_pojavlauncher/src/main/res/layout/fragment_about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_app">

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/fragment_padding_medium"
android:orientation="vertical">

<TextView
android:id="@+id/title_textview"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_large"
android:text="@string/fragment_about_title" />

<TextView
android:id="@+id/open_source"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fragment_about_open_source" />

<View
android:id="@+id/view1"
style="@style/ThickDivider"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/padding_large" />

<TextView
android:id="@+id/component_title"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_large"
android:text="@string/fragment_about_component_title" />

<TextView
android:id="@+id/component_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fragment_about_component" />

<View
android:id="@+id/view2"
style="@style/ThickDivider"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/padding_large" />

<TextView
android:id="@+id/contributor_title"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/padding_large"
android:text="@string/fragment_about_contributor_title" />

<com.firefly.ui.button.LauncherMenuButton
android:id="@+id/contributor_pojavteam"
android:layout_width="match_parent"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="PojavLauncherTeam"
/>

<com.firefly.ui.button.LauncherMenuButton
android:id="@+id/contributor_vera_firefly"
android:layout_width="match_parent"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="Vera-Firefly"
/>

<com.firefly.ui.button.LauncherMenuButton
android:id="@+id/contributor_movtery"
android:layout_width="match_parent"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="MovTery"
/>

<com.firefly.ui.button.LauncherMenuButton
android:id="@+id/contributor_eurya2233369"
android:layout_width="match_parent"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="Eurya2233369"
/>

<com.firefly.ui.button.LauncherMenuButton
android:id="@+id/contributor_coloryr"
android:layout_width="match_parent"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="Coloryr"
/>

<com.firefly.ui.button.LauncherMenuButton
android:id="@+id/contributor_mio"
android:layout_width="match_parent"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="ShirosakiMio"
/>

<com.firefly.ui.button.LauncherMenuButton
android:id="@+id/contributor_tungsten"
android:layout_width="match_parent"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="Tungsten"
/>

</LinearLayout>
</ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
32 changes: 5 additions & 27 deletions app_pojavlauncher/src/main/res/layout/fragment_launcher.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,16 @@
app:layout_constraintGuide_percent="0.5"/>

<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/news_button"
android:id="@+id/about_launcher_button"
android:layout_width="0dp"
android:layout_height="@dimen/_66sdp"
android:background="?android:attr/selectableItemBackground"
android:text="@string/mcl_tab_wiki"
android:text="@string/mcl_tab_about_launcher"
android:drawableStart="@drawable/ic_menu_news"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/social_divider" />

<View
android:id="@+id/social_divider"
android:layout_width="@dimen/padding_tiny"
android:layout_height="0dp"
android:background="@color/divider"
android:layout_marginVertical="@dimen/padding_large"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="@id/center_guideline"
app:layout_constraintEnd_toEndOf="@id/center_guideline"
app:layout_constraintBottom_toBottomOf="@id/news_button"/>

<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:visibility="gone"
android:drawableStart="@drawable/ic_discord"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/social_divider"
app:layout_constraintEnd_toEndOf="parent"/>
app:layout_constraintEnd_toEndOf="parent"
/>

<com.kdt.mcgui.LauncherMenuButton
android:id="@+id/custom_control_button"
Expand All @@ -67,7 +45,7 @@
android:background="?android:attr/selectableItemBackground"
android:drawableStart="@drawable/ic_menu_custom_controls"
android:text="@string/mcl_option_customcontrol"
app:layout_constraintTop_toBottomOf="@id/news_button"
app:layout_constraintTop_toBottomOf="@id/about_launcher_button"
/>

<com.kdt.mcgui.LauncherMenuButton
Expand Down
Loading

0 comments on commit 4e2a35a

Please sign in to comment.