Revision 84d746d7
Added by Leszek Koltunski almost 4 years ago
| src/main/java/org/distorted/dialogs/RubikDialogUpdateView.java | ||
|---|---|---|
| 36 | 36 | 
    import org.distorted.main.R;  | 
| 37 | 37 | 
    import org.distorted.external.RubikNetwork;  | 
| 38 | 38 | 
    import org.distorted.external.RubikUpdates;  | 
| 39 | 
    import org.distorted.objectlib.json.JsonReader;  | 
|
| 39 | 40 | 
    import org.distorted.objects.RubikObjectList;  | 
| 41 | 
    import org.distorted.screens.RubikScreenPlay;  | 
|
| 42 | 
    import org.distorted.screens.ScreenList;  | 
|
| 40 | 43 | 
     | 
| 41 | 44 | 
    ///////////////////////////////////////////////////////////////////////////////////////////////////  | 
| 42 | 45 | 
     | 
| ... | ... | |
| 121 | 124 | 
    Activity act = mAct.get();  | 
| 122 | 125 | 
    RubikFiles files = RubikFiles.getInstance();  | 
| 123 | 126 | 
    mIconSaved = files.saveIcon(act,mInfo.mIcon, name);  | 
| 127 | 
     | 
|
| 128 | 
          android.util.Log.e("D", "Saving icon "+name+" to a file "+mIconSaved);
   | 
|
| 124 | 129 | 
    }  | 
| 125 | 130 | 
    }  | 
| 126 | 131 | 
     | 
| ... | ... | |
| 156 | 161 | 
    String name = mInfo.mObjectShortName + "_object.json";  | 
| 157 | 162 | 
    Activity act = mAct.get();  | 
| 158 | 163 | 
    oSuccess = files.saveFile(act,mInfo.mObjectStream, name);  | 
| 164 | 
     | 
|
| 165 | 
            android.util.Log.e("D", "Saving JSON "+name+" to a file "+oSuccess);
   | 
|
| 166 | 
     | 
|
| 167 | 
    JsonReader reader = JsonReader.getInstance();  | 
|
| 168 | 
    reader.parseJsonFileMetadata(act,name);  | 
|
| 169 | 
    mInfo.mNumScrambles = reader.getNumScrambles();  | 
|
| 170 | 
     | 
|
| 171 | 
            android.util.Log.e("D", "Read from JSON numScrambles="+mInfo.mNumScrambles);
   | 
|
| 159 | 172 | 
    }  | 
| 160 | 173 | 
     | 
| 161 | 174 | 
    if( mInfo.mExtrasStream!=null )  | 
| ... | ... | |
| 163 | 176 | 
    String name = mInfo.mObjectShortName + "_extras.json";  | 
| 164 | 177 | 
    Activity act = mAct.get();  | 
| 165 | 178 | 
    eSuccess = files.saveFile(act,mInfo.mExtrasStream, name);  | 
| 179 | 
     | 
|
| 180 | 
            android.util.Log.e("D", "Saving Extras "+name+" to a file "+eSuccess);
   | 
|
| 166 | 181 | 
    }  | 
| 167 | 182 | 
     | 
| 168 | 183 | 
    if( mIconSaved || oSuccess || eSuccess )  | 
| 169 | 184 | 
            {
   | 
| 170 | 185 | 
    mBar.setProgress(75);  | 
| 171 | 186 | 
    mDescription.setText(R.string.configuring);  | 
| 172 | 
    RubikObjectList.addDownloadedObject(mInfo.mObjectShortName,mIconSaved,oSuccess,eSuccess);  | 
|
| 173 | 
    mBar.setProgress(100);  | 
|
| 174 | 
    mDescription.setText(R.string.success);  | 
|
| 187 | 
    RubikObjectList.addDownloadedObject(mInfo.mObjectShortName,mInfo.mNumScrambles, mInfo.mObjectMinorVersion,  | 
|
| 188 | 
    mInfo.mExtrasMinorVersion, mIconSaved, oSuccess, eSuccess);  | 
|
| 175 | 189 | 
     | 
| 176 | 190 | 
    RubikNetwork network = RubikNetwork.getInstance();  | 
| 177 | 191 | 
    network.updateDone(mInfo.mObjectShortName);  | 
| 192 | 
     | 
|
| 193 | 
    RubikScreenPlay play = (RubikScreenPlay)ScreenList.PLAY.getScreenClass();  | 
|
| 194 | 
    play.recreatePopup();  | 
|
| 195 | 
     | 
|
| 196 | 
    mBar.setProgress(100);  | 
|
| 197 | 
    mDescription.setText(R.string.success);  | 
|
| 178 | 198 | 
    }  | 
| 179 | 199 | 
    else  | 
| 180 | 200 | 
            {
   | 
Also available in: Unified diff
Downloaded Objects more or less work now.