Project

General

Profile

« Previous | Next » 

Revision e847c553

Added by Leszek Koltunski almost 3 years ago

Make 'downloaded' debugs controlled by a single boolean.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogUpdateView.java
41 41
import org.distorted.screens.RubikScreenPlay;
42 42
import org.distorted.screens.ScreenList;
43 43

  
44
import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
45

  
44 46
///////////////////////////////////////////////////////////////////////////////////////////////////
45 47

  
46 48
public class RubikDialogUpdateView implements RubikNetwork.Downloadee
......
125 127
      RubikFiles files = RubikFiles.getInstance();
126 128
      mIconSaved = files.saveIcon(act,mInfo.mIcon, name);
127 129

  
128
      android.util.Log.e("D", "Saving icon "+name+" to a file "+mIconSaved);
130
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Saving icon "+name+" to a file "+mIconSaved);
129 131
      }
130 132
    }
131 133

  
......
193 195
        Activity act = mAct.get();
194 196
        oSuccess = files.saveFile(act,mInfo.mObjectStream, name);
195 197

  
196
        android.util.Log.e("D", "Saving JSON "+name+" to a file "+oSuccess);
198
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Saving JSON "+name+" to a file "+oSuccess);
197 199

  
198 200
        JsonReader reader = JsonReader.getInstance();
199 201
        mInfo.mNumScrambles = reader.readNumScrambles(act,name);
200 202

  
201
        android.util.Log.e("D", "Read from JSON numScrambles="+mInfo.mNumScrambles);
203
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Read from JSON numScrambles="+mInfo.mNumScrambles);
202 204
        }
203 205

  
204 206
      if( mInfo.mExtrasStream!=null )
......
207 209
        Activity act = mAct.get();
208 210
        eSuccess = files.saveFile(act,mInfo.mExtrasStream, name);
209 211

  
210
        android.util.Log.e("D", "Saving Extras "+name+" to a file "+eSuccess);
212
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Saving Extras "+name+" to a file "+eSuccess);
211 213
        }
212 214

  
213 215
      if( mIconSaved || oSuccess || eSuccess )
214 216
        {
215 217
        makeProgress(75,R.string.configuring);
216 218

  
217
        android.util.Log.e("D", "1");
219
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "1");
218 220

  
219 221
        RubikObjectList.addDownloadedObject(mInfo.mObjectShortName,mInfo.mNumScrambles, mInfo.mObjectMinorVersion,
220 222
                                            mInfo.mExtrasMinorVersion, mIconSaved, oSuccess, eSuccess);
221 223

  
222
        android.util.Log.e("D", "2");
224
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "2");
223 225

  
224 226
        RubikNetwork network = RubikNetwork.getInstance();
225 227
        network.updateDone(mInfo.mObjectShortName);
226 228

  
227
        android.util.Log.e("D", "3");
229
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "3");
228 230

  
229 231
        RubikScreenPlay play = (RubikScreenPlay)ScreenList.PLAY.getScreenClass();
230 232
        play.recreatePopup();
231 233

  
232
        android.util.Log.e("D", "4");
234
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "4");
233 235

  
234 236
        makeProgress(100,R.string.success);
235 237

  
236
        android.util.Log.e("D", "5");
238
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "5");
237 239
        }
238 240
      else
239 241
        {
src/main/java/org/distorted/external/RubikNetwork.java
42 42
import org.distorted.objects.RubikObjectList;
43 43

  
44 44
import static org.distorted.objects.RubikObjectList.MAX_LEVEL;
45
import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
45 46

  
46 47
///////////////////////////////////////////////////////////////////////////////////////////////////
47 48

  
......
714 715
          icon = downloadIcon(url);
715 716
          downloaded = true;
716 717

  
717
          android.util.Log.e("D", "Downloading icon "+url);
718
          if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Downloading icon "+url);
718 719
          }
719 720
        if( icon!=null )
