Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solving incomplete camera upload #925

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
auto delete uploaded images
lingzerol committed Sep 7, 2022
commit 3302cf87fbeb0839d5e248b2ca6858669eb3c10f
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -49,6 +49,8 @@ debugkey.properties
# Misc
.DS_Store
app/seed.txt
app/map.txt
app/release
out/

*.store
11 changes: 5 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -18,11 +18,6 @@ android {
}
}

lintOptions {
abortOnError false
disable 'MissingTranslation'
}


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -62,7 +57,7 @@ android {
resValue "string", "account_type", "com.seafile.seadroid2.debug.account.api2"
buildConfigField "String", "ACCOUNT_TYPE", '"com.seafile.seadroid2.debug.account.api2"'
signingConfig signingConfigs.debug
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
applicationVariants.all { variant ->
variant.outputs.all { output ->
@@ -121,5 +116,9 @@ android {
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}
lint {
abortOnError false
disable 'MissingTranslation'
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ public class CameraUploadDBHelper extends SQLiteOpenHelper {
"CREATE TABLE " + PHOTOCACHE_TABLE_NAME + " ("
+ PHOTOCACHE_COLUMN_ID + " INTEGER PRIMARY KEY, "
+ PHOTOCACHE_COLUMN_FILE + " TEXT NOT NULL, "
+ PHOTOCACHE_COLUMN_DATE_ADDED + " BIGINT NOT NULL);";
+ PHOTOCACHE_COLUMN_DATE_ADDED + " BIGINT NOT NULL)";

private static final String[] projection = {
PHOTOCACHE_COLUMN_ID,
@@ -83,9 +83,9 @@ public void onCreate(SQLiteDatabase db) {

private void createPhotoCacheTable(SQLiteDatabase db) {
db.execSQL(SQL_CREATE_PHOTOCACHE_TABLE);
db.execSQL("CREATE INDEX photo_repoid_index ON " + PHOTOCACHE_TABLE_NAME
db.execSQL("CREATE INDEX photo_file_index ON " + PHOTOCACHE_TABLE_NAME
+ " (" + PHOTOCACHE_COLUMN_FILE + ");");
db.execSQL("CREATE INDEX photo_account_index ON " + PHOTOCACHE_TABLE_NAME
db.execSQL("CREATE INDEX photo_date_index ON " + PHOTOCACHE_TABLE_NAME
+ " (" + PHOTOCACHE_COLUMN_DATE_ADDED + ");");
}

@@ -142,7 +142,6 @@ public void markAsUploaded(File file) {
}

public void markAsUploaded(String path, long modified) {

ContentValues values = new ContentValues();
values.put(PHOTOCACHE_COLUMN_FILE, path);
values.put(PHOTOCACHE_COLUMN_DATE_ADDED, modified);
@@ -181,8 +180,8 @@ public boolean isInRepo(File file){
}

public boolean isInRepo(String bucketName, String filename, long filelength){
String prefix = filename.substring(0, filename.lastIndexOf("."));
String suffix = filename.substring(filename.lastIndexOf("."));
// String prefix = filename.substring(0, filename.lastIndexOf("."));
// String suffix = filename.substring(filename.lastIndexOf("."));
// Cursor c = database.query(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two search patterns. This search pattern is the same as the original code. Another we use in L196 is more strict than the original code, but faster.

// REPOCACHE_TABLE_NAME,
// repo_projection,
8 changes: 4 additions & 4 deletions app/src/main/res/layout/cuc_activity_layout.xml
Original file line number Diff line number Diff line change
@@ -6,10 +6,10 @@
android:orientation="vertical" >

<android.support.v4.view.ViewPager
android:id="@+id/cuc_pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/cuc_indicator" />
android:id="@+id/cuc_pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/cuc_indicator" />

<com.viewpagerindicator.LinePageIndicator
android:id="@+id/cuc_indicator"
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.1.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip