Skip to content

Commit

Permalink
change ui
Browse files Browse the repository at this point in the history
  • Loading branch information
finleyChen committed Jun 26, 2017
1 parent face1bc commit ee4043e
Show file tree
Hide file tree
Showing 7 changed files with 501 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected Object doInBackground(Object[] objects) {
// useCases.testEmailList();


useCases.testUpdatesContact();
useCases.testIMUIUpdates();



Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/github/privacystreams/UseCases.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.github.privacystreams.communication.Call;
import com.github.privacystreams.communication.Contact;
import com.github.privacystreams.communication.Email;
import com.github.privacystreams.communication.InstantMessage;
import com.github.privacystreams.communication.Message;
import com.github.privacystreams.core.Callback;
import com.github.privacystreams.core.Function;
Expand Down Expand Up @@ -240,6 +241,12 @@ public void testAccEvents(){
.debug();
}

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public void testIMUIUpdates(){
uqi.getData(InstantMessage.asUpdatesInIM(),Purpose.FEATURE("im updates")).debug();
}


@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public void testIMUpdates(){
uqi.getData(Message.asUpdatesInIM(),Purpose.FEATURE("im updates")).debug();
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
buildscript {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
Expand All @@ -15,6 +14,7 @@ buildscript {
allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void onChange(boolean selfChange) {
if (thisTime - lastUpdateTime > 1000) {
UQI uqi = new UQI(getContext());
List newContactList = null;
Contact newContactUpdateOutput = null;
Contact newContactUpdateOutput;

try {
newContactList = uqi.getData(Contact.getAll(),
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.github.privacystreams.communication;


import android.os.Build;
import android.support.annotation.RequiresApi;
import android.view.accessibility.AccessibilityNodeInfo;

import com.github.privacystreams.core.providers.MStreamProvider;
import com.github.privacystreams.utils.annotations.PSItemField;

import java.util.List;

public class InstantMessage extends Message{
/**
* The current position of this message
* represented by a long[] with left, top, right, bottom
*/
@PSItemField(type = List.class)
public static final String POSITION = "position";

/**
* The root view of the page where this message comes from.
*/
@PSItemField(type = AccessibilityNodeInfo.class)
public static final String ROOT_NODE = "rootNode";


public InstantMessage(String type,
String content,
String packageName,
String contact,
long timestamp,
int[] position,
AccessibilityNodeInfo rootNode){
super(type, content, packageName, contact, timestamp);
this.setFieldValue(POSITION, position);
this.setFieldValue(ROOT_NODE, rootNode);
}

InstantMessage(String type,
String content,
String packageName,
String contact,
long timestamp) {
super(type, content, packageName, contact, timestamp);
}

/**
* Provide a live stream of new Message items in Instant Messenger (IM) apps, including WhatsApp and Facebook.
* This provider requires Accessibility service turned on.
*
* @return the provider function
*/
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public static MStreamProvider asUpdatesInIM(){
return new IMUIUpdatesProvider();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class Message extends Item {
@PSItemField(type = String.class)
public static final String CONTACT = "contact";


/**
* The timestamp of when the message is sent or received.
*/
Expand Down

0 comments on commit ee4043e

Please sign in to comment.