Skip to content

Commit 12e7c49

Browse files
author
ToastcodeDev
committed
Initial commit
0 parents  commit 12e7c49

File tree

66 files changed

+2571
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2571
-0
lines changed

.gitignore

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
/bin/
15+
/gen/
16+
/out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# Gradle files
19+
.gradle/
20+
.androidide
21+
/build/
22+
23+
# Local configuration file (sdk path, etc)
24+
local.properties
25+
26+
# Proguard folder generated by Eclipse
27+
proguard/
28+
29+
# Log Files
30+
*.log
31+
32+
# Android Studio Navigation editor temp files
33+
.navigation/
34+
35+
# Android Studio captures folder
36+
captures/
37+
38+
# IntelliJ
39+
*.iml
40+
.idea/workspace.xml
41+
.idea/tasks.xml
42+
.idea/gradle.xml
43+
.idea/assetWizardSettings.xml
44+
.idea/dictionaries
45+
.idea/libraries
46+
# Android Studio 3 in .gitignore file.
47+
.idea/caches
48+
.idea/modules.xml
49+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
50+
.idea/navEditor.xml
51+
52+
# Keystore files
53+
# Uncomment the following lines if you do not want to check your keystore files in.
54+
#*.jks
55+
#*.keystore
56+
57+
# External native build folder generated in Android Studio 2.2 and later
58+
.externalNativeBuild
59+
.cxx/
60+
61+
# Google Services (e.g. APIs or Firebase)
62+
# google-services.json
63+
64+
# Freeline
65+
freeline.py
66+
freeline/
67+
freeline_project_description.json
68+
69+
# fastlane
70+
fastlane/report.xml
71+
fastlane/Preview.html
72+
fastlane/screenshots
73+
fastlane/test_output
74+
fastlane/readme.md
75+
76+
# Version control
77+
vcs.xml
78+
79+
# lint
80+
lint/intermediates/
81+
lint/generated/
82+
lint/outputs/
83+
lint/tmp/
84+
# lint/reports/

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle.kts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
plugins {
3+
id("com.android.application")
4+
5+
}
6+
7+
android {
8+
namespace = "com.tcd.gamelauncher"
9+
compileSdk = 34
10+
11+
defaultConfig {
12+
applicationId = "com.tcd.gamelauncher"
13+
minSdk = 26
14+
targetSdk = 34
15+
versionCode = 1
16+
versionName = "1.0"
17+
18+
vectorDrawables {
19+
useSupportLibrary = true
20+
}
21+
}
22+
23+
compileOptions {
24+
sourceCompatibility = JavaVersion.VERSION_11
25+
targetCompatibility = JavaVersion.VERSION_11
26+
}
27+
28+
buildTypes {
29+
release{
30+
isMinifyEnabled = true
31+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
32+
}
33+
}
34+
35+
buildFeatures {
36+
viewBinding = true
37+
dataBinding = true
38+
}
39+
40+
}
41+
42+
dependencies {
43+
implementation("com.google.code.gson:gson:2.11.0")
44+
implementation("com.google.android.material:material:1.12.0")
45+
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
46+
implementation("androidx.appcompat:appcompat:1.6.1")
47+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

app/src/main/AndroidManifest.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<manifest
2+
xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
5+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher"
12+
android:theme="@style/ImprovedTheme">
13+
14+
<activity
15+
android:name=".MainActivity"
16+
android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout"
17+
android:launchMode="singleInstance"
18+
android:screenOrientation="user"
19+
android:windowSoftInputMode="stateHidden"
20+
android:exported="true">
21+
22+
<intent-filter>
23+
<action android:name="android.intent.action.MAIN" />
24+
<category android:name="android.intent.category.LAUNCHER" />
25+
</intent-filter>
26+
27+
</activity>
28+
29+
</application>
30+
</manifest>

app/src/main/assets/blacklist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.tcd.gamelauncher
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
package com.tcd.gamelauncher;
2+
3+
import android.content.pm.ApplicationInfo;
4+
import android.content.pm.PackageManager;
5+
import android.os.Bundle;
6+
import android.view.LayoutInflater;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
import android.widget.ImageView;
10+
import android.widget.LinearLayout;
11+
import android.widget.TextView;
12+
import androidx.annotation.NonNull;
13+
import androidx.annotation.Nullable;
14+
import androidx.fragment.app.Fragment;
15+
import androidx.recyclerview.widget.LinearLayoutManager;
16+
import androidx.recyclerview.widget.RecyclerView;
17+
import java.util.List;
18+
19+
public class AppSelectorFragment extends Fragment {
20+
21+
private List<ApplicationInfo> filteredApps;
22+
private PackageManager pm;
23+
24+
public AppSelectorFragment(List<ApplicationInfo> filteredApps, PackageManager pm) {
25+
this.filteredApps = filteredApps;
26+
this.pm = pm;
27+
}
28+
29+
@Override
30+
public View onCreateView(
31+
@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
32+
return inflater.inflate(R.layout.game_browser, container, false);
33+
}
34+
35+
@Override
36+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
37+
super.onViewCreated(view, savedInstanceState);
38+
39+
RecyclerView appListView = view.findViewById(R.id.app_selector_recycler_view);
40+
appListView.setLayoutManager(new LinearLayoutManager(requireContext()));
41+
42+
appListView.setAdapter(
43+
new RecyclerView.Adapter<RecyclerView.ViewHolder>() {
44+
@NonNull
45+
@Override
46+
public RecyclerView.ViewHolder onCreateViewHolder(
47+
@NonNull ViewGroup parent, int viewType) {
48+
View itemView =
49+
LayoutInflater.from(parent.getContext())
50+
.inflate(R.layout.app_selector_item, parent, false);
51+
return new RecyclerView.ViewHolder(itemView) {};
52+
}
53+
54+
@Override
55+
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
56+
ApplicationInfo appInfo = filteredApps.get(position);
57+
LinearLayout layout = (LinearLayout) holder.itemView;
58+
ImageView icon = layout.findViewById(R.id.app_icon);
59+
TextView name = layout.findViewById(R.id.app_name);
60+
61+
icon.setImageDrawable(appInfo.loadIcon(pm));
62+
name.setText(appInfo.loadLabel(pm));
63+
64+
layout.setOnClickListener(
65+
v -> {
66+
if (getActivity() instanceof MainActivity) {
67+
((MainActivity) getActivity())
68+
.addGame(
69+
appInfo.packageName,
70+
appInfo.loadLabel(pm).toString(),
71+
appInfo.loadIcon(pm));
72+
}
73+
requireActivity().getSupportFragmentManager().popBackStack();
74+
});
75+
}
76+
77+
@Override
78+
public int getItemCount() {
79+
return filteredApps.size();
80+
}
81+
});
82+
83+
TextView cancelButton = view.findViewById(R.id.Cancel_Btn);
84+
cancelButton.setOnClickListener(
85+
v -> {
86+
requireActivity()
87+
.getSupportFragmentManager()
88+
.beginTransaction()
89+
.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right)
90+
.remove(this)
91+
.commit();
92+
});
93+
}
94+
95+
@Override
96+
public void onResume() {
97+
super.onResume();
98+
((MainActivity) requireActivity()).setAllowPopupMenu(false);
99+
}
100+
101+
@Override
102+
public void onPause() {
103+
super.onPause();
104+
((MainActivity) requireActivity()).setAllowPopupMenu(true);
105+
}
106+
}

0 commit comments

Comments
 (0)