Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
applicationId "git.artdeell.skymodloader"
minSdk 26
targetSdk 34
versionCode 60
versionName "1.7.4"
versionCode 61
versionName "1.7.5"

externalNativeBuild {
cmake {
Expand Down
358 changes: 358 additions & 0 deletions app/src/main/java/git/artdeell/skymodloader/CommunityTabBuilder.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

Expand All @@ -28,6 +31,7 @@

import git.artdeell.skymodloader.AboutDialogHelper;
import git.artdeell.skymodloader.BuildConfig;
import git.artdeell.skymodloader.CommunityTabBuilder;
import git.artdeell.skymodloader.DialogY;
import git.artdeell.skymodloader.LogcatMonitorService;
import git.artdeell.skymodloader.MainActivity;
Expand Down Expand Up @@ -55,6 +59,15 @@ public class ModManagerActivity extends Activity implements LoadingListener, Mod
private ArrayList<String> skyPackages;
private ModUpdaterDialogManager mDialogManager;

// Tab navigation
private ConstraintLayout modsTabContent;
private ScrollView communityTabContent;
private LinearLayout communityContainer;
private TextView navModsText;
private TextView navCommunityText;
private boolean isModsTabActive = true;
private boolean communityLoaded = false;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -76,6 +89,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
modListView.setAdapter(new ModListAdapter(loader));
setButtonClickListeners();
setButtonLongClickListeners();
initializeTabNavigation();
}

private void initializeModUpdater() {
Expand Down Expand Up @@ -391,6 +405,36 @@ public void runUpdater() {
);
}

private void initializeTabNavigation() {
modsTabContent = findViewById(R.id.mods_tab_content);
communityTabContent = findViewById(R.id.community_tab_content);
communityContainer = findViewById(R.id.community_container);
navModsText = findViewById(R.id.nav_tab_mods_text);
navCommunityText = findViewById(R.id.nav_tab_community_text);

findViewById(R.id.nav_tab_mods).setOnClickListener(v -> switchTab(true));
findViewById(R.id.nav_tab_community).setOnClickListener(v -> switchTab(false));
}

private void switchTab(boolean showMods) {
if (showMods == isModsTabActive) return;
isModsTabActive = showMods;

modsTabContent.setVisibility(showMods ? View.VISIBLE : View.GONE);
communityTabContent.setVisibility(showMods ? View.GONE : View.VISIBLE);

// Active tab: bold + full opacity; inactive: normal + dimmed
navModsText.setTypeface(null, showMods ? android.graphics.Typeface.BOLD : android.graphics.Typeface.NORMAL);
navModsText.setAlpha(showMods ? 1.0f : 0.45f);
navCommunityText.setTypeface(null, showMods ? android.graphics.Typeface.NORMAL : android.graphics.Typeface.BOLD);
navCommunityText.setAlpha(showMods ? 0.45f : 1.0f);

if (!showMods && !communityLoaded) {
communityLoaded = true;
CommunityTabBuilder.build(this, communityContainer);
}
}

public void onClearAppData(View view) {
clearAppDataSelective();
}
Expand Down
Loading
Loading