Revision 903c7bbc
Added by Leszek Koltunski almost 3 years ago
src/main/java/org/distorted/dialogs/RubikDialogUpdates.java | ||
---|---|---|
90 | 90 |
} |
91 | 91 |
}); |
92 | 92 |
|
93 |
RubikNetwork network = RubikNetwork.getInstance(); |
|
94 |
network.signUpForUpdates(this); |
|
95 |
|
|
93 | 96 |
return dialog; |
94 | 97 |
} |
95 | 98 |
|
src/main/java/org/distorted/network/RubikNetwork.java | ||
---|---|---|
743 | 743 |
else if( mDebugState==DEBUG_FAILURE ) updatee.errorUpdate(); |
744 | 744 |
else mUpdatee = updatee; |
745 | 745 |
} |
746 |
|
|
747 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
748 |
|
|
749 |
public void updateDone(String shortName) |
|
750 |
{ |
|
751 |
mUpdates.updateDone(shortName); |
|
752 |
} |
|
746 | 753 |
} |
src/main/java/org/distorted/network/RubikUpdates.java | ||
---|---|---|
49 | 49 |
} |
50 | 50 |
} |
51 | 51 |
|
52 |
private int mNumberOfUpdates; |
|
53 | 52 |
private String mUrl; |
54 | 53 |
private final ArrayList<UpdateInfo> mNew, mUpd; |
55 | 54 |
|
... | ... | |
80 | 79 |
|
81 | 80 |
private void parseLine(String[] elements) |
82 | 81 |
{ |
83 |
boolean added = false; |
|
84 | 82 |
String shortName = elements[0]; |
85 | 83 |
String objMinor = elements[1]; |
86 | 84 |
String extMinor = elements[2]; |
... | ... | |
108 | 106 |
{ |
109 | 107 |
UpdateInfo info = new UpdateInfo(shortName,longName,description,oMinor,eMinor,updateO,updateE); |
110 | 108 |
mUpd.add(info); |
111 |
added = true; |
|
112 | 109 |
} |
113 | 110 |
} |
114 | 111 |
else |
115 | 112 |
{ |
116 | 113 |
UpdateInfo info = new UpdateInfo(shortName,longName,description,oMinor,eMinor,true,true); |
117 | 114 |
mNew.add(info); |
118 |
added = true; |
|
119 | 115 |
} |
120 | 116 |
} |
121 |
|
|
122 |
if( added ) mNumberOfUpdates++; |
|
123 | 117 |
} |
124 | 118 |
|
125 | 119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
128 | 122 |
{ |
129 | 123 |
android.util.Log.e("D", updates); |
130 | 124 |
|
131 |
mNumberOfUpdates = 0; |
|
132 |
|
|
133 | 125 |
mNew.clear(); |
134 | 126 |
mUpd.clear(); |
135 | 127 |
|
... | ... | |
147 | 139 |
} |
148 | 140 |
} |
149 | 141 |
|
142 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
143 |
|
|
144 |
public void updateDone(String shortName) |
|
145 |
{ |
|
146 |
for( UpdateInfo info : mNew) |
|
147 |
{ |
|
148 |
if( info.mObjectShortName.equals(shortName) ) |
|
149 |
{ |
|
150 |
mNew.remove(info); |
|
151 |
return; |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
for( UpdateInfo info : mUpd) |
|
156 |
{ |
|
157 |
if( info.mObjectShortName.equals(shortName) ) |
|
158 |
{ |
|
159 |
mUpd.remove(info); |
|
160 |
return; |
|
161 |
} |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
150 | 165 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
151 | 166 |
|
152 | 167 |
public int getNumberOfUpdates() |
153 | 168 |
{ |
154 |
return mNumberOfUpdates;
|
|
169 |
return mNew.size()+mUpd.size();
|
|
155 | 170 |
} |
156 | 171 |
|
157 | 172 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
---|---|---|
716 | 716 |
mBubbleUpdates.setText(shownNum); |
717 | 717 |
mBubbleUpdates.setVisibility(View.VISIBLE); |
718 | 718 |
} |
719 |
else |
|
720 |
{ |
|
721 |
mBubbleUpdates.setVisibility(View.INVISIBLE); |
|
722 |
} |
|
719 | 723 |
} |
720 | 724 |
|
721 | 725 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress downloading updates: dialog.