Set up Volley request queue
This commit is contained in:
parent
7e02dcd87b
commit
dd2f5c0886
@ -44,4 +44,5 @@ dependencies {
|
|||||||
// CameraX View class
|
// CameraX View class
|
||||||
implementation "androidx.camera:camera-view:1.0.0-alpha14"
|
implementation "androidx.camera:camera-view:1.0.0-alpha14"
|
||||||
implementation 'com.google.zxing:core:3.3.0'
|
implementation 'com.google.zxing:core:3.3.0'
|
||||||
|
implementation 'com.android.volley:volley:1.2.0'
|
||||||
}
|
}
|
@ -5,6 +5,7 @@
|
|||||||
<uses-feature android:name="android.hardware.camera.any" />
|
<uses-feature android:name="android.hardware.camera.any" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -2,10 +2,12 @@ package dev.garrettmills.starship.hyperlink;
|
|||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
import com.android.volley.RequestQueue;
|
||||||
|
|
||||||
public class Hyperlink {
|
public class Hyperlink {
|
||||||
public static final String SHARED_PREFERENCES_NAME = "dev.garrettmills.starship.hyperlink.main";
|
public static final String SHARED_PREFERENCES_NAME = "dev.garrettmills.starship.hyperlink.main";
|
||||||
public static final String SERVER_ADDR = "dev.garrettmills.starship.hyperlink.server";
|
public static final String SERVER_ADDR = "dev.garrettmills.starship.hyperlink.server";
|
||||||
public static final String SERVER_TOKEN = "dev.garrettmills.starship.hyperlink.token.server";
|
public static final String ACCESS_TOKEN = "dev.garrettmills.starship.hyperlink.token.server";
|
||||||
|
|
||||||
public static final String EXTRA_LOGIN_TOKEN = "dev.garrettmills.starship.hyperlink.extra.login_token";
|
public static final String EXTRA_LOGIN_TOKEN = "dev.garrettmills.starship.hyperlink.extra.login_token";
|
||||||
|
|
||||||
@ -13,4 +15,5 @@ public class Hyperlink {
|
|||||||
public static final int REQUEST_PERMISSION_CAMERA = 181;
|
public static final int REQUEST_PERMISSION_CAMERA = 181;
|
||||||
|
|
||||||
public static SharedPreferences preferences;
|
public static SharedPreferences preferences;
|
||||||
|
public static RequestQueue httpRequestQueue;
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,14 @@ import android.os.Bundle;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.android.volley.toolbox.Volley;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Hyperlink.preferences = getSharedPreferences(Hyperlink.SHARED_PREFERENCES_NAME, MODE_PRIVATE);
|
Hyperlink.preferences = getSharedPreferences(Hyperlink.SHARED_PREFERENCES_NAME, MODE_PRIVATE);
|
||||||
|
Hyperlink.httpRequestQueue = Volley.newRequestQueue(this);
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
package dev.garrettmills.starship.hyperlink.util;
|
||||||
|
|
||||||
|
public class AccessToken {
|
||||||
|
}
|
@ -1,5 +1,9 @@
|
|||||||
package dev.garrettmills.starship.hyperlink.util;
|
package dev.garrettmills.starship.hyperlink.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Token format:
|
||||||
|
* "hyperlink|https://hyperlink.url|token"
|
||||||
|
*/
|
||||||
public class LoginToken {
|
public class LoginToken {
|
||||||
public static boolean isValidLoginToken(String token) {
|
public static boolean isValidLoginToken(String token) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user