Added function to cleanup inventory (mine grew to 1.5GB) but no automatism yet
This commit is contained in:
parent
6f26e84f71
commit
249c97d4ba
@ -12,7 +12,7 @@ if (project.hasProperty("project.configs")
|
|||||||
//noinspection GroovyMissingReturnStatement
|
//noinspection GroovyMissingReturnStatement
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 25
|
compileSdkVersion 25
|
||||||
buildToolsVersion "25.0.0"
|
buildToolsVersion "25.0.1"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "ch.dissem.apps." + appName.toLowerCase()
|
applicationId "ch.dissem.apps." + appName.toLowerCase()
|
||||||
@ -40,9 +40,9 @@ android {
|
|||||||
ext.jabitVersion = 'feature-extended-encoding-SNAPSHOT'
|
ext.jabitVersion = 'feature-extended-encoding-SNAPSHOT'
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:25.0.1'
|
compile 'com.android.support:appcompat-v7:25.1.0'
|
||||||
compile 'com.android.support:support-v4:25.0.1'
|
compile 'com.android.support:support-v4:25.1.0'
|
||||||
compile 'com.android.support:design:25.0.1'
|
compile 'com.android.support:design:25.1.0'
|
||||||
|
|
||||||
compile "ch.dissem.jabit:jabit-core:$jabitVersion"
|
compile "ch.dissem.jabit:jabit-core:$jabitVersion"
|
||||||
compile "ch.dissem.jabit:jabit-networking:$jabitVersion"
|
compile "ch.dissem.jabit:jabit-networking:$jabitVersion"
|
||||||
|
@ -38,7 +38,7 @@ import ch.dissem.apps.abit.service.Singleton;
|
|||||||
import ch.dissem.bitmessage.BitmessageContext;
|
import ch.dissem.bitmessage.BitmessageContext;
|
||||||
import ch.dissem.bitmessage.entity.BitmessageAddress;
|
import ch.dissem.bitmessage.entity.BitmessageAddress;
|
||||||
import ch.dissem.bitmessage.entity.Plaintext;
|
import ch.dissem.bitmessage.entity.Plaintext;
|
||||||
import ch.dissem.bitmessage.entity.valueobject.ExtendedEncoding;
|
import ch.dissem.bitmessage.entity.valueobject.extended.Message;
|
||||||
|
|
||||||
import static android.app.Activity.RESULT_OK;
|
import static android.app.Activity.RESULT_OK;
|
||||||
import static ch.dissem.apps.abit.ComposeMessageActivity.EXTRA_BROADCAST;
|
import static ch.dissem.apps.abit.ComposeMessageActivity.EXTRA_BROADCAST;
|
||||||
@ -223,10 +223,10 @@ public class ComposeMessageFragment extends Fragment {
|
|||||||
break;
|
break;
|
||||||
case EXTENDED:
|
case EXTENDED:
|
||||||
builder.message(
|
builder.message(
|
||||||
new ExtendedEncoding.Builder()
|
new Message.Builder()
|
||||||
.message()
|
|
||||||
.subject(subjectInput.getText().toString())
|
.subject(subjectInput.getText().toString())
|
||||||
.body(bodyInput.getText().toString())
|
.body(bodyInput.getText().toString())
|
||||||
|
.addParent(parent)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
@ -19,14 +19,17 @@ package ch.dissem.apps.abit;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.mikepenz.aboutlibraries.Libs;
|
import com.mikepenz.aboutlibraries.Libs;
|
||||||
import com.mikepenz.aboutlibraries.LibsBuilder;
|
import com.mikepenz.aboutlibraries.LibsBuilder;
|
||||||
|
|
||||||
|
import ch.dissem.apps.abit.service.Singleton;
|
||||||
import ch.dissem.apps.abit.synchronization.SyncAdapter;
|
import ch.dissem.apps.abit.synchronization.SyncAdapter;
|
||||||
|
|
||||||
import static ch.dissem.apps.abit.util.Constants.PREFERENCE_SERVER_POW;
|
import static ch.dissem.apps.abit.util.Constants.PREFERENCE_SERVER_POW;
|
||||||
@ -59,6 +62,37 @@ public class SettingsFragment
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
final Preference cleanup = findPreference("cleanup");
|
||||||
|
cleanup.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
new AsyncTask<Void, Void, Void>() {
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
cleanup.setEnabled(false);
|
||||||
|
Toast.makeText(getActivity(), R.string.cleanup_notification_start, Toast
|
||||||
|
.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... voids) {
|
||||||
|
Singleton.getBitmessageContext(getActivity()).cleanup();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Void aVoid) {
|
||||||
|
Toast.makeText(
|
||||||
|
getActivity(),
|
||||||
|
R.string.cleanup_notification_end,
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show();
|
||||||
|
cleanup.setEnabled(true);
|
||||||
|
}
|
||||||
|
}.execute();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Preference status = findPreference("status");
|
Preference status = findPreference("status");
|
||||||
status.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
status.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
|
@ -33,11 +33,11 @@ import static ch.dissem.apps.abit.notification.NetworkNotification.NETWORK_NOTIF
|
|||||||
* onPerformSync().
|
* onPerformSync().
|
||||||
*/
|
*/
|
||||||
public class BitmessageService extends Service {
|
public class BitmessageService extends Service {
|
||||||
private NetworkNotification notification = null;
|
|
||||||
private static BitmessageContext bmc = null;
|
private static BitmessageContext bmc = null;
|
||||||
|
|
||||||
private static volatile boolean running = false;
|
private static volatile boolean running = false;
|
||||||
|
|
||||||
|
private NetworkNotification notification = null;
|
||||||
|
|
||||||
public static boolean isRunning() {
|
public static boolean isRunning() {
|
||||||
return running && bmc.isRunning();
|
return running && bmc.isRunning();
|
||||||
}
|
}
|
||||||
|
@ -113,4 +113,8 @@ Als Alternative kann in den Einstellungen ein vertrauenswürdiger Knoten konfigu
|
|||||||
<string name="error_unsupported_encoding">Codierung ‘%s’ wird nicht unterstützt, es wird ‘SIMPLE’ verwendet.</string>
|
<string name="error_unsupported_encoding">Codierung ‘%s’ wird nicht unterstützt, es wird ‘SIMPLE’ verwendet.</string>
|
||||||
<string name="select_encoding_title">Kodierung auswählen</string>
|
<string name="select_encoding_title">Kodierung auswählen</string>
|
||||||
<string name="select_encoding_warning">‘EXTENDED’ ist ein neues Datenformat welches noch nicht überall funktioniert, es hat jedoch einige interessante Vorteile. Wähle ‘SIMPLE’ um sicher zu gehen.</string>
|
<string name="select_encoding_warning">‘EXTENDED’ ist ein neues Datenformat welches noch nicht überall funktioniert, es hat jedoch einige interessante Vorteile. Wähle ‘SIMPLE’ um sicher zu gehen.</string>
|
||||||
|
<string name="cleanup">Aufräumen</string>
|
||||||
|
<string name="cleanup_notification_start">Aufräumarbeiten gestartet</string>
|
||||||
|
<string name="cleanup_notification_end">Aufräumarbeiten beendet</string>
|
||||||
|
<string name="cleanup_summary">Veraltete Inventareinträge werden entfernt</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -112,4 +112,8 @@ As an alternative you could configure a trusted node in the settings, but as of
|
|||||||
<string name="error_unsupported_encoding">Unsupported encoding ‘%s’, using ‘SIMPLE’ instead.</string>
|
<string name="error_unsupported_encoding">Unsupported encoding ‘%s’, using ‘SIMPLE’ instead.</string>
|
||||||
<string name="select_encoding_warning">‘EXTENDED’ is a new message format that\'s not widely supported yet but has some interesting features. To stay on the save side, select ‘SIMPLE’.</string>
|
<string name="select_encoding_warning">‘EXTENDED’ is a new message format that\'s not widely supported yet but has some interesting features. To stay on the save side, select ‘SIMPLE’.</string>
|
||||||
<string name="select_encoding_title">Select Message Encoding</string>
|
<string name="select_encoding_title">Select Message Encoding</string>
|
||||||
|
<string name="cleanup">Cleanup</string>
|
||||||
|
<string name="cleanup_summary">Remove outdated inventory entries</string>
|
||||||
|
<string name="cleanup_notification_start">Cleanup started</string>
|
||||||
|
<string name="cleanup_notification_end">Cleanup finished</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -44,6 +44,11 @@
|
|||||||
android:action="android.intent.action.VIEW"
|
android:action="android.intent.action.VIEW"
|
||||||
android:data="@string/help_out_link"/>
|
android:data="@string/help_out_link"/>
|
||||||
</Preference>
|
</Preference>
|
||||||
|
<Preference
|
||||||
|
android:key="cleanup"
|
||||||
|
android:title="@string/cleanup"
|
||||||
|
android:summary="@string/cleanup_summary"
|
||||||
|
/>
|
||||||
<Preference
|
<Preference
|
||||||
android:key="status"
|
android:key="status"
|
||||||
android:summary="@string/status_summary"
|
android:summary="@string/status_summary"
|
||||||
|
@ -9,7 +9,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.2.2'
|
classpath 'com.android.tools.build:gradle:2.2.3'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
Loading…
Reference in New Issue
Block a user