Skip to content

Commit

Permalink
Add icons
Browse files Browse the repository at this point in the history
  • Loading branch information
CatotheCat11 committed Dec 23, 2024
1 parent 95ad5f3 commit cc04caf
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/cato/glasssky/PostActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void createCards() {
mCards.add(new CardBuilder(this, CardBuilder.Layout.MENU)
.setText("Add a video")
.setFootnote("Takes a video with the camera")
.setIcon(R.drawable.add_a_photo_64));
.setIcon(R.drawable.videocam_64));
mCards.add(new CardBuilder(this, CardBuilder.Layout.MENU)
.setText("Post")
.setIcon(R.drawable.post_add_64));
Expand Down
50 changes: 34 additions & 16 deletions app/src/main/java/com/cato/glasssky/Timeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,29 +349,39 @@ public void onImageLoaded(Bitmap bitmap) {
String postsCount = Author.getString("postsCount");
if (Author.getJSONObject("viewer").has("blocking")) {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Unblock"));
.setText("Unblock")
.setIcon(R.drawable.block_64));
blocked = true;
} else {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Block"));
.setText("Block")
.setIcon(R.drawable.block_64));
blocked = false;
}
if (Author.getJSONObject("viewer").getBoolean("muted")) {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Unmute"));
.setText("Unmute")
.setIcon(R.drawable.voice_over_off_64));
muted = true;
} else {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Mute"));
.setText("Mute")
.setIcon(R.drawable.voice_over_off_64));
muted = false;
}
if (Author.getJSONObject("viewer").has("following")) {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Unfollow"));
.setText("Unfollow")
.setIcon(R.drawable.person_add_64));
following = true;
} else {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Follow"));
CardBuilder followCard = new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Follow")
.setIcon(R.drawable.person_add_64);
if (blocked = true) {
followCard.setFootnote("You must unblock this user to follow them.");
}
mCards.add(followCard);
following = false;
}
authorCard
Expand All @@ -381,8 +391,10 @@ public void onImageLoaded(Bitmap bitmap) {
.setSubheading(handle)
.setFootnote(round(followersCount) + " followers, " + round(followsCount) + " following, " + round(postsCount) + " posts");
mCards.add(authorCard);
mAdapter.notifyDataSetChanged();
mCardScrollView.setSelection(extraCards - 1);
runOnUiThread(() -> {
mAdapter.notifyDataSetChanged();
mCardScrollView.setSelection(extraCards - 1);
});
HttpsUtils.makePostRequest("https://bsky.social/xrpc/app.bsky.feed.getAuthorFeed?actor=" + uri + "&filter=posts_and_author_threads&limit=" + limit, null, access_token, "GET",
new HttpsUtils.HttpCallback() {

Expand Down Expand Up @@ -425,29 +437,35 @@ public void onError(String errorMessage) {
String postsCount = Author.getString("postsCount");
if (Author.getJSONObject("viewer").has("blocking")) {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Unblock"));
.setText("Unblock")
.setIcon(R.drawable.block_64));
blocked = true;
} else {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Block"));
.setText("Block")
.setIcon(R.drawable.block_64));
blocked = false;
}
if (Author.getJSONObject("viewer").has("muted")) {
if (Author.getJSONObject("viewer").getBoolean("muted")) {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Unmute"));
.setText("Unmute")
.setIcon(R.drawable.voice_over_off_64));
muted = true;
} else {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Mute"));
.setText("Mute")
.setIcon(R.drawable.voice_over_off_64));
muted = false;
}
if (Author.getJSONObject("viewer").has("following")) {
mCards.add(new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Unfollow"));
.setText("Unfollow")
.setIcon(R.drawable.person_add_64));
following = true;
} else {
CardBuilder followCard = new CardBuilder(Timeline.this, CardBuilder.Layout.MENU)
.setText("Follow");
.setText("Follow")
.setIcon(R.drawable.person_add_64);
if (blocked = true) {
followCard.setFootnote("You must unblock this user to follow them.");
}
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/block_64.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="64dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="64dp">

<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM4,12c0,-4.42 3.58,-8 8,-8 1.85,0 3.55,0.63 4.9,1.69L5.69,16.9C4.63,15.55 4,13.85 4,12zM12,20c-1.85,0 -3.55,-0.63 -4.9,-1.69L18.31,7.1C19.37,8.45 20,10.15 20,12c0,4.42 -3.58,8 -8,8z"/>

</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/person_add_64.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="64dp" android:viewportHeight="24" android:viewportWidth="24" android:width="64dp">

<path android:fillColor="#FFFFFF" android:pathData="M15,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM6,10L6,7L4,7v3L1,10v2h3v3h2v-3h3v-2L6,10zM15,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>

</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/videocam_64.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="64dp" android:viewportHeight="24" android:viewportWidth="24" android:width="64dp">

<path android:fillColor="#FFFFFF" android:pathData="M17,10.5V7c0,-0.55 -0.45,-1 -1,-1H4c-0.55,0 -1,0.45 -1,1v10c0,0.55 0.45,1 1,1h12c0.55,0 1,-0.45 1,-1v-3.5l4,4v-11l-4,4z"/>

</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/voice_over_off_64.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="64dp" android:viewportHeight="24" android:viewportWidth="24" android:width="64dp">

<path android:fillColor="#FFFFFF" android:pathData="M12.99,9.18c0,-0.06 0.01,-0.12 0.01,-0.18 0,-2.21 -1.79,-4 -4,-4 -0.06,0 -0.12,0.01 -0.18,0.01l4.17,4.17zM6.89,5.62L4.27,3 3,4.27l2.62,2.62C5.23,7.5 5,8.22 5,9c0,2.21 1.79,4 4,4 0.78,0 1.5,-0.23 2.11,-0.62L19.73,21 21,19.73l-8.62,-8.62 -5.49,-5.49zM9,15c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4zM16.76,5.36l-1.68,1.69c0.84,1.18 0.84,2.71 0,3.89l1.68,1.69c2.02,-2.02 2.02,-5.07 0,-7.27zM20.07,2l-1.63,1.63c2.77,3.02 2.77,7.56 0,10.74L20.07,16c3.9,-3.89 3.91,-9.95 0,-14z"/>

</vector>

0 comments on commit cc04caf

Please sign in to comment.