Project

General

Profile

« Previous | Next » 

Revision 6f8e5dfc

Added by Leszek Koltunski almost 5 years ago

Improvement for Downloader. Remove as much knowledge from it as possible.

View differences:

src/main/java/org/distorted/dialog/RubikDialogScoresPagerAdapter.java
162 162
    if( allCreated )
163 163
      {
164 164
      RubikScoresDownloader downloader = new RubikScoresDownloader();
165
      downloader.download(this);
165
      downloader.download(this, "distorted", 1);                        // TODO
166 166
      }
167 167

  
168 168
    return mViews[position];
src/main/java/org/distorted/network/RubikScoresDownloader.java
85 85
  private static boolean mRunning = false;
86 86
  private static int mMode = IDLE;
87 87
  private static Receiver mReceiver;
88
  private static String mUserName;
89
  private static int mNumRuns;
88 90

  
89 91
  private static String mScores = "";
90 92
  private static String[][][] mCountry = new String[LENGTH][MAX_SCRAMBLE][MAX_PLACES];
......
181 183

  
182 184
  private boolean doDownload()
183 185
    {
184
    // TODO
185
    int numRuns = 1;
186
    String veri = "distored";
187
    // END
188 186
    String version = R.string.app_version+"d";
189 187

  
190
    String message=URL+"/download.cgi?n="+URLencode(veri)+"&r="+numRuns+"&e="+version;
188
    String message=URL+"/download.cgi?n="+URLencode(mUserName)+"&r="+mNumRuns+"&e="+version;
191 189

  
192 190
    try
193 191
      {
......
283 281

  
284 282
///////////////////////////////////////////////////////////////////////////////////////////////////
285 283

  
286
  public void download(Receiver receiver)
284
  public void download(Receiver receiver, String userName, int numRuns)
287 285
    {
288 286
    mReceiver = receiver;
289
    mMode = DOWNLOAD;
287
    mMode     = DOWNLOAD;
288
    mUserName = userName;
289
    mNumRuns  = numRuns;
290

  
290 291
    Thread networkThrd = new Thread(this);
291 292
    networkThrd.start();
292 293
    }

Also available in: Unified diff