Skip to content

Commit

Permalink
Build 32
Browse files Browse the repository at this point in the history
  • Loading branch information
tretdm committed May 5, 2023
1 parent 8ed1c4c commit b5badb5
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 23 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "uk.openvk.android.refresh"
minSdk 21
targetSdk 33
versionCode 31
versionName "0.9.31.alpha"
versionCode 32
versionName "0.9.32.alpha"
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.content.res.Configuration;
import android.os.Build;
import android.preference.PreferenceManager;
import android.util.Log;

import androidx.appcompat.app.AppCompatDelegate;

Expand Down Expand Up @@ -41,7 +42,8 @@ public void onCreate() {
Configuration.SCREENLAYOUT_SIZE_MASK) == 4);
boolean large = ((getResources().getConfiguration().screenLayout &
Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE);
if(xlarge || large) {
int swdp = (int)(getResources().getConfiguration().smallestScreenWidthDp);
if((xlarge || large) && swdp >= 600) {
isTablet = true;
}
}
Expand Down
15 changes: 4 additions & 11 deletions app/src/main/java/uk/openvk/android/refresh/api/Wall.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void parse(Context ctx, DownloadManager downloadManager, String quality,
String author_avatar_url = "";
String content = post.getString("text");
boolean isLiked = false;
boolean verified_author;
boolean verified_author = false;
if(likes.getInt("user_likes") > 0) {
isLiked = true;
} else {
Expand Down Expand Up @@ -173,11 +173,7 @@ public void parse(Context ctx, DownloadManager downloadManager, String quality,
if (-group.getInt("id") == owner_id) {
owner_name = group.getString("name");
avatar_url = group.getString("photo_50");
if (group.getBoolean("verified")) {
verified_author = true;
} else {
verified_author = false;
}
verified_author = group.getBoolean("verified");
}
}
}
Expand All @@ -196,11 +192,7 @@ public void parse(Context ctx, DownloadManager downloadManager, String quality,
if (-group.getInt("id") == author_id) {
item.name = group.getString("name");
avatar_url = group.getString("photo_50");
if (group.getBoolean("verified")) {
verified_author = true;
} else {
verified_author = false;
}
verified_author = group.getBoolean("verified");
}
}
}
Expand All @@ -209,6 +201,7 @@ public void parse(Context ctx, DownloadManager downloadManager, String quality,
avatar.url = avatar_url;
avatar.filename = String.format("avatar_%s", author_id);
avatars.add(avatar);
item.verified_author = verified_author;
this.items.add(item);
}
switch (quality) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ public void onNothingSelected(AdapterView<?> parent) {

}
} else {
drawer.open();
try {
drawer.open();
} catch (Exception ignored) {

}
}
}
});
Expand Down Expand Up @@ -1201,6 +1205,9 @@ public void recreate() {
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
screenOrientation = newConfig.orientation;
if(getResources().getConfiguration().smallestScreenWidthDp != newConfig.smallestScreenWidthDp) {
restart();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ public void createAdapter(Context ctx, ArrayList<Group> groups, String where) {
groupsAdapter = new GroupsAdapter(getContext(), this.groups);
llm = new LinearLayoutManager(ctx);
llm.setOrientation(LinearLayoutManager.VERTICAL);
if(OvkApplication.isTablet) {
if(OvkApplication.isTablet && getResources().getConfiguration().smallestScreenWidthDp >= 760) {
glm = new GridLayoutManager(getContext(), 3);
groupsView.setLayoutManager(glm);
} else if(OvkApplication.isTablet) {
glm = new GridLayoutManager(getContext(), 2);
groupsView.setLayoutManager(glm);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ public View onCreateView(@NonNull LayoutInflater inflater,
view = inflater.inflate(R.layout.fragment_newsfeed, container, false);
global_prefs = PreferenceManager.getDefaultSharedPreferences(requireContext());
((SwipeRefreshLayout) view.findViewById(R.id.newsfeed_swipe_layout)).setVisibility(View.GONE);
if(OvkApplication.isTablet) {
view.findViewById(R.id.newsfeed_layout).setVisibility(View.GONE);
try {
if (OvkApplication.isTablet) {
view.findViewById(R.id.newsfeed_layout).setVisibility(View.GONE);
}
} catch (Exception ignored) {

}
setTheme();
((SwipeRefreshLayout) view.findViewById(R.id.newsfeed_swipe_layout))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ public void createRequestsAdapter(Fragment fragment, Context ctx, ArrayList<Frie
if(requestsAdapter == null) {
llm = new LinearLayoutManager(getContext());
llm.setOrientation(LinearLayoutManager.VERTICAL);
if(OvkApplication.isTablet) {
if(OvkApplication.isTablet && getResources().getConfiguration().smallestScreenWidthDp >= 760) {
glm = new GridLayoutManager(getContext(), 3);
requests_rv.setLayoutManager(glm);
} else if(OvkApplication.isTablet) {
glm = new GridLayoutManager(getContext(), 2);
requests_rv.setLayoutManager(glm);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ public void createFriendsAdapter(Context ctx, ArrayList<Friend> items) {
if(friendsAdapter == null) {
llm = new LinearLayoutManager(getContext());
llm.setOrientation(LinearLayoutManager.VERTICAL);
if(OvkApplication.isTablet) {
if(OvkApplication.isTablet && getResources().getConfiguration().smallestScreenWidthDp >= 760) {
glm = new GridLayoutManager(getContext(), 3);
friends_rv.setLayoutManager(glm);
} else if(OvkApplication.isTablet) {
glm = new GridLayoutManager(getContext(), 2);
friends_rv.setLayoutManager(glm);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;

import uk.openvk.android.refresh.OvkApplication;
import uk.openvk.android.refresh.R;
import uk.openvk.android.refresh.ui.core.fragments.app.friends.FriendRequestsFragment;
import uk.openvk.android.refresh.ui.list.adapters.PublicPageAboutAdapter;
Expand Down Expand Up @@ -59,9 +61,14 @@ public void createAboutAdapter(Context ctx, ArrayList<PublicPageAboutItem> items
this.ctx = ctx;
this.aboutItems = items;
if(aboutAdapter == null) {
llm = new LinearLayoutManager(getContext());
llm.setOrientation(LinearLayoutManager.VERTICAL);
about_rv.setLayoutManager(llm);
if(OvkApplication.isTablet && getResources().getConfiguration().smallestScreenWidthDp >= 760) {
GridLayoutManager glm = new GridLayoutManager(getContext(), 2);
about_rv.setLayoutManager(glm);
} else {
llm = new LinearLayoutManager(getContext());
llm.setOrientation(LinearLayoutManager.VERTICAL);
about_rv.setLayoutManager(llm);
}
aboutAdapter = new PublicPageAboutAdapter(ctx, this.aboutItems);
about_rv.setAdapter(aboutAdapter);
} else {
Expand Down

0 comments on commit b5badb5

Please sign in to comment.