Merge branch 'bugfixes' into 'master'
a few bug fixes Closes #1737, #1782, and #1769 See merge request fdroid/fdroidclient!824
This commit is contained in:
commit
866a7276a4
@ -7,7 +7,7 @@
|
|||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:id="@+id/whats_new" />
|
android:id="@+id/whats_new" />
|
||||||
<item
|
<item
|
||||||
android:title="@string/updates"
|
android:title="@string/main_menu__updates"
|
||||||
android:icon="@drawable/ic_updates"
|
android:icon="@drawable/ic_updates"
|
||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:id="@+id/updates" />
|
android:id="@+id/updates" />
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:id="@+id/nearby" />
|
android:id="@+id/nearby" />
|
||||||
<item
|
<item
|
||||||
android:title="@string/updates"
|
android:title="@string/main_menu__updates"
|
||||||
android:icon="@drawable/ic_updates"
|
android:icon="@drawable/ic_updates"
|
||||||
app:showAsAction="ifRoom|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:id="@+id/updates" />
|
android:id="@+id/updates" />
|
||||||
|
@ -343,14 +343,21 @@ public class FDroidApp extends Application {
|
|||||||
public void onTrimMemory(int level) {
|
public void onTrimMemory(int level) {
|
||||||
super.onTrimMemory(level);
|
super.onTrimMemory(level);
|
||||||
if (level >= TRIM_MEMORY_BACKGROUND) {
|
if (level >= TRIM_MEMORY_BACKGROUND) {
|
||||||
ImageLoader.getInstance().clearMemoryCache();
|
clearImageLoaderMemoryCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLowMemory() {
|
public void onLowMemory() {
|
||||||
super.onLowMemory();
|
super.onLowMemory();
|
||||||
ImageLoader.getInstance().clearMemoryCache();
|
clearImageLoaderMemoryCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearImageLoaderMemoryCache() {
|
||||||
|
ImageLoader imageLoader = ImageLoader.getInstance();
|
||||||
|
if (imageLoader.isInited()) {
|
||||||
|
imageLoader.clearMemoryCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -147,9 +147,9 @@ public class HttpDownloader extends Downloader {
|
|||||||
} else {
|
} else {
|
||||||
String calcedETag = String.format("\"%x-%x\"",
|
String calcedETag = String.format("\"%x-%x\"",
|
||||||
tmpConn.getLastModified() / 1000, contentLength);
|
tmpConn.getLastModified() / 1000, contentLength);
|
||||||
if (calcedETag.equals(headETag)) {
|
if (cacheTag.equals(calcedETag)) {
|
||||||
Utils.debugLog(TAG, urlString + " cached based on calced ETag, not downloading: " +
|
Utils.debugLog(TAG, urlString + " cached based on calced ETag, not downloading: " +
|
||||||
headETag);
|
calcedETag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package org.fdroid.fdroid.views.updates;
|
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.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
@ -8,8 +13,8 @@ import android.support.v7.widget.helper.ItemTouchHelper;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.UpdateService;
|
import org.fdroid.fdroid.UpdateService;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
@ -20,8 +25,11 @@ public class UpdatesViewBinder {
|
|||||||
private final RecyclerView list;
|
private final RecyclerView list;
|
||||||
private final TextView emptyState;
|
private final TextView emptyState;
|
||||||
private final ImageView emptyImage;
|
private final ImageView emptyImage;
|
||||||
|
private final ProgressBar emptyUpdatingProgress;
|
||||||
|
private final AppCompatActivity activity;
|
||||||
|
|
||||||
public UpdatesViewBinder(final AppCompatActivity activity, FrameLayout parent) {
|
public UpdatesViewBinder(final AppCompatActivity activity, FrameLayout parent) {
|
||||||
|
this.activity = activity;
|
||||||
View view = activity.getLayoutInflater().inflate(R.layout.main_tab_updates, parent, true);
|
View view = activity.getLayoutInflater().inflate(R.layout.main_tab_updates, parent, true);
|
||||||
|
|
||||||
adapter = new UpdatesAdapter(activity);
|
adapter = new UpdatesAdapter(activity);
|
||||||
@ -37,6 +45,7 @@ public class UpdatesViewBinder {
|
|||||||
|
|
||||||
emptyState = (TextView) view.findViewById(R.id.empty_state);
|
emptyState = (TextView) view.findViewById(R.id.empty_state);
|
||||||
emptyImage = (ImageView) view.findViewById(R.id.image);
|
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);
|
final SwipeRefreshLayout swipeToRefresh = (SwipeRefreshLayout) view.findViewById(R.id.swipe_to_refresh);
|
||||||
Utils.applySwipeLayoutColors(swipeToRefresh);
|
Utils.applySwipeLayoutColors(swipeToRefresh);
|
||||||
@ -61,12 +70,16 @@ public class UpdatesViewBinder {
|
|||||||
private void updateEmptyState() {
|
private void updateEmptyState() {
|
||||||
if (adapter.getItemCount() == 0) {
|
if (adapter.getItemCount() == 0) {
|
||||||
list.setVisibility(View.GONE);
|
list.setVisibility(View.GONE);
|
||||||
emptyState.setVisibility(View.VISIBLE);
|
|
||||||
emptyImage.setVisibility(View.VISIBLE);
|
emptyImage.setVisibility(View.VISIBLE);
|
||||||
|
setUpEmptyUpdatingProgress(UpdateService.isUpdating());
|
||||||
|
LocalBroadcastManager.getInstance(activity).registerReceiver(updateServiceStatusReceiver,
|
||||||
|
new IntentFilter(UpdateService.LOCAL_ACTION_STATUS));
|
||||||
} else {
|
} else {
|
||||||
list.setVisibility(View.VISIBLE);
|
list.setVisibility(View.VISIBLE);
|
||||||
emptyState.setVisibility(View.GONE);
|
emptyState.setVisibility(View.GONE);
|
||||||
emptyImage.setVisibility(View.GONE);
|
emptyImage.setVisibility(View.GONE);
|
||||||
|
LocalBroadcastManager.getInstance(activity).unregisterReceiver(updateServiceStatusReceiver);
|
||||||
|
emptyUpdatingProgress.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,4 +100,23 @@ public class UpdatesViewBinder {
|
|||||||
updateEmptyState();
|
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:visibility="gone"
|
||||||
android:text="@string/empty_can_update_app_list" />
|
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
|
<ImageView
|
||||||
android:id="@+id/image"
|
android:id="@+id/image"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -294,7 +294,7 @@
|
|||||||
<string name="clear_search">Suche löschen</string>
|
<string name="clear_search">Suche löschen</string>
|
||||||
<string name="main_menu__latest_apps">Neueste</string>
|
<string name="main_menu__latest_apps">Neueste</string>
|
||||||
<string name="main_menu__categories">Kategorien</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="main_menu__swap_nearby">Direkt</string>
|
||||||
<string name="app_recommended_version_installed">Version %1$s (Empfohlen)</string>
|
<string name="app_recommended_version_installed">Version %1$s (Empfohlen)</string>
|
||||||
<string name="app_new">Neu</string>
|
<string name="app_new">Neu</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user