Add initialization message to loading popup window

This commit is contained in:
Steve Soltys 2019-02-22 01:05:55 -05:00
parent bd0c41c2d3
commit 03c92efc24
3 changed files with 9 additions and 5 deletions

View file

@ -167,10 +167,10 @@ class CreateBackupActivityController {
BackupSession backupSession = backupManager.backup(backupObserver, selectedPackages); BackupSession backupSession = backupManager.backup(backupObserver, selectedPackages);
View popupWindowButton = popupWindow.getContentView().findViewById(R.id.popup_cancel_button); View popupWindowButton = popupWindow.getContentView().findViewById(R.id.popup_cancel_button);
popupWindowButton.setOnClickListener(new BackupPopupWindowListener(backupSession));
if (popupWindowButton != null) { TextView textView = popupWindow.getContentView().findViewById(R.id.popup_text_view);
popupWindowButton.setOnClickListener(new BackupPopupWindowListener(backupSession)); textView.setText(R.string.initializing);
}
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Error while running backup: ", e); Log.e(TAG, "Error while running backup: ", e);

View file

@ -5,7 +5,6 @@ import android.widget.PopupWindow;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.stevesoltys.backup.R; import com.stevesoltys.backup.R;
import com.stevesoltys.backup.session.restore.RestoreResult; import com.stevesoltys.backup.session.restore.RestoreResult;
import com.stevesoltys.backup.session.restore.RestoreSessionObserver; import com.stevesoltys.backup.session.restore.RestoreSessionObserver;
@ -31,6 +30,10 @@ class RestoreObserver implements RestoreSessionObserver {
@Override @Override
public void restoreSessionStarted(int packageCount) { public void restoreSessionStarted(int packageCount) {
context.runOnUiThread(() -> {
TextView textView = popupWindow.getContentView().findViewById(R.id.popup_text_view);
textView.setText(R.string.initializing);
});
} }
@Override @Override
@ -55,7 +58,7 @@ class RestoreObserver implements RestoreSessionObserver {
public void restoreSessionCompleted(RestoreResult restoreResult) { public void restoreSessionCompleted(RestoreResult restoreResult) {
ConfigurableBackupTransport backupTransport = ConfigurableBackupTransportService.getBackupTransport(); ConfigurableBackupTransport backupTransport = ConfigurableBackupTransportService.getBackupTransport();
if(!backupTransport.isActive()) { if (!backupTransport.isActive()) {
return; return;
} }

View file

@ -21,5 +21,6 @@
<string name="select_all">Select all</string> <string name="select_all">Select all</string>
<string name="loading_backup">Loading backup…</string> <string name="loading_backup">Loading backup…</string>
<string name="loading_packages">Loading packages…</string> <string name="loading_packages">Loading packages…</string>
<string name="initializing">Initializing…</string>
</resources> </resources>