Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #214 from lgallard/fix/left-menu-flickering
Browse files Browse the repository at this point in the history
Fix left menu flickering
  • Loading branch information
lgallard authored Jan 12, 2020
2 parents f6668dc + 11edf71 commit dc172f1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ android {
productFlavors {
pro {
applicationId 'com.lgallardo.qbittorrentclientpro'
versionName '4.8.2'
versionName '4.8.3'
minSdkVersion 14
targetSdkVersion 28
archivesBaseName = "qBittorrentController_v" + versionName
versionCode 4820
versionCode 4830
dimension "default"
}
free {
applicationId "com.lgallardo.qbittorrentclient"
versionName '4.8.2'
versionName '4.8.3'
minSdkVersion 14
targetSdkVersion 28
archivesBaseName = "qBittorrentController_v" + versionName
versionCode 4820
versionCode 4830
dimension "default"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ public void refreshDrawer() {
DrawerItemRecyclerViewAdapter.items.addAll(DrawerItemRecyclerViewAdapter.settingsItems);
DrawerItemRecyclerViewAdapter.items.addAll(DrawerItemRecyclerViewAdapter.categoryItems);

// Close servers
removeServerItems();

// Refresh
notifyDataSetChanged();

Expand Down
39 changes: 19 additions & 20 deletions app/src/main/java/com/lgallardo/qbittorrentclient/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
Expand Down Expand Up @@ -556,7 +557,6 @@ public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
// getSupportActionBar().setTitle(drawerTitle);
// setTitle(R.string.app_shortname);

}
};

Expand Down Expand Up @@ -2792,7 +2792,7 @@ private List getTorrentListV(final String state, final String category, final To
@Override
public void onResponse(JSONArray response) {

// Log.d("Debug: ", "[getTorrentListV] onResponse");
// Log.d("Debug: ", "[getTorrentListV] onResponse");

// Get list type to parse it
Type listType = new TypeToken<List<Torrent>>() {
Expand Down Expand Up @@ -3888,31 +3888,33 @@ public void onSuccess(List<Torrent> torrents) {
// category = getResources().getString(R.string.drawer_category_uncategorized);
// categoryItems.add(new DrawerItem(R.drawable.ic_drawer_subitem, category, DRAWER_CATEGORY, currentCategory.equals(category) || currentCategory.equals(""), "category"));

if (!drawerLayout.isDrawerOpen(GravityCompat.START)) {

getCategoryListV(new CategoriesListCallBack() {
@Override
public void onSuccess(List<Category> categories) {
Log.d("Debug", "[getCategoryListV] onSuccess");
getCategoryListV(new CategoriesListCallBack() {
@Override
public void onSuccess(List<Category> categories) {
Log.d("Debug", "[getCategoryListV] onSuccess");

String name, savePath;
String name, savePath;

for (int i = 0; i < categories.size(); i++) {
for (int i = 0; i < categories.size(); i++) {

name = categories.get(i).getName();
savePath = categories.get(i).getSavePath();
name = categories.get(i).getName();
savePath = categories.get(i).getSavePath();

// Log.d("Debug", "[getCategoryListV] Name: " + name);
// Log.d("Debug", "[getCategoryListV] Save Path: " + savePath);

// Add category name to the drawer menu
if (name != null && !name.equals("")) {
categoryItems.add(new DrawerItem(R.drawable.ic_drawer_subitem, name, DRAWER_CATEGORY, currentCategory.equals(name), "category"));
// Add category name to the drawer menu
if (name != null && !name.equals("")) {
categoryItems.add(new DrawerItem(R.drawable.ic_drawer_subitem, name, DRAWER_CATEGORY, currentCategory.equals(name), "category"));
}
}
}

rAdapter.refreshDrawerCategories(categoryItems);
}
});
rAdapter.refreshDrawerCategories(categoryItems);
}
});
}

// Sort by filename
if (sortby_value == SORTBY_NAME) {
Expand Down Expand Up @@ -4286,9 +4288,6 @@ public void onSuccess(List<Category> categories) {
item.setName(name);
actionItems.set(6, item);

// Refresh drawer
rAdapter.refreshDrawer();

// Send report
emailReport();

Expand Down

0 comments on commit dc172f1

Please sign in to comment.