Skip to content

Commit

Permalink
Версия 2.9.12
Browse files Browse the repository at this point in the history
- исправлен баг, заключавшийся в зацикливании и повторении постов в ленте;
- починены не отображавшиеся комментарии к постам (но по-прежнему только первого уровня);
- починены музыкальные плейлисты.
  • Loading branch information
Computershik73 committed Apr 16, 2023
1 parent b706c33 commit 52c5e1c
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Application Descriptor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VikaTouch-Edition: release
Nokia-MIDlet-Background-Event: run
MIDlet-Version: 2.9.11
MIDlet-Version: 2.9.12
MIDlet-Info-URL: http://vikamobile.ru
Nokia-UI-Enhancement: CanvasHasBackground,MusicKeysSupported,IgnoreProfilesBasedSoundMuting
Manifest-Version: 1.0
Expand Down
2 changes: 1 addition & 1 deletion src/vikatouch/items/chat/CommentItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void getAva() {
Image img = null;
try {
img = VikaTouch.cameraImg;
if (avaurl != null && !Settings.dontLoadAvas) {
if (avaurl != null && !Settings.dontLoadAvas && avaurl!="") {
try {
img = VikaUtils.downloadImage(avaurl, true);
} catch (Exception e) {
Expand Down
14 changes: 7 additions & 7 deletions src/vikatouch/screens/ChatScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -1952,19 +1952,19 @@ private void send() {
if (!canSend)
return;
canSend = false;
VikaTouch.needstoRedraw=true;

this.serviceRepaints();
VikaTouch.needstoRedraw=true;

buttonSelected = 0;
// inputedLinesCount = 0;

new Thread() {
public void run() {
setPriority(10);
VikaTouch.needstoRedraw=true;

canSend = false;
VikaTouch.canvas.serviceRepaints();
VikaTouch.needstoRedraw=true;

try {
Thread.sleep(200);
} catch (InterruptedException e1) {
Expand Down Expand Up @@ -2172,15 +2172,15 @@ public void run() {
canSend = true;
scrollToLast();
VikaTouch.loading = false;
VikaTouch.needstoRedraw=true;


VikaTouch.canvas.serviceRepaints();
VikaTouch.needstoRedraw=true;
//}
}
}.start();
buttonSelected = 0;
VikaTouch.needstoRedraw=true;

this.serviceRepaints();
try {
Thread.sleep(500);
Expand All @@ -2190,7 +2190,7 @@ public void run() {
}
// updStop=false;
// update();
VikaTouch.needstoRedraw=true;

this.serviceRepaints();
}

Expand Down
10 changes: 5 additions & 5 deletions src/vikatouch/screens/CommentsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void loadComments() {
}
//"https://api.vk.com/method/wall.getComments?access_token=a4ffeaf275bb8e33e1b23c19b3bbe5401968ae66b45cf64a82bbe619ccdbfcb904ac27fddfdf6fbd174de&v=5.130&post_id=770640&owner_id=-36741297&thread_items_count=3&extended=1";


System.out.print(x);

JSONObject response = new JSONObject(x).optJSONObject("response");
//VikaTouch.sendLog(response.toString());
Expand All @@ -140,8 +140,8 @@ public void loadComments() {
if(!VikaTouch.profiles.containsKey(new IntObject(profile.getInt("id"))) && profile != null)
VikaTouch.profiles.put(new IntObject(profile.getInt("id")),
new ProfileObject(profile.getInt("id"),
profile.getString("first_name"), profile.getString("last_name"),
profile.getString("photo_50").indexOf("camera_50") > -1 ? "camera_50." : profile.getString("photo_50"), profile.optString("online")));
profile.optString("first_name"), profile.optString("last_name"),
profile.optString("photo_50").indexOf("camera_50") > -1 ? "camera_50." : profile.optString("photo_50"), profile.optString("online")));
}
}
} catch (Exception e) {
Expand All @@ -154,8 +154,8 @@ public void loadComments() {
if(!VikaTouch.profiles.containsKey(new IntObject(-group.getInt("id"))) && group != null)
VikaTouch.profiles.put(new IntObject(-group.getInt("id")),
new ProfileObject(group.getInt("id"),
group.getString("name"),
group.getString("photo_50").indexOf("camera_50") > -1 ? "camera_50." : group.getString("photo_50")));
group.optString("name"),
group.optString("photo_50").indexOf("camera_50") > -1 ? "camera_50." : group.optString("photo_50")));
}
}
} catch (Exception e) {
Expand Down
23 changes: 11 additions & 12 deletions src/vikatouch/screens/NewsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ public void run() {
.addField("count", count).addField("owner_id", newsSource);
}
if (!fromLatest && startPost != null) {
if (newsSource == 0) {
url = url.addField("start_from", startPost);
} else {
url.addField("offset", offset);
}
url = url.addField("start_from", startPost);
}
hasBackButton = newsSource != 0;

Expand All @@ -102,6 +98,7 @@ public void run() {
VikaTouch.popup(new InfoPopup(s, null));
return;
}
System.out.println(response);
step = 2;
JSONArray items = response.getJSONArray("items");
step = 3;
Expand All @@ -114,7 +111,9 @@ public void run() {
groups = response.getJSONArray("groups");
step = 6;
startPost = response.optString("next_from", null);

if(startPost.length() == 0) {
startPost = null;
}
listHeight = 0;
for (int i = 0; i < itemsCount; i++) {
ii=i;
Expand Down Expand Up @@ -176,11 +175,7 @@ public void run() {
.addField("count", count).addField("owner_id", newsSource);
}
if (startPost != null) {
if (newsSource == 0) {
url = url.addField("start_from", startPost);
} else {
url.addField("offset", offset);
}
url = url.addField("start_from", startPost);
}
hasBackButton = newsSource != 0;

Expand All @@ -198,6 +193,7 @@ public void run() {
VikaTouch.popup(new InfoPopup(s, null));
return;
}
System.out.println(response);
step = 2;
JSONArray items = response.getJSONArray("items");
step = 3;
Expand Down Expand Up @@ -234,6 +230,9 @@ public void run() {

step = 6;
startPost = response.optString("next_from", null);
if(startPost.length() == 0) {
startPost = null;
}
if(VikaTouch.isNotS60())
uiItems.removeElementAt(uiItems.size()-1);
//listHeight = 0;
Expand Down Expand Up @@ -344,7 +343,7 @@ public void draw(Graphics g) {
}

listHeight = y + 50;
if(!VikaTouch.isNotS60()&&!loadingMore&&uiItems.size()>=5) {
if(!VikaTouch.isNotS60()&&!loadingMore&&uiItems.size()>0&&startPost != null) {
if (-scroll+(DisplayUtils.height+DisplayUtils.height/2)>=y+MenuScreen.bottomPanelH) {
loadingMore = true;
System.out.println("LOAD MORE");
Expand Down
4 changes: 2 additions & 2 deletions src/vikatouch/screens/music/MusicScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public void run() {
}
};
downloaderThread.start();
VikaTouch.needstoRedraw=true;

}


Expand Down Expand Up @@ -388,7 +388,7 @@ public void run() {
}
};
downloaderThread.start();
VikaTouch.needstoRedraw=true;

}


Expand Down
21 changes: 12 additions & 9 deletions src/vikatouch/screens/music/PlaylistsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void run() {
.addField("count", 100).addField("offset", 0).toString());
//VikaTouch.sendLog(x);
try {
//System.out.println(x);
System.out.println(x);
VikaTouch.loading = true;
JSONObject response = new JSONObject(x).getJSONObject("response");
JSONArray items = null;
Expand All @@ -70,19 +70,20 @@ public void run() {
itemsCount=6;
}
uiItems = new Vector(itemsCount);
uiItems.setElementAt(new PlaylistItem("Для вас", 100, id, -21, null, null), 0);
uiItems.setElementAt(new PlaylistItem("Плейлист дня 1", 100, id, -25, null, null), 1);
uiItems.setElementAt(new PlaylistItem("Плейлист дня 2", 100, id, -26, null, null), 2);
uiItems.setElementAt(new PlaylistItem("Плейлист дня 3", 100, id, -27, null, null), 3);
uiItems.setElementAt(new PlaylistItem("Плейлист недели", 100, id, -22, null, null), 4);
uiItems.setElementAt(new PlaylistItem("Плейлист месяца", 100, id, -23, null, null), 5);

uiItems.addElement(new PlaylistItem("Для вас", 100, id, -21, null, null));
uiItems.addElement(new PlaylistItem("Плейлист дня 1", 100, id, -25, null, null));
uiItems.addElement(new PlaylistItem("Плейлист дня 2", 100, id, -26, null, null));
uiItems.addElement(new PlaylistItem("Плейлист дня 3", 100, id, -27, null, null));
uiItems.addElement(new PlaylistItem("Плейлист недели", 100, id, -22, null, null));
uiItems.addElement(new PlaylistItem("Плейлист месяца", 100, id, -23, null, null));
VikaTouch.needstoRedraw=true;
repaint();
VikaTouch.needstoRedraw=true;
for (int i = 0; i < itemsCount-6; i++) {
JSONObject item = items.getJSONObject(i);
PlaylistItem pl = new PlaylistItem(item);
uiItems.setElementAt(pl, i+6);
uiItems.addElement(pl);
pl.parseJSON();
VikaTouch.needstoRedraw=true;
}
Expand All @@ -107,6 +108,7 @@ public void run() {
} catch (InterruptedException e) {
return;
} catch (Throwable e) {
e.printStackTrace();
VikaTouch.error(e, ErrorCodes.PLAYLISTSLOAD);
}
VikaTouch.loading = false;
Expand All @@ -126,7 +128,7 @@ public void draw(Graphics g) {
int y = topPanelH;
try {
if (uiItems != null) {
for (int i = 0; i < itemsCount; i++) {
for (int i = 0; i < uiItems.size(); i++) {
if (uiItems.elementAt(i) != null) {
((PressableUIItem) uiItems.elementAt(i)).paint(g, y, scroll);
y += ((PressableUIItem) uiItems.elementAt(i)).getDrawHeight();
Expand All @@ -135,6 +137,7 @@ public void draw(Graphics g) {
listHeight = y + 100;
}
} catch (Exception e) {
e.printStackTrace();
VikaTouch.error(e, ErrorCodes.DOCUMENTSITEMDRAW);
}
g.translate(0, -g.getTranslateY());
Expand Down

0 comments on commit 52c5e1c

Please sign in to comment.