Skip to content

Commit

Permalink
Can switch between different tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBernard03 committed Apr 26, 2024
1 parent 531239a commit 0bb41cf
Show file tree
Hide file tree
Showing 36 changed files with 194 additions and 43 deletions.
14 changes: 0 additions & 14 deletions AndroidTools/AndroidTools.xcodeproj/ExportOptions.plist

This file was deleted.

6 changes: 3 additions & 3 deletions AndroidTools/AndroidTools/AndroidToolsApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import SwiftUI
@main
struct AndroidToolsApp: App {

@AppStorage("isDarkMode") private var isDarkMode = false
@AppStorage("mode") private var mode = false

var body: some Scene {
WindowGroup {
SideBarView()
.frame(minWidth: 600, minHeight: 400)
.preferredColorScheme(isDarkMode ? .dark : .light)
.preferredColorScheme(.light)
}

Settings {
SettingsView()
.preferredColorScheme(isDarkMode ? .dark : .light)
.preferredColorScheme(.dark)
}

}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"images" : [
{
"filename" : "16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "32.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "32 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "256.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "256 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "512.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "512 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "1024.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"images" : [
{
"filename" : "16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "32.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "32 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "256.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "256 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "512.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "512 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "1024.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
81 changes: 55 additions & 26 deletions AndroidTools/AndroidTools/Views/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// SettingsView.swift
// AndroidTools
//
// Created by Thomas Bernard on 19/04/2024.
//

import SwiftUI

struct SettingsView: View {
Expand All @@ -13,30 +6,66 @@ struct SettingsView: View {
case general, advanced
}

@AppStorage("isDarkMode") private var isDarkMode = false
let appIcons: [String] = ["AppIconDark", "AppIconLight", "AppIconAndroid"]
let modes : [String] = ["Automatic", "Dark", "Light"]

@AppStorage("mode") private var mode = "Automatic"
@AppStorage("appIconName") private var appIconName = "AppIconDark"


// State to track the currently selected icon
@State private var selectedIcon: String = (NSApplication.shared.applicationIconImage.name() ?? "")

var body: some View {
TabView {
VStack{
Toggle("Dark Mode", isOn: $isDarkMode)
}
.tabItem {
Label("General", systemImage: "gear")
}
.tag(Tabs.general)
VStack {

}
.tabItem {
Label("Advanced", systemImage: "star")
Form {
Group {

Section("Apparance") {
VStack {
Picker("", selection: $mode) {
ForEach(modes, id: \.self) { mode in
Text(mode)
if mode == modes.first {
Divider()
}

}
}

ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(appIcons, id: \.self) { name in
VStack {
Image(nsImage: NSImage(named: name)!)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 60, height: 60) // Highlight the selected icon
}

.background(appIconName == name ? Color.accentColor : Color.clear)
.cornerRadius(13.4)

.onTapGesture {
NSApplication.shared.applicationIconImage = NSImage(named: name)
appIconName = name // Update the selected icon
}
}
}
.padding()
}

Spacer()
}
}
}
.tag(Tabs.advanced)
}
.padding(20)
.frame(width: 375, height: 150)


}
}

#Preview {
SettingsView()
struct SettingsView_Previews: PreviewProvider {
static var previews: some View {
SettingsView()
}
}

0 comments on commit 0bb41cf

Please sign in to comment.