Skip to content

Commit b5badb5

Browse files
committed
Build 32
1 parent 8ed1c4c commit b5badb5

9 files changed

Lines changed: 45 additions & 23 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "uk.openvk.android.refresh"
1111
minSdk 21
1212
targetSdk 33
13-
versionCode 31
14-
versionName "0.9.31.alpha"
13+
versionCode 32
14+
versionName "0.9.32.alpha"
1515
}
1616

1717
buildTypes {

app/src/main/java/uk/openvk/android/refresh/OvkApplication.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import android.content.res.Configuration;
77
import android.os.Build;
88
import android.preference.PreferenceManager;
9+
import android.util.Log;
910

1011
import androidx.appcompat.app.AppCompatDelegate;
1112

@@ -41,7 +42,8 @@ public void onCreate() {
4142
Configuration.SCREENLAYOUT_SIZE_MASK) == 4);
4243
boolean large = ((getResources().getConfiguration().screenLayout &
4344
Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
44-
if(xlarge || large) {
45+
int swdp = (int)(getResources().getConfiguration().smallestScreenWidthDp);
46+
if((xlarge || large) && swdp >= 600) {
4547
isTablet = true;
4648
}
4749
}

app/src/main/java/uk/openvk/android/refresh/api/Wall.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void parse(Context ctx, DownloadManager downloadManager, String quality,
9696
String author_avatar_url = "";
9797
String content = post.getString("text");
9898
boolean isLiked = false;
99-
boolean verified_author;
99+
boolean verified_author = false;
100100
if(likes.getInt("user_likes") > 0) {
101101
isLiked = true;
102102
} else {
@@ -173,11 +173,7 @@ public void parse(Context ctx, DownloadManager downloadManager, String quality,
173173
if (-group.getInt("id") == owner_id) {
174174
owner_name = group.getString("name");
175175
avatar_url = group.getString("photo_50");
176-
if (group.getBoolean("verified")) {
177-
verified_author = true;
178-
} else {
179-
verified_author = false;
180-
}
176+
verified_author = group.getBoolean("verified");
181177
}
182178
}
183179
}
@@ -196,11 +192,7 @@ public void parse(Context ctx, DownloadManager downloadManager, String quality,
196192
if (-group.getInt("id") == author_id) {
197193
item.name = group.getString("name");
198194
avatar_url = group.getString("photo_50");
199-
if (group.getBoolean("verified")) {
200-
verified_author = true;
201-
} else {
202-
verified_author = false;
203-
}
195+
verified_author = group.getBoolean("verified");
204196
}
205197
}
206198
}
@@ -209,6 +201,7 @@ public void parse(Context ctx, DownloadManager downloadManager, String quality,
209201
avatar.url = avatar_url;
210202
avatar.filename = String.format("avatar_%s", author_id);
211203
avatars.add(avatar);
204+
item.verified_author = verified_author;
212205
this.items.add(item);
213206
}
214207
switch (quality) {

app/src/main/java/uk/openvk/android/refresh/ui/core/activities/AppActivity.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ public void onNothingSelected(AdapterView<?> parent) {
296296

297297
}
298298
} else {
299-
drawer.open();
299+
try {
300+
drawer.open();
301+
} catch (Exception ignored) {
302+
303+
}
300304
}
301305
}
302306
});
@@ -1201,6 +1205,9 @@ public void recreate() {
12011205
public void onConfigurationChanged(@NonNull Configuration newConfig) {
12021206
super.onConfigurationChanged(newConfig);
12031207
screenOrientation = newConfig.orientation;
1208+
if(getResources().getConfiguration().smallestScreenWidthDp != newConfig.smallestScreenWidthDp) {
1209+
restart();
1210+
}
12041211
}
12051212

12061213
@Override

app/src/main/java/uk/openvk/android/refresh/ui/core/fragments/app/GroupsFragment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ public void createAdapter(Context ctx, ArrayList<Group> groups, String where) {
102102
groupsAdapter = new GroupsAdapter(getContext(), this.groups);
103103
llm = new LinearLayoutManager(ctx);
104104
llm.setOrientation(LinearLayoutManager.VERTICAL);
105-
if(OvkApplication.isTablet) {
105+
if(OvkApplication.isTablet && getResources().getConfiguration().smallestScreenWidthDp >= 760) {
106+
glm = new GridLayoutManager(getContext(), 3);
107+
groupsView.setLayoutManager(glm);
108+
} else if(OvkApplication.isTablet) {
106109
glm = new GridLayoutManager(getContext(), 2);
107110
groupsView.setLayoutManager(glm);
108111
} else {

app/src/main/java/uk/openvk/android/refresh/ui/core/fragments/app/NewsfeedFragment.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ public View onCreateView(@NonNull LayoutInflater inflater,
5252
view = inflater.inflate(R.layout.fragment_newsfeed, container, false);
5353
global_prefs = PreferenceManager.getDefaultSharedPreferences(requireContext());
5454
((SwipeRefreshLayout) view.findViewById(R.id.newsfeed_swipe_layout)).setVisibility(View.GONE);
55-
if(OvkApplication.isTablet) {
56-
view.findViewById(R.id.newsfeed_layout).setVisibility(View.GONE);
55+
try {
56+
if (OvkApplication.isTablet) {
57+
view.findViewById(R.id.newsfeed_layout).setVisibility(View.GONE);
58+
}
59+
} catch (Exception ignored) {
60+
5761
}
5862
setTheme();
5963
((SwipeRefreshLayout) view.findViewById(R.id.newsfeed_swipe_layout))

app/src/main/java/uk/openvk/android/refresh/ui/core/fragments/app/friends/FriendRequestsFragment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ public void createRequestsAdapter(Fragment fragment, Context ctx, ArrayList<Frie
6767
if(requestsAdapter == null) {
6868
llm = new LinearLayoutManager(getContext());
6969
llm.setOrientation(LinearLayoutManager.VERTICAL);
70-
if(OvkApplication.isTablet) {
70+
if(OvkApplication.isTablet && getResources().getConfiguration().smallestScreenWidthDp >= 760) {
71+
glm = new GridLayoutManager(getContext(), 3);
72+
requests_rv.setLayoutManager(glm);
73+
} else if(OvkApplication.isTablet) {
7174
glm = new GridLayoutManager(getContext(), 2);
7275
requests_rv.setLayoutManager(glm);
7376
} else {

app/src/main/java/uk/openvk/android/refresh/ui/core/fragments/app/friends/FriendsListFragment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ public void createFriendsAdapter(Context ctx, ArrayList<Friend> items) {
6363
if(friendsAdapter == null) {
6464
llm = new LinearLayoutManager(getContext());
6565
llm.setOrientation(LinearLayoutManager.VERTICAL);
66-
if(OvkApplication.isTablet) {
66+
if(OvkApplication.isTablet && getResources().getConfiguration().smallestScreenWidthDp >= 760) {
67+
glm = new GridLayoutManager(getContext(), 3);
68+
friends_rv.setLayoutManager(glm);
69+
} else if(OvkApplication.isTablet) {
6770
glm = new GridLayoutManager(getContext(), 2);
6871
friends_rv.setLayoutManager(glm);
6972
} else {

app/src/main/java/uk/openvk/android/refresh/ui/core/fragments/app/pub_pages/AboutFragment.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
import androidx.annotation.NonNull;
1313
import androidx.annotation.Nullable;
1414
import androidx.fragment.app.Fragment;
15+
import androidx.recyclerview.widget.GridLayoutManager;
1516
import androidx.recyclerview.widget.LinearLayoutManager;
1617
import androidx.recyclerview.widget.RecyclerView;
1718

1819
import java.util.ArrayList;
1920

21+
import uk.openvk.android.refresh.OvkApplication;
2022
import uk.openvk.android.refresh.R;
2123
import uk.openvk.android.refresh.ui.core.fragments.app.friends.FriendRequestsFragment;
2224
import uk.openvk.android.refresh.ui.list.adapters.PublicPageAboutAdapter;
@@ -59,9 +61,14 @@ public void createAboutAdapter(Context ctx, ArrayList<PublicPageAboutItem> items
5961
this.ctx = ctx;
6062
this.aboutItems = items;
6163
if(aboutAdapter == null) {
62-
llm = new LinearLayoutManager(getContext());
63-
llm.setOrientation(LinearLayoutManager.VERTICAL);
64-
about_rv.setLayoutManager(llm);
64+
if(OvkApplication.isTablet && getResources().getConfiguration().smallestScreenWidthDp >= 760) {
65+
GridLayoutManager glm = new GridLayoutManager(getContext(), 2);
66+
about_rv.setLayoutManager(glm);
67+
} else {
68+
llm = new LinearLayoutManager(getContext());
69+
llm.setOrientation(LinearLayoutManager.VERTICAL);
70+
about_rv.setLayoutManager(llm);
71+
}
6572
aboutAdapter = new PublicPageAboutAdapter(ctx, this.aboutItems);
6673
about_rv.setAdapter(aboutAdapter);
6774
} else {

0 commit comments

Comments
 (0)