mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 07:04:17 +01:00
Addition of a UI: Settings and NRO list
This update adds a minimal UI.
This commit is contained in:
parent
d4ddbe9b88
commit
15f8c4b5f0
@ -5,7 +5,7 @@ android {
|
|||||||
buildToolsVersion "29.0.0"
|
buildToolsVersion "29.0.0"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "gq.cyuubi.lightswitch"
|
applicationId "gq.cyuubi.lightswitch"
|
||||||
minSdkVersion 22
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
@ -40,4 +40,5 @@ dependencies {
|
|||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
|
implementation 'androidx.preference:preference:1.1.0-beta01'
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,14 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
|
<activity
|
||||||
|
android:name=".SettingsActivity"
|
||||||
|
android:label="@string/settings"
|
||||||
|
android:parentActivityName=".MainActivity">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value="gq.cyuubi.lightswitch.MainActivity" />
|
||||||
|
</activity>
|
||||||
<activity android:name=".MainActivity">
|
<activity android:name=".MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -5,15 +5,12 @@
|
|||||||
#include <core/hos/loaders/nro.h>
|
#include <core/hos/loaders/nro.h>
|
||||||
#include <core/arm/memory.h>
|
#include <core/arm/memory.h>
|
||||||
|
|
||||||
extern "C" JNIEXPORT jstring JNICALL
|
extern "C"
|
||||||
Java_gq_cyuubi_lightswitch_MainActivity_stringFromJNI(
|
JNIEXPORT void JNICALL
|
||||||
JNIEnv *env,
|
Java_gq_cyuubi_lightswitch_MainActivity_loadFile(JNIEnv *env, jobject instance, jstring file_) {
|
||||||
jobject /* this */) {
|
const char *file = env->GetStringUTFChars(file_, 0);
|
||||||
|
|
||||||
core::cpu::Initialize();
|
core::cpu::Initialize();
|
||||||
core::loader::LoadNro("/sdcard/lawsofaviation.nro");
|
core::loader::LoadNro(file);
|
||||||
core::cpu::Run(BASE_ADDRESS);
|
core::cpu::Run(BASE_ADDRESS);
|
||||||
|
env->ReleaseStringUTFChars(file_, file);
|
||||||
std::string finished = "finished!";
|
|
||||||
return env->NewStringUTF(finished.c_str());
|
|
||||||
}
|
}
|
@ -1,13 +1,104 @@
|
|||||||
package gq.cyuubi.lightswitch;
|
package gq.cyuubi.lightswitch;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class DataModel {
|
||||||
|
File file;
|
||||||
|
int index;
|
||||||
|
|
||||||
|
public DataModel(File file) {
|
||||||
|
this.file = file;
|
||||||
|
index = file.getName().lastIndexOf(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return getName() + "(" + getType() + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
String name = "";
|
||||||
|
for (String str_i : file.getName().substring(0, index).split("_")) {
|
||||||
|
name += str_i.substring(0, 1).toUpperCase() + str_i.substring(1) + " ";
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return file.getName().substring(index + 1).toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return file.getAbsolutePath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileAdapter extends ArrayAdapter<DataModel> {
|
||||||
|
|
||||||
|
Context mContext;
|
||||||
|
private ArrayList<DataModel> dataSet;
|
||||||
|
|
||||||
|
public FileAdapter(Context context, @NonNull ArrayList<DataModel> data) {
|
||||||
|
super(context, android.R.layout.simple_list_item_2, data);
|
||||||
|
this.dataSet = new ArrayList<>();
|
||||||
|
this.mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add(DataModel object) {
|
||||||
|
super.add(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
DataModel dataModel = getItem(position);
|
||||||
|
ViewHolder viewHolder;
|
||||||
|
if (convertView == null) {
|
||||||
|
viewHolder = new ViewHolder();
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||||
|
convertView = inflater.inflate(android.R.layout.simple_list_item_2, parent, false);
|
||||||
|
viewHolder.txtTitle = convertView.findViewById(android.R.id.text1);
|
||||||
|
viewHolder.txtPath = convertView.findViewById(android.R.id.text2);
|
||||||
|
convertView.setTag(viewHolder);
|
||||||
|
} else {
|
||||||
|
viewHolder = (ViewHolder) convertView.getTag();
|
||||||
|
}
|
||||||
|
viewHolder.txtTitle.setText(dataModel.getTitle());
|
||||||
|
viewHolder.txtPath.setText(dataModel.getPath());
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ViewHolder {
|
||||||
|
TextView txtTitle;
|
||||||
|
TextView txtPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@ -15,22 +106,85 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
System.loadLibrary("lightswitch");
|
System.loadLibrary("lightswitch");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences;
|
||||||
|
FileAdapter adapter;
|
||||||
|
|
||||||
|
private List<File> findFile(String ext, File file, @Nullable List<File> files) {
|
||||||
|
if (files == null) {
|
||||||
|
files = new ArrayList<>();
|
||||||
|
}
|
||||||
|
File[] list = file.listFiles();
|
||||||
|
if (list != null) {
|
||||||
|
for (File file_i : list) {
|
||||||
|
if (file_i.isDirectory()) {
|
||||||
|
files = findFile(ext, file_i, files);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
String file_str = file_i.getName();
|
||||||
|
if (ext.equalsIgnoreCase(file_str.substring(file_str.lastIndexOf(".") + 1))) {
|
||||||
|
files.add(file_i);
|
||||||
|
}
|
||||||
|
} catch (StringIndexOutOfBoundsException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refresh_files() {
|
||||||
|
adapter.clear();
|
||||||
|
List<File> files = findFile("nro", new File(sharedPreferences.getString("search_location", "")), null);
|
||||||
|
for (File file : files) {
|
||||||
|
adapter.add(new DataModel(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
|
||||||
|
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
|
||||||
if(ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
|
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
|
||||||
{
|
System.exit(0);
|
||||||
ActivityCompat.requestPermissions(MainActivity.this,
|
}
|
||||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
}
|
||||||
1);
|
setContentView(R.layout.main_activity);
|
||||||
|
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
|
||||||
|
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||||
|
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
adapter = new FileAdapter(this, new ArrayList<DataModel>());
|
||||||
|
ListView game_list = findViewById(R.id.game_list);
|
||||||
|
game_list.setAdapter(adapter);
|
||||||
|
game_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
loadFile(((DataModel) parent.getItemAtPosition(position)).getPath());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
refresh_files();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example of a call to a native method
|
@Override
|
||||||
TextView tv = findViewById(R.id.sample_text);
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
tv.setText(stringFromJNI());
|
getMenuInflater().inflate(R.menu.toolbar, menu);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public native String stringFromJNI();
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.action_settings:
|
||||||
|
startActivity(new Intent(this, SettingsActivity.class));
|
||||||
|
return true;
|
||||||
|
case R.id.action_refresh:
|
||||||
|
refresh_files();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public native void loadFile(String file);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package gq.cyuubi.lightswitch;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.ActionBar;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
|
||||||
|
public class SettingsActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.settings_activity);
|
||||||
|
getSupportFragmentManager()
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.settings, new HeaderFragment())
|
||||||
|
.commit();
|
||||||
|
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class HeaderFragment extends PreferenceFragmentCompat {
|
||||||
|
@Override
|
||||||
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
|
setPreferencesFromResource(R.xml.preferences, rootKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5
app/src/main/res/drawable/ic_console.xml
Normal file
5
app/src/main/res/drawable/ic_console.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:alpha="0.85" android:height="24dp"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FFFF" android:pathData="M7,5h10v2h2L19,3c0,-1.1 -0.9,-1.99 -2,-1.99L7,1c-1.1,0 -2,0.9 -2,2v4h2L7,5zM15.41,16.59L20,12l-4.59,-4.59L14,8.83 17.17,12 14,15.17l1.41,1.42zM10,15.17L6.83,12 10,8.83 8.59,7.41 4,12l4.59,4.59L10,15.17zM17,19L7,19v-2L5,17v4c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2v-4h-2v2z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_refresh.xml
Normal file
9
app/src/main/res/drawable/ic_refresh.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFF"
|
||||||
|
android:pathData="M12,4L12,1L8,5l4,4L12,6c3.31,0 6,2.69 6,6 0,1.01 -0.25,1.97 -0.7,2.8l1.46,1.46C19.54,15.03 20,13.57 20,12c0,-4.42 -3.58,-8 -8,-8zM12,18c-3.31,0 -6,-2.69 -6,-6 0,-1.01 0.25,-1.97 0.7,-2.8L5.24,7.74C4.46,8.97 4,10.43 4,12c0,4.42 3.58,8 8,8v3l4,-4 -4,-4v3z" />
|
||||||
|
</vector>
|
5
app/src/main/res/drawable/ic_settings.xml
Normal file
5
app/src/main/res/drawable/ic_settings.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:alpha="0.85" android:height="24dp"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FFFF" android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z"/>
|
||||||
|
</vector>
|
@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".MainActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/sample_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Hello World!"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
28
app/src/main/res/layout/main_activity.xml
Normal file
28
app/src/main/res/layout/main_activity.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:theme="@style/ThemeOverlay.AppCompat.Dark"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/game_list"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
22
app/src/main/res/layout/settings_activity.xml
Normal file
22
app/src/main/res/layout/settings_activity.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:theme="@style/ThemeOverlay.AppCompat.Dark"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/settings"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</LinearLayout>
|
14
app/src/main/res/menu/toolbar.xml
Normal file
14
app/src/main/res/menu/toolbar.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_settings"
|
||||||
|
android:icon="@drawable/ic_settings"
|
||||||
|
android:title="@string/settings"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_refresh"
|
||||||
|
android:icon="@drawable/ic_refresh"
|
||||||
|
android:title="@string/refresh"
|
||||||
|
app:showAsAction="ifRoom"/>
|
||||||
|
</menu>
|
11
app/src/main/res/values/array.xml
Normal file
11
app/src/main/res/values/array.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string-array name="language_names">
|
||||||
|
<item>System Language</item>
|
||||||
|
<item>English</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="language_values">
|
||||||
|
<item>sys</item>
|
||||||
|
<item>en</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#008577</color>
|
<color name="colorPrimary">#E60012</color>
|
||||||
<color name="colorPrimaryDark">#00574B</color>
|
<color name="colorPrimaryDark">#AB0000</color>
|
||||||
<color name="colorAccent">#D81B60</color>
|
<color name="colorAccent">#E60012</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Lightswitch</string>
|
<string name="app_name">Lightswitch</string>
|
||||||
|
<!-- Toolbar -->
|
||||||
|
<string name="settings">Settings</string>
|
||||||
|
<string name="refresh">Refresh</string>
|
||||||
|
<!-- Main -->
|
||||||
|
<string name="request_string">The following permission</string>
|
||||||
|
<!-- Settings -->
|
||||||
|
<string name="search">Search</string>
|
||||||
|
<string name="search_location">Search Location</string>
|
||||||
|
<string name="localization">Localization</string>
|
||||||
|
<string name="localization_language">Language</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<!-- Switch Red Theme -->
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
39
app/src/main/res/xml/preferences.xml
Normal file
39
app/src/main/res/xml/preferences.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright 2018 The Android Open Source Project
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="category_search"
|
||||||
|
android:title="@string/search">
|
||||||
|
<EditTextPreference
|
||||||
|
android:defaultValue="/sdcard/"
|
||||||
|
app:key="search_location"
|
||||||
|
app:title="@string/search_location"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="category_localization"
|
||||||
|
android:title="@string/localization">
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="sys"
|
||||||
|
android:entries="@array/language_names"
|
||||||
|
android:entryValues="@array/language_values"
|
||||||
|
app:key="localization_language"
|
||||||
|
app:title="@string/localization_language"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
</androidx.preference.PreferenceScreen>
|
@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx1536m
|
|||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
# Android operating system, and which are packaged with your app's APK
|
# Android operating system, and which are packaged with your app's APK
|
||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
Loading…
Reference in New Issue
Block a user