Skip to content

Commit 69016a9

Browse files
committed
simplify indexing a little
1 parent 59bd875 commit 69016a9

4 files changed

Lines changed: 8 additions & 17 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ Pull requests with translations are welcome. See [Russian translation](app/src/m
6060

6161

6262
## Screenshots
63-
<img src="android-contacts.png" alt="App screenshot - contacts" width="270" /> <img src="android-chat.png" alt="App screenshot - chat" width="270" /> <img src="android-topic-info.png" alt="App screenshot - chat settings" width="270" />
63+
<img src="android-contacts.png" alt="App screenshot - chat list" width="270" /> <img src="android-chat.png" alt="App screenshot - chat" width="270" /> <img src="android-topic-info.png" alt="App screenshot - chat settings" width="270" />
6464
<img src="android-account.png" alt="App screenshot - account info" width="270" /> <img src="android-find-people.png" alt="App screenshot - searching for contacts" width="270" /> <img src="android-new-topic.png" alt="App screenshot - creating new topic" width="270" />

app/src/main/java/co/tinode/tindroid/ChatsAdapter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ public boolean isIncluded(Topic t) {
7474
});
7575

7676
final HashMap<String,Integer> newTopicIndex = new HashMap<>(newTopics.size());
77-
int i = 0;
7877
for (Topic t : newTopics) {
79-
newTopicIndex.put(t.getName(), i);
80-
i++;
78+
newTopicIndex.put(t.getName(), newTopicIndex.size());
8179
}
8280

8381
activity.runOnUiThread(new Runnable() {

app/src/main/java/co/tinode/tindroid/widgets/CircleImageView.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,20 @@
2929
import android.view.animation.Animation;
3030

3131
import androidx.appcompat.widget.AppCompatImageView;
32-
import androidx.core.content.ContextCompat;
3332
import androidx.core.view.ViewCompat;
3433

3534
/**
3635
* This ImageView is used to display circular progress indicator. It matches the one in SwipeRefreshLayout.
3736
*
38-
* Copied from android/9.0.0/androidx/swiperefreshlayout/widget/circleimageview.java
37+
* Adopted from android/9.0.0/androidx/swiperefreshlayout/widget/circleimageview.java
3938
*/
4039
public class CircleImageView extends AppCompatImageView {
4140

4241
private static final int CIRCLE_BG_LIGHT = 0xFFFAFAFA;
4342

43+
// Default offset in dips from the top of the view to where the progress spinner should appear.
44+
private static final int DEFAULT_CIRCLE_TARGET = 64;
45+
4446
private static final int KEY_SHADOW_COLOR = 0x1E000000;
4547
private static final int FILL_SHADOW_COLOR = 0x3D000000;
4648
// PX
@@ -115,15 +117,6 @@ public void onAnimationEnd() {
115117
}
116118
}
117119

118-
/**
119-
* Update the background color of the circle image view.
120-
*
121-
* @param colorRes Id of a color resource.
122-
*/
123-
public void setBackgroundColorRes(int colorRes) {
124-
setBackgroundColor(ContextCompat.getColor(getContext(), colorRes));
125-
}
126-
127120
@Override
128121
public void setBackgroundColor(int color) {
129122
if (getBackground() instanceof ShapeDrawable) {

tinodesdk/src/main/java/co/tinode/tinodesdk/Tinode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ public <T extends Topic> List<T> getFilteredTopics(TopicFilter filter) {
15041504
}
15051505

15061506
/**
1507-
* Start tracking topic.
1507+
* Start tracking topic: add it to in-memory cache.
15081508
*/
15091509
void startTrackingTopic(final Topic topic) {
15101510
final String name = topic.getName();
@@ -1516,7 +1516,7 @@ void startTrackingTopic(final Topic topic) {
15161516
}
15171517

15181518
/**
1519-
* Stop tracking the topic, delete it from local storage.
1519+
* Stop tracking the topic: remove it from in-memory cache.
15201520
*/
15211521
void stopTrackingTopic(String topicName) {
15221522
mTopics.remove(topicName);

0 commit comments

Comments
 (0)