mirror of
https://github.com/etesync/android
synced 2024-11-29 03:18:12 +00:00
Remote Module - Add journal list
This commit is contained in:
parent
eda72a55b4
commit
835d2c833c
@ -0,0 +1,4 @@
|
||||
// CollectionInfo.aidl
|
||||
package com.etesync.syncadapter.model;
|
||||
|
||||
parcelable CollectionInfo;
|
@ -2,9 +2,12 @@
|
||||
package com.etesync.syncadapter;
|
||||
|
||||
// Declare any non-default types here with import statements
|
||||
import com.etesync.syncadapter.model.CollectionInfo;
|
||||
|
||||
interface IEteSyncService {
|
||||
boolean hasPermission(String journalType);
|
||||
|
||||
void requestPermission(String journalType);
|
||||
|
||||
CollectionInfo[] getJournalEntries(String journalType);
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
// CollectionInfo.aidl
|
||||
package com.etesync.syncadapter.model;
|
||||
|
||||
parcelable CollectionInfo;
|
@ -10,6 +10,7 @@ import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
|
||||
import com.etesync.syncadapter.IEteSyncService;
|
||||
import com.etesync.syncadapter.model.CollectionInfo;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@ -28,6 +29,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
boolean isAllowed = mEteSyncService.hasPermission(JOURNAL_TYPE);
|
||||
if (!isAllowed) {
|
||||
mEteSyncService.requestPermission(JOURNAL_TYPE);
|
||||
} else {
|
||||
CollectionInfo[] collectionInfo = mEteSyncService.getJournalEntries(JOURNAL_TYPE);
|
||||
if (collectionInfo == null) {
|
||||
Log.i(TAG, "Received no collection infos");
|
||||
} else {
|
||||
for (CollectionInfo collectionInfo1 : collectionInfo) {
|
||||
Log.i(TAG, "Received collection info: " + collectionInfo1.displayName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log.i(TAG, JOURNAL_TYPE + " isAllowed:" + mEteSyncService.hasPermission(JOURNAL_TYPE) +
|
||||
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright © 2013 – 2016 Ricki Hirner (bitfire web engineering).
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Public License v3.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
package com.etesync.syncadapter.model;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CollectionInfo implements Serializable, Parcelable {
|
||||
public int serviceID;
|
||||
|
||||
public long id;
|
||||
|
||||
public enum Type {
|
||||
ADDRESS_BOOK,
|
||||
CALENDAR
|
||||
}
|
||||
|
||||
public int version = -1;
|
||||
|
||||
public Type type;
|
||||
|
||||
public String uid;
|
||||
|
||||
public String displayName, description;
|
||||
public Integer color;
|
||||
|
||||
public String timeZone;
|
||||
|
||||
public boolean selected;
|
||||
|
||||
protected CollectionInfo(Parcel in) {
|
||||
id = in.readLong();
|
||||
serviceID = in.readInt();
|
||||
version = in.readInt();
|
||||
uid = in.readString();
|
||||
displayName = in.readString();
|
||||
description = in.readString();
|
||||
timeZone = in.readString();
|
||||
selected = in.readByte() != 0;
|
||||
}
|
||||
|
||||
public static final Creator<CollectionInfo> CREATOR = new Creator<CollectionInfo>() {
|
||||
@Override
|
||||
public CollectionInfo createFromParcel(Parcel in) {
|
||||
return new CollectionInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionInfo[] newArray(int size) {
|
||||
return new CollectionInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel aParcel, int aI) {
|
||||
aParcel.writeLong(id);
|
||||
aParcel.writeInt(serviceID);
|
||||
aParcel.writeInt(version);
|
||||
aParcel.writeString(uid);
|
||||
aParcel.writeString(displayName);
|
||||
aParcel.writeString(description);
|
||||
aParcel.writeString(timeZone);
|
||||
aParcel.writeByte((byte) (selected ? 1 : 0));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user