720 721
          {
......
739 740
          icon = downloadIcon(url);
740 741
          downloaded = true;
741 742

  
742
          android.util.Log.e("D", "Downloading icon "+url);
743
          if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Downloading icon "+url);
743 744
          }
744 745
        if( icon!=null )
745 746
          {
......
758 759

  
759 760
    try
760 761
      {
761
      android.util.Log.e("D", "Downloading JSON "+url);
762
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Downloading JSON "+url);
762 763

  
763 764
      java.net.URL connectURL = new URL(url);
764 765
      HttpURLConnection conn = (HttpURLConnection) connectURL.openConnection();
src/main/java/org/distorted/external/RubikUpdates.java
26 26
import android.graphics.Bitmap;
27 27
import org.distorted.objects.RubikObjectList;
28 28

  
29
import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
30

  
29 31
///////////////////////////////////////////////////////////////////////////////////////////////////
30 32

  
31 33
public class RubikUpdates
......
118 120
      int objOrdinal = RubikObjectList.getOrdinal(shortName.toUpperCase());
119 121
      boolean updateO=true, updateE=true;
120 122

  
121
android.util.Log.e("D", "downloaded object "+shortName+" oMinor="+oMinor+" eMinor="+eMinor);
123
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "downloaded object "+shortName+" oMinor="+oMinor+" eMinor="+eMinor);
122 124

  
123 125
      if( objOrdinal>=0 )
124 126
        {
......
127 129
        updateO = localObjectMinor<oMinor;
128 130
        updateE = localExtrasMinor<eMinor;
129 131

  
130

  
131
android.util.Log.e("D", "object exists locally, localObjectMinor="+localObjectMinor+" localExtrasMinor="+localExtrasMinor);
132

  
132
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "object exists locally, localObjectMinor="+localObjectMinor+" localExtrasMinor="+localExtrasMinor);
133 133
        }
134 134
      if( updateO || updateE )
135 135
        {
136 136
        UpdateInfo info = new UpdateInfo(shortName,longName,description,oMinor,eMinor,oPercent,oIcon,updateO,updateE);
137 137
        if(oPercent>=100)
138 138
          {
139
android.util.Log.e("D", "object added to completed");
140

  
139
          if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "object added to completed");
141 140
          mCompleted.add(info);
142 141
          }
143 142
        else
144 143
          {
145
android.util.Log.e("D", "object added to started");
146

  
144
          if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "object added to started");
147 145
          mStarted.add(info);
148 146
          }
149 147
        }
......
154 152

  
155 153
  void parse(String updates)
156 154
    {
157
    android.util.Log.e("D", updates);
155
    if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", updates);
158 156

  
159 157
    mCompleted.clear();
160 158
    mStarted.clear();
src/main/java/org/distorted/main/RubikActivity.java
65 65

  
66 66
public class RubikActivity extends AppCompatActivity
67 67
{
68
    public static final boolean SHOW_DOWNLOADED_DEBUG = false;
69

  
68 70
    public static final float PADDING             = 0.01f;
69 71
    public static final float SMALL_MARGIN        = 0.004f;
70 72
    public static final float MEDIUM_MARGIN       = 0.015f;
......
85 87
    public static final float MENU_SMALL_TEXT_SIZE= 0.035f;
86 88
    public static final float TAB_WIDTH           = 0.100f;
87 89
    public static final float TAB_HEIGHT          = 0.100f;
88
    public static final float BUBBLE_SIZE         = 0.15f;
89 90

  
90 91
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
91 92
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
src/main/java/org/distorted/objects/RubikObject.java
37 37
import org.distorted.patterns.RubikPatternList;
38 38

  
39 39
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
40
import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
40 41

  
41 42
///////////////////////////////////////////////////////////////////////////////////////////////////
42 43

  
......
85 86

  
86 87
  RubikObject(RubikObjectList.DownloadedObject object)
87 88
    {
88
    android.util.Log.e("D", "new downloaded RubikObject "+object.shortName+" added");
89
    if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "new downloaded RubikObject "+object.shortName+" added");
89 90

  
90 91
    mLowerName     = object.shortName;
91 92
    mUpperName     = object.shortName.toUpperCase();
......
111 112

  
112 113
    if( object.objectMinor>JsonWriter.VERSION_OBJECT_MINOR )
113 114
      {
114
      android.util.Log.e("D", "Updating RubikObject's "+object.shortName+" main JSON");
115
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Updating RubikObject's "+object.shortName+" main JSON");
115 116

  
116 117
      mObjectMinor = object.objectMinor;
117 118
      mNumScramble = object.numScrambles;
......
122 123

  
123 124
    if( object.extrasMinor>JsonWriter.VERSION_EXTRAS_MINOR )
124 125
      {
125
      android.util.Log.e("D", "Updating RubikObject's "+object.shortName+" extras JSON");
126
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Updating RubikObject's "+object.shortName+" extras JSON");
126 127

  
127 128
      mExtrasMinor = object.extrasMinor;
128 129
      mExtrasID = -1;
src/main/java/org/distorted/objects/RubikObjectList.java
31 31

  
32 32
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
33 33
import static org.distorted.objectlib.main.ObjectType.NUM_OBJECTS;
34
import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
34 35

  
35 36
///////////////////////////////////////////////////////////////////////////////////////////////////
36 37

  
......
104 105
      mObjects.add(obj);
105 106
      mNumObjects++;
106 107

  
107
android.util.Log.e("D", "creating local object "+type.name() );
108
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "creating local object "+type.name() );
108 109

  
109 110
      if( obj.hasExtras() )
110 111
        {
111
        android.util.Log.e("D", "has extras "+mNumExtras );
112

  
112
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "has extras "+mNumExtras );
113 113

  
114 114
        obj.setExtrasOrdinal(mNumExtras);
115 115
        mNumExtras++;
116 116
        }
117 117
      else
118 118
        {
119
        android.util.Log.e("D", "no extras");
120

  
119
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "no extras");
121 120
        }
122 121
      }
123 122
    }
......
138 137
    mObjects.add(obj);
139 138
    mNumObjects++;
140 139

  
141

  
142
android.util.Log.e("D", "creating downloaded object "+obj.getUpperName() );
140
    if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "creating downloaded object "+obj.getUpperName() );
143 141

  
144 142
    if( obj.hasExtras() )
145 143
      {
146
      android.util.Log.e("D", "has extras "+mNumExtras );
144
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "has extras "+mNumExtras );
147 145

  
148 146
      obj.setExtrasOrdinal(mNumExtras);
149 147
      mNumExtras++;
150 148
      }
151 149
    else
152 150
      {
153
      android.util.Log.e("D", "no extras");
151
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "no extras");
154 152
      }
155 153

  
156 154
    return true;
......
197 195
        obj.object|= object;
198 196
        obj.extras|= extras;
199 197

  
200
        android.util.Log.e("D", "Updating downloaded object "+shortName);
198
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Updating downloaded object "+shortName);
201 199

  
202 200
        return;
203 201
        }
......
206 204
    DownloadedObject extra = new DownloadedObject(shortName,numScrambles,objectMinor,extrasMinor,icon,object,extras);
207 205
    if ( internalAddDownloadedObject(extra) )
208 206
      {
209
      android.util.Log.e("D", "Adding new downloaded object "+shortName);
207
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Adding new downloaded object "+shortName);
210 208
      mDownloadedObjects.add(extra);
211 209
      }
212 210
    }
......
259 257
        }
260 258

  
261 259
      String objects = downloadedObjects.toString();
262
android.util.Log.e("D", "saving: "+objects);
260
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "saving: "+objects);
263 261

  
264 262
      editor.putString("rol_downloaded", objects );
265 263
      }
......
287 285
    {
288 286
    String downloaded = preferences.getString("rol_downloaded","");
289 287

  
290
    android.util.Log.e("D", downloaded);
288
    if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", downloaded);
291 289

  
292 290
    if( !downloaded.equals(""))
293 291
      {

Also available in: Unified diff