mirror of
https://github.com/Dark98/SliceBeam.git
synced 2026-07-03 00:38:53 +00:00
Fix import
This commit is contained in:
@@ -97,6 +97,7 @@ import ru.ytkab0bp.slicebeam.config.ConfigObject;
|
|||||||
import ru.ytkab0bp.slicebeam.events.BeamServerDataUpdatedEvent;
|
import ru.ytkab0bp.slicebeam.events.BeamServerDataUpdatedEvent;
|
||||||
import ru.ytkab0bp.slicebeam.events.CloudFeaturesUpdatedEvent;
|
import ru.ytkab0bp.slicebeam.events.CloudFeaturesUpdatedEvent;
|
||||||
import ru.ytkab0bp.slicebeam.events.CloudLoginStateUpdatedEvent;
|
import ru.ytkab0bp.slicebeam.events.CloudLoginStateUpdatedEvent;
|
||||||
|
import ru.ytkab0bp.slicebeam.events.CloudSyncFinishedEvent;
|
||||||
import ru.ytkab0bp.slicebeam.recycler.BigHeaderItem;
|
import ru.ytkab0bp.slicebeam.recycler.BigHeaderItem;
|
||||||
import ru.ytkab0bp.slicebeam.recycler.PreferenceItem;
|
import ru.ytkab0bp.slicebeam.recycler.PreferenceItem;
|
||||||
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerAdapter;
|
import ru.ytkab0bp.slicebeam.recycler.SimpleRecyclerAdapter;
|
||||||
@@ -510,19 +511,27 @@ public class SetupActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
@EventHandler(runOnMainThread = true)
|
||||||
|
public void onCloudSyncFinished(CloudSyncFinishedEvent e) {
|
||||||
|
if (cloudProfile && Prefs.getCloudAPIToken() != null && cloudImport) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
if (!about && !boostyOnly && !cloudProfile) {
|
||||||
|
if (Prefs.getCloudAPIToken() != null) {
|
||||||
|
limitRepoFragmentCount = false;
|
||||||
|
limitProfileFragmentCount = false;
|
||||||
|
pager.getAdapter().notifyDataSetChanged();
|
||||||
|
pager.setCurrentItem(pager.getAdapter().getItemCount() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(runOnMainThread = true)
|
@EventHandler(runOnMainThread = true)
|
||||||
public void onCloudAuthStateUpdated(CloudLoginStateUpdatedEvent e) {
|
public void onCloudAuthStateUpdated(CloudLoginStateUpdatedEvent e) {
|
||||||
if (cloudProfile) {
|
if (cloudProfile) {
|
||||||
cloudItem.bindLoginButton(true);
|
cloudItem.bindLoginButton(true);
|
||||||
cloudItem.bindFeatures();
|
cloudItem.bindFeatures();
|
||||||
|
|
||||||
if (Prefs.getCloudAPIToken() != null && cloudImport) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
} else if (!about && !boostyOnly) {
|
|
||||||
if (Prefs.getCloudAPIToken() != null) {
|
|
||||||
pager.setCurrentItem(pager.getAdapter().getItemCount() - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1254,7 +1263,10 @@ public class SetupActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCloudInfoUpdated() {
|
public void onCloudInfoUpdated() {
|
||||||
cloudImportView.setVisibility(BeamServerData.isCloudAvailable() ? View.VISIBLE : View.GONE);
|
if (cloudImportView != null) {
|
||||||
|
cloudImportView.setVisibility(BeamServerData.isCloudAvailable() ? View.VISIBLE : View.GONE);
|
||||||
|
cloudOrView.setVisibility(BeamServerData.isCloudAvailable() ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onReposLoaded() {
|
public void onReposLoaded() {
|
||||||
@@ -1617,11 +1629,13 @@ public class SetupActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SliceBeam.getCurrentConfigFile().delete();
|
if (Prefs.getCloudAPIToken() == null || SliceBeam.CONFIG == null) {
|
||||||
SliceBeam.CONFIG = cfg;
|
SliceBeam.getCurrentConfigFile().delete();
|
||||||
FileOutputStream fos = new FileOutputStream(SliceBeam.getConfigFile());
|
SliceBeam.CONFIG = cfg;
|
||||||
fos.write(cfg.serialize().getBytes(StandardCharsets.UTF_8));
|
FileOutputStream fos = new FileOutputStream(SliceBeam.getConfigFile());
|
||||||
fos.close();
|
fos.write(cfg.serialize().getBytes(StandardCharsets.UTF_8));
|
||||||
|
fos.close();
|
||||||
|
}
|
||||||
|
|
||||||
startActivity(new Intent(SetupActivity.this, MainActivity.class));
|
startActivity(new Intent(SetupActivity.this, MainActivity.class));
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import ru.ytkab0bp.slicebeam.components.BeamAlertDialogBuilder;
|
|||||||
import ru.ytkab0bp.slicebeam.events.CloudFeaturesUpdatedEvent;
|
import ru.ytkab0bp.slicebeam.events.CloudFeaturesUpdatedEvent;
|
||||||
import ru.ytkab0bp.slicebeam.events.CloudLoginStateUpdatedEvent;
|
import ru.ytkab0bp.slicebeam.events.CloudLoginStateUpdatedEvent;
|
||||||
import ru.ytkab0bp.slicebeam.events.CloudModelsRemainingCountUpdatedEvent;
|
import ru.ytkab0bp.slicebeam.events.CloudModelsRemainingCountUpdatedEvent;
|
||||||
|
import ru.ytkab0bp.slicebeam.events.CloudSyncFinishedEvent;
|
||||||
import ru.ytkab0bp.slicebeam.events.CloudUserInfoUpdatedEvent;
|
import ru.ytkab0bp.slicebeam.events.CloudUserInfoUpdatedEvent;
|
||||||
import ru.ytkab0bp.slicebeam.events.NeedDismissSnackbarEvent;
|
import ru.ytkab0bp.slicebeam.events.NeedDismissSnackbarEvent;
|
||||||
import ru.ytkab0bp.slicebeam.events.NeedSnackbarEvent;
|
import ru.ytkab0bp.slicebeam.events.NeedSnackbarEvent;
|
||||||
@@ -297,12 +298,14 @@ public class CloudController {
|
|||||||
Prefs.setCloudLastSync(SliceBeam.TRUE_TIME.now().getTime());
|
Prefs.setCloudLastSync(SliceBeam.TRUE_TIME.now().getTime());
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.CloudSyncSuccess));
|
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.CloudSyncSuccess));
|
||||||
|
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "Failed to write data", e);
|
Log.e(TAG, "Failed to write data", e);
|
||||||
isSyncInProgress = false;
|
isSyncInProgress = false;
|
||||||
|
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
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 NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||||
|
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -314,6 +317,7 @@ public class CloudController {
|
|||||||
|
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
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 NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||||
|
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -335,6 +339,7 @@ public class CloudController {
|
|||||||
} else if (response.usedSize == 0) {
|
} else if (response.usedSize == 0) {
|
||||||
if (SliceBeam.CONFIG == null) {
|
if (SliceBeam.CONFIG == null) {
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||||
|
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,6 +369,7 @@ public class CloudController {
|
|||||||
} else {
|
} else {
|
||||||
// Not modified on server and on client
|
// Not modified on server and on client
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||||
|
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -406,6 +412,7 @@ public class CloudController {
|
|||||||
Prefs.setCloudLastSync(SliceBeam.TRUE_TIME.now().getTime());
|
Prefs.setCloudLastSync(SliceBeam.TRUE_TIME.now().getTime());
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.CloudSyncSuccess));
|
SliceBeam.EVENT_BUS.fireEvent(new NeedSnackbarEvent(R.string.CloudSyncSuccess));
|
||||||
|
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -415,6 +422,7 @@ public class CloudController {
|
|||||||
|
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
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 NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||||
|
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -423,6 +431,7 @@ public class CloudController {
|
|||||||
|
|
||||||
SliceBeam.EVENT_BUS.fireEvent(new NeedDismissSnackbarEvent(CLOUD_SYNC_TAG));
|
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 NeedSnackbarEvent(SnackbarsLayout.Type.ERROR, R.string.CloudSyncError));
|
||||||
|
SliceBeam.EVENT_BUS.fireEvent(new CloudSyncFinishedEvent());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package ru.ytkab0bp.slicebeam.events;
|
||||||
|
|
||||||
|
import ru.ytkab0bp.eventbus.Event;
|
||||||
|
|
||||||
|
@Event
|
||||||
|
public class CloudSyncFinishedEvent {}
|
||||||
Reference in New Issue
Block a user