Launcher
|
@ -0,0 +1,15 @@
|
||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="17" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="testRunner" value="GRADLE" />
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleJvm" value="jbr-17" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1 @@
|
||||||
|
/build
|
|
@ -0,0 +1,57 @@
|
||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'com.xixun.launcher'
|
||||||
|
compileSdk 34
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.xixun.launcher"
|
||||||
|
minSdk 21
|
||||||
|
targetSdk 34
|
||||||
|
versionCode 1
|
||||||
|
versionName "1"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
aidl true
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
|
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||||
|
implementation 'androidx.leanback:leanback:1.0.0'
|
||||||
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25'
|
||||||
|
implementation files('libs/gnph.jar')
|
||||||
|
implementation 'com.google.android.material:material:1.8.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
def getAppName() {
|
||||||
|
def stringsFile = android.sourceSets.main.res.sourceFiles.find { it.name.equals 'strings.xml' }
|
||||||
|
String s = new XmlParser().parse(stringsFile).string.find { it.@name.equals 'app_name' }.text();
|
||||||
|
return s.replaceAll("\"", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改 Apk 名
|
||||||
|
android.applicationVariants.configureEach { variant ->
|
||||||
|
variant.outputs.configureEach {
|
||||||
|
def fileName = "${getAppName()}-${versionName}.apk"
|
||||||
|
outputFileName = fileName
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||||
|
tools:ignore="ScopedStorage" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.Launcher"
|
||||||
|
android:usesCleartextTraffic="true">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:label="@string/app_name">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.HOME" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ProgActivity"/>
|
||||||
|
<activity
|
||||||
|
android:name=".ProgEditActi"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -0,0 +1,234 @@
|
||||||
|
package com.xixun.launcher;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.bluetooth.BluetoothAdapter;
|
||||||
|
import android.bluetooth.BluetoothDevice;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.os.StrictMode;
|
||||||
|
import android.view.Choreographer;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import androidx.activity.ComponentActivity;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MainActivity extends ComponentActivity implements Choreographer.FrameCallback {
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
var msg = "==== MainActivity onCreate ==== UI Thread: " + Thread.currentThread().getId();
|
||||||
|
Util.println(msg);
|
||||||
|
|
||||||
|
Button btnProg = findViewById(R.id.btnProg);
|
||||||
|
btnProg.setOnClickListener((View v)->startActivity(new Intent(MainActivity.this, ProgActivity.class)));
|
||||||
|
|
||||||
|
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build());
|
||||||
|
|
||||||
|
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
// if(! Environment.isExternalStorageManager()) {// android 11 且 不是已经被拒绝
|
||||||
|
// Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
||||||
|
// intent.setData(Uri.parse("package:" + getPackageName()));
|
||||||
|
// startActivityForResult(intent, 1024);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
if(ContextCompat.checkSelfPermission(this, android.Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED)
|
||||||
|
init();
|
||||||
|
else {
|
||||||
|
Util.println("---- No permission, Try again ...");
|
||||||
|
ActivityCompat.requestPermissions(this, new String[] {
|
||||||
|
android.Manifest.permission.ACCESS_FINE_LOCATION,
|
||||||
|
android.Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||||
|
android.Manifest.permission.BLUETOOTH,
|
||||||
|
android.Manifest.permission.BLUETOOTH_ADMIN,
|
||||||
|
android.Manifest.permission.BLUETOOTH_CONNECT,
|
||||||
|
android.Manifest.permission.BLUETOOTH_SCAN,
|
||||||
|
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||||
|
android.Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
|
android.Manifest.permission.MANAGE_EXTERNAL_STORAGE,
|
||||||
|
android.Manifest.permission.RECEIVE_BOOT_COMPLETED,
|
||||||
|
android.Manifest.permission.INTERNET
|
||||||
|
}, 999);
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
var intentFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
|
||||||
|
intentFilter.addDataScheme("file");
|
||||||
|
registerReceiver(new BroadcastReceiver(){
|
||||||
|
long lastMs;
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
var path = intent.getData().getPath();
|
||||||
|
Util.println("\nMEDIA_MOUNTED path: "+path);
|
||||||
|
var ms = System.currentTimeMillis();
|
||||||
|
if(ms-lastMs<1000) return;
|
||||||
|
lastMs = ms;
|
||||||
|
Util.makeText(MainActivity.this, "MEDIA_MOUNTED path: "+path).show();
|
||||||
|
}
|
||||||
|
}, intentFilter);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.R) return;
|
||||||
|
Util.println("onActivityResult "+resultCode+" isExternalStorageManager "+Environment.isExternalStorageManager());
|
||||||
|
if (requestCode == 1024) {
|
||||||
|
if(Environment.isExternalStorageManager()) init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
Util.println("onRequestPermissionsResult "+grantResults[0]);
|
||||||
|
Util.makeText(MainActivity.this, "onRequestPermissionsResult "+grantResults[0]).show();
|
||||||
|
if (requestCode == 999 && grantResults[0] == PackageManager.PERMISSION_GRANTED && Util.backImgFile == null)
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<BroadcastReceiver> reces = new ArrayList<>();
|
||||||
|
BluetoothDevice mBluetoothDevice;
|
||||||
|
// BluetoothAdapter bluetoothAdapter;
|
||||||
|
|
||||||
|
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||||
|
public void init() {
|
||||||
|
var dir = Build.VERSION.SDK_INT < Build.VERSION_CODES.R ? Environment.getExternalStorageDirectory().getAbsolutePath() + "/Launcher" : getExternalFilesDir(null).getAbsolutePath();
|
||||||
|
var msg = "---- dir " + dir;
|
||||||
|
Util.println(msg);
|
||||||
|
Util.programsDir = dir + "/programs";
|
||||||
|
Util.backImgFile = dir + "/background";
|
||||||
|
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addAction(BluetoothDevice.ACTION_FOUND);
|
||||||
|
//filter.addAction(BluetoothDevice.ACTION_CONNECTION_STATE_CHANGED);
|
||||||
|
filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
|
||||||
|
filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
|
||||||
|
BroadcastReceiver rece;
|
||||||
|
registerReceiver(rece = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
var action = intent.getAction();
|
||||||
|
Util.println("\nBluetooth action: " + action);
|
||||||
|
Util.makeText(MainActivity.this, "Bluetooth action: " + action).show();
|
||||||
|
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
|
||||||
|
mBluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||||
|
if (ActivityCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
Util.println("No Permission BLUETOOTH_CONNECT");
|
||||||
|
Util.makeText(MainActivity.this, "No Permission BLUETOOTH_CONNECT").show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Util.println("Device Name: " + mBluetoothDevice.getName() + " Address: " + mBluetoothDevice.getAddress() + " BondState: " + mBluetoothDevice.getBondState());
|
||||||
|
if (mBluetoothDevice.getName() == null || !mBluetoothDevice.getName().equals("RCSP"))
|
||||||
|
return;
|
||||||
|
if (mBluetoothDevice.getBondState() == BluetoothDevice.BOND_NONE) {
|
||||||
|
try {
|
||||||
|
mBluetoothDevice.createBond();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Util.printStackTrace(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// } else if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {
|
||||||
|
// int status = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, 0);
|
||||||
|
// if (BluetoothAdapter.STATE_ON == status) {
|
||||||
|
// mBluetoothAdapter.startDiscovery();
|
||||||
|
// Log.d(TAG, "mBluetoothAdapter.startDiscovery---STATE_ON");
|
||||||
|
// }
|
||||||
|
// } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
|
||||||
|
// if (!isConnected) {
|
||||||
|
// mBluetoothAdapter.startDiscovery();
|
||||||
|
// Log.d(TAG, "mBluetoothAdapter.startDiscovery---ACTION_DISCOVERY_FINISHED");
|
||||||
|
// }
|
||||||
|
// } else if (BluetoothInputDevice.ACTION_CONNECTION_STATE_CHANGED.equals(action)) {
|
||||||
|
// int newState = intent.getExtras().getInt(BluetoothProfile.EXTRA_STATE);
|
||||||
|
// switch (newState) {
|
||||||
|
// case BluetoothProfile.STATE_CONNECTING:
|
||||||
|
// Log.d(TAG, "CONNECTING");
|
||||||
|
// Toast.makeText(context, R.string.bluetooth_connecting, Toast.LENGTH_SHORT).show();
|
||||||
|
// break;
|
||||||
|
// case BluetoothProfile.STATE_CONNECTED:
|
||||||
|
// Log.d(TAG, "CONNECTED");
|
||||||
|
// Toast.makeText(context, R.string.bluetooth_connected, Toast.LENGTH_SHORT).show();
|
||||||
|
// RcConnectActivity.this.finish();
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, filter);
|
||||||
|
reces.add(rece);
|
||||||
|
|
||||||
|
// var intentFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
|
||||||
|
// intentFilter.addDataScheme("file");
|
||||||
|
// registerReceiver(new BroadcastReceiver() {
|
||||||
|
// long lastMs;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onReceive(Context context, Intent intent) {
|
||||||
|
// var path = intent.getData().getPath();
|
||||||
|
// Util.println("\nMEDIA_MOUNTED path: " + path);
|
||||||
|
// var ms = System.currentTimeMillis();
|
||||||
|
// if (ms - lastMs < 1000) return;
|
||||||
|
// lastMs = ms;
|
||||||
|
// Util.makeText(MainActivity.this, "MEDIA_MOUNTED path: " + path).show();
|
||||||
|
// }
|
||||||
|
// }, intentFilter);
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
|
// if (bluetoothAdapter == null) {
|
||||||
|
// Util.println("BluetoothAdapter is Null");
|
||||||
|
// Util.makeText(MainActivity.this, "BluetoothAdapter is Null").show();
|
||||||
|
// } else {
|
||||||
|
// Util.println("BluetoothState: " + bluetoothAdapter.getState());
|
||||||
|
// if (bluetoothAdapter.isEnabled()) {
|
||||||
|
// Util.println("startDiscovery");
|
||||||
|
// Util.makeText(MainActivity.this, "bluetoothAdapter startDiscovery").show();
|
||||||
|
// bluetoothAdapter.startDiscovery();
|
||||||
|
// } else {
|
||||||
|
// Util.println("enable");
|
||||||
|
// Util.makeText(MainActivity.this, "bluetoothAdapter enable").show();
|
||||||
|
// bluetoothAdapter.enable();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// Util.printStackTrace(e);
|
||||||
|
// Util.makeText(this, Util.toStr(e)).show();
|
||||||
|
// }
|
||||||
|
choreographer.postFrameCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Choreographer choreographer = Choreographer.getInstance();
|
||||||
|
int frameCnt;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFrame(long frameTimeNanos) {
|
||||||
|
choreographer.postFrameCallback(this);
|
||||||
|
if(--frameCnt > 0) return;
|
||||||
|
frameCnt = 600;
|
||||||
|
//System.out.println("root Width: "+root.getWidth());
|
||||||
|
// if(ActivityCompat.checkSelfPermission(this, android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// Util.println("No Permission BLUETOOTH_SCAN");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// Util.println("BluetoothAdapter is Discovering: " + bluetoothAdapter.isDiscovering());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
for(var rece : reces) unregisterReceiver(rece);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.xixun.launcher;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.GridLayout;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class ProgActivity extends FragmentActivity {
|
||||||
|
|
||||||
|
GridLayout _grid;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_prog);
|
||||||
|
|
||||||
|
_grid = findViewById(R.id.grid_layout);
|
||||||
|
Button btnNew = findViewById(R.id.BtnNew);
|
||||||
|
btnNew.setOnClickListener((View v)->startActivity(new Intent(ProgActivity.this, ProgEditActi.class)));
|
||||||
|
|
||||||
|
var programsDir = new File(Util.programsDir);
|
||||||
|
programsDir.mkdirs();
|
||||||
|
var progs = programsDir.listFiles();
|
||||||
|
File cover;
|
||||||
|
for(var prog : progs) if(prog.isDirectory() && (cover = new File(prog, "cover.png")).isFile()) add(prog.getName(), cover);
|
||||||
|
for(int i=0; i<5; i++) {
|
||||||
|
var vv = new LinearLayout(this);
|
||||||
|
vv.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
var imgV = new ImageView(this);
|
||||||
|
imgV.setImageResource(R.mipmap.ic_launcher);
|
||||||
|
imgV.setFocusable(true);
|
||||||
|
var prm = new LinearLayout.LayoutParams(480, 270);
|
||||||
|
vv.addView(imgV, prm);
|
||||||
|
var text = new TextView(this);
|
||||||
|
text.setText("Prog "+i);
|
||||||
|
vv.addView(text);
|
||||||
|
|
||||||
|
var hhh = new LinearLayout(this);
|
||||||
|
var btn = new Button(this);
|
||||||
|
btn.setText("编辑");
|
||||||
|
hhh.addView(btn);
|
||||||
|
|
||||||
|
btn = new Button(this);
|
||||||
|
btn.setText("删除");
|
||||||
|
hhh.addView(btn);
|
||||||
|
|
||||||
|
vv.addView(hhh);
|
||||||
|
|
||||||
|
_grid.addView(vv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void add(String name, File cover) {
|
||||||
|
var item = new LinearLayout(this);
|
||||||
|
item.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
var imgV = new ImageView(this);
|
||||||
|
imgV.setImageURI(Uri.fromFile(cover));
|
||||||
|
imgV.setFocusable(true);
|
||||||
|
item.addView(imgV, new LinearLayout.LayoutParams(480, 270));
|
||||||
|
var text = new TextView(this);
|
||||||
|
text.setText(name);
|
||||||
|
item.addView(text);
|
||||||
|
|
||||||
|
var hhh = new LinearLayout(this);
|
||||||
|
var btn = new Button(this);
|
||||||
|
btn.setText("编辑");
|
||||||
|
hhh.addView(btn);
|
||||||
|
|
||||||
|
btn = new Button(this);
|
||||||
|
btn.setText("删除");
|
||||||
|
hhh.addView(btn);
|
||||||
|
|
||||||
|
item.addView(hhh);
|
||||||
|
_grid.addView(item);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,230 @@
|
||||||
|
package com.xixun.launcher;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.media.MediaMetadataRetriever;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import gnph.util.Arrs;
|
||||||
|
import gnph.util.IOs;
|
||||||
|
import gnph.util.JSList;
|
||||||
|
import gnph.util.JSMap;
|
||||||
|
|
||||||
|
public class ProgEditActi extends FragmentActivity implements View.OnFocusChangeListener {
|
||||||
|
|
||||||
|
LinearLayout _pageList;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_prog_edit);
|
||||||
|
_pageList = findViewById(R.id.pageList);
|
||||||
|
|
||||||
|
var name = getIntent().getStringExtra("name");
|
||||||
|
if(name==null) {
|
||||||
|
var names = new File(Util.programsDir).list();
|
||||||
|
int i=1;
|
||||||
|
while(Arrs.indexOf(names, name = "新建节目"+i) > -1) i++;
|
||||||
|
}
|
||||||
|
var lbTitle = (TextView) findViewById(R.id.lbTitle);
|
||||||
|
lbTitle.setText(name);
|
||||||
|
|
||||||
|
var btnClose = (Button) findViewById(R.id.btnClose);
|
||||||
|
btnClose.setOnClickListener((View v)->finish());
|
||||||
|
|
||||||
|
var btnSave = (Button) findViewById(R.id.btnSave);
|
||||||
|
btnSave.setOnClickListener((View v)->{
|
||||||
|
var pages = new JSList<JSMap>();
|
||||||
|
var cnt = _pageList.getChildCount();
|
||||||
|
var progDir = new File(Util.programsDir+"/"+lbTitle.getText());
|
||||||
|
progDir.mkdirs();
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
var item = (PageItem) _pageList.getChildAt(i);
|
||||||
|
var src = new File(item.path);
|
||||||
|
if(! src.isFile()) continue;
|
||||||
|
var filename = ""+i+" - "+src.length();
|
||||||
|
try {
|
||||||
|
IOs.writeClose(new FileOutputStream(new File(progDir, filename)), new FileInputStream(src));
|
||||||
|
pages.add(new JSMap("file", filename));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Util.printStackTrace(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
new JSMap("pages", pages).writeClose(new FileOutputStream(new File(progDir, "cfg.json")));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Util.printStackTrace(e);
|
||||||
|
Util.makeText(this, "cfg.json write error: "+e).show();
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
});
|
||||||
|
|
||||||
|
add(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
PageItem _item;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if(requestCode==111) {
|
||||||
|
var path = data.getData().getPath().replace("/document/primary:","/storage/emulated/0/");
|
||||||
|
System.out.println(path+" "+new File(path).exists());
|
||||||
|
_item.removeViewAt(0);
|
||||||
|
_item.path = path;
|
||||||
|
_item.lbImg = new ImageView(this);
|
||||||
|
_item.lbImg.setOnFocusChangeListener(this);
|
||||||
|
boolean unset = true;
|
||||||
|
if(path.endsWith(".mp4")) {
|
||||||
|
var retriever = new MediaMetadataRetriever();
|
||||||
|
try {
|
||||||
|
retriever.setDataSource(path);
|
||||||
|
var img = retriever.getFrameAtTime(1000, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
|
||||||
|
_item.lbImg.setImageBitmap(_item.img = img);
|
||||||
|
unset = false;
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
retriever.release();
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(unset) _item.lbImg.setImageURI(_item.uri = data.getData());
|
||||||
|
var prm = new LinearLayout.LayoutParams(480, 270);
|
||||||
|
_item.addView(_item.lbImg, 0, prm);
|
||||||
|
onFocusChange(_item.lbImg, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void add(int idx) {
|
||||||
|
var pageItem = new PageItem(this);
|
||||||
|
var lbImg = new Button(this);
|
||||||
|
lbImg.setText("添加文件");
|
||||||
|
pageItem.addView(lbImg, new LinearLayout.LayoutParams(480, 270));
|
||||||
|
lbImg.setOnClickListener((View v)->{
|
||||||
|
var inte = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||||
|
inte.setType("*/*");
|
||||||
|
startActivityForResult(inte, 111);
|
||||||
|
_item = (PageItem) v.getParent();
|
||||||
|
});
|
||||||
|
|
||||||
|
var hhh = new LinearLayout(this);
|
||||||
|
|
||||||
|
pageItem.lbIdx = new TextView(this);
|
||||||
|
pageItem.lbIdx.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||||
|
hhh.addView(pageItem.lbIdx, new LinearLayout.LayoutParams(120, 84));
|
||||||
|
|
||||||
|
var btn = new Button(this);
|
||||||
|
btn.setText("✚");
|
||||||
|
btn.setOnFocusChangeListener(this);
|
||||||
|
btn.setOnClickListener((View v)->{
|
||||||
|
var item = (LinearLayout) v.getParent().getParent();
|
||||||
|
var ppp = (LinearLayout) item.getParent();
|
||||||
|
var iii = ppp.indexOfChild(item);
|
||||||
|
add(iii+1);
|
||||||
|
});
|
||||||
|
hhh.addView(btn, new LinearLayout.LayoutParams(84, 84));
|
||||||
|
|
||||||
|
btn = new Button(this);
|
||||||
|
btn.setText("↑");
|
||||||
|
hhh.addView(btn, new LinearLayout.LayoutParams(84, 84));
|
||||||
|
btn.setOnFocusChangeListener(this);
|
||||||
|
btn.setOnClickListener((View v)->{
|
||||||
|
var item = (LinearLayout) v.getParent().getParent();
|
||||||
|
var list = (LinearLayout) item.getParent();
|
||||||
|
var iii = list.indexOfChild(item);
|
||||||
|
list.removeViewAt(iii);
|
||||||
|
list.addView(item, iii-1);
|
||||||
|
v.requestFocus();
|
||||||
|
var cnt = list.getChildCount();
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
var pitem = (PageItem) list.getChildAt(i);
|
||||||
|
pitem.lbIdx.setText(""+(i+1));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btn = new Button(this);
|
||||||
|
btn.setText("↓");
|
||||||
|
hhh.addView(btn, new LinearLayout.LayoutParams(84, 84));
|
||||||
|
btn.setOnFocusChangeListener(this);
|
||||||
|
btn.setOnClickListener((View v)->{
|
||||||
|
var item = (LinearLayout) v.getParent().getParent();
|
||||||
|
var list = (LinearLayout) item.getParent();
|
||||||
|
var iii = list.indexOfChild(item);
|
||||||
|
list.removeViewAt(iii);
|
||||||
|
list.addView(item, iii+1);
|
||||||
|
v.requestFocus();
|
||||||
|
var cnt = list.getChildCount();
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
var pitem = (PageItem) list.getChildAt(i);
|
||||||
|
pitem.lbIdx.setText(""+(i+1));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btn = new Button(this);
|
||||||
|
btn.setText("\uD83E\uDEA3");
|
||||||
|
hhh.addView(btn, new LinearLayout.LayoutParams(84, 84));
|
||||||
|
btn.setOnClickListener((View v)->{
|
||||||
|
var item = (LinearLayout) v.getParent().getParent();
|
||||||
|
var list = (LinearLayout) item.getParent();
|
||||||
|
list.removeView(item);
|
||||||
|
var cnt = list.getChildCount();
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
var pitem = (PageItem) list.getChildAt(i);
|
||||||
|
pitem.lbIdx.setText(""+(i+1));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
pageItem.addView(hhh);
|
||||||
|
|
||||||
|
_pageList.addView(pageItem, idx);
|
||||||
|
|
||||||
|
var cnt = _pageList.getChildCount();
|
||||||
|
for(int i=0; i<cnt; i++) {
|
||||||
|
var item = (PageItem) _pageList.getChildAt(i);
|
||||||
|
item.lbIdx.setText(""+(i+1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
if(! hasFocus) return;
|
||||||
|
var pare = v.getParent();
|
||||||
|
if(! (pare instanceof PageItem)) {
|
||||||
|
pare = pare.getParent();
|
||||||
|
if(! (pare instanceof PageItem)) return;
|
||||||
|
}
|
||||||
|
var item = (PageItem) pare;
|
||||||
|
var bigImg = (ImageView) findViewById(R.id.bigImg);
|
||||||
|
if(item.img!=null) bigImg.setImageBitmap(item.img);
|
||||||
|
else if(item.uri!=null) bigImg.setImageURI(item.uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class PageItem extends LinearLayout {
|
||||||
|
ImageView lbImg;
|
||||||
|
Bitmap img;
|
||||||
|
Uri uri;
|
||||||
|
String path;
|
||||||
|
TextView lbIdx;
|
||||||
|
public PageItem(Context context) {
|
||||||
|
super(context);
|
||||||
|
setOrientation(LinearLayout.VERTICAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
package com.xixun.launcher;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.leanback.app.BackgroundManager;
|
||||||
|
import androidx.leanback.app.BrowseSupportFragment;
|
||||||
|
import androidx.leanback.widget.ArrayObjectAdapter;
|
||||||
|
import androidx.leanback.widget.HeaderItem;
|
||||||
|
import androidx.leanback.widget.ListRow;
|
||||||
|
import androidx.leanback.widget.ListRowPresenter;
|
||||||
|
import androidx.leanback.widget.OnItemViewClickedListener;
|
||||||
|
import androidx.leanback.widget.Presenter;
|
||||||
|
import androidx.leanback.widget.Row;
|
||||||
|
import androidx.leanback.widget.RowPresenter;
|
||||||
|
import androidx.leanback.widget.VerticalGridPresenter;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.request.target.SimpleTarget;
|
||||||
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
public class ProgFragment extends BrowseSupportFragment {
|
||||||
|
private static final String TAG = "ProgFragment";
|
||||||
|
|
||||||
|
private static final int BACKGROUND_UPDATE_DELAY = 300;
|
||||||
|
|
||||||
|
private final Handler mHandler = new Handler(Looper.myLooper());
|
||||||
|
private Drawable mDefaultBackground;
|
||||||
|
private DisplayMetrics mMetrics;
|
||||||
|
private Timer mBackgroundTimer;
|
||||||
|
private String mBackgroundUri;
|
||||||
|
private BackgroundManager mBackgroundManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
Log.i(TAG, "onCreate");
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
|
//prepareBackgroundManager
|
||||||
|
mBackgroundManager = BackgroundManager.getInstance(getActivity());
|
||||||
|
mBackgroundManager.attach(getActivity().getWindow());
|
||||||
|
mDefaultBackground = ContextCompat.getDrawable(getContext(), R.drawable.default_background);
|
||||||
|
getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics = new DisplayMetrics());
|
||||||
|
|
||||||
|
|
||||||
|
// setBadgeDrawable(getActivity().getResources().getDrawable(R.drawable.videos_by_google_banner));
|
||||||
|
setTitle("title");
|
||||||
|
setHeadersState(HEADERS_ENABLED);
|
||||||
|
setHeadersTransitionOnBackEnabled(true);
|
||||||
|
// set fastLane (or headers) background color
|
||||||
|
setBrandColor(ContextCompat.getColor(getContext(), R.color.fastlane_background));
|
||||||
|
//loadRows
|
||||||
|
var rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
|
||||||
|
var vvv = new VerticalGridPresenter();
|
||||||
|
vvv.setNumberOfColumns(4);
|
||||||
|
var page = new ArrayObjectAdapter(vvv);
|
||||||
|
var gridRowAdapter = new ArrayObjectAdapter(new GridItemPresenter());
|
||||||
|
gridRowAdapter.add("aaa");
|
||||||
|
gridRowAdapter.add("bbb");
|
||||||
|
gridRowAdapter.add("ccc");
|
||||||
|
page.add(gridRowAdapter);
|
||||||
|
rowsAdapter.add(new ListRow(new HeaderItem(0, "PREFERENCES"), page));
|
||||||
|
|
||||||
|
setAdapter(rowsAdapter);
|
||||||
|
|
||||||
|
setOnSearchClickedListener((View view)->{
|
||||||
|
Toast.makeText(getActivity(), "Implement your own in-app search", Toast.LENGTH_LONG).show();
|
||||||
|
});
|
||||||
|
setOnItemViewClickedListener(new ItemViewClickedListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (null != mBackgroundTimer) {
|
||||||
|
Log.d(TAG, "onDestroy: " + mBackgroundTimer.toString());
|
||||||
|
mBackgroundTimer.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class ItemViewClickedListener implements OnItemViewClickedListener {
|
||||||
|
@Override
|
||||||
|
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
|
||||||
|
if(item instanceof String) {
|
||||||
|
// if (((String) item).contains(getString(R.string.error_fragment))) {
|
||||||
|
// Intent intent = new Intent(getActivity(), BrowseErrorActivity.class);
|
||||||
|
// startActivity(intent);
|
||||||
|
// } else {
|
||||||
|
// Toast.makeText(getActivity(), ((String) item), Toast.LENGTH_SHORT).show();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateBackground(String uri) {
|
||||||
|
int width = mMetrics.widthPixels;
|
||||||
|
int height = mMetrics.heightPixels;
|
||||||
|
Glide.with(getActivity())
|
||||||
|
.load(uri)
|
||||||
|
.centerCrop()
|
||||||
|
.error(mDefaultBackground)
|
||||||
|
.into(new SimpleTarget<Drawable>(width, height) {
|
||||||
|
@Override
|
||||||
|
public void onResourceReady(@NonNull Drawable drawable,
|
||||||
|
@Nullable Transition<? super Drawable> transition) {
|
||||||
|
mBackgroundManager.setDrawable(drawable);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBackgroundTimer.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startBackgroundTimer() {
|
||||||
|
if (null != mBackgroundTimer) {
|
||||||
|
mBackgroundTimer.cancel();
|
||||||
|
}
|
||||||
|
mBackgroundTimer = new Timer();
|
||||||
|
mBackgroundTimer.schedule(new UpdateBackgroundTask(), BACKGROUND_UPDATE_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UpdateBackgroundTask extends TimerTask {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateBackground(mBackgroundUri);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GridItemPresenter extends Presenter {
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(ViewGroup parent) {
|
||||||
|
TextView view = new TextView(parent.getContext());
|
||||||
|
view.setLayoutParams(new ViewGroup.LayoutParams(200, 200));
|
||||||
|
view.setFocusable(true);
|
||||||
|
view.setFocusableInTouchMode(true);
|
||||||
|
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.default_background));
|
||||||
|
view.setTextColor(Color.WHITE);
|
||||||
|
view.setGravity(Gravity.CENTER);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(ViewHolder viewHolder, Object item) {
|
||||||
|
((TextView) viewHolder.view).setText((String) item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUnbindViewHolder(ViewHolder viewHolder) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.xixun.launcher;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.io.CharArrayWriter;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
public class Util {
|
||||||
|
public static StringBuffer buf = new StringBuffer();
|
||||||
|
|
||||||
|
public static void println(String msg) {
|
||||||
|
System.out.println(msg);
|
||||||
|
if(buf.length()>1000000) buf.replace(0, 100000, "");
|
||||||
|
buf.append(msg).append("\n");
|
||||||
|
}
|
||||||
|
public static void printStackTrace(Throwable e) {
|
||||||
|
println(toStackTrace(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toStr(Throwable e) {
|
||||||
|
var traces = e.getStackTrace();
|
||||||
|
var msg = e.toString();
|
||||||
|
for(var trace : traces) if(trace.getClassName().startsWith("com.xixun.launcher.")) {
|
||||||
|
msg += "\n at "+trace.getFileName()+'.'+trace.getMethodName()+':'+trace.getLineNumber();
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
public static String toStackTrace(Throwable e) {
|
||||||
|
var out = new CharArrayWriter();
|
||||||
|
var writer = new PrintWriter(out);
|
||||||
|
e.printStackTrace(writer);
|
||||||
|
writer.flush();
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Toast makeText(Context context, CharSequence text) {
|
||||||
|
var toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
|
||||||
|
toast.setGravity(Gravity.TOP | Gravity.LEFT, 0, 0);
|
||||||
|
return toast;
|
||||||
|
}
|
||||||
|
public static String programsDir, backImgFile;
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package gnph.android;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
public class LinearBox extends LinearLayout {
|
||||||
|
|
||||||
|
public LinearBox(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
public LinearBox(ViewGroup box) {
|
||||||
|
super(box.getContext());
|
||||||
|
box.addView(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinearBox horizontal() {
|
||||||
|
setOrientation(HORIZONTAL);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public LinearBox vertical() {
|
||||||
|
setOrientation(VERTICAL);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinearBox addSpacing(int spacing) {
|
||||||
|
if(getOrientation()==HORIZONTAL) addView(new View(getContext()), new LayoutParams(spacing, 0));
|
||||||
|
else addView(new View(getContext()), new LayoutParams(0, spacing));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public LinearBox addStretch() {
|
||||||
|
addView(new View(getContext()), new LayoutParams(0, 0,1));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 168 KiB |
After Width: | Height: | Size: 182 KiB |
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:startColor="@color/background_gradient_start"
|
||||||
|
android:endColor="@color/background_gradient_end"
|
||||||
|
android:angle="-270" />
|
||||||
|
</shape>
|
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 141 KiB |
|
@ -0,0 +1,170 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 87 KiB |
|
@ -0,0 +1,73 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/back"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
android:layout_width="128dp"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:paddingStart="45dp"
|
||||||
|
android:id="@+id/btnProg"
|
||||||
|
android:background="@drawable/prog"
|
||||||
|
android:text="节目播控"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:paddingStart="45dp"
|
||||||
|
android:background="@drawable/cast"
|
||||||
|
android:text="无线投屏"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
android:layout_width="128dp"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:paddingStart="45dp"
|
||||||
|
android:background="@drawable/signal"
|
||||||
|
android:text="信号源"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:paddingStart="45dp"
|
||||||
|
android:background="@drawable/more"
|
||||||
|
android:text="更多应用"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:layout_width="72dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:paddingTop="60dp"
|
||||||
|
android:background="@drawable/game"
|
||||||
|
android:text="互动游戏"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/LinearLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/BtnNew"
|
||||||
|
android:text="新建节目"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="节目列表"
|
||||||
|
android:textAlignment="center"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
<GridLayout
|
||||||
|
android:id="@+id/grid_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:columnCount="4"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/LinearLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/btnClose"
|
||||||
|
android:text="关闭"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/btnSave"
|
||||||
|
android:text="保存"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/btnRename"
|
||||||
|
android:text="重命名"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/lbTitle"
|
||||||
|
android:textAlignment="center"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/hBox"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
>
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="480px"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/pageList"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/bigImg"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 7.6 KiB |
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
|
||||||
|
<color name="background_gradient_start">#000000</color>
|
||||||
|
<color name="background_gradient_end">#DDDDDD</color>
|
||||||
|
<color name="fastlane_background">#0096a6</color>
|
||||||
|
<color name="search_opaque">#ffaa3f</color>
|
||||||
|
<color name="selected_background">#ffaa3f</color>
|
||||||
|
<color name="default_background">#333333</color>
|
||||||
|
</resources>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Launcher</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<style name="Theme.Launcher" parent="@style/Theme.Leanback">
|
||||||
|
<item name="android:textColor">@color/white</item>
|
||||||
|
<item name="android:textColorPrimary">@color/white</item>
|
||||||
|
<item name="android:textSize">18sp</item>
|
||||||
|
<item name="android:colorControlHighlight">#ffffff</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
|
@ -0,0 +1,4 @@
|
||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
id 'com.android.application' version '8.1.1' apply false
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# 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
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# 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
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
|
@ -0,0 +1,6 @@
|
||||||
|
#Wed Oct 11 11:55:49 CST 2023
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,185 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# https://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.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,89 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
|
@ -0,0 +1,18 @@
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "Launcher"
|
||||||
|
include ':app'
|