@ -42,6 +42,7 @@ import android.os.Build;
import android.os.Bundle ;
import android.os.Bundle ;
import android.text.SpannableStringBuilder ;
import android.text.SpannableStringBuilder ;
import android.text.TextUtils ;
import android.text.TextUtils ;
import android.text.style.ForegroundColorSpan ;
import android.text.style.StyleSpan ;
import android.text.style.StyleSpan ;
import android.util.Pair ;
import android.util.Pair ;
import android.view.LayoutInflater ;
import android.view.LayoutInflater ;
@ -782,6 +783,8 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
Log . w ( ex ) ;
Log . w ( ex ) ;
}
}
final int colorWarning = Helper . resolveColor ( this , R . attr . colorWarning ) ;
View dview = LayoutInflater . from ( this ) . inflate ( R . layout . dialog_import_progress , null ) ;
View dview = LayoutInflater . from ( this ) . inflate ( R . layout . dialog_import_progress , null ) ;
TextView tvLog = dview . findViewById ( R . id . tvLog ) ;
TextView tvLog = dview . findViewById ( R . id . tvLog ) ;
tvLog . setText ( null ) ;
tvLog . setText ( null ) ;
@ -935,6 +938,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
SpannableStringBuilder ssb = new SpannableStringBuilder ( ) ;
SpannableStringBuilder ssb = new SpannableStringBuilder ( ) ;
ssb . append ( context . getString ( R . string . title_importing_wizard ) ) ;
ssb . append ( context . getString ( R . string . title_importing_wizard ) ) ;
ssb . setSpan ( new StyleSpan ( Typeface . BOLD ) , 0 , ssb . length ( ) , 0 ) ;
ssb . setSpan ( new StyleSpan ( Typeface . BOLD ) , 0 , ssb . length ( ) , 0 ) ;
ssb . setSpan ( new ForegroundColorSpan ( colorWarning ) , 0 , ssb . length ( ) , 0 ) ;
postProgress ( ssb ) ;
postProgress ( ssb ) ;
EntityLog . log ( context , "Run wizard account=" + account . name +
EntityLog . log ( context , "Run wizard account=" + account . name +
"id=" + account . id ) ;
"id=" + account . id ) ;
@ -1224,27 +1228,27 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
ServiceSynchronize . eval ( context , "import" ) ;
ServiceSynchronize . eval ( context , "import" ) ;
Log . i ( "Imported data" ) ;
Log . i ( "Imported data" ) ;
postProgress ( context . getString ( R . string . title_setup_imported ) , null ) ;
SpannableStringBuilder ssb = new SpannableStringBuilder ( ) ;
ssb . append ( context . getString ( R . string . title_setup_imported ) ) ;
ssb . setSpan ( new StyleSpan ( Typeface . BOLD ) , 0 , ssb . length ( ) , 0 ) ;
postProgress ( ssb , null ) ;
return null ;
return null ;
}
}
@Override
@Override
protected void onException ( Bundle args , Throwable ex ) {
protected void onException ( Bundle args , Throwable ex ) {
if ( ex . getCause ( ) instanceof BadPaddingException ) {
SpannableStringBuilder ssb = new SpannableStringBuilder ( ) ;
onProgress ( getString ( R . string . title_setup_password_invalid ) , null ) ;
if ( ex . getCause ( ) instanceof BadPaddingException )
onProgress ( "\n" + ex . toString ( ) , null ) ;
ssb . append ( getString ( R . string . title_setup_password_invalid ) ) ;
} else if ( ex instanceof IOException & & ex . getCause ( ) instanceof IllegalBlockSizeException ) {
else if ( ex instanceof IOException & & ex . getCause ( ) instanceof IllegalBlockSizeException )
onProgress ( getString ( R . string . title_setup_import_invalid ) , null ) ;
ssb . append ( getString ( R . string . title_setup_import_invalid ) ) ;
onProgress ( "\n" + ex . toString ( ) , null ) ;
if ( ssb . length ( ) > 0 ) {
} else if ( ex instanceof IllegalArgumentException | |
ssb . setSpan ( new StyleSpan ( Typeface . BOLD ) , 0 , ssb . length ( ) , 0 ) ;
ex instanceof IOException | |
ssb . setSpan ( new ForegroundColorSpan ( colorWarning ) , 0 , ssb . length ( ) , 0 ) ;
ex instanceof JSONException | |
ssb . append ( "\n\n" ) ;
ex instanceof SecurityException ) {
onProgress ( ex . toString ( ) , null ) ;
} else {
dialog . dismiss ( ) ;
Log . unexpectedError ( getSupportFragmentManager ( ) , ex ) ;
}
}
ssb . append ( ex . toString ( ) ) ;
onProgress ( ssb , null ) ;
}
}
} . execute ( this , args , "setup:import" ) ;
} . execute ( this , args , "setup:import" ) ;
}
}