mirror of
https://github.com/Dark98/SliceBeam.git
synced 2026-07-02 16:49:02 +00:00
Srat Refactoring To Santoku
This commit is contained in:
+4
-4
@@ -8,7 +8,7 @@ include(CheckLibraryExists)
|
||||
include(GenerateExportHeader)
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
project(SliceBeam)
|
||||
project(Santoku)
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
@@ -1241,9 +1241,9 @@ add_library(slic3r
|
||||
|
||||
src/main/jni/bbl/Orient.cpp
|
||||
|
||||
src/main/jni/slicebeam/beam_native.cpp
|
||||
src/main/jni/slicebeam/GLModel.cpp
|
||||
src/main/jni/slicebeam/GLShader.cpp
|
||||
src/main/jni/santoku/beam_native.cpp
|
||||
src/main/jni/santoku/GLModel.cpp
|
||||
src/main/jni/santoku/GLShader.cpp
|
||||
|
||||
# $<TARGET_OBJECTS:simd>
|
||||
)
|
||||
|
||||
+3
-3
@@ -8,11 +8,11 @@ plugins {
|
||||
def commit = getGitCommitHash(file('.'))
|
||||
|
||||
android {
|
||||
namespace 'ru.ytkab0bp.slicebeam'
|
||||
namespace 'com.dark98.santoku'
|
||||
compileSdk 35
|
||||
|
||||
defaultConfig {
|
||||
applicationId "ru.ytkab0bp.slicebeam"
|
||||
applicationId "com.dark98.santoku"
|
||||
minSdk 21
|
||||
targetSdk 35
|
||||
versionCode 8
|
||||
@@ -74,7 +74,7 @@ android {
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all {
|
||||
outputFileName = "SliceBeam_" + commit + ".apk"
|
||||
outputFileName = "Santoku_" + commit + ".apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
android:icon="@mipmap/icon"
|
||||
android:label="@string/AppName"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.SliceBeam"
|
||||
android:name=".SliceBeam"
|
||||
android:theme="@style/Theme.Santoku"
|
||||
android:name=".Santoku"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:largeHeap="true"
|
||||
android:isGame="false"
|
||||
@@ -35,7 +35,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:configChanges="uiMode"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.SliceBeam">
|
||||
android:theme="@style/Theme.Santoku">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<activity android:name=".SetupActivity" android:exported="false"/>
|
||||
<activity android:name=".SafeStartActivity" android:exported="false"/>
|
||||
<provider
|
||||
android:authorities="ru.ytkab0bp.slicebeam.provider"
|
||||
android:authorities="com.dark98.santoku.provider"
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false">
|
||||
|
||||
@@ -47,13 +47,13 @@ var dark = $['is_dark_theme'];
|
||||
document.getElementsByClassName('md-option')[dark ? 1 : 0].click();
|
||||
|
||||
beginSaveFile = function(filename) {
|
||||
SliceBeam.beginDownload(filename);
|
||||
Santoku.beginDownload(filename);
|
||||
}
|
||||
|
||||
writeToFile = function(data) {
|
||||
SliceBeam.writeData(btoa(unescape(encodeURIComponent(data))));
|
||||
Santoku.writeData(btoa(unescape(encodeURIComponent(data))));
|
||||
}
|
||||
|
||||
finishFile = function() {
|
||||
SliceBeam.finishDownload();
|
||||
Santoku.finishDownload();
|
||||
}
|
||||
@@ -47,7 +47,7 @@ var dark = $['is_dark_theme'];
|
||||
document.getElementsByClassName('md-option')[dark ? 1 : 0].click();
|
||||
|
||||
saveTextAsFile = function(filename, text) {
|
||||
SliceBeam.beginDownload(filename);
|
||||
SliceBeam.writeData(btoa(unescape(encodeURIComponent(text))));
|
||||
SliceBeam.finishDownload();
|
||||
Santoku.beginDownload(filename);
|
||||
Santoku.writeData(btoa(unescape(encodeURIComponent(text))));
|
||||
Santoku.finishDownload();
|
||||
}
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam;
|
||||
package com.dark98.santoku;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
@@ -15,9 +15,9 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import cz.msebera.android.httpclient.Header;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import ru.ytkab0bp.slicebeam.events.BeamServerDataUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
import com.dark98.santoku.events.BeamServerDataUpdatedEvent;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
|
||||
public class BeamServerData {
|
||||
private final static String TAG = "BeamServerData";
|
||||
@@ -26,7 +26,7 @@ public class BeamServerData {
|
||||
private static AsyncHttpClient client = new AsyncHttpClient();
|
||||
|
||||
static {
|
||||
client.setUserAgent(String.format(Locale.ROOT, "SliceBeam/%s-%d", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
client.setUserAgent(String.format(Locale.ROOT, "Santoku/%s-%d", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
client.setEnableRedirects(true);
|
||||
client.setLoggingEnabled(false);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class BeamServerData {
|
||||
Prefs.setLastCheckedInfo();
|
||||
|
||||
try {
|
||||
SliceBeam.SERVER_DATA = new BeamServerData(new JSONObject(str));
|
||||
Santoku.SERVER_DATA = new BeamServerData(new JSONObject(str));
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -81,11 +81,11 @@ public class BeamServerData {
|
||||
|
||||
private void setIsRussia(boolean v) {
|
||||
Prefs.setRussianIP(v);
|
||||
SliceBeam.EVENT_BUS.fireEvent(new BeamServerDataUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new BeamServerDataUpdatedEvent());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new BeamServerDataUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new BeamServerDataUpdatedEvent());
|
||||
}
|
||||
}
|
||||
|
||||
+63
-63
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam;
|
||||
package com.dark98.santoku;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
@@ -49,28 +49,28 @@ import java.util.UUID;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import ru.ytkab0bp.sapil.APICallback;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudAPI;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.ChangeLogBottomSheet;
|
||||
import ru.ytkab0bp.slicebeam.components.UnfoldMenu;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissAIGeneratorMenu;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.ObjectsListChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.fragment.BedFragment;
|
||||
import ru.ytkab0bp.slicebeam.navigation.Fragment;
|
||||
import ru.ytkab0bp.slicebeam.navigation.MobileNavigationDelegate;
|
||||
import ru.ytkab0bp.slicebeam.navigation.NavigationDelegate;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Model;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rConfigWrapper;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rRuntimeError;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.IOUtils;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.SnackbarsLayout;
|
||||
import com.dark98.santoku.cloud.CloudAPI;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.ChangeLogBottomSheet;
|
||||
import com.dark98.santoku.components.UnfoldMenu;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.events.NeedDismissAIGeneratorMenu;
|
||||
import com.dark98.santoku.events.NeedDismissSnackbarEvent;
|
||||
import com.dark98.santoku.events.NeedSnackbarEvent;
|
||||
import com.dark98.santoku.events.ObjectsListChangedEvent;
|
||||
import com.dark98.santoku.fragment.BedFragment;
|
||||
import com.dark98.santoku.navigation.Fragment;
|
||||
import com.dark98.santoku.navigation.MobileNavigationDelegate;
|
||||
import com.dark98.santoku.navigation.NavigationDelegate;
|
||||
import com.dark98.santoku.slic3r.Model;
|
||||
import com.dark98.santoku.slic3r.Slic3rConfigWrapper;
|
||||
import com.dark98.santoku.slic3r.Slic3rRuntimeError;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.IOUtils;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.SnackbarsLayout;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
// Activity result
|
||||
@@ -105,7 +105,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
if (SliceBeam.CONFIG == null) {
|
||||
if (Santoku.CONFIG == null) {
|
||||
Prefs.setLastCommit();
|
||||
startActivity(new Intent(this, SetupActivity.class));
|
||||
finish();
|
||||
@@ -194,7 +194,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
if (!Objects.equals(Prefs.getLastCommit(), BuildConfig.COMMIT) && SliceBeam.hasUpdateInfo) {
|
||||
if (!Objects.equals(Prefs.getLastCommit(), BuildConfig.COMMIT) && Santoku.hasUpdateInfo) {
|
||||
Prefs.setLastCommit();
|
||||
BeamServerData.load();
|
||||
new ChangeLogBottomSheet(this).show();
|
||||
@@ -226,8 +226,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
OutputStream out = getContentResolver().openOutputStream(data.getData());
|
||||
Model model = ((BedFragment) fragment).getGlView().getRenderer().getModel();
|
||||
File tempFile = File.createTempFile("temp_project", ".3mf");
|
||||
SliceBeam.genCurrentConfig();
|
||||
File cfg = SliceBeam.getCurrentConfigFile();
|
||||
Santoku.genCurrentConfig();
|
||||
File cfg = Santoku.getCurrentConfigFile();
|
||||
model.export3mf(cfg.getAbsolutePath(), tempFile.getAbsolutePath());
|
||||
|
||||
InputStream in = new FileInputStream(tempFile);
|
||||
@@ -240,7 +240,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
out.close();
|
||||
tempFile.delete();
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileExport3mfSuccess));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileExport3mfSuccess));
|
||||
} catch (IOException | Slic3rRuntimeError e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -273,21 +273,21 @@ public class MainActivity extends AppCompatActivity {
|
||||
EXPORTING_PRINTERS = null;
|
||||
|
||||
w.presets = new ConfigObject();
|
||||
if (w.findPrint(SliceBeam.CONFIG.presets.get("print")) != null) {
|
||||
w.presets.put("print", SliceBeam.CONFIG.presets.get("print"));
|
||||
if (w.findPrint(Santoku.CONFIG.presets.get("print")) != null) {
|
||||
w.presets.put("print", Santoku.CONFIG.presets.get("print"));
|
||||
}
|
||||
if (w.findFilament(SliceBeam.CONFIG.presets.get("filament")) != null) {
|
||||
w.presets.put("filament", SliceBeam.CONFIG.presets.get("filament"));
|
||||
if (w.findFilament(Santoku.CONFIG.presets.get("filament")) != null) {
|
||||
w.presets.put("filament", Santoku.CONFIG.presets.get("filament"));
|
||||
}
|
||||
if (w.findPrinter(SliceBeam.CONFIG.presets.get("printer")) != null) {
|
||||
w.presets.put("printer", SliceBeam.CONFIG.presets.get("printer"));
|
||||
if (w.findPrinter(Santoku.CONFIG.presets.get("printer")) != null) {
|
||||
w.presets.put("printer", Santoku.CONFIG.presets.get("printer"));
|
||||
}
|
||||
|
||||
OutputStream out = getContentResolver().openOutputStream(data.getData());
|
||||
out.write(w.serialize().getBytes(StandardCharsets.UTF_8));
|
||||
out.close();
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileExportProfilesSuccess));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileExportProfilesSuccess));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -328,14 +328,14 @@ public class MainActivity extends AppCompatActivity {
|
||||
.show();
|
||||
}
|
||||
} else if (requestCode == REQUEST_CODE_AI_GENERATOR_TAKE_PHOTO) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissAIGeneratorMenu());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissAIGeneratorMenu());
|
||||
|
||||
Bitmap bm = BitmapFactory.decodeFile(aiTempFile.getAbsolutePath());
|
||||
generateAiModel(bm);
|
||||
aiTempFile.delete();
|
||||
aiTempFile = null;
|
||||
} else if (requestCode == REQUEST_CODE_AI_GENERATOR_CHOOSE_PHOTO) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissAIGeneratorMenu());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissAIGeneratorMenu());
|
||||
|
||||
try {
|
||||
InputStream in = getContentResolver().openInputStream(data.getData());
|
||||
@@ -350,8 +350,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void loadConvertedProfile(Uri uri) {
|
||||
String tag = UUID.randomUUID().toString();
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.OrcaConversionPleaseWait).tag(tag));
|
||||
File f = new File(SliceBeam.getModelCacheDir(), "orca_conv.zip");
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.OrcaConversionPleaseWait).tag(tag));
|
||||
File f = new File(Santoku.getModelCacheDir(), "orca_conv.zip");
|
||||
IOUtils.IO_POOL.submit(()->{
|
||||
try {
|
||||
InputStream in = getContentResolver().openInputStream(uri);
|
||||
@@ -369,7 +369,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
if (!bundle.get("bundle_type").equals("printer config bundle")) {
|
||||
zf.close();
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
ViewUtils.postOnMainThread(() -> new BeamAlertDialogBuilder(this)
|
||||
.setTitle(R.string.MenuFileImportProfilesFailed)
|
||||
.setMessage(R.string.OrcaConversionNotAConfigBundle)
|
||||
@@ -470,17 +470,17 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
zf.close();
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
loadIniForImport(new ByteArrayInputStream(w.serialize().getBytes(StandardCharsets.UTF_8)));
|
||||
} catch (IOUtils.MissingProfileException ep) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
ViewUtils.postOnMainThread(() -> new BeamAlertDialogBuilder(this)
|
||||
.setTitle(R.string.MenuFileImportProfilesFailed)
|
||||
.setMessage(getString(R.string.MenuFileImportProfilesFailedBaseProfileNotFound, ep.profile))
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show());
|
||||
} catch (Exception e) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
ViewUtils.postOnMainThread(() -> new BeamAlertDialogBuilder(this)
|
||||
.setTitle(R.string.MenuFileImportProfilesFailed)
|
||||
.setMessage(e.toString())
|
||||
@@ -493,7 +493,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
private void generateAiModel(Bitmap bm) {
|
||||
IS_GENERATING_AI_MODEL = true;
|
||||
String uploadTag = UUID.randomUUID().toString();
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileAIGeneratorUploading).tag(uploadTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileAIGeneratorUploading).tag(uploadTag));
|
||||
IOUtils.IO_POOL.submit(()->{
|
||||
Bitmap scaled;
|
||||
if (bm.getWidth() > 1024 || bm.getHeight() > 1024) {
|
||||
@@ -519,13 +519,13 @@ public class MainActivity extends AppCompatActivity {
|
||||
CloudAPI.INSTANCE.modelsGenerate(Base64.encodeToString(out.toByteArray(), Base64.NO_WRAP), "image/png", new APICallback<InputStream>() {
|
||||
@Override
|
||||
public void onResponse(InputStream in) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(processTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(processTag));
|
||||
|
||||
String downloadTag = UUID.randomUUID().toString();
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileAIGeneratorDownloading).tag(downloadTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileAIGeneratorDownloading).tag(downloadTag));
|
||||
String fileName = "generated_" + UUID.randomUUID() + ".stl";
|
||||
|
||||
File f = new File(SliceBeam.getModelCacheDir(), fileName);
|
||||
File f = new File(Santoku.getModelCacheDir(), fileName);
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
@@ -571,8 +571,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
} catch (Exception e) {
|
||||
Log.e("ai_generator", "Failed to write to downloads", e);
|
||||
}
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(downloadTag));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileAIGeneratorSavedAs, fileName));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(downloadTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileAIGeneratorSavedAs, fileName));
|
||||
loadFile(f, true);
|
||||
CloudController.checkGeneratorRemaining();
|
||||
IS_GENERATING_AI_MODEL = false;
|
||||
@@ -580,7 +580,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onException(Exception e) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(processTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(processTag));
|
||||
ViewUtils.postOnMainThread(() -> new BeamAlertDialogBuilder(MainActivity.this)
|
||||
.setTitle(R.string.MenuFileAIGeneratorError)
|
||||
.setMessage(e.toString())
|
||||
@@ -589,8 +589,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
IS_GENERATING_AI_MODEL = false;
|
||||
}
|
||||
});
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(uploadTag));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileAIGeneratorProcessing).tag(processTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(uploadTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileAIGeneratorProcessing).tag(processTag));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -633,20 +633,20 @@ public class MainActivity extends AppCompatActivity {
|
||||
Runnable finish = () -> {
|
||||
for (int i = 0; i < enabledPrints.length; i++) {
|
||||
if (enabledPrints[i]) {
|
||||
SliceBeam.CONFIG.importPrint(w.printConfigs.get(i));
|
||||
Santoku.CONFIG.importPrint(w.printConfigs.get(i));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < enabledFilaments.length; i++) {
|
||||
if (enabledFilaments[i]) {
|
||||
SliceBeam.CONFIG.importFilament(w.filamentConfigs.get(i));
|
||||
Santoku.CONFIG.importFilament(w.filamentConfigs.get(i));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < enabledPrinters.length; i++) {
|
||||
if (enabledPrinters[i]) {
|
||||
SliceBeam.CONFIG.importPrinter(w.printerConfigs.get(i));
|
||||
Santoku.CONFIG.importPrinter(w.printerConfigs.get(i));
|
||||
}
|
||||
}
|
||||
SliceBeam.saveConfig();
|
||||
Santoku.saveConfig();
|
||||
};
|
||||
Runnable printersRun = () -> {
|
||||
if (printers.length == 0) {
|
||||
@@ -698,7 +698,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void loadFile(File f, boolean autoorient) {
|
||||
String tag = UUID.randomUUID().toString();
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileOpenFileLoading).tag(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileOpenFileLoading).tag(tag));
|
||||
IOUtils.IO_POOL.submit(() -> {
|
||||
Process.setThreadPriority(-20);
|
||||
if (delegate.getCurrentFragment() instanceof BedFragment) {
|
||||
@@ -720,7 +720,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
if (!gcode) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new ObjectsListChangedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new ObjectsListChangedEvent());
|
||||
}
|
||||
int i = model.getObjectsCount() - 1;
|
||||
if (autoorient) {
|
||||
@@ -728,10 +728,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
fragment.getGlView().getRenderer().invalidateGlModel(i);
|
||||
fragment.getGlView().requestRender();
|
||||
}
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileOpenFileLoaded));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileOpenFileLoaded));
|
||||
if (model.isBigObject(i)) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.WARNING, R.string.MenuFileOpenFileBigObject));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.WARNING, R.string.MenuFileOpenFileBigObject));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -739,7 +739,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
Log.e("MainActivity", "Failed to load model", e);
|
||||
f.delete();
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
ViewUtils.postOnMainThread(() -> new BeamAlertDialogBuilder(this)
|
||||
.setTitle(R.string.MenuFileOpenFileFailed)
|
||||
.setMessage(e.toString())
|
||||
@@ -780,7 +780,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
File f = new File(SliceBeam.getModelCacheDir(), fileName);
|
||||
File f = new File(Santoku.getModelCacheDir(), fileName);
|
||||
// TODO: Check if file already exists
|
||||
IOUtils.IO_POOL.submit(()->{
|
||||
try {
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam;
|
||||
package com.dark98.santoku;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
@@ -17,10 +17,10 @@ import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.BeamButton;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.BeamButton;
|
||||
|
||||
public class SafeStartActivity extends Activity {
|
||||
@Override
|
||||
+24
-24
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam;
|
||||
package com.dark98.santoku;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Application;
|
||||
@@ -17,26 +17,26 @@ import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventBus;
|
||||
import ru.ytkab0bp.slicebeam.boot.AppBoot;
|
||||
import ru.ytkab0bp.slicebeam.boot.BeamServerDataTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.CheckUpdateJsonTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.ClearModelCacheTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.CloudInitTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.EventBusTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.LoadSlic3rConfigTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.PrefsTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.PrintConfigWarmupTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.TrueTimeTask;
|
||||
import ru.ytkab0bp.slicebeam.boot.VibrationUtilsTask;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.ConfigOptionDef;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.PrintConfigDef;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rConfigWrapper;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import com.dark98.santoku.boot.AppBoot;
|
||||
import com.dark98.santoku.boot.BeamServerDataTask;
|
||||
import com.dark98.santoku.boot.CheckUpdateJsonTask;
|
||||
import com.dark98.santoku.boot.ClearModelCacheTask;
|
||||
import com.dark98.santoku.boot.CloudInitTask;
|
||||
import com.dark98.santoku.boot.EventBusTask;
|
||||
import com.dark98.santoku.boot.LoadSlic3rConfigTask;
|
||||
import com.dark98.santoku.boot.PrefsTask;
|
||||
import com.dark98.santoku.boot.PrintConfigWarmupTask;
|
||||
import com.dark98.santoku.boot.TrueTimeTask;
|
||||
import com.dark98.santoku.boot.VibrationUtilsTask;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.slic3r.ConfigOptionDef;
|
||||
import com.dark98.santoku.slic3r.PrintConfigDef;
|
||||
import com.dark98.santoku.slic3r.Slic3rConfigWrapper;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
|
||||
public class SliceBeam extends Application {
|
||||
public static SliceBeam INSTANCE;
|
||||
public class Santoku extends Application {
|
||||
public static Santoku INSTANCE;
|
||||
public static EventBus EVENT_BUS = EventBus.newBus("main");
|
||||
public static TrueTimeImpl TRUE_TIME;
|
||||
public static Slic3rConfigWrapper CONFIG;
|
||||
@@ -75,7 +75,7 @@ public class SliceBeam extends Application {
|
||||
}
|
||||
|
||||
public static void saveConfig() {
|
||||
SliceBeam.CONFIG_UID++;
|
||||
Santoku.CONFIG_UID++;
|
||||
File f = getConfigFile();
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
@@ -101,11 +101,11 @@ public class SliceBeam extends Application {
|
||||
|
||||
public static ConfigObject buildCurrentConfigObject() {
|
||||
ConfigObject singleObject = new ConfigObject();
|
||||
ConfigObject printerConfig = SliceBeam.CONFIG.findPrinter(SliceBeam.CONFIG.presets.get("printer"));
|
||||
ConfigObject printerConfig = Santoku.CONFIG.findPrinter(Santoku.CONFIG.presets.get("printer"));
|
||||
if (printerConfig != null) {
|
||||
singleObject.values.putAll(printerConfig.values);
|
||||
}
|
||||
ConfigObject printConfig = SliceBeam.CONFIG.findPrint(SliceBeam.CONFIG.presets.get("print"));
|
||||
ConfigObject printConfig = Santoku.CONFIG.findPrint(Santoku.CONFIG.presets.get("print"));
|
||||
if (printConfig != null) {
|
||||
for (Map.Entry<String, String> en : printConfig.values.entrySet()) {
|
||||
if (!Slic3rConfigWrapper.PRINTER_CONFIG_KEYS.contains(en.getKey())) {
|
||||
@@ -114,7 +114,7 @@ public class SliceBeam extends Application {
|
||||
}
|
||||
}
|
||||
// TODO: MMU. Detect by printerConfig#getExtruderCount()
|
||||
ConfigObject filamentConfig = SliceBeam.CONFIG.findFilament(SliceBeam.CONFIG.presets.get("filament"));
|
||||
ConfigObject filamentConfig = Santoku.CONFIG.findFilament(Santoku.CONFIG.presets.get("filament"));
|
||||
if (filamentConfig != null) {
|
||||
for (Map.Entry<String, String> en : filamentConfig.values.entrySet()) {
|
||||
if (!Slic3rConfigWrapper.PRINTER_CONFIG_KEYS.contains(en.getKey())) {
|
||||
+44
-44
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam;
|
||||
package com.dark98.santoku;
|
||||
|
||||
import static android.opengl.GLES30.GL_COLOR_BUFFER_BIT;
|
||||
import static android.opengl.GLES30.GL_DEPTH_BUFFER_BIT;
|
||||
@@ -89,35 +89,35 @@ import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import cz.msebera.android.httpclient.Header;
|
||||
import ru.ytkab0bp.eventbus.EventHandler;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudAPI;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.CloudManageBottomSheet;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.events.BeamServerDataUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudFeaturesUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudLoginStateUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudSyncFinishedEvent;
|
||||
import ru.ytkab0bp.slicebeam.recycler.BigHeaderItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.PreferenceItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerAdapter;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.TextHintRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLModel;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLShaderProgram;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLShadersManager;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rConfigWrapper;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rUtils;
|
||||
import ru.ytkab0bp.slicebeam.theme.BeamTheme;
|
||||
import ru.ytkab0bp.slicebeam.theme.IThemeView;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.BeamSwitch;
|
||||
import ru.ytkab0bp.slicebeam.view.BoostySubsView;
|
||||
import ru.ytkab0bp.slicebeam.view.FadeRecyclerView;
|
||||
import ru.ytkab0bp.slicebeam.view.MiniColorView;
|
||||
import ru.ytkab0bp.slicebeam.view.TextColorImageSpan;
|
||||
import com.dark98.santoku.cloud.CloudAPI;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.CloudManageBottomSheet;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.events.BeamServerDataUpdatedEvent;
|
||||
import com.dark98.santoku.events.CloudFeaturesUpdatedEvent;
|
||||
import com.dark98.santoku.events.CloudLoginStateUpdatedEvent;
|
||||
import com.dark98.santoku.events.CloudSyncFinishedEvent;
|
||||
import com.dark98.santoku.recycler.BigHeaderItem;
|
||||
import com.dark98.santoku.recycler.PreferenceItem;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerAdapter;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.recycler.TextHintRecyclerItem;
|
||||
import com.dark98.santoku.slic3r.GLModel;
|
||||
import com.dark98.santoku.slic3r.GLShaderProgram;
|
||||
import com.dark98.santoku.slic3r.GLShadersManager;
|
||||
import com.dark98.santoku.slic3r.Slic3rConfigWrapper;
|
||||
import com.dark98.santoku.slic3r.Slic3rUtils;
|
||||
import com.dark98.santoku.theme.BeamTheme;
|
||||
import com.dark98.santoku.theme.IThemeView;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.BeamSwitch;
|
||||
import com.dark98.santoku.view.BoostySubsView;
|
||||
import com.dark98.santoku.view.FadeRecyclerView;
|
||||
import com.dark98.santoku.view.MiniColorView;
|
||||
import com.dark98.santoku.view.TextColorImageSpan;
|
||||
|
||||
public class SetupActivity extends AppCompatActivity {
|
||||
public final static String EXTRA_ABOUT = "about";
|
||||
@@ -173,7 +173,7 @@ public class SetupActivity extends AppCompatActivity {
|
||||
private List<ConfigObject> enabledPrinters = new ArrayList<>();
|
||||
|
||||
{
|
||||
client.setUserAgent(String.format(Locale.ROOT, "SliceBeam/%s-%d", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
client.setUserAgent(String.format(Locale.ROOT, "Santoku/%s-%d", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
client.setEnableRedirects(true);
|
||||
client.setLoggingEnabled(false);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class SetupActivity extends AppCompatActivity {
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
|
||||
about = getIntent().getBooleanExtra(EXTRA_ABOUT, false);
|
||||
boostyOnly = getIntent().getBooleanExtra(EXTRA_BOOSTY_ONLY, false);
|
||||
@@ -334,7 +334,7 @@ public class SetupActivity extends AppCompatActivity {
|
||||
Log.e(TAG, "Failed to load vendor file " + iniUrl, error);
|
||||
isLoading = false;
|
||||
ViewUtils.postOnMainThread(() -> {
|
||||
Toast.makeText(SliceBeam.INSTANCE, R.string.IntroFailedToLoadRepos, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(Santoku.INSTANCE, R.string.IntroFailedToLoadRepos, Toast.LENGTH_SHORT).show();
|
||||
fakeScroll(-1);
|
||||
pager.setUserInputEnabled(true);
|
||||
});
|
||||
@@ -361,7 +361,7 @@ public class SetupActivity extends AppCompatActivity {
|
||||
isLoading = false;
|
||||
Log.e(TAG, "Failed to load repo", error);
|
||||
ViewUtils.postOnMainThread(() -> {
|
||||
Toast.makeText(SliceBeam.INSTANCE, R.string.IntroFailedToLoadRepos, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(Santoku.INSTANCE, R.string.IntroFailedToLoadRepos, Toast.LENGTH_SHORT).show();
|
||||
fakeScroll(-1);
|
||||
pager.setUserInputEnabled(true);
|
||||
});
|
||||
@@ -498,7 +498,7 @@ public class SetupActivity extends AppCompatActivity {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
}
|
||||
|
||||
@EventHandler(runOnMainThread = true)
|
||||
@@ -634,7 +634,7 @@ public class SetupActivity extends AppCompatActivity {
|
||||
Log.e(TAG, "Failed to load repos", error);
|
||||
if (fromPage) {
|
||||
ViewUtils.postOnMainThread(() -> {
|
||||
Toast.makeText(SliceBeam.INSTANCE, R.string.IntroFailedToLoadRepos, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(Santoku.INSTANCE, R.string.IntroFailedToLoadRepos, Toast.LENGTH_SHORT).show();
|
||||
fakeScroll(-1);
|
||||
pager.setUserInputEnabled(true);
|
||||
});
|
||||
@@ -1244,7 +1244,7 @@ public class SetupActivity extends AppCompatActivity {
|
||||
|
||||
if (adapter.getItemCount() == 0 && isReposLoaded) {
|
||||
List<SimpleRecyclerItem> items = new ArrayList<>(repos);
|
||||
items.add(new TextHintRecyclerItem(SliceBeam.INSTANCE.getString(R.string.IntroSelectRepos)));
|
||||
items.add(new TextHintRecyclerItem(Santoku.INSTANCE.getString(R.string.IntroSelectRepos)));
|
||||
adapter.setItems(items);
|
||||
} else {
|
||||
adapter.notifyDataSetChanged();
|
||||
@@ -1271,7 +1271,7 @@ public class SetupActivity extends AppCompatActivity {
|
||||
|
||||
public void onReposLoaded() {
|
||||
List<SimpleRecyclerItem> items = new ArrayList<>(repos);
|
||||
items.add(new TextHintRecyclerItem(SliceBeam.INSTANCE.getString(R.string.IntroSelectRepos)));
|
||||
items.add(new TextHintRecyclerItem(Santoku.INSTANCE.getString(R.string.IntroSelectRepos)));
|
||||
adapter.setItems(items);
|
||||
new SpringAnimation(new FloatValueHolder(0))
|
||||
.setMinimumVisibleChange(1 / 256f)
|
||||
@@ -1443,8 +1443,8 @@ public class SetupActivity extends AppCompatActivity {
|
||||
ll.addView(title);
|
||||
|
||||
BoostySubsView subsView = new BoostySubsView(ctx);
|
||||
if (SliceBeam.SERVER_DATA != null) {
|
||||
List<String> list = new ArrayList<>(SliceBeam.SERVER_DATA.boostySubscribers);
|
||||
if (Santoku.SERVER_DATA != null) {
|
||||
List<String> list = new ArrayList<>(Santoku.SERVER_DATA.boostySubscribers);
|
||||
Collections.shuffle(list);
|
||||
subsView.setStrings(list);
|
||||
}
|
||||
@@ -1629,10 +1629,10 @@ public class SetupActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (Prefs.getCloudAPIToken() == null || SliceBeam.CONFIG == null) {
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
SliceBeam.CONFIG = cfg;
|
||||
FileOutputStream fos = new FileOutputStream(SliceBeam.getConfigFile());
|
||||
if (Prefs.getCloudAPIToken() == null || Santoku.CONFIG == null) {
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
Santoku.CONFIG = cfg;
|
||||
FileOutputStream fos = new FileOutputStream(Santoku.getConfigFile());
|
||||
fos.write(cfg.serialize().getBytes(StandardCharsets.UTF_8));
|
||||
fos.close();
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import android.util.Log;
|
||||
import android.util.SparseBooleanArray;
|
||||
@@ -11,7 +11,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
|
||||
public class AppBoot {
|
||||
private final static String TAG = "boot";
|
||||
+6
-6
@@ -1,18 +1,18 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.BeamServerData;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.BeamServerData;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class BeamServerDataTask extends BootTask {
|
||||
public BeamServerDataTask() {
|
||||
super(() -> {
|
||||
try {
|
||||
SliceBeam.SERVER_DATA = new BeamServerData(new JSONObject(Prefs.getBeamServerData()));
|
||||
Santoku.SERVER_DATA = new BeamServerData(new JSONObject(Prefs.getBeamServerData()));
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
+5
-5
@@ -1,17 +1,17 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import com.dark98.santoku.Santoku;
|
||||
|
||||
public class CheckUpdateJsonTask extends BootTask {
|
||||
public CheckUpdateJsonTask() {
|
||||
super(() -> {
|
||||
try {
|
||||
SliceBeam.INSTANCE.getAssets().open("update.json").close();
|
||||
SliceBeam.hasUpdateInfo = true;
|
||||
Santoku.INSTANCE.getAssets().open("update.json").close();
|
||||
Santoku.hasUpdateInfo = true;
|
||||
} catch (IOException e) {
|
||||
SliceBeam.hasUpdateInfo = false;
|
||||
Santoku.hasUpdateInfo = false;
|
||||
}
|
||||
});
|
||||
onWorker();
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import com.dark98.santoku.Santoku;
|
||||
|
||||
public class ClearModelCacheTask extends BootTask {
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
public ClearModelCacheTask() {
|
||||
super(()->{
|
||||
File cache = SliceBeam.getModelCacheDir();
|
||||
File cache = Santoku.getModelCacheDir();
|
||||
if (cache.exists()) {
|
||||
for (File f : cache.listFiles()) {
|
||||
f.delete();
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
|
||||
public class CloudCachedInitTask extends BootTask {
|
||||
public CloudCachedInitTask() {
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
|
||||
public class CloudInitTask extends BootTask {
|
||||
public CloudInitTask() {
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventBus;
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
|
||||
public class EventBusTask extends BootTask {
|
||||
|
||||
+6
-6
@@ -1,20 +1,20 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rConfigWrapper;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.slic3r.Slic3rConfigWrapper;
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
public class LoadSlic3rConfigTask extends BootTask {
|
||||
public LoadSlic3rConfigTask() {
|
||||
super(() -> {
|
||||
File cfgFile = SliceBeam.getConfigFile();
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
File cfgFile = Santoku.getConfigFile();
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
if (cfgFile.exists()) {
|
||||
try {
|
||||
SliceBeam.CONFIG = new Slic3rConfigWrapper(cfgFile);
|
||||
Santoku.CONFIG = new Slic3rConfigWrapper(cfgFile);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
|
||||
public class PrefsTask extends BootTask {
|
||||
public PrefsTask() {
|
||||
super(()->Prefs.init(Santoku.INSTANCE));
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.slic3r.PrintConfigDef;
|
||||
import com.dark98.santoku.slic3r.PrintConfigDef;
|
||||
|
||||
public class PrintConfigWarmupTask extends BootTask {
|
||||
public PrintConfigWarmupTask() {
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -13,13 +13,13 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import kotlinx.coroutines.Dispatchers;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import com.dark98.santoku.Santoku;
|
||||
|
||||
public class TrueTimeTask extends BootTask {
|
||||
public TrueTimeTask() {
|
||||
super(() -> {
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
SliceBeam.TRUE_TIME = new TrueTimeImpl(new TrueTimeParameters.Builder().buildParams(), Dispatchers.getIO(), new TrueTimeEventListener() {
|
||||
Santoku.TRUE_TIME = new TrueTimeImpl(new TrueTimeParameters.Builder().buildParams(), Dispatchers.getIO(), new TrueTimeEventListener() {
|
||||
@Override
|
||||
public void initialize(@NonNull TrueTimeParameters trueTimeParameters) {}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class TrueTimeTask extends BootTask {
|
||||
@Override
|
||||
public void returningDeviceTime() {}
|
||||
});
|
||||
SliceBeam.TRUE_TIME.sync();
|
||||
Santoku.TRUE_TIME.sync();
|
||||
try {
|
||||
latch.await(300, TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException ignored) {}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.dark98.santoku.boot;
|
||||
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.utils.VibrationUtils;
|
||||
|
||||
public class VibrationUtilsTask extends BootTask {
|
||||
|
||||
public VibrationUtilsTask() {
|
||||
super(() -> VibrationUtils.init(Santoku.INSTANCE));
|
||||
onWorker();
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.cloud;
|
||||
package com.dark98.santoku.cloud;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -18,8 +18,8 @@ import ru.ytkab0bp.sapil.Arg;
|
||||
import ru.ytkab0bp.sapil.Header;
|
||||
import ru.ytkab0bp.sapil.Method;
|
||||
import ru.ytkab0bp.sapil.RequestType;
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
|
||||
public interface CloudAPI extends APIRunner {
|
||||
CloudAPI INSTANCE = APILibrary.newRunner(CloudAPI.class, new RunnerConfig() {
|
||||
@@ -32,7 +32,7 @@ public interface CloudAPI extends APIRunner {
|
||||
|
||||
@Override
|
||||
public String getDefaultUserAgent() {
|
||||
return "SliceBeam v" + BuildConfig.VERSION_NAME + "/" + BuildConfig.VERSION_CODE;
|
||||
return "Santoku v" + BuildConfig.VERSION_NAME + "/" + BuildConfig.VERSION_CODE;
|
||||
}
|
||||
|
||||
@Override
|
||||
+68
-68
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.cloud;
|
||||
package com.dark98.santoku.cloud;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@@ -18,21 +18,21 @@ import java.util.Locale;
|
||||
|
||||
import ru.ytkab0bp.sapil.APICallback;
|
||||
import ru.ytkab0bp.sapil.APIRequestHandle;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudFeaturesUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudLoginStateUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudModelsRemainingCountUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudSyncFinishedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudUserInfoUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rConfigWrapper;
|
||||
import ru.ytkab0bp.slicebeam.utils.IOUtils;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.SnackbarsLayout;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.events.CloudFeaturesUpdatedEvent;
|
||||
import com.dark98.santoku.events.CloudLoginStateUpdatedEvent;
|
||||
import com.dark98.santoku.events.CloudModelsRemainingCountUpdatedEvent;
|
||||
import com.dark98.santoku.events.CloudSyncFinishedEvent;
|
||||
import com.dark98.santoku.events.CloudUserInfoUpdatedEvent;
|
||||
import com.dark98.santoku.events.NeedDismissSnackbarEvent;
|
||||
import com.dark98.santoku.events.NeedSnackbarEvent;
|
||||
import com.dark98.santoku.slic3r.Slic3rConfigWrapper;
|
||||
import com.dark98.santoku.utils.IOUtils;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.SnackbarsLayout;
|
||||
|
||||
public class CloudController {
|
||||
public final static String USER_INFO_AI_GEN_TAG = "ai_gen_user_info";
|
||||
@@ -54,7 +54,7 @@ public class CloudController {
|
||||
private static Runnable loginAutoCancel = () -> {
|
||||
loginSessionId = null;
|
||||
isLoggingIn = false;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
};
|
||||
private static Runnable loginCheck = new Runnable() {
|
||||
@Override
|
||||
@@ -99,7 +99,7 @@ public class CloudController {
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
long now = SliceBeam.TRUE_TIME.now().getTime();
|
||||
long now = Santoku.TRUE_TIME.now().getTime();
|
||||
boolean needSyncInfo = userFeatures == null || now - Prefs.getCloudLastFeaturesSync() > MIN_SYNC_FEATURES_DELTA;
|
||||
if (needSyncInfo) {
|
||||
checkUserFeatures();
|
||||
@@ -128,21 +128,21 @@ public class CloudController {
|
||||
userInfo = null;
|
||||
Prefs.setCloudAPIToken(null);
|
||||
Prefs.setCloudCachedUserInfo(null);
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudUserInfoUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudUserInfoUpdatedEvent());
|
||||
|
||||
if (isLoggingIn) {
|
||||
isLoggingIn = false;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
}
|
||||
} else {
|
||||
Prefs.setCloudCachedUserInfo(gson.toJson(userInfo));
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(USER_INFO_AI_GEN_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudUserInfoUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(USER_INFO_AI_GEN_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudUserInfoUpdatedEvent());
|
||||
|
||||
if (isLoggingIn) {
|
||||
isLoggingIn = false;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
}
|
||||
|
||||
if (isSyncAvailable() && Prefs.isCloudProfileSyncEnabled()) {
|
||||
@@ -150,7 +150,7 @@ public class CloudController {
|
||||
}
|
||||
checkGeneratorRemaining();
|
||||
}
|
||||
Prefs.setCloudLastFeaturesSync(SliceBeam.TRUE_TIME.now().getTime());
|
||||
Prefs.setCloudLastFeaturesSync(Santoku.TRUE_TIME.now().getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -171,9 +171,9 @@ public class CloudController {
|
||||
public void onResponse(CloudAPI.LoginData response) {
|
||||
loginSessionId = response.sessionId;
|
||||
|
||||
ViewUtils.postOnMainThread(loginAutoCancel, response.expiresAt * 1000L - SliceBeam.TRUE_TIME.now().getTime());
|
||||
ViewUtils.postOnMainThread(loginAutoCancel, response.expiresAt * 1000L - Santoku.TRUE_TIME.now().getTime());
|
||||
ViewUtils.postOnMainThread(loginCheck, 5000);
|
||||
ViewUtils.postOnMainThread(() -> SliceBeam.INSTANCE.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(response.url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)));
|
||||
ViewUtils.postOnMainThread(() -> Santoku.INSTANCE.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(response.url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,13 +185,13 @@ public class CloudController {
|
||||
|
||||
public static void beginLogin() {
|
||||
isLoggingIn = true;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
beginLogin0();
|
||||
}
|
||||
|
||||
public static void cancelLogin() {
|
||||
isLoggingIn = false;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
if (loginSessionId != null) {
|
||||
CloudAPI.INSTANCE.loginCancel(loginSessionId, response -> {});
|
||||
}
|
||||
@@ -207,8 +207,8 @@ public class CloudController {
|
||||
public static void logout() {
|
||||
Prefs.setCloudAPIToken(null);
|
||||
userInfo = null;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudUserInfoUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudLoginStateUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudUserInfoUpdatedEvent());
|
||||
CloudAPI.INSTANCE.logout(response -> {});
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public class CloudController {
|
||||
modelsUsed = response.used;
|
||||
modelsMaxGenerations = response.max;
|
||||
Prefs.setCloudCachedUsedMaxModels(modelsUsed, modelsMaxGenerations);
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudModelsRemainingCountUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudModelsRemainingCountUpdatedEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -237,9 +237,9 @@ public class CloudController {
|
||||
userFeatures = response;
|
||||
Prefs.setCloudCachedUserFeatures(gson.toJson(userFeatures));
|
||||
if (Prefs.getCloudAPIToken() == null) {
|
||||
Prefs.setCloudLastFeaturesSync(SliceBeam.TRUE_TIME.now().getTime());
|
||||
Prefs.setCloudLastFeaturesSync(Santoku.TRUE_TIME.now().getTime());
|
||||
}
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudFeaturesUpdatedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudFeaturesUpdatedEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -284,28 +284,28 @@ public class CloudController {
|
||||
public void onResponse(String response) {
|
||||
IOUtils.IO_POOL.submit(() -> {
|
||||
try {
|
||||
File f = SliceBeam.getConfigFile();
|
||||
File f = Santoku.getConfigFile();
|
||||
byte[] data = Base64.decode(response, 0);
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
fos.write(data);
|
||||
fos.close();
|
||||
|
||||
SliceBeam.CONFIG = new Slic3rConfigWrapper(f);
|
||||
Santoku.CONFIG = new Slic3rConfigWrapper(f);
|
||||
|
||||
Prefs.setCloudLocalLastModified(lastModified);
|
||||
Prefs.setCloudLocalLastSentModified(lastModified);
|
||||
Prefs.setCloudRemoteLastModified(lastModified);
|
||||
Prefs.setCloudLastSync(SliceBeam.TRUE_TIME.now().getTime());
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.CloudSyncSuccess));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
Prefs.setCloudLastSync(Santoku.TRUE_TIME.now().getTime());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.CloudSyncSuccess));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to write data", e);
|
||||
isSyncInProgress = false;
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -315,9 +315,9 @@ public class CloudController {
|
||||
Log.e(TAG, "Failed to download data", e);
|
||||
isSyncInProgress = false;
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -328,18 +328,18 @@ public class CloudController {
|
||||
}
|
||||
long modified = Prefs.getCloudLocalLastModified();
|
||||
isSyncInProgress = true;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.CloudSyncInProgress).tag(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.CloudSyncInProgress).tag(CLOUD_SYNC_TAG));
|
||||
|
||||
CloudAPI.INSTANCE.syncGetState(new APICallback<CloudAPI.SyncState>() {
|
||||
@Override
|
||||
public void onResponse(CloudAPI.SyncState response) {
|
||||
if (SliceBeam.CONFIG == null && response.usedSize != 0) {
|
||||
if (Santoku.CONFIG == null && response.usedSize != 0) {
|
||||
// Setup screen, no config yet
|
||||
downloadData(response.lastUpdatedDate);
|
||||
} else if (response.usedSize == 0) {
|
||||
if (SliceBeam.CONFIG == null) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
if (Santoku.CONFIG == null) {
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -351,8 +351,8 @@ public class CloudController {
|
||||
downloadData(response.lastUpdatedDate);
|
||||
} else {
|
||||
// Modified on client and on server
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.WARNING, R.string.CloudSyncConflict).button(R.string.CloudSyncConflictResolve, v -> {
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.WARNING, R.string.CloudSyncConflict).button(R.string.CloudSyncConflictResolve, v -> {
|
||||
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm", Locale.getDefault());
|
||||
new BeamAlertDialogBuilder(v.getContext())
|
||||
.setTitle(R.string.CloudSyncConflict)
|
||||
@@ -368,8 +368,8 @@ public class CloudController {
|
||||
uploadData(modified);
|
||||
} else {
|
||||
// Not modified on server and on client
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,8 +379,8 @@ public class CloudController {
|
||||
Log.e(TAG, "Failed to get sync state", e);
|
||||
isSyncInProgress = false;
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -388,7 +388,7 @@ public class CloudController {
|
||||
private static void uploadData(long modified) {
|
||||
IOUtils.IO_POOL.submit(() -> {
|
||||
try {
|
||||
File f = SliceBeam.getConfigFile();
|
||||
File f = Santoku.getConfigFile();
|
||||
FileInputStream fis = new FileInputStream(f);
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[10240];
|
||||
@@ -409,10 +409,10 @@ public class CloudController {
|
||||
}
|
||||
Prefs.setCloudRemoteLastModified(response.lastUpdatedDate);
|
||||
Prefs.setCloudLocalLastSentModified(modified);
|
||||
Prefs.setCloudLastSync(SliceBeam.TRUE_TIME.now().getTime());
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.CloudSyncSuccess));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
Prefs.setCloudLastSync(Santoku.TRUE_TIME.now().getTime());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.CloudSyncSuccess));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -420,24 +420,24 @@ public class CloudController {
|
||||
Log.e(TAG, "Failed to upload sync data", e);
|
||||
isSyncInProgress = false;
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to read sync data", e);
|
||||
isSyncInProgress = false;
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||
Santoku.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void notifyDataChanged() {
|
||||
long now = SliceBeam.TRUE_TIME.now().getTime();
|
||||
long now = Santoku.TRUE_TIME.now().getTime();
|
||||
Prefs.setCloudLocalLastModified(now);
|
||||
if (!isSyncAvailable() || !Prefs.isCloudProfileSyncEnabled()) {
|
||||
return;
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components;
|
||||
package com.dark98.santoku.components;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -21,9 +21,9 @@ import androidx.appcompat.widget.AppCompatCheckedTextView;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class BeamAlertDialogBuilder extends MaterialAlertDialogBuilder {
|
||||
public BeamAlertDialogBuilder(@NonNull Context context) {
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components;
|
||||
package com.dark98.santoku.components;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -8,9 +8,9 @@ import android.widget.TextView;
|
||||
|
||||
import com.mrudultora.colorpicker.ColorPickerPopUp;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class BeamColorPickerPopUp extends ColorPickerPopUp {
|
||||
public BeamColorPickerPopUp(Context context) {
|
||||
+15
-15
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components;
|
||||
package com.dark98.santoku.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -35,14 +35,14 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventHandler;
|
||||
import ru.ytkab0bp.slicebeam.BeamServerData;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.events.BeamServerDataUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.BeamButton;
|
||||
import ru.ytkab0bp.slicebeam.view.BoostySubsView;
|
||||
import com.dark98.santoku.BeamServerData;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.events.BeamServerDataUpdatedEvent;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.BeamButton;
|
||||
import com.dark98.santoku.view.BoostySubsView;
|
||||
|
||||
public class ChangeLogBottomSheet extends BottomSheetDialog {
|
||||
private BoostySubsView subsView;
|
||||
@@ -156,8 +156,8 @@ public class ChangeLogBottomSheet extends BottomSheetDialog {
|
||||
ll.addView(subtitle);
|
||||
|
||||
subsView = new BoostySubsView(context);
|
||||
if (SliceBeam.SERVER_DATA != null) {
|
||||
List<String> list = new ArrayList<>(SliceBeam.SERVER_DATA.boostySubscribers);
|
||||
if (Santoku.SERVER_DATA != null) {
|
||||
List<String> list = new ArrayList<>(Santoku.SERVER_DATA.boostySubscribers);
|
||||
Collections.shuffle(list);
|
||||
subsView.setStrings(list);
|
||||
}
|
||||
@@ -233,14 +233,14 @@ public class ChangeLogBottomSheet extends BottomSheetDialog {
|
||||
ll.setFitsSystemWindows(true);
|
||||
setContentView(ll);
|
||||
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
setOnDismissListener(dialog -> SliceBeam.EVENT_BUS.unregisterListener(this));
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
setOnDismissListener(dialog -> Santoku.EVENT_BUS.unregisterListener(this));
|
||||
}
|
||||
|
||||
@EventHandler(runOnMainThread = true)
|
||||
public void onDataUpdated(BeamServerDataUpdatedEvent e) {
|
||||
if (SliceBeam.SERVER_DATA != null) {
|
||||
List<String> list = new ArrayList<>(SliceBeam.SERVER_DATA.boostySubscribers);
|
||||
if (Santoku.SERVER_DATA != null) {
|
||||
List<String> list = new ArrayList<>(Santoku.SERVER_DATA.boostySubscribers);
|
||||
Collections.shuffle(list);
|
||||
subsView.setStrings(list);
|
||||
}
|
||||
+14
-14
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components;
|
||||
package com.dark98.santoku.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -24,18 +24,18 @@ import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudAPI;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.recycler.PreferenceSwitchItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerAdapter;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.TextColorImageSpan;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.cloud.CloudAPI;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
import com.dark98.santoku.events.NeedDismissSnackbarEvent;
|
||||
import com.dark98.santoku.recycler.PreferenceSwitchItem;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerAdapter;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.TextColorImageSpan;
|
||||
|
||||
public class CloudManageBottomSheet extends BottomSheetDialog {
|
||||
public CloudManageBottomSheet(@NonNull Context context) {
|
||||
@@ -97,7 +97,7 @@ public class CloudManageBottomSheet extends BottomSheetDialog {
|
||||
if (isChecked) {
|
||||
CloudController.notifyDataChanged();
|
||||
} else {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CloudController.CLOUD_SYNC_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CloudController.CLOUD_SYNC_TAG));
|
||||
}
|
||||
}));
|
||||
}
|
||||
+9
-9
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components;
|
||||
package com.dark98.santoku.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -21,12 +21,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventHandler;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.events.SlicingProgressEvent;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rLocalization;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.events.SlicingProgressEvent;
|
||||
import com.dark98.santoku.slic3r.Slic3rLocalization;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class SliceProgressBottomSheet extends BottomSheetDialog {
|
||||
private RecyclerView recyclerView;
|
||||
@@ -122,12 +122,12 @@ public class SliceProgressBottomSheet extends BottomSheetDialog {
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components;
|
||||
package com.dark98.santoku.components;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -18,10 +18,10 @@ import androidx.dynamicanimation.animation.FloatValueHolder;
|
||||
import androidx.dynamicanimation.animation.SpringAnimation;
|
||||
import androidx.dynamicanimation.animation.SpringForce;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.fragment.BedFragment;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.MirrorView;
|
||||
import com.dark98.santoku.fragment.BedFragment;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.MirrorView;
|
||||
|
||||
public abstract class UnfoldMenu {
|
||||
protected BedFragment fragment;
|
||||
+13
-13
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components;
|
||||
package com.dark98.santoku.components;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -23,14 +23,14 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissCalibrationsMenu;
|
||||
import ru.ytkab0bp.slicebeam.fragment.BedFragment;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.DividerView;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.events.NeedDismissCalibrationsMenu;
|
||||
import com.dark98.santoku.fragment.BedFragment;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.DividerView;
|
||||
|
||||
public class WebViewMenu extends UnfoldMenu {
|
||||
private final Uri uri;
|
||||
@@ -93,10 +93,10 @@ public class WebViewMenu extends UnfoldMenu {
|
||||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
};
|
||||
webView.addJavascriptInterface(new Bridge(), "SliceBeam");
|
||||
webView.addJavascriptInterface(new Bridge(), "Santoku");
|
||||
|
||||
WebSettings settings = webView.getSettings();
|
||||
settings.setUserAgentString(String.format(Locale.ROOT, "SliceBeam/%s-%d", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
settings.setUserAgentString(String.format(Locale.ROOT, "Santoku/%s-%d", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setDomStorageEnabled(true);
|
||||
settings.setDatabaseEnabled(true);
|
||||
@@ -131,7 +131,7 @@ public class WebViewMenu extends UnfoldMenu {
|
||||
|
||||
@JavascriptInterface
|
||||
public void beginDownload(String filename) {
|
||||
cacheFile = new File(SliceBeam.getModelCacheDir(), filename);
|
||||
cacheFile = new File(Santoku.getModelCacheDir(), filename);
|
||||
try {
|
||||
fileStream = new FileOutputStream(cacheFile);
|
||||
} catch (Exception e) {
|
||||
@@ -155,7 +155,7 @@ public class WebViewMenu extends UnfoldMenu {
|
||||
|
||||
ViewUtils.postOnMainThread(() -> {
|
||||
dismiss(true);
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissCalibrationsMenu());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissCalibrationsMenu());
|
||||
ViewUtils.postOnMainThread(() -> fragment.loadGCode(cacheFile), 200);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
package ru.ytkab0bp.slicebeam.components.bed_menu;
|
||||
package com.dark98.santoku.components.bed_menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.fragment.BedFragment;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Bed3D;
|
||||
import com.dark98.santoku.fragment.BedFragment;
|
||||
import com.dark98.santoku.slic3r.Bed3D;
|
||||
|
||||
public abstract class BedMenu {
|
||||
private View view;
|
||||
+9
-9
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components.bed_menu;
|
||||
package com.dark98.santoku.components.bed_menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -31,13 +31,13 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.theme.IThemeView;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.RandomUtils;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.theme.IThemeView;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.RandomUtils;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class BedMenuItem extends SimpleRecyclerItem<BedMenuItem.BedMenuItemHolderView> {
|
||||
public final int titleRes;
|
||||
@@ -169,7 +169,7 @@ public class BedMenuItem extends SimpleRecyclerItem<BedMenuItem.BedMenuItemHolde
|
||||
canvas.save();
|
||||
if (sparkles == null) sparkles = new ArrayList<>();
|
||||
if (sparkleDrawable == null) {
|
||||
sparkleDrawable = ContextCompat.getDrawable(SliceBeam.INSTANCE, R.drawable.sparkle_28);
|
||||
sparkleDrawable = ContextCompat.getDrawable(Santoku.INSTANCE, R.drawable.sparkle_28);
|
||||
sparkleDrawable.setColorFilter(new PorterDuffColorFilter(ThemesRepo.getColor(android.R.attr.colorAccent), PorterDuff.Mode.SRC_IN));
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components.bed_menu;
|
||||
package com.dark98.santoku.components.bed_menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Toast;
|
||||
@@ -10,16 +10,16 @@ import androidx.dynamicanimation.animation.SpringForce;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SpaceItem;
|
||||
import ru.ytkab0bp.slicebeam.render.Camera;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Bed3D;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.GLView;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.recycler.SpaceItem;
|
||||
import com.dark98.santoku.render.Camera;
|
||||
import com.dark98.santoku.slic3r.Bed3D;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.GLView;
|
||||
|
||||
public class CameraMenu extends ListBedMenu {
|
||||
private boolean checkInvalidBed() {
|
||||
+63
-63
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components.bed_menu;
|
||||
package com.dark98.santoku.components.bed_menu;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -33,40 +33,40 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventHandler;
|
||||
import ru.ytkab0bp.slicebeam.BeamServerData;
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import ru.ytkab0bp.slicebeam.MainActivity;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SetupActivity;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.UnfoldMenu;
|
||||
import ru.ytkab0bp.slicebeam.components.WebViewMenu;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudFeaturesUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudModelsRemainingCountUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissAIGeneratorMenu;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissCalibrationsMenu;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.ObjectsListChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.SelectedObjectChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.fragment.BedFragment;
|
||||
import ru.ytkab0bp.slicebeam.recycler.PreferenceItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerAdapter;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SpaceItem;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Bed3D;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rRuntimeError;
|
||||
import ru.ytkab0bp.slicebeam.theme.BeamTheme;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.DividerView;
|
||||
import ru.ytkab0bp.slicebeam.view.FadeRecyclerView;
|
||||
import ru.ytkab0bp.slicebeam.view.SegmentsView;
|
||||
import ru.ytkab0bp.slicebeam.view.SnackbarsLayout;
|
||||
import com.dark98.santoku.BeamServerData;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
import com.dark98.santoku.MainActivity;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.SetupActivity;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.UnfoldMenu;
|
||||
import com.dark98.santoku.components.WebViewMenu;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.events.CloudFeaturesUpdatedEvent;
|
||||
import com.dark98.santoku.events.CloudModelsRemainingCountUpdatedEvent;
|
||||
import com.dark98.santoku.events.NeedDismissAIGeneratorMenu;
|
||||
import com.dark98.santoku.events.NeedDismissCalibrationsMenu;
|
||||
import com.dark98.santoku.events.NeedDismissSnackbarEvent;
|
||||
import com.dark98.santoku.events.NeedSnackbarEvent;
|
||||
import com.dark98.santoku.events.ObjectsListChangedEvent;
|
||||
import com.dark98.santoku.events.SelectedObjectChangedEvent;
|
||||
import com.dark98.santoku.fragment.BedFragment;
|
||||
import com.dark98.santoku.recycler.PreferenceItem;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerAdapter;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.recycler.SpaceItem;
|
||||
import com.dark98.santoku.slic3r.Bed3D;
|
||||
import com.dark98.santoku.slic3r.Slic3rRuntimeError;
|
||||
import com.dark98.santoku.theme.BeamTheme;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.DividerView;
|
||||
import com.dark98.santoku.view.FadeRecyclerView;
|
||||
import com.dark98.santoku.view.SegmentsView;
|
||||
import com.dark98.santoku.view.SnackbarsLayout;
|
||||
|
||||
public class FileMenu extends ListBedMenu {
|
||||
private final static List<String> K3D_SUPPORTED_LANGUAGES = Arrays.asList("en", "ru");
|
||||
@@ -134,11 +134,11 @@ public class FileMenu extends ListBedMenu {
|
||||
return;
|
||||
}
|
||||
if (CloudController.getUserInfo() == null) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileAIGeneratorPleaseWaitSetup).tag(CloudController.USER_INFO_AI_GEN_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuFileAIGeneratorPleaseWaitSetup).tag(CloudController.USER_INFO_AI_GEN_TAG));
|
||||
ViewUtils.postOnMainThread(() -> {
|
||||
if (CloudController.getUserInfo() == null) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CloudController.USER_INFO_AI_GEN_TAG));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.MenuFileAIGeneratorErrorNotLoadedUserAccount));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CloudController.USER_INFO_AI_GEN_TAG));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.MenuFileAIGeneratorErrorNotLoadedUserAccount));
|
||||
} else {
|
||||
fragment.showUnfoldMenu(new AIGeneratorMenu(), view);
|
||||
}
|
||||
@@ -169,24 +169,24 @@ public class FileMenu extends ListBedMenu {
|
||||
}
|
||||
}),
|
||||
new BedMenuItem(R.string.MenuFileExportProfiles, R.drawable.folder_simple_arrow_right_outline_28).onClick(v -> {
|
||||
CharSequence[] prints = new CharSequence[SliceBeam.CONFIG.printConfigs.size()];
|
||||
CharSequence[] prints = new CharSequence[Santoku.CONFIG.printConfigs.size()];
|
||||
boolean[] enabledPrints = new boolean[prints.length];
|
||||
for (int i = 0; i < prints.length; i++) {
|
||||
prints[i] = SliceBeam.CONFIG.printConfigs.get(i).getTitle();
|
||||
prints[i] = Santoku.CONFIG.printConfigs.get(i).getTitle();
|
||||
enabledPrints[i] = true;
|
||||
}
|
||||
|
||||
CharSequence[] filaments = new CharSequence[SliceBeam.CONFIG.filamentConfigs.size()];
|
||||
CharSequence[] filaments = new CharSequence[Santoku.CONFIG.filamentConfigs.size()];
|
||||
boolean[] enabledFilaments = new boolean[filaments.length];
|
||||
for (int i = 0; i < filaments.length; i++) {
|
||||
filaments[i] = SliceBeam.CONFIG.filamentConfigs.get(i).getTitle();
|
||||
filaments[i] = Santoku.CONFIG.filamentConfigs.get(i).getTitle();
|
||||
enabledFilaments[i] = true;
|
||||
}
|
||||
|
||||
CharSequence[] printers = new CharSequence[SliceBeam.CONFIG.printerConfigs.size()];
|
||||
CharSequence[] printers = new CharSequence[Santoku.CONFIG.printerConfigs.size()];
|
||||
boolean[] enabledPrinters = new boolean[printers.length];
|
||||
for (int i = 0; i < printers.length; i++) {
|
||||
printers[i] = SliceBeam.CONFIG.printerConfigs.get(i).getTitle();
|
||||
printers[i] = Santoku.CONFIG.printerConfigs.get(i).getTitle();
|
||||
enabledPrinters[i] = true;
|
||||
}
|
||||
|
||||
@@ -205,21 +205,21 @@ public class FileMenu extends ListBedMenu {
|
||||
for (int i = 0; i < enabledPrints.length; i++) {
|
||||
if (enabledPrints[i]) {
|
||||
hasEnabled = true;
|
||||
MainActivity.EXPORTING_PRINTS.add(SliceBeam.CONFIG.printConfigs.get(i));
|
||||
MainActivity.EXPORTING_PRINTS.add(Santoku.CONFIG.printConfigs.get(i));
|
||||
}
|
||||
}
|
||||
MainActivity.EXPORTING_FILAMENTS = new ArrayList<>();
|
||||
for (int i = 0; i < enabledFilaments.length; i++) {
|
||||
if (enabledFilaments[i]) {
|
||||
hasEnabled = true;
|
||||
MainActivity.EXPORTING_FILAMENTS.add(SliceBeam.CONFIG.filamentConfigs.get(i));
|
||||
MainActivity.EXPORTING_FILAMENTS.add(Santoku.CONFIG.filamentConfigs.get(i));
|
||||
}
|
||||
}
|
||||
MainActivity.EXPORTING_PRINTERS = new ArrayList<>();
|
||||
for (int i = 0; i < enabledPrinters.length; i++) {
|
||||
if (enabledPrinters[i]) {
|
||||
hasEnabled = true;
|
||||
MainActivity.EXPORTING_PRINTERS.add(SliceBeam.CONFIG.printerConfigs.get(i));
|
||||
MainActivity.EXPORTING_PRINTERS.add(Santoku.CONFIG.printerConfigs.get(i));
|
||||
}
|
||||
}
|
||||
if (!hasEnabled) {
|
||||
@@ -300,11 +300,11 @@ public class FileMenu extends ListBedMenu {
|
||||
adapter.setItems(Arrays.asList(
|
||||
new PreferenceItem().setIcon(R.drawable.camera_outline_28).setTitle(ctx.getString(R.string.MenuFileAIGeneratorFromCamera)).setOnClickListener(v -> {
|
||||
if (CloudController.getGeneratedModels() >= CloudController.getMaxGeneratedModels()) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.MenuFileAIGeneratorNoGenerationsLeft));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.MenuFileAIGeneratorNoGenerationsLeft));
|
||||
return;
|
||||
}
|
||||
if (MainActivity.IS_GENERATING_AI_MODEL) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.WARNING, R.string.MenuFileAIGeneratorAlreadyGenerating));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.WARNING, R.string.MenuFileAIGeneratorAlreadyGenerating));
|
||||
return;
|
||||
}
|
||||
if (ctx instanceof MainActivity) {
|
||||
@@ -321,11 +321,11 @@ public class FileMenu extends ListBedMenu {
|
||||
}),
|
||||
new PreferenceItem().setIcon(R.drawable.picture_outline_28).setTitle(ctx.getString(R.string.MenuFileAIGeneratorFromGallery)).setOnClickListener(v -> {
|
||||
if (CloudController.getGeneratedModels() >= CloudController.getMaxGeneratedModels()) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.MenuFileAIGeneratorNoGenerationsLeft));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.MenuFileAIGeneratorNoGenerationsLeft));
|
||||
return;
|
||||
}
|
||||
if (MainActivity.IS_GENERATING_AI_MODEL) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.WARNING, R.string.MenuFileAIGeneratorAlreadyGenerating));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.WARNING, R.string.MenuFileAIGeneratorAlreadyGenerating));
|
||||
return;
|
||||
}
|
||||
if (ctx instanceof MainActivity) {
|
||||
@@ -391,7 +391,7 @@ public class FileMenu extends ListBedMenu {
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
ViewUtils.postOnMainThread(() -> segmentsView.startAnimation(), 50);
|
||||
}
|
||||
|
||||
@@ -409,12 +409,12 @@ public class FileMenu extends ListBedMenu {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
}
|
||||
|
||||
private void updateRemaining() {
|
||||
int rev = CloudController.getMaxGeneratedModels() - CloudController.getGeneratedModels();
|
||||
remainingView.setText(SliceBeam.INSTANCE.getString(R.string.MenuFileAIGeneratorRemaining, rev, CloudController.getMaxGeneratedModels()));
|
||||
remainingView.setText(Santoku.INSTANCE.getString(R.string.MenuFileAIGeneratorRemaining, rev, CloudController.getMaxGeneratedModels()));
|
||||
segmentsView.setValues(new float[]{0, rev / (float) CloudController.getMaxGeneratedModels(), 1});
|
||||
}
|
||||
}
|
||||
@@ -427,7 +427,7 @@ public class FileMenu extends ListBedMenu {
|
||||
|
||||
private String loadJSLoader(String key) {
|
||||
try {
|
||||
InputStream in = SliceBeam.INSTANCE.getAssets().open("js_loader/" + key + ".js");
|
||||
InputStream in = Santoku.INSTANCE.getAssets().open("js_loader/" + key + ".js");
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[10240]; int c;
|
||||
while ((c = in.read(buffer)) != -1) {
|
||||
@@ -436,7 +436,7 @@ public class FileMenu extends ListBedMenu {
|
||||
bos.close();
|
||||
in.close();
|
||||
|
||||
ConfigObject cfg = SliceBeam.buildCurrentConfigObject();
|
||||
ConfigObject cfg = Santoku.buildCurrentConfigObject();
|
||||
Bed3D bed = FileMenu.this.fragment.getGlView().getRenderer().getBed();
|
||||
double bedX = bed.getVolumeMax().x - bed.getVolumeMin().x;
|
||||
double bedY = bed.getVolumeMax().y - bed.getVolumeMin().y;
|
||||
@@ -562,14 +562,14 @@ public class FileMenu extends ListBedMenu {
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,10 +577,10 @@ public class FileMenu extends ListBedMenu {
|
||||
private void loadModel(String key) {
|
||||
BedFragment fragment = this.fragment;
|
||||
ViewUtils.postOnMainThread(() -> {
|
||||
File f = new File(SliceBeam.getModelCacheDir(), "calibration_" + key + ".stl");
|
||||
File f = new File(Santoku.getModelCacheDir(), "calibration_" + key + ".stl");
|
||||
new Thread(()->{
|
||||
try {
|
||||
InputStream in = SliceBeam.INSTANCE.getAssets().open("models/" + key + ".stl");
|
||||
InputStream in = Santoku.INSTANCE.getAssets().open("models/" + key + ".stl");
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
byte[] buffer = new byte[10240]; int c;
|
||||
while ((c = in.read(buffer)) != -1) {
|
||||
@@ -595,9 +595,9 @@ public class FileMenu extends ListBedMenu {
|
||||
fragment.loadGCode(f);
|
||||
} else {
|
||||
fragment.loadModel(f);
|
||||
SliceBeam.EVENT_BUS.fireEvent(new ObjectsListChangedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new ObjectsListChangedEvent());
|
||||
}
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileOpenFileLoaded));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuFileOpenFileLoaded));
|
||||
} catch (Slic3rRuntimeError e) {
|
||||
f.delete();
|
||||
|
||||
@@ -618,7 +618,7 @@ public class FileMenu extends ListBedMenu {
|
||||
}
|
||||
}).start();
|
||||
}, 200);
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissCalibrationsMenu());
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissCalibrationsMenu());
|
||||
dismiss(true);
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components.bed_menu;
|
||||
package com.dark98.santoku.components.bed_menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
@@ -11,11 +11,11 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.fragment.BedFragment;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerAdapter;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.fragment.BedFragment;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerAdapter;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public abstract class ListBedMenu extends BedMenu {
|
||||
protected BedFragment fragment;
|
||||
@@ -69,13 +69,13 @@ public abstract class ListBedMenu extends BedMenu {
|
||||
@Override
|
||||
public void onViewCreated(View v) {
|
||||
super.onViewCreated(v);
|
||||
SliceBeam.EVENT_BUS.registerListener(ListBedMenu.this);
|
||||
Santoku.EVENT_BUS.registerListener(ListBedMenu.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDestroyed() {
|
||||
super.onViewDestroyed();
|
||||
SliceBeam.EVENT_BUS.unregisterListener(ListBedMenu.this);
|
||||
Santoku.EVENT_BUS.unregisterListener(ListBedMenu.this);
|
||||
}
|
||||
|
||||
protected abstract List<SimpleRecyclerItem> onCreateItems(boolean portrait);
|
||||
+30
-30
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components.bed_menu;
|
||||
package com.dark98.santoku.components.bed_menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -26,25 +26,25 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventHandler;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.UnfoldMenu;
|
||||
import ru.ytkab0bp.slicebeam.events.FlattenModeResetEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.LongClickTranslationEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.ObjectsListChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.SelectedObjectChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SpaceItem;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Model;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.BeamButton;
|
||||
import ru.ytkab0bp.slicebeam.view.DividerView;
|
||||
import ru.ytkab0bp.slicebeam.view.PositionScrollView;
|
||||
import ru.ytkab0bp.slicebeam.view.TextColorImageSpan;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.UnfoldMenu;
|
||||
import com.dark98.santoku.events.FlattenModeResetEvent;
|
||||
import com.dark98.santoku.events.LongClickTranslationEvent;
|
||||
import com.dark98.santoku.events.NeedSnackbarEvent;
|
||||
import com.dark98.santoku.events.ObjectsListChangedEvent;
|
||||
import com.dark98.santoku.events.SelectedObjectChangedEvent;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.recycler.SpaceItem;
|
||||
import com.dark98.santoku.slic3r.Model;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.BeamButton;
|
||||
import com.dark98.santoku.view.DividerView;
|
||||
import com.dark98.santoku.view.PositionScrollView;
|
||||
import com.dark98.santoku.view.TextColorImageSpan;
|
||||
|
||||
public class OrientationMenu extends ListBedMenu {
|
||||
private boolean hasSelection() {
|
||||
@@ -61,7 +61,7 @@ public class OrientationMenu extends ListBedMenu {
|
||||
fragment.getGlView().requestRender();
|
||||
}
|
||||
});
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuOrientationArrangeFinished));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuOrientationArrangeFinished));
|
||||
}).setEnabled(fragment.getGlView().getRenderer().getModel() != null),
|
||||
new SpaceItem(portrait ? ViewUtils.dp(8) : 0, portrait ? 0 : ViewUtils.dp(8)),
|
||||
new BedMenuItem(R.string.MenuOrientationAutoOrient, R.drawable.menu_orientation_auto_28).setEnabled(hasSelection()).onClick(view -> {
|
||||
@@ -76,7 +76,7 @@ public class OrientationMenu extends ListBedMenu {
|
||||
fragment.getGlView().getRenderer().invalidateGlModel(i);
|
||||
fragment.getGlView().requestRender();
|
||||
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuOrientationAutoOrientDone, Snackbar.LENGTH_SHORT));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.MenuOrientationAutoOrientDone, Snackbar.LENGTH_SHORT));
|
||||
}),
|
||||
new BedMenuItem(R.string.MenuOrientationFlatten, R.drawable.menu_orientation_flatten_28).setEnabled(hasSelection()).setCheckable((buttonView, isChecked) -> {
|
||||
fragment.getGlView().getRenderer().setInFlattenMode(isChecked);
|
||||
@@ -200,10 +200,10 @@ public class OrientationMenu extends ListBedMenu {
|
||||
}
|
||||
|
||||
private CharSequence formatTrackTitle(int res, double value) {
|
||||
SpannableStringBuilder sb = SpannableStringBuilder.valueOf(SliceBeam.INSTANCE.getString(res, value));
|
||||
SpannableStringBuilder sb = SpannableStringBuilder.valueOf(Santoku.INSTANCE.getString(res, value));
|
||||
sb.append(" d");
|
||||
int size = ViewUtils.dp(14);
|
||||
Drawable dr = ContextCompat.getDrawable(SliceBeam.INSTANCE, R.drawable.edit_outline_28);
|
||||
Drawable dr = ContextCompat.getDrawable(Santoku.INSTANCE, R.drawable.edit_outline_28);
|
||||
dr.setTint(ThemesRepo.getColor(android.R.attr.textColorSecondary));
|
||||
dr.setBounds(0, 0, size, size);
|
||||
sb.setSpan(new TextColorImageSpan(dr, 0), sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
@@ -355,7 +355,7 @@ public class OrientationMenu extends ListBedMenu {
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
setSelectionValues();
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ public class OrientationMenu extends ListBedMenu {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
stopScroll();
|
||||
}
|
||||
|
||||
@@ -501,10 +501,10 @@ public class OrientationMenu extends ListBedMenu {
|
||||
}
|
||||
|
||||
private CharSequence formatTrackTitle(int res, double value) {
|
||||
SpannableStringBuilder sb = SpannableStringBuilder.valueOf(SliceBeam.INSTANCE.getString(res, value));
|
||||
SpannableStringBuilder sb = SpannableStringBuilder.valueOf(Santoku.INSTANCE.getString(res, value));
|
||||
sb.append(" d");
|
||||
int size = ViewUtils.dp(14);
|
||||
Drawable dr = ContextCompat.getDrawable(SliceBeam.INSTANCE, R.drawable.edit_outline_28);
|
||||
Drawable dr = ContextCompat.getDrawable(Santoku.INSTANCE, R.drawable.edit_outline_28);
|
||||
dr.setTint(ThemesRepo.getColor(android.R.attr.textColorSecondary));
|
||||
dr.setBounds(0, 0, size, size);
|
||||
sb.setSpan(new TextColorImageSpan(dr, 0), sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
@@ -666,7 +666,7 @@ public class OrientationMenu extends ListBedMenu {
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
setSelectionValues();
|
||||
}
|
||||
|
||||
@@ -674,7 +674,7 @@ public class OrientationMenu extends ListBedMenu {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
stopScroll();
|
||||
}
|
||||
|
||||
+40
-40
@@ -1,6 +1,6 @@
|
||||
package ru.ytkab0bp.slicebeam.components.bed_menu;
|
||||
package com.dark98.santoku.components.bed_menu;
|
||||
|
||||
import static ru.ytkab0bp.slicebeam.utils.DebugUtils.assertTrue;
|
||||
import static com.dark98.santoku.utils.DebugUtils.assertTrue;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@@ -46,28 +46,28 @@ import java.util.UUID;
|
||||
import cz.msebera.android.httpclient.Header;
|
||||
import cz.msebera.android.httpclient.entity.ContentType;
|
||||
import cz.msebera.android.httpclient.message.BasicHeader;
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import ru.ytkab0bp.slicebeam.MainActivity;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.UnfoldMenu;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.fragment.BedFragment;
|
||||
import ru.ytkab0bp.slicebeam.print_host.ElegooLinkClient;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GCodeProcessorResult;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GCodeViewer;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rLocalization;
|
||||
import ru.ytkab0bp.slicebeam.theme.IThemeView;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.DividerView;
|
||||
import ru.ytkab0bp.slicebeam.view.PositionScrollView;
|
||||
import ru.ytkab0bp.slicebeam.view.SegmentsView;
|
||||
import ru.ytkab0bp.slicebeam.view.SnackbarsLayout;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
import com.dark98.santoku.MainActivity;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.UnfoldMenu;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.events.NeedDismissSnackbarEvent;
|
||||
import com.dark98.santoku.events.NeedSnackbarEvent;
|
||||
import com.dark98.santoku.fragment.BedFragment;
|
||||
import com.dark98.santoku.print_host.ElegooLinkClient;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.slic3r.GCodeProcessorResult;
|
||||
import com.dark98.santoku.slic3r.GCodeViewer;
|
||||
import com.dark98.santoku.slic3r.Slic3rLocalization;
|
||||
import com.dark98.santoku.theme.IThemeView;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.DividerView;
|
||||
import com.dark98.santoku.view.PositionScrollView;
|
||||
import com.dark98.santoku.view.SegmentsView;
|
||||
import com.dark98.santoku.view.SnackbarsLayout;
|
||||
|
||||
public class SliceMenu extends ListBedMenu {
|
||||
private AsyncHttpClient client = new AsyncHttpClient();
|
||||
@@ -82,7 +82,7 @@ public class SliceMenu extends ListBedMenu {
|
||||
|
||||
@Override
|
||||
protected List<SimpleRecyclerItem> onCreateItems(boolean portrait) {
|
||||
lastUid = SliceBeam.CONFIG_UID;
|
||||
lastUid = Santoku.CONFIG_UID;
|
||||
List<SimpleRecyclerItem> items = new ArrayList<>(Arrays.asList(
|
||||
new BedMenuItem(R.string.MenuSliceInfo, R.drawable.clock_circle_dashed_outline_24).onClick(v -> fragment.showUnfoldMenu(new InfoMenu(), v)),
|
||||
new BedMenuItem(R.string.MenuSliceLayers, R.drawable.square_stack_up_outline_28).onClick(v -> fragment.showUnfoldMenu(new LayersMenu(), v)),
|
||||
@@ -114,7 +114,7 @@ public class SliceMenu extends ListBedMenu {
|
||||
}
|
||||
})
|
||||
));
|
||||
ConfigObject obj = SliceBeam.CONFIG.findPrinter(SliceBeam.CONFIG.presets.get("printer"));
|
||||
ConfigObject obj = Santoku.CONFIG.findPrinter(Santoku.CONFIG.presets.get("printer"));
|
||||
assertTrue(obj != null);
|
||||
String type = obj.get("host_type");
|
||||
if (type == null) type = "octoprint";
|
||||
@@ -138,7 +138,7 @@ public class SliceMenu extends ListBedMenu {
|
||||
host = "http://" + host;
|
||||
}
|
||||
String tag = UUID.randomUUID().toString();
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuSliceSendToPrinterLoading).tag(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuSliceSendToPrinterLoading).tag(tag));
|
||||
Header[] headers = TextUtils.isEmpty(apiKey) ? new Header[0] : new Header[] {new BasicHeader("X-Api-Key", apiKey)};
|
||||
RequestParams params = new RequestParams();
|
||||
try {
|
||||
@@ -149,7 +149,7 @@ public class SliceMenu extends ListBedMenu {
|
||||
params.put("select", String.valueOf(print));
|
||||
params.put("print", String.valueOf(print));
|
||||
|
||||
client.post(SliceBeam.INSTANCE, host + "/api/files/local", headers, params, null, new AsyncHttpResponseHandler() {
|
||||
client.post(Santoku.INSTANCE, host + "/api/files/local", headers, params, null, new AsyncHttpResponseHandler() {
|
||||
@Override
|
||||
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
|
||||
try {
|
||||
@@ -157,8 +157,8 @@ public class SliceMenu extends ListBedMenu {
|
||||
if (!obj.has("action") && !obj.has("files")) {
|
||||
throw new JSONException(obj.toString());
|
||||
}
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(print ? SnackbarsLayout.Type.INFO : SnackbarsLayout.Type.DONE, print ? R.string.MenuSliceSendToPrinterPrintStarted : R.string.MenuSliceSendToPrinterOK));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(print ? SnackbarsLayout.Type.INFO : SnackbarsLayout.Type.DONE, print ? R.string.MenuSliceSendToPrinterPrintStarted : R.string.MenuSliceSendToPrinterOK));
|
||||
} catch (JSONException e) {
|
||||
onFailure(statusCode, headers, responseBody, e);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class SliceMenu extends ListBedMenu {
|
||||
|
||||
@Override
|
||||
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(tag));
|
||||
ViewUtils.postOnMainThread(() -> new BeamAlertDialogBuilder(fragment.getContext())
|
||||
.setTitle(R.string.MenuSliceSendToPrinterFailed)
|
||||
.setMessage(error.toString())
|
||||
@@ -180,7 +180,7 @@ public class SliceMenu extends ListBedMenu {
|
||||
host = "http://" + host;
|
||||
}
|
||||
String elegooTag = UUID.randomUUID().toString();
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuSliceSendToPrinterLoading).tag(elegooTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(SnackbarsLayout.Type.LOADING, R.string.MenuSliceSendToPrinterLoading).tag(elegooTag));
|
||||
String finalHost = host;
|
||||
final boolean timelapse = config != null && "1".equals(config.get("elegoolink_timelapse"));
|
||||
final boolean bedLeveling = config != null && "1".equals(config.get("elegoolink_bed_leveling"));
|
||||
@@ -195,9 +195,9 @@ public class SliceMenu extends ListBedMenu {
|
||||
new Thread(() -> {
|
||||
ElegooLinkClient.Result result = ElegooLinkClient.upload(BedFragment.getTempGCodePath(), finalHost, name, print, timelapse, bedLeveling, bedType);
|
||||
ViewUtils.postOnMainThread(() -> {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(elegooTag));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(elegooTag));
|
||||
if (result.ok) {
|
||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(print ? SnackbarsLayout.Type.INFO : SnackbarsLayout.Type.DONE, print ? R.string.MenuSliceSendToPrinterPrintStarted : R.string.MenuSliceSendToPrinterOK));
|
||||
Santoku.EVENT_BUS.fireEvent(new NeedSnackbarEvent(print ? SnackbarsLayout.Type.INFO : SnackbarsLayout.Type.DONE, print ? R.string.MenuSliceSendToPrinterPrintStarted : R.string.MenuSliceSendToPrinterOK));
|
||||
} else {
|
||||
new BeamAlertDialogBuilder(fragment.getContext())
|
||||
.setTitle(R.string.MenuSliceSendToPrinterFailed)
|
||||
@@ -218,7 +218,7 @@ public class SliceMenu extends ListBedMenu {
|
||||
v.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
||||
@Override
|
||||
public void onViewAttachedToWindow(@NonNull View v) {
|
||||
if (lastUid != SliceBeam.CONFIG_UID) {
|
||||
if (lastUid != Santoku.CONFIG_UID) {
|
||||
adapter.setItems(onCreateItems(v.getWidth() < v.getHeight()));
|
||||
}
|
||||
}
|
||||
@@ -386,9 +386,9 @@ public class SliceMenu extends ListBedMenu {
|
||||
private static String formatComplex(double weight, double length, float time) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (weight > 0) {
|
||||
sb.append(format.format(weight)).append(" ").append(SliceBeam.INSTANCE.getString(R.string.MenuSliceInfoWeight)).append(" | ");
|
||||
sb.append(format.format(weight)).append(" ").append(Santoku.INSTANCE.getString(R.string.MenuSliceInfoWeight)).append(" | ");
|
||||
}
|
||||
sb.append(format.format(length)).append(" ").append(SliceBeam.INSTANCE.getString(R.string.MenuSliceInfoLength)).append(" | ");
|
||||
sb.append(format.format(length)).append(" ").append(Santoku.INSTANCE.getString(R.string.MenuSliceInfoLength)).append(" | ");
|
||||
sb.append(formatTime(time));
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -401,17 +401,17 @@ public class SliceMenu extends ListBedMenu {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (hours > 0) {
|
||||
sb.append(hours).append(" ").append(SliceBeam.INSTANCE.getString(R.string.MenuSliceInfoHour));
|
||||
sb.append(hours).append(" ").append(Santoku.INSTANCE.getString(R.string.MenuSliceInfoHour));
|
||||
}
|
||||
if (minutes > 0) {
|
||||
if (sb.length() > 0) sb.append(" ");
|
||||
|
||||
sb.append(minutes).append(" ").append(SliceBeam.INSTANCE.getString(R.string.MenuSliceInfoMinute));
|
||||
sb.append(minutes).append(" ").append(Santoku.INSTANCE.getString(R.string.MenuSliceInfoMinute));
|
||||
}
|
||||
if (seconds > 0 || sb.length() == 0) {
|
||||
if (sb.length() > 0) sb.append(" ");
|
||||
|
||||
sb.append(seconds).append(" ").append(SliceBeam.INSTANCE.getString(R.string.MenuSliceInfoSecond));
|
||||
sb.append(seconds).append(" ").append(Santoku.INSTANCE.getString(R.string.MenuSliceInfoSecond));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
+24
-24
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.components.bed_menu;
|
||||
package com.dark98.santoku.components.bed_menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -26,24 +26,24 @@ import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventHandler;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.UnfoldMenu;
|
||||
import ru.ytkab0bp.slicebeam.events.ObjectsListChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.SelectedObjectChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.recycler.PreferenceSwitchItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.render.GLRenderer;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Model;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.DoubleMatrix;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.DividerView;
|
||||
import ru.ytkab0bp.slicebeam.view.PositionScrollView;
|
||||
import ru.ytkab0bp.slicebeam.view.TextColorImageSpan;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.UnfoldMenu;
|
||||
import com.dark98.santoku.events.ObjectsListChangedEvent;
|
||||
import com.dark98.santoku.events.SelectedObjectChangedEvent;
|
||||
import com.dark98.santoku.recycler.PreferenceSwitchItem;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.render.GLRenderer;
|
||||
import com.dark98.santoku.slic3r.Model;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.DoubleMatrix;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.DividerView;
|
||||
import com.dark98.santoku.view.PositionScrollView;
|
||||
import com.dark98.santoku.view.TextColorImageSpan;
|
||||
|
||||
public class TransformMenu extends ListBedMenu {
|
||||
private double[] tempMatrix = new double[16];
|
||||
@@ -116,7 +116,7 @@ public class TransformMenu extends ListBedMenu {
|
||||
renderer.resetGlModels();
|
||||
}
|
||||
fragment.getGlView().requestRender();
|
||||
SliceBeam.EVENT_BUS.fireEvent(new ObjectsListChangedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new ObjectsListChangedEvent());
|
||||
ViewUtils.postOnMainThread(() -> Toast.makeText(fragment.getContext(), fragment.getContext().getResources().getQuantityString(R.plurals.MenuTransformCloneSuccessCount, clones, clones), Toast.LENGTH_SHORT).show());
|
||||
});
|
||||
fragment.getGlView().requestRender();
|
||||
@@ -330,10 +330,10 @@ public class TransformMenu extends ListBedMenu {
|
||||
}
|
||||
|
||||
private CharSequence formatTrackTitle(int res, double value, double mm) {
|
||||
SpannableStringBuilder sb = SpannableStringBuilder.valueOf(SliceBeam.INSTANCE.getString(res, value, mm));
|
||||
SpannableStringBuilder sb = SpannableStringBuilder.valueOf(Santoku.INSTANCE.getString(res, value, mm));
|
||||
sb.append(" d");
|
||||
int size = ViewUtils.dp(14);
|
||||
Drawable dr = ContextCompat.getDrawable(SliceBeam.INSTANCE, R.drawable.edit_outline_28);
|
||||
Drawable dr = ContextCompat.getDrawable(Santoku.INSTANCE, R.drawable.edit_outline_28);
|
||||
dr.setTint(ThemesRepo.getColor(android.R.attr.textColorSecondary));
|
||||
dr.setBounds(0, 0, size, size);
|
||||
sb.setSpan(new TextColorImageSpan(dr, 0), sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
@@ -588,7 +588,7 @@ public class TransformMenu extends ListBedMenu {
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
setSelectionValues();
|
||||
}
|
||||
|
||||
@@ -596,7 +596,7 @@ public class TransformMenu extends ListBedMenu {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
stopScroll();
|
||||
}
|
||||
|
||||
+10
-10
@@ -1,12 +1,12 @@
|
||||
package ru.ytkab0bp.slicebeam.config;
|
||||
package com.dark98.santoku.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.fragment.ProfileListFragment;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.fragment.ProfileListFragment;
|
||||
|
||||
/** @noinspection CopyConstructorMissesField*/
|
||||
public class ConfigObject implements ProfileListFragment.ProfileListItem {
|
||||
@@ -70,11 +70,11 @@ public class ConfigObject implements ProfileListFragment.ProfileListItem {
|
||||
public boolean isSelected() {
|
||||
switch (profileListType) {
|
||||
case PROFILE_LIST_PRINT:
|
||||
return getTitle().equals(SliceBeam.CONFIG.presets.get("print"));
|
||||
return getTitle().equals(Santoku.CONFIG.presets.get("print"));
|
||||
case PROFILE_LIST_FILAMENT:
|
||||
return getTitle().equals(SliceBeam.CONFIG.presets.get("filament"));
|
||||
return getTitle().equals(Santoku.CONFIG.presets.get("filament"));
|
||||
case PROFILE_LIST_PRINTER:
|
||||
return getTitle().equals(SliceBeam.CONFIG.presets.get("printer"));
|
||||
return getTitle().equals(Santoku.CONFIG.presets.get("printer"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class ConfigObject implements ProfileListFragment.ProfileListItem {
|
||||
}
|
||||
|
||||
public static ConfigObject createCustomPrinterProfile() {
|
||||
ConfigObject custom = new ConfigObject(SliceBeam.INSTANCE.getString(R.string.IntroCustomProfileName));
|
||||
ConfigObject custom = new ConfigObject(Santoku.INSTANCE.getString(R.string.IntroCustomProfileName));
|
||||
custom.put("printer_technology", "FFF");
|
||||
custom.put("bed_shape", "0x0,200x0,200x200,0x200");
|
||||
custom.put("auto_arrange_bed_clearance", "5");
|
||||
@@ -137,7 +137,7 @@ public class ConfigObject implements ProfileListFragment.ProfileListItem {
|
||||
}
|
||||
|
||||
public static ConfigObject createCustomFilamentProfile() {
|
||||
ConfigObject genericFilament = new ConfigObject(SliceBeam.INSTANCE.getString(R.string.IntroCustomProfileFilamentName));
|
||||
ConfigObject genericFilament = new ConfigObject(Santoku.INSTANCE.getString(R.string.IntroCustomProfileFilamentName));
|
||||
genericFilament.profileListType = ConfigObject.PROFILE_LIST_FILAMENT;
|
||||
genericFilament.put("first_layer_bed_temperature", "60");
|
||||
genericFilament.put("bed_temperature", "60");
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.view.SnackbarsLayout;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.view.SnackbarsLayout;
|
||||
|
||||
@Event
|
||||
public class NeedSnackbarEvent {
|
||||
@@ -25,12 +25,12 @@ public class NeedSnackbarEvent {
|
||||
}
|
||||
|
||||
public NeedSnackbarEvent(int title, Object... args) {
|
||||
this.title = SliceBeam.INSTANCE.getString(title, args);
|
||||
this.title = Santoku.INSTANCE.getString(title, args);
|
||||
}
|
||||
|
||||
public NeedSnackbarEvent(SnackbarsLayout.Type type, int title, Object... args) {
|
||||
this.type = type;
|
||||
this.title = SliceBeam.INSTANCE.getString(title, args);
|
||||
this.title = Santoku.INSTANCE.getString(title, args);
|
||||
}
|
||||
|
||||
public NeedSnackbarEvent tag(String tag) {
|
||||
@@ -39,7 +39,7 @@ public class NeedSnackbarEvent {
|
||||
}
|
||||
|
||||
public NeedSnackbarEvent button(int title, View.OnClickListener click) {
|
||||
this.buttonTitle = SliceBeam.INSTANCE.getString(title);
|
||||
this.buttonTitle = Santoku.INSTANCE.getString(title);
|
||||
this.buttonClick = click;
|
||||
return this;
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
import ru.ytkab0bp.eventbus.Event;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.events;
|
||||
package com.dark98.santoku.events;
|
||||
|
||||
public class SlicingProgressEvent {
|
||||
public final int progress;
|
||||
+45
-45
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.fragment;
|
||||
package com.dark98.santoku.fragment;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -32,37 +32,37 @@ import com.google.android.material.navigation.NavigationBarView;
|
||||
import java.io.File;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventHandler;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.SliceProgressBottomSheet;
|
||||
import ru.ytkab0bp.slicebeam.components.UnfoldMenu;
|
||||
import ru.ytkab0bp.slicebeam.components.bed_menu.BedMenu;
|
||||
import ru.ytkab0bp.slicebeam.components.bed_menu.CameraMenu;
|
||||
import ru.ytkab0bp.slicebeam.components.bed_menu.FileMenu;
|
||||
import ru.ytkab0bp.slicebeam.components.bed_menu.OrientationMenu;
|
||||
import ru.ytkab0bp.slicebeam.components.bed_menu.SliceMenu;
|
||||
import ru.ytkab0bp.slicebeam.components.bed_menu.TransformMenu;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.events.FlattenModeResetEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedDismissSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.NeedSnackbarEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.SlicingProgressEvent;
|
||||
import ru.ytkab0bp.slicebeam.navigation.Fragment;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Bed3D;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GCodeProcessorResult;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GCodeThumbnailer;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Model;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rRuntimeError;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.BedSwipeDownLayout;
|
||||
import ru.ytkab0bp.slicebeam.view.DividerView;
|
||||
import ru.ytkab0bp.slicebeam.view.GLView;
|
||||
import ru.ytkab0bp.slicebeam.view.SnackbarsLayout;
|
||||
import ru.ytkab0bp.slicebeam.view.ThemeBottomNavigationView;
|
||||
import ru.ytkab0bp.slicebeam.view.ThemeRailNavigationView;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.SliceProgressBottomSheet;
|
||||
import com.dark98.santoku.components.UnfoldMenu;
|
||||
import com.dark98.santoku.components.bed_menu.BedMenu;
|
||||
import com.dark98.santoku.components.bed_menu.CameraMenu;
|
||||
import com.dark98.santoku.components.bed_menu.FileMenu;
|
||||
import com.dark98.santoku.components.bed_menu.OrientationMenu;
|
||||
import com.dark98.santoku.components.bed_menu.SliceMenu;
|
||||
import com.dark98.santoku.components.bed_menu.TransformMenu;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.events.FlattenModeResetEvent;
|
||||
import com.dark98.santoku.events.NeedDismissSnackbarEvent;
|
||||
import com.dark98.santoku.events.NeedSnackbarEvent;
|
||||
import com.dark98.santoku.events.SlicingProgressEvent;
|
||||
import com.dark98.santoku.navigation.Fragment;
|
||||
import com.dark98.santoku.slic3r.Bed3D;
|
||||
import com.dark98.santoku.slic3r.GCodeProcessorResult;
|
||||
import com.dark98.santoku.slic3r.GCodeThumbnailer;
|
||||
import com.dark98.santoku.slic3r.Model;
|
||||
import com.dark98.santoku.slic3r.Slic3rRuntimeError;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.BedSwipeDownLayout;
|
||||
import com.dark98.santoku.view.DividerView;
|
||||
import com.dark98.santoku.view.GLView;
|
||||
import com.dark98.santoku.view.SnackbarsLayout;
|
||||
import com.dark98.santoku.view.ThemeBottomNavigationView;
|
||||
import com.dark98.santoku.view.ThemeRailNavigationView;
|
||||
|
||||
public class BedFragment extends Fragment {
|
||||
private final static boolean DEBUG_VIEWER = false;
|
||||
@@ -129,14 +129,14 @@ public class BedFragment extends Fragment {
|
||||
}
|
||||
|
||||
public static File getTempGCodePath() {
|
||||
return tempExportingFile != null ? tempExportingFile : new File(SliceBeam.INSTANCE.getCacheDir(), "temp.gcode");
|
||||
return tempExportingFile != null ? tempExportingFile : new File(Santoku.INSTANCE.getCacheDir(), "temp.gcode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
}
|
||||
|
||||
@EventHandler(runOnMainThread = true)
|
||||
@@ -210,7 +210,7 @@ public class BedFragment extends Fragment {
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
|
||||
for (int i = 0; i < menuMap.size(); i++) {
|
||||
menuMap.valueAt(i).onViewDestroyed();
|
||||
@@ -232,7 +232,7 @@ public class BedFragment extends Fragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
glView.onResume();
|
||||
ConfigObject cfg = SliceBeam.CONFIG.findPrinter(SliceBeam.CONFIG.presets.get("printer"));
|
||||
ConfigObject cfg = Santoku.CONFIG.findPrinter(Santoku.CONFIG.presets.get("printer"));
|
||||
boolean enable = cfg != null && cfg.get("host_type") != null && !TextUtils.isEmpty(cfg.get("print_host")) && panelWebView != null;
|
||||
swipeDownLayout.setEnableTop(enable);
|
||||
if (enable) {
|
||||
@@ -388,7 +388,7 @@ public class BedFragment extends Fragment {
|
||||
.show();
|
||||
} else {
|
||||
tempExportingFile = null;
|
||||
File cfg = SliceBeam.getCurrentConfigFile();
|
||||
File cfg = Santoku.getCurrentConfigFile();
|
||||
File gcode = getTempGCodePath();
|
||||
|
||||
if (!DEBUG_VIEWER) {
|
||||
@@ -399,12 +399,12 @@ public class BedFragment extends Fragment {
|
||||
Process.setThreadPriority(-20);
|
||||
|
||||
try {
|
||||
SliceBeam.genCurrentConfig();
|
||||
Santoku.genCurrentConfig();
|
||||
} catch (Exception e) {
|
||||
Log.e("BedFragment", "Failed to write config", e);
|
||||
|
||||
ViewUtils.postOnMainThread(()->{
|
||||
SliceBeam.EVENT_BUS.fireEvent(new SlicingProgressEvent(100, ""));
|
||||
Santoku.EVENT_BUS.fireEvent(new SlicingProgressEvent(100, ""));
|
||||
new BeamAlertDialogBuilder(ctx)
|
||||
.setTitle(R.string.SliceFailed)
|
||||
.setMessage(e.getMessage())
|
||||
@@ -414,12 +414,12 @@ public class BedFragment extends Fragment {
|
||||
}
|
||||
|
||||
if (!DEBUG_VIEWER) {
|
||||
gCodeResult = glView.getRenderer().getModel().slice(cfg.getAbsolutePath(), gcode.getAbsolutePath(), (progress, text) -> SliceBeam.EVENT_BUS.fireEvent(new SlicingProgressEvent(progress, text)));
|
||||
GCodeThumbnailer.addThumbnailsToGcode(gcode, SliceBeam.buildCurrentConfigObject(), glView);
|
||||
SliceBeam.EVENT_BUS.fireEvent(new SlicingProgressEvent(100, ""));
|
||||
gCodeResult = glView.getRenderer().getModel().slice(cfg.getAbsolutePath(), gcode.getAbsolutePath(), (progress, text) -> Santoku.EVENT_BUS.fireEvent(new SlicingProgressEvent(progress, text)));
|
||||
GCodeThumbnailer.addThumbnailsToGcode(gcode, Santoku.buildCurrentConfigObject(), glView);
|
||||
Santoku.EVENT_BUS.fireEvent(new SlicingProgressEvent(100, ""));
|
||||
} else {
|
||||
gCodeResult = new GCodeProcessorResult(gcode);
|
||||
GCodeThumbnailer.addThumbnailsToGcode(gcode, SliceBeam.buildCurrentConfigObject(), glView);
|
||||
GCodeThumbnailer.addThumbnailsToGcode(gcode, Santoku.buildCurrentConfigObject(), glView);
|
||||
}
|
||||
ViewUtils.postOnMainThread(()-> {
|
||||
glView.queueEvent(()->{
|
||||
@@ -438,7 +438,7 @@ public class BedFragment extends Fragment {
|
||||
} catch (Exception e) {
|
||||
Log.e("BedFragment", "Slice failed", e);
|
||||
ViewUtils.postOnMainThread(()->{
|
||||
SliceBeam.EVENT_BUS.fireEvent(new SlicingProgressEvent(100, ""));
|
||||
Santoku.EVENT_BUS.fireEvent(new SlicingProgressEvent(100, ""));
|
||||
new BeamAlertDialogBuilder(ctx)
|
||||
.setTitle(R.string.SliceFailed)
|
||||
.setMessage(e.getMessage())
|
||||
@@ -491,7 +491,7 @@ public class BedFragment extends Fragment {
|
||||
private void selectMenu(Context ctx, boolean portrait, int slot) {
|
||||
if (glView.getRenderer().resetFlattenMode()) {
|
||||
glView.requestRender();
|
||||
SliceBeam.EVENT_BUS.fireEvent(new FlattenModeResetEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new FlattenModeResetEvent());
|
||||
}
|
||||
isAnimatingMenu = true;
|
||||
|
||||
+30
-30
@@ -1,18 +1,18 @@
|
||||
package ru.ytkab0bp.slicebeam.fragment;
|
||||
package com.dark98.santoku.fragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SpaceItem;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.PrintConfigDef;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rLocalization;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rUtils;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.recycler.SpaceItem;
|
||||
import com.dark98.santoku.slic3r.PrintConfigDef;
|
||||
import com.dark98.santoku.slic3r.Slic3rLocalization;
|
||||
import com.dark98.santoku.slic3r.Slic3rUtils;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class FilamentConfigFragment extends ProfileListFragment {
|
||||
private List<ProfileListItem> compatItems;
|
||||
@@ -29,18 +29,18 @@ public class FilamentConfigFragment extends ProfileListFragment {
|
||||
|
||||
@Override
|
||||
protected List<ProfileListItem> getItems(boolean filter) {
|
||||
List<ConfigObject> list = SliceBeam.CONFIG.filamentConfigs;
|
||||
List<ConfigObject> list = Santoku.CONFIG.filamentConfigs;
|
||||
if (filter) {
|
||||
String printer = SliceBeam.CONFIG.presets.get("printer");
|
||||
String print = SliceBeam.CONFIG.presets.get("print");
|
||||
if (Objects.equals(lastPrinter, printer) && Objects.equals(lastPrint, print) && compatItems != null && lastUid == SliceBeam.CONFIG_UID) {
|
||||
String printer = Santoku.CONFIG.presets.get("printer");
|
||||
String print = Santoku.CONFIG.presets.get("print");
|
||||
if (Objects.equals(lastPrinter, printer) && Objects.equals(lastPrint, print) && compatItems != null && lastUid == Santoku.CONFIG_UID) {
|
||||
return compatItems;
|
||||
}
|
||||
|
||||
List<ConfigObject> nList = new ArrayList<>(list.size());
|
||||
Slic3rUtils.ConfigChecker checker = new Slic3rUtils.ConfigChecker(SliceBeam.CONFIG.findPrinter(printer).serialize());
|
||||
if (SliceBeam.CONFIG.findPrint(print) != null) {
|
||||
Slic3rUtils.ConfigChecker printChecker = new Slic3rUtils.ConfigChecker(SliceBeam.CONFIG.findPrint(print).serialize());
|
||||
Slic3rUtils.ConfigChecker checker = new Slic3rUtils.ConfigChecker(Santoku.CONFIG.findPrinter(printer).serialize());
|
||||
if (Santoku.CONFIG.findPrint(print) != null) {
|
||||
Slic3rUtils.ConfigChecker printChecker = new Slic3rUtils.ConfigChecker(Santoku.CONFIG.findPrint(print).serialize());
|
||||
for (ConfigObject obj : list) {
|
||||
if (checker.checkCompatibility(obj.get("compatible_printers_condition")) && printChecker.checkCompatibility(obj.get("compatible_prints_condition"))) {
|
||||
nList.add(obj);
|
||||
@@ -51,7 +51,7 @@ public class FilamentConfigFragment extends ProfileListFragment {
|
||||
checker.release();
|
||||
lastPrinter = printer;
|
||||
lastPrint = print;
|
||||
lastUid = SliceBeam.CONFIG_UID;
|
||||
lastUid = Santoku.CONFIG_UID;
|
||||
return compatItems = (List) nList;
|
||||
}
|
||||
return (List) list;
|
||||
@@ -218,14 +218,14 @@ public class FilamentConfigFragment extends ProfileListFragment {
|
||||
|
||||
@Override
|
||||
protected void cloneCurrentProfile() {
|
||||
ConfigObject obj = new ConfigObject(SliceBeam.INSTANCE.getString(R.string.SettingsProfileCopy, currentConfig.getTitle()));
|
||||
ConfigObject obj = new ConfigObject(Santoku.INSTANCE.getString(R.string.SettingsProfileCopy, currentConfig.getTitle()));
|
||||
obj.values.putAll(currentConfig.values);
|
||||
currentConfig = new ConfigObject(obj);
|
||||
|
||||
SliceBeam.CONFIG.filamentConfigs.add(obj);
|
||||
SliceBeam.CONFIG.presets.put("filament", obj.getTitle());
|
||||
SliceBeam.saveConfig();
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
Santoku.CONFIG.filamentConfigs.add(obj);
|
||||
Santoku.CONFIG.presets.put("filament", obj.getTitle());
|
||||
Santoku.saveConfig();
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
|
||||
currentConfig = new ConfigObject(obj);
|
||||
dropdownView.setTitle(getCurrentConfig().getTitle());
|
||||
@@ -235,7 +235,7 @@ public class FilamentConfigFragment extends ProfileListFragment {
|
||||
@Override
|
||||
protected void deleteCurrentProfile() {
|
||||
compatItems = null;
|
||||
SliceBeam.CONFIG.filamentConfigs.remove(SliceBeam.CONFIG.findFilament(currentConfig.getTitle()));
|
||||
Santoku.CONFIG.filamentConfigs.remove(Santoku.CONFIG.findFilament(currentConfig.getTitle()));
|
||||
selectItem(getItems(true).get(0));
|
||||
|
||||
dropdownView.setTitle(getCurrentConfig().getTitle());
|
||||
@@ -244,21 +244,21 @@ public class FilamentConfigFragment extends ProfileListFragment {
|
||||
@Override
|
||||
protected void onApplyConfig(String title) {
|
||||
compatItems = null;
|
||||
ConfigObject obj = SliceBeam.CONFIG.findFilament(currentConfig.getTitle());
|
||||
ConfigObject obj = Santoku.CONFIG.findFilament(currentConfig.getTitle());
|
||||
obj.setTitle(title);
|
||||
obj.values.putAll(currentConfig.values);
|
||||
currentConfig.setTitle(title);
|
||||
|
||||
SliceBeam.CONFIG.presets.put("filament", title);
|
||||
SliceBeam.saveConfig();
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
Santoku.CONFIG.presets.put("filament", title);
|
||||
Santoku.saveConfig();
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
|
||||
dropdownView.setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResetConfig() {
|
||||
currentConfig = new ConfigObject(SliceBeam.CONFIG.findFilament(SliceBeam.CONFIG.presets.get("filament")));
|
||||
currentConfig = new ConfigObject(Santoku.CONFIG.findFilament(Santoku.CONFIG.presets.get("filament")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -274,7 +274,7 @@ public class FilamentConfigFragment extends ProfileListFragment {
|
||||
@Override
|
||||
protected void selectItem(ProfileListItem item) {
|
||||
currentConfig = new ConfigObject((ConfigObject) item);
|
||||
SliceBeam.CONFIG.presets.put("filament", item.getTitle());
|
||||
SliceBeam.saveConfig();
|
||||
Santoku.CONFIG.presets.put("filament", item.getTitle());
|
||||
Santoku.saveConfig();
|
||||
}
|
||||
}
|
||||
+30
-30
@@ -1,17 +1,17 @@
|
||||
package ru.ytkab0bp.slicebeam.fragment;
|
||||
package com.dark98.santoku.fragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SpaceItem;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.PrintConfigDef;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rUtils;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.recycler.SpaceItem;
|
||||
import com.dark98.santoku.slic3r.PrintConfigDef;
|
||||
import com.dark98.santoku.slic3r.Slic3rUtils;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class PrintConfigFragment extends ProfileListFragment {
|
||||
private List<ProfileListItem> compatItems;
|
||||
@@ -28,15 +28,15 @@ public class PrintConfigFragment extends ProfileListFragment {
|
||||
|
||||
@Override
|
||||
protected List<ProfileListItem> getItems(boolean filter) {
|
||||
List<ConfigObject> list = SliceBeam.CONFIG.printConfigs;
|
||||
List<ConfigObject> list = Santoku.CONFIG.printConfigs;
|
||||
if (filter) {
|
||||
String printer = SliceBeam.CONFIG.presets.get("printer");
|
||||
if (Objects.equals(lastPrinter, printer) && compatItems != null && lastUid == SliceBeam.CONFIG_UID) {
|
||||
String printer = Santoku.CONFIG.presets.get("printer");
|
||||
if (Objects.equals(lastPrinter, printer) && compatItems != null && lastUid == Santoku.CONFIG_UID) {
|
||||
return compatItems;
|
||||
}
|
||||
|
||||
List<ConfigObject> nList = new ArrayList<>(list.size());
|
||||
Slic3rUtils.ConfigChecker checker = new Slic3rUtils.ConfigChecker(SliceBeam.CONFIG.findPrinter(printer).serialize());
|
||||
Slic3rUtils.ConfigChecker checker = new Slic3rUtils.ConfigChecker(Santoku.CONFIG.findPrinter(printer).serialize());
|
||||
for (ConfigObject obj : list) {
|
||||
if (checker.checkCompatibility(obj.get("compatible_printers_condition"))) {
|
||||
nList.add(obj);
|
||||
@@ -44,7 +44,7 @@ public class PrintConfigFragment extends ProfileListFragment {
|
||||
}
|
||||
checker.release();
|
||||
lastPrinter = printer;
|
||||
lastUid = SliceBeam.CONFIG_UID;
|
||||
lastUid = Santoku.CONFIG_UID;
|
||||
return compatItems = (List) nList;
|
||||
}
|
||||
return (List) list;
|
||||
@@ -354,14 +354,14 @@ public class PrintConfigFragment extends ProfileListFragment {
|
||||
|
||||
@Override
|
||||
protected void cloneCurrentProfile() {
|
||||
ConfigObject obj = new ConfigObject(SliceBeam.INSTANCE.getString(R.string.SettingsProfileCopy, currentConfig.getTitle()));
|
||||
ConfigObject obj = new ConfigObject(Santoku.INSTANCE.getString(R.string.SettingsProfileCopy, currentConfig.getTitle()));
|
||||
obj.values.putAll(currentConfig.values);
|
||||
currentConfig = new ConfigObject(obj);
|
||||
|
||||
SliceBeam.CONFIG.printConfigs.add(obj);
|
||||
SliceBeam.CONFIG.presets.put("print", obj.getTitle());
|
||||
SliceBeam.saveConfig();
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
Santoku.CONFIG.printConfigs.add(obj);
|
||||
Santoku.CONFIG.presets.put("print", obj.getTitle());
|
||||
Santoku.saveConfig();
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
|
||||
currentConfig = new ConfigObject(obj);
|
||||
dropdownView.setTitle(getCurrentConfig().getTitle());
|
||||
@@ -371,7 +371,7 @@ public class PrintConfigFragment extends ProfileListFragment {
|
||||
@Override
|
||||
protected void deleteCurrentProfile() {
|
||||
compatItems = null;
|
||||
SliceBeam.CONFIG.printConfigs.remove(SliceBeam.CONFIG.findPrint(currentConfig.getTitle()));
|
||||
Santoku.CONFIG.printConfigs.remove(Santoku.CONFIG.findPrint(currentConfig.getTitle()));
|
||||
selectItem(getItems(true).get(0));
|
||||
|
||||
dropdownView.setTitle(getCurrentConfig().getTitle());
|
||||
@@ -380,28 +380,28 @@ public class PrintConfigFragment extends ProfileListFragment {
|
||||
@Override
|
||||
protected void onApplyConfig(String title) {
|
||||
compatItems = null;
|
||||
ConfigObject obj = SliceBeam.CONFIG.findPrint(currentConfig.getTitle());
|
||||
ConfigObject obj = Santoku.CONFIG.findPrint(currentConfig.getTitle());
|
||||
obj.setTitle(title);
|
||||
obj.values.putAll(currentConfig.values);
|
||||
currentConfig.setTitle(title);
|
||||
|
||||
SliceBeam.CONFIG.presets.put("print", title);
|
||||
SliceBeam.saveConfig();
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
Santoku.CONFIG.presets.put("print", title);
|
||||
Santoku.saveConfig();
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
|
||||
dropdownView.setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResetConfig() {
|
||||
ConfigObject print = SliceBeam.CONFIG.findPrint(SliceBeam.CONFIG.presets.get("print"));
|
||||
ConfigObject print = Santoku.CONFIG.findPrint(Santoku.CONFIG.presets.get("print"));
|
||||
if (print != null) {
|
||||
currentConfig = new ConfigObject(print);
|
||||
} else {
|
||||
currentConfig = new ConfigObject(SliceBeam.INSTANCE.getString(R.string.IntroCustomProfileName));
|
||||
SliceBeam.CONFIG.printConfigs.add(new ConfigObject(currentConfig));
|
||||
SliceBeam.saveConfig();
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
currentConfig = new ConfigObject(Santoku.INSTANCE.getString(R.string.IntroCustomProfileName));
|
||||
Santoku.CONFIG.printConfigs.add(new ConfigObject(currentConfig));
|
||||
Santoku.saveConfig();
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ public class PrintConfigFragment extends ProfileListFragment {
|
||||
@Override
|
||||
protected void selectItem(ProfileListItem item) {
|
||||
currentConfig = new ConfigObject((ConfigObject) item);
|
||||
SliceBeam.CONFIG.presets.put("print", item.getTitle());
|
||||
SliceBeam.saveConfig();
|
||||
Santoku.CONFIG.presets.put("print", item.getTitle());
|
||||
Santoku.saveConfig();
|
||||
}
|
||||
}
|
||||
+23
-23
@@ -1,17 +1,17 @@
|
||||
package ru.ytkab0bp.slicebeam.fragment;
|
||||
package com.dark98.santoku.fragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SpaceItem;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.PrintConfigDef;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.ConfigOptionDef;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rLocalization;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.recycler.SpaceItem;
|
||||
import com.dark98.santoku.slic3r.PrintConfigDef;
|
||||
import com.dark98.santoku.slic3r.ConfigOptionDef;
|
||||
import com.dark98.santoku.slic3r.Slic3rLocalization;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class PrinterConfigFragment extends ProfileListFragment {
|
||||
private ConfigObject currentConfig;
|
||||
@@ -24,7 +24,7 @@ public class PrinterConfigFragment extends ProfileListFragment {
|
||||
|
||||
@Override
|
||||
protected List<ProfileListItem> getItems(boolean filter) {
|
||||
return (List) SliceBeam.CONFIG.printerConfigs;
|
||||
return (List) Santoku.CONFIG.printerConfigs;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,14 +202,14 @@ public class PrinterConfigFragment extends ProfileListFragment {
|
||||
|
||||
@Override
|
||||
protected void cloneCurrentProfile() {
|
||||
ConfigObject obj = new ConfigObject(SliceBeam.INSTANCE.getString(R.string.SettingsProfileCopy, currentConfig.getTitle()));
|
||||
ConfigObject obj = new ConfigObject(Santoku.INSTANCE.getString(R.string.SettingsProfileCopy, currentConfig.getTitle()));
|
||||
obj.values.putAll(currentConfig.values);
|
||||
currentConfig = new ConfigObject(obj);
|
||||
|
||||
SliceBeam.CONFIG.printerConfigs.add(obj);
|
||||
SliceBeam.CONFIG.presets.put("printer", obj.getTitle());
|
||||
SliceBeam.saveConfig();
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
Santoku.CONFIG.printerConfigs.add(obj);
|
||||
Santoku.CONFIG.presets.put("printer", obj.getTitle());
|
||||
Santoku.saveConfig();
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
|
||||
currentConfig = new ConfigObject(obj);
|
||||
dropdownView.setTitle(getCurrentConfig().getTitle());
|
||||
@@ -217,28 +217,28 @@ public class PrinterConfigFragment extends ProfileListFragment {
|
||||
|
||||
@Override
|
||||
protected void deleteCurrentProfile() {
|
||||
SliceBeam.CONFIG.printerConfigs.remove(SliceBeam.CONFIG.findPrinter(currentConfig.getTitle()));
|
||||
Santoku.CONFIG.printerConfigs.remove(Santoku.CONFIG.findPrinter(currentConfig.getTitle()));
|
||||
selectItem(getItems(true).get(0));
|
||||
dropdownView.setTitle(getCurrentConfig().getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onApplyConfig(String title) {
|
||||
ConfigObject obj = SliceBeam.CONFIG.findPrinter(currentConfig.getTitle());
|
||||
ConfigObject obj = Santoku.CONFIG.findPrinter(currentConfig.getTitle());
|
||||
obj.setTitle(title);
|
||||
obj.values.putAll(currentConfig.values);
|
||||
currentConfig.setTitle(title);
|
||||
|
||||
SliceBeam.CONFIG.presets.put("printer", title);
|
||||
SliceBeam.saveConfig();
|
||||
SliceBeam.getCurrentConfigFile().delete();
|
||||
Santoku.CONFIG.presets.put("printer", title);
|
||||
Santoku.saveConfig();
|
||||
Santoku.getCurrentConfigFile().delete();
|
||||
|
||||
dropdownView.setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResetConfig() {
|
||||
currentConfig = new ConfigObject(SliceBeam.CONFIG.findPrinter(SliceBeam.CONFIG.presets.get("printer")));
|
||||
currentConfig = new ConfigObject(Santoku.CONFIG.findPrinter(Santoku.CONFIG.presets.get("printer")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -254,10 +254,10 @@ public class PrinterConfigFragment extends ProfileListFragment {
|
||||
@Override
|
||||
protected void selectItem(ProfileListItem item) {
|
||||
currentConfig = new ConfigObject((ConfigObject) item);
|
||||
SliceBeam.CONFIG.presets.put("printer", item.getTitle());
|
||||
Santoku.CONFIG.presets.put("printer", item.getTitle());
|
||||
|
||||
// TODO: Reset print/filament profiles, maybe physical profiles?
|
||||
SliceBeam.saveConfig();
|
||||
Santoku.saveConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
+27
-27
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.fragment;
|
||||
package com.dark98.santoku.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -49,30 +49,30 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudAPI;
|
||||
import ru.ytkab0bp.slicebeam.cloud.CloudController;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamColorPickerPopUp;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.navigation.Fragment;
|
||||
import ru.ytkab0bp.slicebeam.recycler.CubicBezierItemAnimator;
|
||||
import ru.ytkab0bp.slicebeam.recycler.PreferenceItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.PreferenceSwitchItem;
|
||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerItem;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.ConfigOptionDef;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.PrintConfigDef;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rConfigWrapper;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rLocalization;
|
||||
import ru.ytkab0bp.slicebeam.theme.IThemeView;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.BeamButton;
|
||||
import ru.ytkab0bp.slicebeam.view.DividerView;
|
||||
import ru.ytkab0bp.slicebeam.view.FadeRecyclerView;
|
||||
import ru.ytkab0bp.slicebeam.view.ProfileDropdownView;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.cloud.CloudAPI;
|
||||
import com.dark98.santoku.cloud.CloudController;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.BeamColorPickerPopUp;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.navigation.Fragment;
|
||||
import com.dark98.santoku.recycler.CubicBezierItemAnimator;
|
||||
import com.dark98.santoku.recycler.PreferenceItem;
|
||||
import com.dark98.santoku.recycler.PreferenceSwitchItem;
|
||||
import com.dark98.santoku.recycler.SimpleRecyclerItem;
|
||||
import com.dark98.santoku.slic3r.ConfigOptionDef;
|
||||
import com.dark98.santoku.slic3r.PrintConfigDef;
|
||||
import com.dark98.santoku.slic3r.Slic3rConfigWrapper;
|
||||
import com.dark98.santoku.slic3r.Slic3rLocalization;
|
||||
import com.dark98.santoku.theme.IThemeView;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.BeamButton;
|
||||
import com.dark98.santoku.view.DividerView;
|
||||
import com.dark98.santoku.view.FadeRecyclerView;
|
||||
import com.dark98.santoku.view.ProfileDropdownView;
|
||||
|
||||
public abstract class ProfileListFragment extends Fragment {
|
||||
public final static int SPECIAL_TYPE_CLOUD_HEADER = 0;
|
||||
@@ -507,13 +507,13 @@ public abstract class ProfileListFragment extends Fragment {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
SliceBeam.EVENT_BUS.registerListener(this);
|
||||
Santoku.EVENT_BUS.registerListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
SliceBeam.EVENT_BUS.unregisterListener(this);
|
||||
Santoku.EVENT_BUS.unregisterListener(this);
|
||||
unfolded.clear();
|
||||
}
|
||||
|
||||
+16
-16
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.fragment;
|
||||
package com.dark98.santoku.fragment;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -20,19 +20,19 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import ru.ytkab0bp.eventbus.EventHandler;
|
||||
import ru.ytkab0bp.slicebeam.BeamServerData;
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SetupActivity;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
||||
import ru.ytkab0bp.slicebeam.components.BeamColorPickerPopUp;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.events.BeamServerDataUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.CloudUserInfoUpdatedEvent;
|
||||
import ru.ytkab0bp.slicebeam.recycler.PreferenceItem;
|
||||
import ru.ytkab0bp.slicebeam.theme.BeamTheme;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import com.dark98.santoku.BeamServerData;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.SetupActivity;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.components.BeamAlertDialogBuilder;
|
||||
import com.dark98.santoku.components.BeamColorPickerPopUp;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.events.BeamServerDataUpdatedEvent;
|
||||
import com.dark98.santoku.events.CloudUserInfoUpdatedEvent;
|
||||
import com.dark98.santoku.recycler.PreferenceItem;
|
||||
import com.dark98.santoku.theme.BeamTheme;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
|
||||
public class SettingsFragment extends ProfileListFragment {
|
||||
|
||||
@@ -163,8 +163,8 @@ public class SettingsFragment extends ProfileListFragment {
|
||||
.setTitle(R.string.SettingsResetToDefaultTitle)
|
||||
.setMessage(R.string.SettingsResetToDefaultDescription)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
SliceBeam.getConfigFile().delete();
|
||||
SliceBeam.CONFIG = null;
|
||||
Santoku.getConfigFile().delete();
|
||||
Santoku.CONFIG = null;
|
||||
Prefs.getPrefs().edit().clear().apply();
|
||||
Prefs.setLastCommit();
|
||||
act.startActivity(new Intent(act, SetupActivity.class));
|
||||
+7
-7
@@ -1,14 +1,14 @@
|
||||
package ru.ytkab0bp.slicebeam.navigation;
|
||||
package com.dark98.santoku.navigation;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.fragment.BedFragment;
|
||||
import ru.ytkab0bp.slicebeam.fragment.FilamentConfigFragment;
|
||||
import ru.ytkab0bp.slicebeam.fragment.PrintConfigFragment;
|
||||
import ru.ytkab0bp.slicebeam.fragment.PrinterConfigFragment;
|
||||
import ru.ytkab0bp.slicebeam.fragment.SettingsFragment;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.fragment.BedFragment;
|
||||
import com.dark98.santoku.fragment.FilamentConfigFragment;
|
||||
import com.dark98.santoku.fragment.PrintConfigFragment;
|
||||
import com.dark98.santoku.fragment.PrinterConfigFragment;
|
||||
import com.dark98.santoku.fragment.SettingsFragment;
|
||||
|
||||
public abstract class DelegateSlotImpl extends NavigationDelegate {
|
||||
public int getSlotCount() {
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package ru.ytkab0bp.slicebeam.navigation;
|
||||
package com.dark98.santoku.navigation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
|
||||
public abstract class Fragment {
|
||||
private View mView;
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.navigation;
|
||||
package com.dark98.santoku.navigation;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -23,12 +23,12 @@ import androidx.core.content.ContextCompat;
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.navigation.NavigationBarView;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.TextColorImageSpan;
|
||||
import ru.ytkab0bp.slicebeam.view.ThemeBottomNavigationView;
|
||||
import ru.ytkab0bp.slicebeam.view.ThemeRailNavigationView;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.TextColorImageSpan;
|
||||
import com.dark98.santoku.view.ThemeBottomNavigationView;
|
||||
import com.dark98.santoku.view.ThemeRailNavigationView;
|
||||
|
||||
public class MobileNavigationDelegate extends DelegateSlotImpl {
|
||||
private boolean portrait;
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package ru.ytkab0bp.slicebeam.navigation;
|
||||
package com.dark98.santoku.navigation;
|
||||
|
||||
import static ru.ytkab0bp.slicebeam.utils.DebugUtils.assertTrue;
|
||||
import static com.dark98.santoku.utils.DebugUtils.assertTrue;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.SparseArray;
|
||||
@@ -14,7 +14,7 @@ import androidx.dynamicanimation.animation.SpringForce;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
|
||||
public abstract class NavigationDelegate {
|
||||
protected Context context;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.print_host;
|
||||
package com.dark98.santoku.print_host;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
@@ -8,8 +8,8 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class BigHeaderItem extends SimpleRecyclerItem<TextView> {
|
||||
public String title;
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -29,7 +29,7 @@ import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
/**
|
||||
* This implementation of {@link RecyclerView.ItemAnimator} provides basic
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.DividerView;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.DividerView;
|
||||
|
||||
public class DividerItem extends SimpleRecyclerItem<DividerView> {
|
||||
@Override
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -20,11 +20,11 @@ import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.theme.BeamTheme;
|
||||
import ru.ytkab0bp.slicebeam.theme.IThemeView;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.theme.BeamTheme;
|
||||
import com.dark98.santoku.theme.IThemeView;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class PreferenceItem extends SimpleRecyclerItem<PreferenceItem.PreferenceHolderView> {
|
||||
private Drawable mIcon;
|
||||
@@ -75,7 +75,7 @@ public class PreferenceItem extends SimpleRecyclerItem<PreferenceItem.Preference
|
||||
}
|
||||
|
||||
public PreferenceItem setIcon(int iconRes) {
|
||||
mIcon = ContextCompat.getDrawable(SliceBeam.INSTANCE, iconRes);
|
||||
mIcon = ContextCompat.getDrawable(Santoku.INSTANCE, iconRes);
|
||||
return this;
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -15,12 +15,12 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.theme.IThemeView;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.BeamSwitch;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.theme.IThemeView;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.BeamSwitch;
|
||||
|
||||
public class PreferenceSwitchItem extends SimpleRecyclerItem<PreferenceSwitchItem.SwitchPreferenceHolderView> {
|
||||
private Drawable mIcon;
|
||||
@@ -64,7 +64,7 @@ public class PreferenceSwitchItem extends SimpleRecyclerItem<PreferenceSwitchIte
|
||||
}
|
||||
|
||||
public PreferenceSwitchItem setIcon(int iconRes) {
|
||||
mIcon = ContextCompat.getDrawable(SliceBeam.INSTANCE, iconRes);
|
||||
mIcon = ContextCompat.getDrawable(Santoku.INSTANCE, iconRes);
|
||||
return this;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.ViewGroup;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.Space;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.recycler;
|
||||
package com.dark98.santoku.recycler;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
@@ -8,8 +8,8 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class TextHintRecyclerItem extends SimpleRecyclerItem<TextView> {
|
||||
public String title;
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package ru.ytkab0bp.slicebeam.render;
|
||||
package com.dark98.santoku.render;
|
||||
|
||||
import androidx.core.math.MathUtils;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.utils.DoubleMatrix;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.DoubleMatrix;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
|
||||
public class Camera {
|
||||
private double[] viewMatrix = new double[16];
|
||||
+9
-9
@@ -1,13 +1,13 @@
|
||||
package ru.ytkab0bp.slicebeam.render;
|
||||
package com.dark98.santoku.render;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLModel;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLShaderProgram;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLShadersManager;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rUtils;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.DoubleMatrix;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.slic3r.GLModel;
|
||||
import com.dark98.santoku.slic3r.GLShaderProgram;
|
||||
import com.dark98.santoku.slic3r.GLShadersManager;
|
||||
import com.dark98.santoku.slic3r.Slic3rUtils;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.DoubleMatrix;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
|
||||
public class CoordAxes {
|
||||
public Vec3d origin = new Vec3d(0, 0, 0);
|
||||
+28
-28
@@ -1,7 +1,7 @@
|
||||
package ru.ytkab0bp.slicebeam.render;
|
||||
package com.dark98.santoku.render;
|
||||
|
||||
import static android.opengl.GLES30.*;
|
||||
import static ru.ytkab0bp.slicebeam.utils.DebugUtils.assertTrue;
|
||||
import static com.dark98.santoku.utils.DebugUtils.assertTrue;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
@@ -18,24 +18,24 @@ import java.nio.IntBuffer;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.events.ObjectsListChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.events.SelectedObjectChangedEvent;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Bed3D;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GCodeProcessorResult;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GCodeViewer;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLModel;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLShaderProgram;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.GLShadersManager;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Model;
|
||||
import ru.ytkab0bp.slicebeam.slic3r.Slic3rUtils;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.DoubleMatrix;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import ru.ytkab0bp.slicebeam.view.GLView;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.events.ObjectsListChangedEvent;
|
||||
import com.dark98.santoku.events.SelectedObjectChangedEvent;
|
||||
import com.dark98.santoku.slic3r.Bed3D;
|
||||
import com.dark98.santoku.slic3r.GCodeProcessorResult;
|
||||
import com.dark98.santoku.slic3r.GCodeViewer;
|
||||
import com.dark98.santoku.slic3r.GLModel;
|
||||
import com.dark98.santoku.slic3r.GLShaderProgram;
|
||||
import com.dark98.santoku.slic3r.GLShadersManager;
|
||||
import com.dark98.santoku.slic3r.Model;
|
||||
import com.dark98.santoku.slic3r.Slic3rUtils;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.DoubleMatrix;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
import com.dark98.santoku.view.GLView;
|
||||
|
||||
public class GLRenderer implements GLSurfaceView.Renderer {
|
||||
private final static float FOV = 60f;
|
||||
@@ -425,7 +425,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
boolean bottom = Prefs.isOrthoProjectionEnabled() ? camera.getDirForward().z > 0 : camera.getDirToBed().z > 0;
|
||||
if (lastConfigUid != SliceBeam.CONFIG_UID) {
|
||||
if (lastConfigUid != Santoku.CONFIG_UID) {
|
||||
configureBed();
|
||||
}
|
||||
if (bed.isValid() && bedVisible) {
|
||||
@@ -567,14 +567,14 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
||||
selX = selY = selZ = 0;
|
||||
selRotX = selRotY = selRotZ = 0;
|
||||
selScaleX = selScaleY = selScaleZ = 1;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new SelectedObjectChangedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new SelectedObjectChangedEvent());
|
||||
}
|
||||
|
||||
if (model.getObjectsCount() == 0) {
|
||||
model.release();
|
||||
model = null;
|
||||
}
|
||||
SliceBeam.EVENT_BUS.fireEvent(new ObjectsListChangedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new ObjectsListChangedEvent());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
||||
flattenPlanes.clear();
|
||||
|
||||
selectedObject = -1;
|
||||
SliceBeam.EVENT_BUS.fireEvent(new SelectedObjectChangedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new SelectedObjectChangedEvent());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
||||
selRotX = selRotY = selRotZ = 0;
|
||||
selScaleX = selScaleY = selScaleZ = 1;
|
||||
}
|
||||
SliceBeam.EVENT_BUS.fireEvent(new SelectedObjectChangedEvent());
|
||||
Santoku.EVENT_BUS.fireEvent(new SelectedObjectChangedEvent());
|
||||
}
|
||||
return render;
|
||||
}
|
||||
@@ -793,9 +793,9 @@ public class GLRenderer implements GLSurfaceView.Renderer {
|
||||
|
||||
private void configureBed() {
|
||||
try {
|
||||
lastConfigUid = SliceBeam.CONFIG_UID;
|
||||
SliceBeam.genCurrentConfig();
|
||||
bed.configure(SliceBeam.getCurrentConfigFile());
|
||||
lastConfigUid = Santoku.CONFIG_UID;
|
||||
Santoku.genCurrentConfig();
|
||||
bed.configure(Santoku.getCurrentConfigFile());
|
||||
} catch (Exception e) {
|
||||
Log.e("GLRenderer", "Failed to update config", e);
|
||||
}
|
||||
+8
-8
@@ -1,17 +1,17 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import static android.opengl.GLES30.*;
|
||||
import static ru.ytkab0bp.slicebeam.utils.DebugUtils.assertTrue;
|
||||
import static com.dark98.santoku.utils.DebugUtils.assertTrue;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.render.CoordAxes;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import ru.ytkab0bp.slicebeam.utils.DoubleMatrix;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import ru.ytkab0bp.slicebeam.utils.ViewUtils;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.render.CoordAxes;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
import com.dark98.santoku.utils.DoubleMatrix;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.ViewUtils;
|
||||
|
||||
public class Bed3D {
|
||||
private final static float GROUND_Z = -0.02f;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
@@ -23,8 +23,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import ru.ytkab0bp.slicebeam.view.GLView;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
import com.dark98.santoku.view.GLView;
|
||||
|
||||
public final class GCodeThumbnailer {
|
||||
private static final String TAG = "GCodeThumbnailer";
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import static ru.ytkab0bp.slicebeam.utils.DebugUtils.assertTrue;
|
||||
import static com.dark98.santoku.utils.DebugUtils.assertTrue;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
@@ -10,8 +10,8 @@ import androidx.core.util.Pair;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.theme.ThemesRepo;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.theme.ThemesRepo;
|
||||
|
||||
public class GCodeViewer {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
+6
-6
@@ -1,15 +1,15 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import static ru.ytkab0bp.slicebeam.utils.DebugUtils.assertTrue;
|
||||
import static com.dark98.santoku.utils.DebugUtils.assertTrue;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.render.Camera;
|
||||
import ru.ytkab0bp.slicebeam.render.GLRenderer;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import com.dark98.santoku.render.Camera;
|
||||
import com.dark98.santoku.render.GLRenderer;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
|
||||
public class GLModel {
|
||||
long pointer;
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import static ru.ytkab0bp.slicebeam.utils.DebugUtils.assertTrue;
|
||||
import static com.dark98.santoku.utils.DebugUtils.assertTrue;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.graphics.Color;
|
||||
@@ -13,8 +13,8 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.utils.IOUtils;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.utils.IOUtils;
|
||||
|
||||
public class GLShaderProgram {
|
||||
long pointer;
|
||||
@@ -39,7 +39,7 @@ public class GLShaderProgram {
|
||||
};
|
||||
|
||||
public GLShaderProgram(String name) {
|
||||
AssetManager assets = SliceBeam.INSTANCE.getAssets();
|
||||
AssetManager assets = Santoku.INSTANCE.getAssets();
|
||||
try {
|
||||
pointer = Native.shader_init_from_texts(name, IOUtils.readString(assets.open("shaders/" + name + ".fs")), IOUtils.readString(assets.open("shaders/" + name + ".vs")));
|
||||
} catch (IOException e) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import android.opengl.GLES30;
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
|
||||
public class Model {
|
||||
public final String key = UUID.randomUUID().toString();
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import com.dark98.santoku.Santoku;
|
||||
|
||||
class Native {
|
||||
static {
|
||||
@@ -12,7 +12,7 @@ class Native {
|
||||
|
||||
System.loadLibrary("slic3r");
|
||||
|
||||
set_svg_path_prefix(SliceBeam.INSTANCE.getCacheDir().getAbsolutePath());
|
||||
set_svg_path_prefix(Santoku.INSTANCE.getCacheDir().getAbsolutePath());
|
||||
}
|
||||
|
||||
static native void get_print_config_def(PrintConfigDef def);
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.Nullable;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -13,8 +13,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
import com.dark98.santoku.config.ConfigObject;
|
||||
|
||||
public class Slic3rConfigWrapper {
|
||||
public final static String BLACKLISTED_SYMBOLS = "<>[]:/\\|?*\"";
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import com.dark98.santoku.Santoku;
|
||||
|
||||
public class Slic3rLocalization {
|
||||
private static Map<String, Slic3rLocalization> localesMap = new HashMap<String, Slic3rLocalization>() {
|
||||
@@ -38,7 +38,7 @@ public class Slic3rLocalization {
|
||||
private Map<String, String> map = new HashMap<>();
|
||||
|
||||
public Slic3rLocalization(String key) throws IOException {
|
||||
InputStream in = SliceBeam.INSTANCE.getAssets().open("localization/" + key + ".po");
|
||||
InputStream in = Santoku.INSTANCE.getAssets().open("localization/" + key + ".po");
|
||||
BufferedReader r = new BufferedReader(new InputStreamReader(in));
|
||||
String line;
|
||||
StringBuilder msgId = null;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
public class Slic3rRuntimeError extends Exception {
|
||||
public Slic3rRuntimeError() {
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
import static ru.ytkab0bp.slicebeam.utils.DebugUtils.assertTrue;
|
||||
import static com.dark98.santoku.utils.DebugUtils.assertTrue;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.utils.Vec3d;
|
||||
import com.dark98.santoku.utils.Vec3d;
|
||||
|
||||
public class Slic3rUtils {
|
||||
public static void calcViewNormalMatrix(double[] viewMatrix, double[] worldMatrix, double[] normalMatrix) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.slic3r;
|
||||
package com.dark98.santoku.slic3r;
|
||||
|
||||
public interface SliceListener {
|
||||
void onProgress(int progress, String text);
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
package ru.ytkab0bp.slicebeam.theme;
|
||||
package com.dark98.santoku.theme;
|
||||
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.R;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import com.dark98.santoku.R;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
|
||||
public class BeamTheme {
|
||||
public final static BeamTheme LIGHT = new BeamTheme() {{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.theme;
|
||||
package com.dark98.santoku.theme;
|
||||
|
||||
public interface IThemeView {
|
||||
void onApplyTheme();
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
package ru.ytkab0bp.slicebeam.theme;
|
||||
package com.dark98.santoku.theme;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@@ -8,9 +8,9 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.MainActivity;
|
||||
import ru.ytkab0bp.slicebeam.SliceBeam;
|
||||
import ru.ytkab0bp.slicebeam.utils.Prefs;
|
||||
import com.dark98.santoku.MainActivity;
|
||||
import com.dark98.santoku.Santoku;
|
||||
import com.dark98.santoku.utils.Prefs;
|
||||
|
||||
public class ThemesRepo {
|
||||
private static Boolean resolvedSystemMode;
|
||||
@@ -18,7 +18,7 @@ public class ThemesRepo {
|
||||
public static BeamTheme getCurrent() {
|
||||
if (Prefs.getThemeMode() == Prefs.ThemeMode.SYSTEM) {
|
||||
if (resolvedSystemMode == null) {
|
||||
resolvedSystemMode = (SliceBeam.INSTANCE.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
|
||||
resolvedSystemMode = (Santoku.INSTANCE.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
|
||||
}
|
||||
return resolvedSystemMode ? BeamTheme.DARK : BeamTheme.LIGHT;
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package ru.ytkab0bp.slicebeam.utils;
|
||||
package com.dark98.santoku.utils;
|
||||
|
||||
import ru.ytkab0bp.slicebeam.BuildConfig;
|
||||
import com.dark98.santoku.BuildConfig;
|
||||
|
||||
public class DebugUtils {
|
||||
public static void assertTrue(boolean value) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user