If you think the Android project sms-backup-plus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.zegoggles.smssync.service.state;
//fromwww.java2s.comimport android.content.res.Resources;
import com.zegoggles.smssync.R;
import com.zegoggles.smssync.mail.DataType;
importstatic com.zegoggles.smssync.service.state.SmsSyncState.INITIAL;
publicclass RestoreState extends State {
/** items currently restored */publicfinalint currentRestoredCount;
/** total number of items to be restored */publicfinalint itemsToRestore;
/** how many items did get actually restored */publicfinalint actualRestoredCount;
/** how many duplicates where detected after restore */publicfinalint duplicateCount;
public RestoreState() {
this(INITIAL, 0, 0, 0, 0, null, null);
}
public RestoreState(SmsSyncState state,
int currentRestoredCount,
int itemsToRestore,
int actualRestoredCount,
int duplicateCount,
DataType dataType,
Exception exception) {
super(state, dataType, exception);
this.currentRestoredCount = currentRestoredCount;
this.actualRestoredCount = actualRestoredCount;
this.itemsToRestore = itemsToRestore;
this.duplicateCount = duplicateCount;
}
@Override
public String toString() {
return"RestoreStateChanged{" +
"state=" + state +
", currentRestoredCount=" + currentRestoredCount +
", itemsToRestore=" + itemsToRestore +
", actualRestoredCount=" + actualRestoredCount +
", duplicateCount=" + duplicateCount +
'}';
}
@Override
public RestoreState transition(SmsSyncState newState, Exception exception) {
returnnew RestoreState(newState, currentRestoredCount, itemsToRestore, actualRestoredCount, duplicateCount, dataType, exception);
}
@Override
public String getNotificationLabel(Resources resources) {
String label = super.getNotificationLabel(resources);
if (label != null) return label;
switch (state) {
case RESTORE:
label = resources.getString(R.string.status_restore_details,
currentRestoredCount,
itemsToRestore);
if (dataType != null) {
label += " ("+resources.getString(dataType.resId)+")";
}
return label;
case UPDATING_THREADS:
return resources.getString(R.string.status_updating_threads);
default:
return"";
}
}
}