Project

General

Profile

« Previous | Next » 

Revision 35161021

Added by Leszek Koltunski over 2 years ago

Beginnings of support for saving the downloaded JSONs in local data storage.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogUpdateView.java
30 30
import android.widget.ProgressBar;
31 31
import android.widget.TextView;
32 32

  
33
import org.distorted.external.RubikFiles;
33 34
import org.distorted.main.R;
34 35
import org.distorted.external.RubikNetwork;
35 36
import org.distorted.external.RubikUpdates;
......
131 132
      {
132 133
      mBar.setProgress(50);
133 134
      mDescription.setText(R.string.installing);
135

  
136
      RubikFiles files = RubikFiles.getInstance();
137
      boolean oSuccess=true, eSuccess=true;
138

  
139
      if( mInfo.mObjectStream!=null )
140
        {
141
        String name = mInfo.mObjectShortName + "_object.json";
142
        oSuccess = files.saveFile(mInfo.mObjectStream, name);
143
        }
144

  
145
      if( mInfo.mExtrasStream!=null )
146
        {
147
        String name = mInfo.mObjectShortName + "_extras.json";
148
        eSuccess = files.saveFile(mInfo.mExtrasStream, name);
149
        }
150

  
151
      if( oSuccess )
152
        {
153
        mBar.setProgress(75);
154
        mDescription.setText(R.string.configuring);
155
        }
156
      else
157
        {
158
        mDescription.setTextColor(Color.parseColor("#ff0000"));
159
        mDescription.setText(R.string.saveError);
160
        }
134 161
      }
135 162
    }
136 163
  }

Also available in: Unified diff