Skip to content

Commit 83d7e1e

Browse files
committed
initial commit
0 parents  commit 83d7e1e

52 files changed

Lines changed: 1178 additions & 0 deletions

Some content is hidden

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

app/.gitignore

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

app/build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
compileSdk 31
7+
8+
defaultConfig {
9+
applicationId "navjot.valorant.valorantagentradomizer"
10+
minSdk 26
11+
targetSdk 31
12+
versionCode 3
13+
versionName "1.0.5"
14+
15+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16+
}
17+
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
compileOptions {
25+
sourceCompatibility JavaVersion.VERSION_1_8
26+
targetCompatibility JavaVersion.VERSION_1_8
27+
}
28+
}
29+
30+
dependencies {
31+
32+
implementation 'androidx.appcompat:appcompat:1.3.1'
33+
implementation 'com.google.android.material:material:1.4.0'
34+
implementation 'com.google.android.material:material:1.6.0'
35+
testImplementation 'junit:junit:4.+'
36+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
37+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
38+
}

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/release/app-release.apk

2.9 MB
Binary file not shown.

app/release/output-metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "navjot.valorant.valorantagentradomizer",
8+
"variantName": "release",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 2,
15+
"versionName": "1.0.1",
16+
"outputFile": "app-release.apk"
17+
}
18+
],
19+
"elementType": "File"
20+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package navjot.valorant.valorantagentradomizer;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("navjot.valorant.valorantagentradomizer", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="navjot.valorant.valorantagentradomizer">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.ValorantAgentRadomizer" >
12+
<activity
13+
android:name=".MainActivity"
14+
android:label="@string/app_name"
15+
android:exported="true">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
<category android:name="android.intent.category.LAUNCHER" />
19+
</intent-filter>
20+
</activity>
21+
</application>
22+
</manifest>
41 KB
Loading
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package navjot.valorant.valorantagentradomizer;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.widget.Toast;
6+
7+
import androidx.annotation.Nullable;
8+
import androidx.core.content.res.ResourcesCompat;
9+
import androidx.recyclerview.widget.DefaultItemAnimator;
10+
import androidx.recyclerview.widget.GridLayoutManager;
11+
import androidx.recyclerview.widget.RecyclerView;
12+
13+
import java.util.ArrayList;
14+
import java.util.List;
15+
16+
import navjot.valorant.valorantagentradomizer.UIElements.modernAgentHolder.AgentData;
17+
import navjot.valorant.valorantagentradomizer.UIElements.modernAgentHolder.ModernAgentAdapter;
18+
import navjot.valorant.valorantagentradomizer.valorant.AgentFlag;
19+
20+
public class MainActivity extends Activity {
21+
22+
public static int SELECTED, UNSELECTED;
23+
24+
private final List<AgentData> agentDataList = new ArrayList<>();
25+
private ModernAgentAdapter modernAgentAdapter;
26+
private static AgentFlag agentFlags;
27+
28+
@Override
29+
protected void onCreate(@Nullable Bundle savedInstanceState) {
30+
super.onCreate(savedInstanceState);
31+
setContentView(R.layout.activity_main);
32+
33+
SELECTED = ResourcesCompat.getColor(getResources(), R.color.selected, null);
34+
UNSELECTED = ResourcesCompat.getColor(getResources(), R.color.unselected, null);
35+
36+
initializeAgentFlagsAndRecyclerView();
37+
38+
findViewById(R.id.generate).setOnClickListener((v) -> generateButtonListener());
39+
}
40+
41+
@Override
42+
protected void onPause() {
43+
super.onPause();
44+
}
45+
46+
@Override
47+
protected void onResume() {
48+
super.onResume();
49+
}
50+
51+
private void initializeAgentFlagsAndRecyclerView() {
52+
modernAgentAdapter = new ModernAgentAdapter(agentDataList);
53+
RecyclerView recyclerView = findViewById(R.id.recycler_view);
54+
GridLayoutManager layoutManager = new GridLayoutManager(getApplicationContext(), 3);
55+
recyclerView.setLayoutManager(layoutManager);
56+
recyclerView.setItemAnimator(new DefaultItemAnimator());
57+
recyclerView.setAdapter(modernAgentAdapter);
58+
String[] array = getResources().getStringArray(R.array.agents);
59+
agentFlags = new AgentFlag(array);
60+
int c = 0;
61+
for (String s : array) {
62+
agentDataList.add(new AgentData(s, SELECTED));
63+
modernAgentAdapter.notifyItemInserted(c++);
64+
}
65+
}
66+
67+
public void generateButtonListener() {
68+
new Thread(() -> {
69+
String agent = ValorantRandomAgentSelect.getAgent(agentFlags);
70+
runOnUiThread(() -> Toast.makeText(getApplicationContext(), agent, Toast.LENGTH_SHORT).show()
71+
);
72+
}).start();
73+
}
74+
75+
public static AgentFlag getAgentFlags() {
76+
return agentFlags;
77+
}
78+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package navjot.valorant.valorantagentradomizer.UIElements.agentBox;
2+
3+
import android.view.View;
4+
import android.widget.TextView;
5+
6+
import androidx.recyclerview.widget.RecyclerView;
7+
8+
import navjot.valorant.valorantagentradomizer.R;
9+
10+
@Deprecated
11+
public class AgentBox extends RecyclerView.ViewHolder {
12+
private final TextView agentName;
13+
14+
public AgentBox(View view) {
15+
super(view);
16+
17+
agentName = view.findViewById(R.id.agentName);
18+
}
19+
20+
public TextView getAgentName() {
21+
return agentName;
22+
}
23+
}

0 commit comments

Comments
 (0)