mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-24 08:47:11 -04:00
Merge branch '2710-update-scheduling' into 'master'
Improve missing update checks See merge request fdroid/fdroidclient!1337
This commit is contained in:
@@ -351,7 +351,7 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
||||
}
|
||||
}
|
||||
|
||||
private long getLastUpdateCheck() {
|
||||
public long getLastUpdateCheck() {
|
||||
return preferences.getLong(PREF_LAST_UPDATE_CHECK, DEFAULT_LAST_UPDATE_CHECK);
|
||||
}
|
||||
|
||||
|
||||
@@ -187,6 +187,7 @@ public class UpdateService extends JobIntentService {
|
||||
ComponentName componentName = new ComponentName(context, UpdateJobService.class);
|
||||
JobInfo.Builder builder = new JobInfo.Builder(JOB_ID, componentName)
|
||||
.setRequiresDeviceIdle(true)
|
||||
.setPersisted(true)
|
||||
.setPeriodic(interval);
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
builder.setRequiresBatteryNotLow(true)
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.fdroid.fdroid.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import org.fdroid.fdroid.UpdateService;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
@@ -31,6 +32,7 @@ public class StartupReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context ctx, Intent intent) {
|
||||
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
||||
Log.e(TAG, "Received ACTION_BOOT_COMPLETED intent, scheduling update!!!");
|
||||
UpdateService.schedule(ctx);
|
||||
} else {
|
||||
Utils.debugLog(TAG, "received unsupported Intent " + intent);
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -45,6 +46,7 @@ import com.google.android.material.snackbar.Snackbar;
|
||||
import org.fdroid.database.Repository;
|
||||
import org.fdroid.fdroid.AppUpdateStatusManager;
|
||||
import org.fdroid.fdroid.FDroidApp;
|
||||
import org.fdroid.fdroid.Preferences;
|
||||
import org.fdroid.fdroid.R;
|
||||
import org.fdroid.fdroid.UpdateService;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
@@ -126,6 +128,12 @@ public class ManageReposActivity extends AppCompatActivity implements RepoAdapte
|
||||
MaterialToolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
long lastUpdate = Preferences.get().getLastUpdateCheck();
|
||||
CharSequence lastUpdateStr = lastUpdate < 0 ?
|
||||
getString(R.string.repositories_last_update_never) :
|
||||
DateUtils.getRelativeTimeSpanString(lastUpdate, System.currentTimeMillis(),
|
||||
DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_ABBREV_ALL);
|
||||
getSupportActionBar().setSubtitle(getString(R.string.repositories_last_update, lastUpdateStr));
|
||||
findViewById(R.id.fab).setOnClickListener(view -> {
|
||||
Intent i = new Intent(this, AddRepoActivity.class);
|
||||
startActivity(i);
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Widget.MaterialComponents.Toolbar.PrimarySurface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:title="@string/menu_manage" />
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
app:title="@string/menu_manage"
|
||||
app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
tools:subtitle="@string/repo_last_update" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<item
|
||||
android:id="@+id/action_info"
|
||||
android:icon="@drawable/ic_info"
|
||||
android:title="@string/menu_share"
|
||||
android:title="@string/repo_list_info_title"
|
||||
app:showAsAction="ifRoom|withText" />
|
||||
|
||||
</menu>
|
||||
@@ -232,6 +232,8 @@ This often occurs with apps installed via Google Play or other sources, if they
|
||||
<string name="has_disallow_install_unknown_sources">Unknown sources can\'t be added by this user, that includes new repos</string>
|
||||
|
||||
<string name="menu_manage">Repositories</string>
|
||||
<string name="repositories_last_update">Last Update: %s</string>
|
||||
<string name="repositories_last_update_never">never</string>
|
||||
<string name="repositories_summary">Add additional sources of apps</string>
|
||||
<!-- This should be exactly the same as the standard word for Settings throughout Android and apps -->
|
||||
<string name="menu_settings">Settings</string>
|
||||
|
||||
Reference in New Issue
Block a user