Skip to content

Commit 63c4572

Browse files
show notes on receiving shares
Signed-off-by: tobiasKaminsky <[email protected]>
1 parent bc80cac commit 63c4572

File tree

12 files changed

+231
-169
lines changed

12 files changed

+231
-169
lines changed

src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public boolean saveFile(OCFile file) {
207207
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, file.getUnreadCommentsCount());
208208
cv.put(ProviderTableMeta.FILE_OWNER_ID, file.getOwnerId());
209209
cv.put(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME, file.getOwnerDisplayName());
210+
cv.put(ProviderTableMeta.FILE_NOTE, file.getNote());
210211

211212
boolean sameRemotePath = fileExists(file.getRemotePath());
212213
if (sameRemotePath ||
@@ -447,6 +448,7 @@ private ContentValues createContentValueForFile(OCFile folder) {
447448
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, folder.getUnreadCommentsCount());
448449
cv.put(ProviderTableMeta.FILE_OWNER_ID, folder.getOwnerId());
449450
cv.put(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME, folder.getOwnerDisplayName());
451+
cv.put(ProviderTableMeta.FILE_NOTE, folder.getNote());
450452

451453
return cv;
452454
}
@@ -485,6 +487,7 @@ private ContentValues createContentValueForFile(OCFile file, OCFile folder) {
485487
cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, file.getUnreadCommentsCount());
486488
cv.put(ProviderTableMeta.FILE_OWNER_ID, file.getOwnerId());
487489
cv.put(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME, file.getOwnerDisplayName());
490+
cv.put(ProviderTableMeta.FILE_NOTE, file.getNote());
488491

489492
return cv;
490493
}
@@ -983,6 +986,7 @@ private OCFile createFileInstance(Cursor c) {
983986
file.setUnreadCommentsCount(c.getInt(c.getColumnIndex(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT)));
984987
file.setOwnerId(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_OWNER_ID)));
985988
file.setOwnerDisplayName(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME)));
989+
file.setNote(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_NOTE)));
986990
}
987991

988992
return file;

src/main/java/com/owncloud/android/datamodel/OCFile.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
8787
@Getter @Setter private int unreadCommentsCount;
8888
@Getter @Setter private String ownerId;
8989
@Getter @Setter private String ownerDisplayName;
90+
@Getter @Setter String note;
9091

9192
/**
9293
* URI to the local path of the file contents, if stored in the device; cached after first call

src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import java.io.InputStream;
7272
import java.lang.ref.WeakReference;
7373
import java.net.URLEncoder;
74+
import java.security.NoSuchAlgorithmException;
7475
import java.util.List;
7576

7677
import androidx.annotation.Nullable;
@@ -872,6 +873,16 @@ Drawable doAvatarInBackground() {
872873

873874
int px = getAvatarDimension();
874875

876+
boolean notOnSameServer = false;
877+
878+
if (notOnSameServer) {
879+
try {
880+
return TextDrawable.createAvatar(mAccount.name, mAvatarRadius);
881+
} catch (NoSuchAlgorithmException e) {
882+
Log_OC.e(this, "Error creating avatar", e);
883+
}
884+
}
885+
875886
// Download avatar from server
876887
if (mClient != null) {
877888
GetMethod get = null;

src/main/java/com/owncloud/android/db/ProviderMeta.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class ProviderMeta {
3333

3434
public static final String DB_NAME = "filelist";
35-
public static final int DB_VERSION = 43;
35+
public static final int DB_VERSION = 44;
3636

3737
private ProviderMeta() {
3838
}
@@ -108,6 +108,7 @@ static public class ProviderTableMeta implements BaseColumns {
108108
public static final String FILE_UNREAD_COMMENTS_COUNT = "unread_comments_count";
109109
public static final String FILE_OWNER_ID = "owner_id";
110110
public static final String FILE_OWNER_DISPLAY_NAME = "owner_display_name";
111+
public static final String FILE_NOTE = "note";
111112

112113
public static final String[] FILE_ALL_COLUMNS = {
113114
_ID, FILE_PARENT, FILE_NAME, FILE_CREATION, FILE_MODIFIED,

src/main/java/com/owncloud/android/providers/FileContentProvider.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,8 @@ private void createFilesTable(SQLiteDatabase db) {
700700
+ ProviderTableMeta.FILE_HAS_PREVIEW + INTEGER
701701
+ ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT + INTEGER
702702
+ ProviderTableMeta.FILE_OWNER_ID + TEXT
703-
+ ProviderTableMeta.FILE_OWNER_DISPLAY_NAME + " TEXT);"
703+
+ ProviderTableMeta.FILE_OWNER_DISPLAY_NAME + TEXT
704+
+ ProviderTableMeta.FILE_NOTE + " TEXT);"
704705
);
705706
}
706707

@@ -1882,6 +1883,24 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
18821883
if (!upgraded) {
18831884
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
18841885
}
1886+
1887+
if (oldVersion < 44 && newVersion >= 44) {
1888+
Log_OC.i(SQL, "Entering in the #44 add note to file table");
1889+
db.beginTransaction();
1890+
try {
1891+
db.execSQL(ALTER_TABLE + ProviderTableMeta.FILE_TABLE_NAME +
1892+
ADD_COLUMN + ProviderTableMeta.FILE_NOTE + " TEXT ");
1893+
1894+
upgraded = true;
1895+
db.setTransactionSuccessful();
1896+
} finally {
1897+
db.endTransaction();
1898+
}
1899+
}
1900+
1901+
if (!upgraded) {
1902+
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
1903+
}
18851904
}
18861905

18871906
@Override

src/main/java/com/owncloud/android/ui/adapter/FileDetailTabAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ public FileDetailActivitiesFragment getFileDetailActivitiesFragment() {
7171

7272
@Override
7373
public int getCount() {
74-
return file.canReshare() ? 2 : 1;
74+
return 2;
7575
}
7676
}

0 commit comments

Comments
 (0)