Commit 866a7276 authored by Hans-Christoph Steiner's avatar Hans-Christoph Steiner

Merge branch 'bugfixes' into 'master'

a few bug fixes

Closes #1737, #1782, and #1769

See merge request !824
parents 8d60f40e c5a64452
Pipeline #62194455 passed with stages
in 36 minutes and 59 seconds
......@@ -7,7 +7,7 @@
app:showAsAction="ifRoom|withText"
android:id="@+id/whats_new" />
<item
android:title="@string/updates"
android:title="@string/main_menu__updates"
android:icon="@drawable/ic_updates"
app:showAsAction="ifRoom|withText"
android:id="@+id/updates" />
......
......@@ -17,7 +17,7 @@
app:showAsAction="ifRoom|withText"
android:id="@+id/nearby" />
<item
android:title="@string/updates"
android:title="@string/main_menu__updates"
android:icon="@drawable/ic_updates"
app:showAsAction="ifRoom|withText"
android:id="@+id/updates" />
......
......@@ -343,14 +343,21 @@ public class FDroidApp extends Application {
public void onTrimMemory(int level) {
super.onTrimMemory(level);
if (level >= TRIM_MEMORY_BACKGROUND) {
ImageLoader.getInstance().clearMemoryCache();
clearImageLoaderMemoryCache();
}
}
@Override
public void onLowMemory() {
super.onLowMemory();
ImageLoader.getInstance().clearMemoryCache();
clearImageLoaderMemoryCache();
}
private void clearImageLoaderMemoryCache() {
ImageLoader imageLoader = ImageLoader.getInstance();
if (imageLoader.isInited()) {
imageLoader.clearMemoryCache();
}
}
@Override
......
......@@ -147,9 +147,9 @@ public class HttpDownloader extends Downloader {
} else {
String calcedETag = String.format("\"%x-%x\"",
tmpConn.getLastModified() / 1000, contentLength);
if (calcedETag.equals(headETag)) {
if (cacheTag.equals(calcedETag)) {
Utils.debugLog(TAG, urlString + " cached based on calced ETag, not downloading: " +
headETag);
calcedETag);
return;
}
}
......
package org.fdroid.fdroid.views.updates;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
......@@ -8,8 +13,8 @@ import android.support.v7.widget.helper.ItemTouchHelper;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.UpdateService;
import org.fdroid.fdroid.Utils;
......@@ -20,8 +25,11 @@ public class UpdatesViewBinder {
private final RecyclerView list;
private final TextView emptyState;
private final ImageView emptyImage;
private final ProgressBar emptyUpdatingProgress;
private final AppCompatActivity activity;
public UpdatesViewBinder(final AppCompatActivity activity, FrameLayout parent) {
this.activity = activity;
View view = activity.getLayoutInflater().inflate(R.layout.main_tab_updates, parent, true);
adapter = new UpdatesAdapter(activity);
......@@ -37,6 +45,7 @@ public class UpdatesViewBinder {
emptyState = (TextView) view.findViewById(R.id.empty_state);
emptyImage = (ImageView) view.findViewById(R.id.image);
emptyUpdatingProgress = view.findViewById(R.id.empty_updating_progress);
final SwipeRefreshLayout swipeToRefresh = (SwipeRefreshLayout) view.findViewById(R.id.swipe_to_refresh);
Utils.applySwipeLayoutColors(swipeToRefresh);
......@@ -61,12 +70,16 @@ public class UpdatesViewBinder {
private void updateEmptyState() {
if (adapter.getItemCount() == 0) {
list.setVisibility(View.GONE);
emptyState.setVisibility(View.VISIBLE);
emptyImage.setVisibility(View.VISIBLE);
setUpEmptyUpdatingProgress(UpdateService.isUpdating());
LocalBroadcastManager.getInstance(activity).registerReceiver(updateServiceStatusReceiver,
new IntentFilter(UpdateService.LOCAL_ACTION_STATUS));
} else {
list.setVisibility(View.VISIBLE);
emptyState.setVisibility(View.GONE);
emptyImage.setVisibility(View.GONE);
LocalBroadcastManager.getInstance(activity).unregisterReceiver(updateServiceStatusReceiver);
emptyUpdatingProgress.setVisibility(View.GONE);
}
}
......@@ -87,4 +100,23 @@ public class UpdatesViewBinder {
updateEmptyState();
}
};
private final BroadcastReceiver updateServiceStatusReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Anything other than a STATUS_INFO broadcast signifies that it was complete
boolean isUpdating = intent.getIntExtra(UpdateService.EXTRA_STATUS_CODE, 0) == UpdateService.STATUS_INFO;
setUpEmptyUpdatingProgress(isUpdating);
}
};
private void setUpEmptyUpdatingProgress(boolean isUpdating) {
if (isUpdating) {
emptyState.setVisibility(View.GONE);
emptyUpdatingProgress.setVisibility(View.VISIBLE);
} else {
emptyState.setVisibility(View.VISIBLE);
emptyUpdatingProgress.setVisibility(View.GONE);
}
}
}
......@@ -36,6 +36,15 @@
android:visibility="gone"
android:text="@string/empty_can_update_app_list" />
<ProgressBar
android:id="@+id/empty_updating_progress"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/banner_updating_repos"
android:visibility="gone"/>
<ImageView
android:id="@+id/image"
android:layout_width="0dp"
......
......@@ -294,7 +294,7 @@
<string name="clear_search">Suche löschen</string>
<string name="main_menu__latest_apps">Neueste</string>
<string name="main_menu__categories">Kategorien</string>
<string name="main_menu__updates">Aktualisierungen</string>
<string name="main_menu__updates">Aufgaben</string>
<string name="main_menu__swap_nearby">Direkt</string>
<string name="app_recommended_version_installed">Version %1$s (Empfohlen)</string>
<string name="app_new">Neu</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment