forked from upstream-mirrors/quik
Merged master into mainactivity-cleanup
This commit is contained in:
@@ -12,11 +12,11 @@ public class DateFormatterTest extends AndroidTestCase {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void test24Hours(){
|
||||
public void test24Hours() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
prefs.edit().putBoolean(SettingsFragment.TIMESTAMPS_24H, true).commit();
|
||||
prefs.edit().putBoolean(SettingsFragment.TIMESTAMPS_24H, true).apply();
|
||||
assertTrue(DateFormatter.accountFor24HourTime(getContext(), new SimpleDateFormat("h:mm a")).equals(new SimpleDateFormat("H:mm")));
|
||||
prefs.edit().putBoolean(SettingsFragment.TIMESTAMPS_24H, false).commit();
|
||||
prefs.edit().putBoolean(SettingsFragment.TIMESTAMPS_24H, false).apply();
|
||||
}
|
||||
|
||||
public void testDateSymbolsAPI(){
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.lang.annotation.Target;
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SdkConstant {
|
||||
public static enum SdkConstantType {
|
||||
public enum SdkConstantType {
|
||||
ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class CountryDetector {
|
||||
*/
|
||||
public CountryDetector(ICountryDetector service) {
|
||||
mService = service;
|
||||
mListeners = new HashMap<CountryListener, ListenerTransport>();
|
||||
mListeners = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DhcpInfoInternal {
|
||||
private Collection<RouteInfo> mRoutes;
|
||||
|
||||
public DhcpInfoInternal() {
|
||||
mRoutes = new ArrayList<RouteInfo>();
|
||||
mRoutes = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addRoute(RouteInfo routeInfo) {
|
||||
|
||||
@@ -1387,7 +1387,7 @@ public interface IConnectivityManager extends android.os.IInterface {
|
||||
}
|
||||
}
|
||||
|
||||
static final int TRANSACTION_setNetworkPreference = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
|
||||
static final int TRANSACTION_setNetworkPreference = (android.os.IBinder.FIRST_CALL_TRANSACTION);
|
||||
static final int TRANSACTION_getNetworkPreference = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
|
||||
static final int TRANSACTION_getActiveNetworkInfo = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
|
||||
static final int TRANSACTION_getActiveNetworkInfoForUid = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
|
||||
|
||||
@@ -125,7 +125,7 @@ public interface INetworkPolicyListener extends android.os.IInterface {
|
||||
}
|
||||
}
|
||||
|
||||
static final int TRANSACTION_onUidRulesChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
|
||||
static final int TRANSACTION_onUidRulesChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION);
|
||||
static final int TRANSACTION_onMeteredIfacesChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
|
||||
static final int TRANSACTION_onRestrictBackgroundChanged = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ public interface INetworkPolicyManager extends android.os.IInterface {
|
||||
}
|
||||
}
|
||||
|
||||
static final int TRANSACTION_setUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
|
||||
static final int TRANSACTION_setUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION);
|
||||
static final int TRANSACTION_getUidPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
|
||||
static final int TRANSACTION_getUidsWithPolicy = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
|
||||
static final int TRANSACTION_isUidForeground = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
|
||||
|
||||
@@ -199,7 +199,7 @@ public class LinkCapabilities implements Parcelable {
|
||||
* Constructor
|
||||
*/
|
||||
public LinkCapabilities() {
|
||||
mCapabilities = new HashMap<Integer, String>();
|
||||
mCapabilities = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,9 +209,9 @@ public class LinkCapabilities implements Parcelable {
|
||||
*/
|
||||
public LinkCapabilities(LinkCapabilities source) {
|
||||
if (source != null) {
|
||||
mCapabilities = new HashMap<Integer, String>(source.mCapabilities);
|
||||
mCapabilities = new HashMap<>(source.mCapabilities);
|
||||
} else {
|
||||
mCapabilities = new HashMap<Integer, String>();
|
||||
mCapabilities = new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public class LinkCapabilities implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(mCapabilities.size());
|
||||
for (Entry<Integer, String> entry : mCapabilities.entrySet()) {
|
||||
dest.writeInt(entry.getKey().intValue());
|
||||
dest.writeInt(entry.getKey());
|
||||
dest.writeString(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,14 +52,14 @@ import java.util.Collections;
|
||||
public class LinkProperties implements Parcelable {
|
||||
|
||||
String mIfaceName;
|
||||
private Collection<LinkAddress> mLinkAddresses = new ArrayList<LinkAddress>();
|
||||
private Collection<InetAddress> mDnses = new ArrayList<InetAddress>();
|
||||
private Collection<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
|
||||
private Collection<LinkAddress> mLinkAddresses = new ArrayList<>();
|
||||
private Collection<InetAddress> mDnses = new ArrayList<>();
|
||||
private Collection<RouteInfo> mRoutes = new ArrayList<>();
|
||||
private ProxyProperties mHttpProxy;
|
||||
|
||||
public static class CompareResult<T> {
|
||||
public Collection<T> removed = new ArrayList<T>();
|
||||
public Collection<T> added = new ArrayList<T>();
|
||||
public Collection<T> removed = new ArrayList<>();
|
||||
public Collection<T> added = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -97,7 +97,7 @@ public class LinkProperties implements Parcelable {
|
||||
}
|
||||
|
||||
public Collection<InetAddress> getAddresses() {
|
||||
Collection<InetAddress> addresses = new ArrayList<InetAddress>();
|
||||
Collection<InetAddress> addresses = new ArrayList<>();
|
||||
for (LinkAddress linkAddress : mLinkAddresses) {
|
||||
addresses.add(linkAddress.getAddress());
|
||||
}
|
||||
@@ -192,8 +192,7 @@ public class LinkProperties implements Parcelable {
|
||||
public boolean isIdenticalAddresses(LinkProperties target) {
|
||||
Collection<InetAddress> targetAddresses = target.getAddresses();
|
||||
Collection<InetAddress> sourceAddresses = getAddresses();
|
||||
return (sourceAddresses.size() == targetAddresses.size()) ?
|
||||
sourceAddresses.containsAll(targetAddresses) : false;
|
||||
return (sourceAddresses.size() == targetAddresses.size()) && sourceAddresses.containsAll(targetAddresses);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,8 +274,8 @@ public class LinkProperties implements Parcelable {
|
||||
* are in target but not in mLinkAddresses are placed in the
|
||||
* addedAddresses.
|
||||
*/
|
||||
CompareResult<LinkAddress> result = new CompareResult<LinkAddress>();
|
||||
result.removed = new ArrayList<LinkAddress>(mLinkAddresses);
|
||||
CompareResult<LinkAddress> result = new CompareResult<>();
|
||||
result.removed = new ArrayList<>(mLinkAddresses);
|
||||
result.added.clear();
|
||||
if (target != null) {
|
||||
for (LinkAddress newAddress : target.getLinkAddresses()) {
|
||||
@@ -305,9 +304,9 @@ public class LinkProperties implements Parcelable {
|
||||
* are in target but not in mDnses are placed in the
|
||||
* addedAddresses.
|
||||
*/
|
||||
CompareResult<InetAddress> result = new CompareResult<InetAddress>();
|
||||
CompareResult<InetAddress> result = new CompareResult<>();
|
||||
|
||||
result.removed = new ArrayList<InetAddress>(mDnses);
|
||||
result.removed = new ArrayList<>(mDnses);
|
||||
result.added.clear();
|
||||
if (target != null) {
|
||||
for (InetAddress newAddress : target.getDnses()) {
|
||||
@@ -335,9 +334,9 @@ public class LinkProperties implements Parcelable {
|
||||
* leaving the routes that are different. And route address which
|
||||
* are in target but not in mRoutes are placed in added.
|
||||
*/
|
||||
CompareResult<RouteInfo> result = new CompareResult<RouteInfo>();
|
||||
CompareResult<RouteInfo> result = new CompareResult<>();
|
||||
|
||||
result.removed = new ArrayList<RouteInfo>(mRoutes);
|
||||
result.removed = new ArrayList<>(mRoutes);
|
||||
result.added.clear();
|
||||
if (target != null) {
|
||||
for (RouteInfo r : target.getRoutes()) {
|
||||
|
||||
@@ -168,17 +168,7 @@ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder builder = new StringBuilder("NetworkPolicy");
|
||||
builder.append("[").append(template).append("]:");
|
||||
builder.append(" cycleDay=").append(cycleDay);
|
||||
builder.append(", cycleTimezone=").append(cycleTimezone);
|
||||
builder.append(", warningBytes=").append(warningBytes);
|
||||
builder.append(", limitBytes=").append(limitBytes);
|
||||
builder.append(", lastWarningSnooze=").append(lastWarningSnooze);
|
||||
builder.append(", lastLimitSnooze=").append(lastLimitSnooze);
|
||||
builder.append(", metered=").append(metered);
|
||||
builder.append(", inferred=").append(inferred);
|
||||
return builder.toString();
|
||||
return "NetworkPolicy" + "[" + template + "]:" + " cycleDay=" + cycleDay + ", cycleTimezone=" + cycleTimezone + ", warningBytes=" + warningBytes + ", limitBytes=" + limitBytes + ", lastWarningSnooze=" + lastWarningSnooze + ", lastLimitSnooze=" + lastLimitSnooze + ", metered=" + metered + ", inferred=" + inferred;
|
||||
}
|
||||
|
||||
public static final Creator<NetworkPolicy> CREATOR = new Creator<NetworkPolicy>() {
|
||||
|
||||
@@ -153,8 +153,7 @@ public class ProxyProperties implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
if (mHost != null && p.mHost == null) return false;
|
||||
if (mHost == null && p.mHost != null) return false;
|
||||
return mPort == p.mPort;
|
||||
return !(mHost == null && p.mHost != null) && mPort == p.mPort;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,11 +72,11 @@ public abstract class ElementTimeImpl implements ElementTime {
|
||||
String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");
|
||||
|
||||
// TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
|
||||
ArrayList<Time> beginTimeList = new ArrayList<Time>();
|
||||
ArrayList<Time> beginTimeList = new ArrayList<>();
|
||||
// Initialize Time instances and add them to Vector
|
||||
for (int i = 0; i < beginTimeStringList.length; i++) {
|
||||
for (String aBeginTimeStringList : beginTimeStringList) {
|
||||
try {
|
||||
beginTimeList.add(new TimeImpl(beginTimeStringList[i], getBeginConstraints()));
|
||||
beginTimeList.add(new TimeImpl(aBeginTimeStringList, getBeginConstraints()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Ignore badly formatted times
|
||||
}
|
||||
@@ -121,15 +121,15 @@ public abstract class ElementTimeImpl implements ElementTime {
|
||||
}
|
||||
|
||||
public TimeList getEnd() {
|
||||
ArrayList<Time> endTimeList = new ArrayList<Time>();
|
||||
ArrayList<Time> endTimeList = new ArrayList<>();
|
||||
|
||||
String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
|
||||
int len = endTimeStringList.length;
|
||||
if (!((len == 1) && (endTimeStringList[0].length() == 0))) { // Ensure the end field is set.
|
||||
// Initialize Time instances and add them to Vector
|
||||
for (int i = 0; i < len; i++) {
|
||||
for (String anEndTimeStringList : endTimeStringList) {
|
||||
try {
|
||||
endTimeList.add(new TimeImpl(endTimeStringList[i],
|
||||
endTimeList.add(new TimeImpl(anEndTimeStringList,
|
||||
getEndConstraints()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Ignore badly formatted times
|
||||
@@ -245,7 +245,7 @@ public abstract class ElementTimeImpl implements ElementTime {
|
||||
*/
|
||||
return FILL_AUTO;
|
||||
} else {
|
||||
return ((ElementTimeImpl) parent).getFillDefault();
|
||||
return parent.getFillDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,28 +156,29 @@ public class SmilDocumentImpl extends DocumentImpl implements SMILDocument, Docu
|
||||
public Element createElement(String tagName) throws DOMException {
|
||||
// Find the appropriate class for this element
|
||||
tagName = tagName.toLowerCase();
|
||||
if (tagName.equals("text") ||
|
||||
tagName.equals("img") ||
|
||||
tagName.equals("video")) {
|
||||
return new SmilRegionMediaElementImpl(this, tagName);
|
||||
} else if (tagName.equals("audio")) {
|
||||
return new SmilMediaElementImpl(this, tagName);
|
||||
} else if (tagName.equals("layout")) {
|
||||
return new SmilLayoutElementImpl(this, tagName);
|
||||
} else if (tagName.equals("root-layout")) {
|
||||
return new SmilRootLayoutElementImpl(this, tagName);
|
||||
} else if (tagName.equals("region")) {
|
||||
return new SmilRegionElementImpl(this, tagName);
|
||||
} else if (tagName.equals("ref")) {
|
||||
return new SmilRefElementImpl(this, tagName);
|
||||
} else if (tagName.equals("par")) {
|
||||
return new SmilParElementImpl(this, tagName);
|
||||
} else if (tagName.equals("vcard")) {
|
||||
return new SmilRegionMediaElementImpl(this, tagName);
|
||||
} else {
|
||||
// This includes also the structural nodes SMIL,
|
||||
// HEAD, BODY, for which no specific types are defined.
|
||||
return new SmilElementImpl(this, tagName);
|
||||
switch (tagName) {
|
||||
case "text":
|
||||
case "img":
|
||||
case "video":
|
||||
return new SmilRegionMediaElementImpl(this, tagName);
|
||||
case "audio":
|
||||
return new SmilMediaElementImpl(this, tagName);
|
||||
case "layout":
|
||||
return new SmilLayoutElementImpl(this, tagName);
|
||||
case "root-layout":
|
||||
return new SmilRootLayoutElementImpl(this, tagName);
|
||||
case "region":
|
||||
return new SmilRegionElementImpl(this, tagName);
|
||||
case "ref":
|
||||
return new SmilRefElementImpl(this, tagName);
|
||||
case "par":
|
||||
return new SmilParElementImpl(this, tagName);
|
||||
case "vcard":
|
||||
return new SmilRegionMediaElementImpl(this, tagName);
|
||||
default:
|
||||
// This includes also the structural nodes SMIL,
|
||||
// HEAD, BODY, for which no specific types are defined.
|
||||
return new SmilElementImpl(this, tagName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SmilParElementImpl extends SmilElementImpl implements SMILParElemen
|
||||
*/
|
||||
TimeList beginTimeList = super.getBegin();
|
||||
if (beginTimeList.getLength() > 1) {
|
||||
ArrayList<Time> singleTimeContainer = new ArrayList<Time>();
|
||||
ArrayList<Time> singleTimeContainer = new ArrayList<>();
|
||||
singleTimeContainer.add(beginTimeList.item(0));
|
||||
beginTimeList = new TimeListImpl(singleTimeContainer);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SmilPlayer implements Runnable {
|
||||
private static final boolean LOCAL_LOGV = false;
|
||||
private static final int TIMESLICE = 200;
|
||||
|
||||
private static enum SmilPlayerState {
|
||||
private enum SmilPlayerState {
|
||||
INITIALIZED,
|
||||
PLAYING,
|
||||
PLAYED,
|
||||
@@ -54,7 +54,7 @@ public class SmilPlayer implements Runnable {
|
||||
STOPPED,
|
||||
}
|
||||
|
||||
private static enum SmilPlayerAction {
|
||||
private enum SmilPlayerAction {
|
||||
NO_ACTIVE_ACTION,
|
||||
RELOAD,
|
||||
STOP,
|
||||
@@ -88,7 +88,7 @@ public class SmilPlayer implements Runnable {
|
||||
|
||||
private static ArrayList<TimelineEntry> getParTimeline(
|
||||
ElementParallelTimeContainer par, double offset, double maxOffset) {
|
||||
ArrayList<TimelineEntry> timeline = new ArrayList<TimelineEntry>();
|
||||
ArrayList<TimelineEntry> timeline = new ArrayList<>();
|
||||
|
||||
// Set my begin at first
|
||||
TimeList myBeginList = par.getBegin();
|
||||
@@ -145,7 +145,7 @@ public class SmilPlayer implements Runnable {
|
||||
|
||||
private static ArrayList<TimelineEntry> getSeqTimeline(
|
||||
ElementSequentialTimeContainer seq, double offset, double maxOffset) {
|
||||
ArrayList<TimelineEntry> timeline = new ArrayList<TimelineEntry>();
|
||||
ArrayList<TimelineEntry> timeline = new ArrayList<>();
|
||||
double orgOffset = offset;
|
||||
|
||||
// Set my begin at first
|
||||
@@ -211,7 +211,7 @@ public class SmilPlayer implements Runnable {
|
||||
return getSeqTimeline((ElementSequentialTimeContainer) element, offset, maxOffset);
|
||||
} else {
|
||||
// Not ElementTimeContainer here
|
||||
ArrayList<TimelineEntry> timeline = new ArrayList<TimelineEntry>();
|
||||
ArrayList<TimelineEntry> timeline = new ArrayList<>();
|
||||
|
||||
TimeList beginList = element.getBegin();
|
||||
for (int i = 0; i < beginList.getLength(); ++i) {
|
||||
@@ -301,7 +301,7 @@ public class SmilPlayer implements Runnable {
|
||||
mAllEntries = getTimeline(mRoot, 0, Long.MAX_VALUE);
|
||||
mMediaTimeUpdatedEvent = ((DocumentEvent) mRoot).createEvent("Event");
|
||||
mMediaTimeUpdatedEvent.initEvent(MEDIA_TIME_UPDATED_EVENT, false, false);
|
||||
mActiveElements = new ArrayList<ElementTime>();
|
||||
mActiveElements = new ArrayList<>();
|
||||
}
|
||||
|
||||
public synchronized void play() {
|
||||
@@ -529,7 +529,7 @@ public class SmilPlayer implements Runnable {
|
||||
}
|
||||
|
||||
private void stopCurrentSlide() {
|
||||
HashSet<TimelineEntry> skippedEntries = new HashSet<TimelineEntry>();
|
||||
HashSet<TimelineEntry> skippedEntries = new HashSet<>();
|
||||
int totalEntries = mAllEntries.size();
|
||||
for (int i = mCurrentElement; i < totalEntries; i++) {
|
||||
// Stop any started entries, and skip the not started entries until
|
||||
|
||||
@@ -64,7 +64,7 @@ public class EndlessJabberInterface {
|
||||
editor.putString("InterfaceClass", concreteImplementation.getName());
|
||||
editor.putBoolean("SendSMS", sendSMS);
|
||||
editor.putBoolean("SendMMS", sendMMS);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
|
||||
SendInfoToEndlessJabber(context);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class EndlessJabberInterface {
|
||||
public static void DisableIntegration(Context context, Class nameOfImplementation) {
|
||||
SharedPreferences.Editor editor = context.getSharedPreferences("EndlessJabberSDK", Context.MODE_PRIVATE).edit();
|
||||
editor.clear();
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
|
||||
SendInfoToEndlessJabber(context);
|
||||
}
|
||||
|
||||
+55
-54
@@ -7,72 +7,73 @@ import android.os.Bundle;
|
||||
|
||||
public class EndlessJabberWakefulService extends IntentService {
|
||||
|
||||
public EndlessJabberWakefulService() {
|
||||
super("EndlessJabberWakefulService");
|
||||
}
|
||||
public EndlessJabberWakefulService() {
|
||||
super("EndlessJabberWakefulService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
Context context = getApplicationContext();
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
Context context = getApplicationContext();
|
||||
|
||||
// Get the class to call
|
||||
String implemenationClass = context.getSharedPreferences("EndlessJabberSDK", Context.MODE_PRIVATE).getString("InterfaceClass", null);
|
||||
// Get the class to call
|
||||
String implementationClass = context.getSharedPreferences("EndlessJabberSDK", Context.MODE_PRIVATE).getString("InterfaceClass", null);
|
||||
|
||||
if (implemenationClass == null) {
|
||||
return;
|
||||
}
|
||||
if (implementationClass != null) {
|
||||
IEndlessJabberImplementation instanceOfMyClass;
|
||||
try {
|
||||
instanceOfMyClass = (IEndlessJabberImplementation) Class.forName(implementationClass).newInstance();
|
||||
|
||||
IEndlessJabberImplementation instanceOfMyClass;
|
||||
try {
|
||||
instanceOfMyClass = (IEndlessJabberImplementation) Class.forName(implemenationClass).newInstance();
|
||||
Bundle extras = intent.getExtras();
|
||||
|
||||
Bundle extras = intent.getExtras();
|
||||
switch (extras.getString("Action")) {
|
||||
case "UpdateRead": {
|
||||
long time = extras.getLong("Time");
|
||||
int conversationID = extras.getInt("ConversationID");
|
||||
instanceOfMyClass.UpdateReadMessages(context, time, conversationID);
|
||||
break;
|
||||
}
|
||||
case "DeleteThread": {
|
||||
|
||||
switch (extras.getString("Action")) {
|
||||
case "UpdateRead": {
|
||||
long time = extras.getLong("Time");
|
||||
int conversationID = extras.getInt("ConversationID");
|
||||
instanceOfMyClass.UpdateReadMessages(context, time, conversationID);
|
||||
break;
|
||||
}
|
||||
case "DeleteThread": {
|
||||
int conversationID = extras.getInt("ConversationID");
|
||||
instanceOfMyClass.DeleteThread(context, conversationID);
|
||||
break;
|
||||
}
|
||||
case "SendMMS": {
|
||||
|
||||
int conversationID = extras.getInt("ConversationID");
|
||||
instanceOfMyClass.DeleteThread(context, conversationID);
|
||||
break;
|
||||
}
|
||||
case "SendMMS": {
|
||||
boolean save = extras.getBoolean("Save");
|
||||
boolean send = extras.getBoolean("Send");
|
||||
String[] Recipients = extras.getStringArray("Recipients");
|
||||
|
||||
boolean save = extras.getBoolean("Save");
|
||||
boolean send = extras.getBoolean("Send");
|
||||
String[] Recipients = extras.getStringArray("Recipients");
|
||||
MMSPart[] parts = new MMSPart[extras.getParcelableArray("Parts").length];
|
||||
|
||||
MMSPart[] parts = new MMSPart[extras.getParcelableArray("Parts").length];
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
parts[i] = (MMSPart) extras.getParcelableArray("Parts")[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
parts[i] = (MMSPart) extras.getParcelableArray("Parts")[i];
|
||||
}
|
||||
instanceOfMyClass.SendMMS(context, Recipients, parts, extras.getString("Subject"), save, send);
|
||||
break;
|
||||
}
|
||||
case "SendSMS": {
|
||||
boolean send = extras.getBoolean("Send");
|
||||
String[] Recipients = extras.getStringArray("Recipients");
|
||||
String message = extras.getString("Message");
|
||||
|
||||
instanceOfMyClass.SendMMS(context, Recipients, parts, extras.getString("Subject"), save, send);
|
||||
break;
|
||||
}
|
||||
case "SendSMS": {
|
||||
boolean send = extras.getBoolean("Send");
|
||||
String[] Recipients = extras.getStringArray("Recipients");
|
||||
String message = extras.getString("Message");
|
||||
instanceOfMyClass.SendSMS(context, Recipients, message, send);
|
||||
break;
|
||||
}
|
||||
case "UpdateInfo": {
|
||||
EndlessJabberInterface.SendInfoToEndlessJabber(context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
|
||||
instanceOfMyClass.SendSMS(context, Recipients, message, send);
|
||||
break;
|
||||
}
|
||||
case "UpdateInfo": {
|
||||
EndlessJabberInterface.SendInfoToEndlessJabber(context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
||||
EndlessJabberReceiver.completeWakefulIntent(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
EndlessJabberReceiver.completeWakefulIntent(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,10 @@ public class ConversationPrefsHelper {
|
||||
return getBoolean(SettingsFragment.NOTIFICATION_CALL_BUTTON, false);
|
||||
}
|
||||
|
||||
public boolean getDimissedReadEnabled() {
|
||||
return getBoolean(SettingsFragment.DISMISSED_READ, false);
|
||||
}
|
||||
|
||||
public void putString(String key, String value) {
|
||||
mConversationPrefs.edit().putString(key, value).apply();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.moez.QKSMS.common.formatter;
|
||||
|
||||
public interface Formatter {
|
||||
String format(String text);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.moez.QKSMS.common.formatter;
|
||||
|
||||
public class FormatterFactory {
|
||||
private static final Formatter[] FORMATTERS = {new NumberToContactFormatter()};
|
||||
|
||||
public static String format(String text) {
|
||||
for (Formatter formatter : FORMATTERS) {
|
||||
text = formatter.format(text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.moez.QKSMS.common.formatter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import com.google.i18n.phonenumbers.PhoneNumberMatch;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
|
||||
import com.moez.QKSMS.QKSMSAppBase;
|
||||
import com.moez.QKSMS.data.Contact;
|
||||
|
||||
public class NumberToContactFormatter implements Formatter {
|
||||
String mCountryIso;
|
||||
|
||||
@Override
|
||||
public String format(String text) {
|
||||
PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
|
||||
Iterable<PhoneNumberMatch> matches = phoneNumberUtil.findNumbers(text, getCurrentCountryIso());
|
||||
for (PhoneNumberMatch match : matches) {
|
||||
Contact contact = Contact.get(match.rawString(), true);
|
||||
if (contact.isNamed()) {
|
||||
String nameAndNumber = phoneNumberUtil.format(match.number(), PhoneNumberFormat.NATIONAL)
|
||||
+ " (" + contact.getName() + ")";
|
||||
text = text.replace(match.rawString(), nameAndNumber);
|
||||
} // If the contact doesn't exist yet, leave the number as-is
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public String getCurrentCountryIso() {
|
||||
if (mCountryIso == null) {
|
||||
TelephonyManager tm = (TelephonyManager) QKSMSAppBase.getApplication().getSystemService(Context.TELEPHONY_SERVICE);
|
||||
mCountryIso = tm.getNetworkCountryIso();
|
||||
// Just in case the TelephonyManager method failed, fallback to US
|
||||
if (mCountryIso == null) {
|
||||
mCountryIso = "US";
|
||||
}
|
||||
mCountryIso = mCountryIso.toUpperCase();
|
||||
}
|
||||
return mCountryIso;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class CacheManager {
|
||||
// ignore.
|
||||
}
|
||||
if (n != 0) return;
|
||||
pref.edit().putInt(KEY_CACHE_UP_TO_DATE, 1).commit();
|
||||
pref.edit().putInt(KEY_CACHE_UP_TO_DATE, 1).apply();
|
||||
|
||||
clear(context);
|
||||
}
|
||||
|
||||
@@ -137,8 +137,8 @@ public class ImageCacheService {
|
||||
|
||||
public static final long crc64Long(byte[] buffer) {
|
||||
long crc = INITIALCRC;
|
||||
for (int k = 0, n = buffer.length; k < n; ++k) {
|
||||
crc = sCrcTable[(((int) crc) ^ buffer[k]) & 0xff] ^ (crc >> 8);
|
||||
for (byte aBuffer : buffer) {
|
||||
crc = sCrcTable[(((int) crc) ^ aBuffer) & 0xff] ^ (crc >> 8);
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ThumbnailManager extends BackgroundLoaderManager {
|
||||
public ThumbnailManager(final Context context) {
|
||||
super(context);
|
||||
|
||||
mThumbnailCache = new SimpleCache<Uri, Bitmap>(8, 16, 0.75f, true);
|
||||
mThumbnailCache = new SimpleCache<>(8, 16, 0.75f, true);
|
||||
mContext = context;
|
||||
|
||||
mEmptyImageBitmap = BitmapFactory.decodeResource(context.getResources(),
|
||||
|
||||
@@ -261,6 +261,10 @@ public class Contact {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean isNamed() {
|
||||
return !TextUtils.isEmpty(mName);
|
||||
}
|
||||
|
||||
public synchronized String getNameAndNumber() {
|
||||
return mNameAndNumber;
|
||||
}
|
||||
|
||||
@@ -1247,7 +1247,7 @@ public class ExifInterface {
|
||||
if (l == null || l.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
return new Long(l[0]);
|
||||
return Long.valueOf(l[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1266,7 +1266,7 @@ public class ExifInterface {
|
||||
if (l == null || l.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
return new Integer(l[0]);
|
||||
return Integer.valueOf(l[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1285,7 +1285,7 @@ public class ExifInterface {
|
||||
if (l == null || l.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
return new Byte(l[0]);
|
||||
return Byte.valueOf(l[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -474,6 +474,7 @@ public class NotificationManager {
|
||||
.addAction(R.drawable.ic_accept, sRes.getString(R.string.read), readPI)
|
||||
.extend(WearableIntentReceiver.getSingleConversationExtender(context, message.mContact, message.mAddress, threadId))
|
||||
.setDeleteIntent(seenPI);
|
||||
if (conversationPrefs.getDimissedReadEnabled()){builder.setDeleteIntent(readPI);}
|
||||
|
||||
if (conversationPrefs.getCallButtonEnabled()) {
|
||||
Intent callIntent = new Intent(Intent.ACTION_CALL);
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.moez.QKSMS.transaction.SmsHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -95,7 +94,7 @@ public class DeliveryReportHelper {
|
||||
public List<DeliveryReportItem> getListItems() {
|
||||
List<DeliveryReportItem> items = getReportItems();
|
||||
if (items == null) {
|
||||
items = new ArrayList<DeliveryReportItem>(1);
|
||||
items = new ArrayList<>(1);
|
||||
items.add(new DeliveryReportItem("", mContext.getString(R.string.status_none), null));
|
||||
Log.w(LOG_TAG, "cursor == null");
|
||||
}
|
||||
@@ -191,15 +190,12 @@ public class DeliveryReportHelper {
|
||||
private static MmsReportStatus queryStatusByRecipient(
|
||||
Map<String, MmsReportStatus> status, String recipient) {
|
||||
Set<String> recipientSet = status.keySet();
|
||||
Iterator<String> iterator = recipientSet.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String r = iterator.next();
|
||||
for (String r : recipientSet) {
|
||||
if (SmsHelper.isEmailAddress(recipient)) {
|
||||
if (TextUtils.equals(r, recipient)) {
|
||||
return status.get(r);
|
||||
}
|
||||
}
|
||||
else if (PhoneNumberUtils.compare(r, recipient)) {
|
||||
} else if (PhoneNumberUtils.compare(r, recipient)) {
|
||||
return status.get(r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class QKDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
public QKDialog buildMenu(final OnItemClickListener onItemClickListener) {
|
||||
ArrayAdapter adapter = new ArrayAdapter<String>(mContext, R.layout.list_item_simple, mMenuItems);
|
||||
ArrayAdapter adapter = new ArrayAdapter<>(mContext, R.layout.list_item_simple, mMenuItems);
|
||||
ListView listView = new ListView(mContext);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setDivider(null);
|
||||
@@ -256,7 +256,7 @@ public class QKDialog extends DialogFragment {
|
||||
}
|
||||
|
||||
public QKDialog setItems(String[] items, final OnItemClickListener onClickListener) {
|
||||
ArrayAdapter adapter = new ArrayAdapter<String>(mContext, R.layout.list_item_simple, items);
|
||||
ArrayAdapter adapter = new ArrayAdapter<>(mContext, R.layout.list_item_simple, items);
|
||||
ListView listView = new ListView(mContext);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setDivider(null);
|
||||
|
||||
@@ -301,7 +301,7 @@ public class QKDialogFragment extends DialogFragment {
|
||||
}
|
||||
|
||||
public QKDialogFragment setItems(String[] items) {
|
||||
ArrayAdapter adapter = new ArrayAdapter<String>(mContext, R.layout.list_item_simple, items);
|
||||
ArrayAdapter adapter = new ArrayAdapter<>(mContext, R.layout.list_item_simple, items);
|
||||
ListView listView = new ListView(mContext);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setDivider(null);
|
||||
|
||||
@@ -36,9 +36,9 @@ import com.google.android.mms.pdu_alt.NotificationInd;
|
||||
import com.google.android.mms.pdu_alt.PduHeaders;
|
||||
import com.google.android.mms.pdu_alt.PduPersister;
|
||||
import com.google.android.mms.pdu_alt.RetrieveConf;
|
||||
import com.google.android.mms.pdu_alt.SendReq;
|
||||
import com.moez.QKSMS.QKSMSApp;
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.common.formatter.FormatterFactory;
|
||||
import com.moez.QKSMS.data.Contact;
|
||||
import com.moez.QKSMS.model.SlideModel;
|
||||
import com.moez.QKSMS.model.SlideshowModel;
|
||||
@@ -152,6 +152,7 @@ public class MessageItem {
|
||||
mContact = Contact.get(mAddress, canBlock).getName();
|
||||
}
|
||||
mBody = cursor.getString(columnsMap.mColumnSmsBody);
|
||||
mBody = FormatterFactory.format(mBody);
|
||||
|
||||
// Unless the message is currently in the progress of being sent, it gets a time stamp.
|
||||
if (!isOutgoingMessage()) {
|
||||
@@ -383,7 +384,7 @@ public class MessageItem {
|
||||
// Use constant string for outgoing messages
|
||||
mContact = mAddress =
|
||||
mContext.getString(R.string.messagelist_sender_self);
|
||||
timestamp = msg == null ? 0 : ((SendReq) msg).getDate() * 1000L;
|
||||
timestamp = msg == null ? 0 : msg.getDate() * 1000L;
|
||||
}
|
||||
|
||||
SlideModel slide = mSlideshow == null ? null : mSlideshow.get(0);
|
||||
|
||||
@@ -150,7 +150,7 @@ public class SlideshowActivity extends QKActivity implements EventListener {
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
// Play slide-show in full-screen mode.
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
super.onCreate(icicle);
|
||||
mHandler = new Handler();
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
|
||||
public static final String MMS_CONTACT_SUPPORT = "pref_key_mms_contact_support";
|
||||
public static final String SIMPLE_PREFS = "pref_key_simple";
|
||||
public static final String DONATE = "pref_key_donate";
|
||||
public static final String DISMISSED_READ = "pref_key_dismiss_read";
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@@ -479,7 +480,10 @@ public class SettingsFragment extends PreferenceFragment implements Preference.O
|
||||
case DELAY_DURATION:
|
||||
try {
|
||||
int duration = Integer.parseInt((String) newValue);
|
||||
if (duration < 1 || duration > 30) throw new Exception("Duration out of bounds");
|
||||
|
||||
if (duration < 1 || duration > 30)
|
||||
throw new Exception("Duration out of bounds");
|
||||
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(mContext, R.string.delayed_duration_bounds_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@@ -194,18 +194,26 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
|
||||
switch (Integer.parseInt(mPrefs.getString(SettingsFragment.ENTER_BUTTON, "0"))) {
|
||||
case 0: // emoji
|
||||
break;
|
||||
case 1: // return
|
||||
case 1: // new line
|
||||
mReplyText.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE |
|
||||
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
|
||||
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES |
|
||||
InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE);
|
||||
mReplyText.setSingleLine(false);
|
||||
break;
|
||||
case 2: // send
|
||||
mReplyText.setInputType(
|
||||
mReplyText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
mReplyText.setInputType(InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
|
||||
mReplyText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI |
|
||||
EditorInfo.IME_ACTION_SEND);
|
||||
mReplyText.setSingleLine(false);
|
||||
mReplyText.setOnKeyListener(new OnKeyListener() { //Workaround because ACTION_SEND does not support multiline mode
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode == 66) {
|
||||
sendSms();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -228,18 +236,6 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
|
||||
}
|
||||
});
|
||||
|
||||
mReplyText.setOnEditorActionListener(new android.widget.TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(android.widget.TextView v, int actionId, KeyEvent event) {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
||||
sendSms();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mProgressAnimator = new ValueAnimator();
|
||||
mProgressAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
mProgressAnimator.setDuration(mDelayDuration);
|
||||
@@ -460,7 +456,9 @@ public class ComposeView extends LinearLayout implements View.OnClickListener, L
|
||||
}
|
||||
|
||||
long threadId = mConversation != null ? mConversation.getThreadId() : 0;
|
||||
sendTransaction.sendNewMessage(message, threadId);
|
||||
if (!message.toString().equals("")) {
|
||||
sendTransaction.sendNewMessage(message, threadId);
|
||||
}
|
||||
NotificationManager.update(mContext);
|
||||
|
||||
if (mConversationLegacy != null) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DemoConversationCursorLoader extends Loader<Cursor> {
|
||||
ArrayList<MessageData> candidates = new ArrayList<>();
|
||||
|
||||
if (THREAD_ID_WELCOME_SCREEN == mThreadId) {
|
||||
candidates = new ArrayList<MessageData>();
|
||||
candidates = new ArrayList<>();
|
||||
long time = System.currentTimeMillis() - 50000;
|
||||
candidates.add(new MessageData(
|
||||
"sms", 0, mThreadId, "QKSMS",
|
||||
|
||||
@@ -176,6 +176,6 @@ public class WelcomeActivity extends QKActivity implements ViewPager.OnPageChang
|
||||
|
||||
SharedPreferences.Editor prefs = PreferenceManager.getDefaultSharedPreferences(this).edit();
|
||||
prefs.putBoolean(SettingsFragment.WELCOME_SEEN, true);
|
||||
prefs.commit();
|
||||
prefs.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.moez.QKSMS.ui.widget;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
@@ -23,8 +24,10 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.ui.MainActivity;
|
||||
import com.moez.QKSMS.ui.ThemeManager;
|
||||
@@ -45,7 +48,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||
ThemeManager.loadThemeProperties(context);
|
||||
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
updateWidget(context, appWidgetId);
|
||||
updateWidget(context, appWidgetId, isSmallWidget(appWidgetManager, appWidgetId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +72,40 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update widget when widget size changes
|
||||
*/
|
||||
@Override
|
||||
public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager,
|
||||
int appWidgetId, Bundle newOptions) {
|
||||
Log.v("TAG", "Changed widget dimensions");
|
||||
updateWidget(context, appWidgetId, isSmallWidget(appWidgetManager,appWidgetId));
|
||||
|
||||
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 1 when widget has less than 4 columns, else 0
|
||||
*/
|
||||
@TargetApi(16)
|
||||
private static int isSmallWidget(AppWidgetManager appWidgetManager, int appWidgetId) {
|
||||
|
||||
Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
||||
int size = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
|
||||
int n = 2;
|
||||
while (70 * n - 30 < size) {
|
||||
++n;
|
||||
}
|
||||
int columns = n - 1;
|
||||
|
||||
if (columns < 4) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the widget appWidgetId
|
||||
*/
|
||||
private static void updateWidget(Context context, int appWidgetId) {
|
||||
private static void updateWidget(Context context, int appWidgetId, int smallWidget) {
|
||||
Log.v(TAG, "updateWidget appWidgetId: " + appWidgetId);
|
||||
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
|
||||
PendingIntent clickIntent;
|
||||
@@ -80,8 +113,9 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||
// Launch an intent to avoid ANRs
|
||||
final Intent intent = new Intent(context, WidgetService.class);
|
||||
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
||||
intent.putExtra("small_widget", smallWidget);
|
||||
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
|
||||
remoteViews.setRemoteAdapter(appWidgetId, R.id.conversation_list, intent);
|
||||
remoteViews.setRemoteAdapter(R.id.conversation_list, intent);
|
||||
|
||||
remoteViews.setTextViewText(R.id.widget_label, context.getString(R.string.title_conversation_list));
|
||||
remoteViews.setTextColor(R.id.widget_label, ThemeManager.getTextOnColorPrimary());
|
||||
@@ -125,7 +159,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
||||
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, WidgetProvider.class));
|
||||
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
updateWidget(context, appWidgetId);
|
||||
updateWidget(context, appWidgetId, isSmallWidget(appWidgetManager, appWidgetId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,13 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.RemoteViews;
|
||||
import android.widget.RemoteViewsService;
|
||||
|
||||
import com.moez.QKSMS.R;
|
||||
import com.moez.QKSMS.data.ContactHelper;
|
||||
import com.moez.QKSMS.data.Conversation;
|
||||
import com.moez.QKSMS.common.ConversationPrefsHelper;
|
||||
import com.moez.QKSMS.common.utils.ImageUtils;
|
||||
import com.moez.QKSMS.common.utils.MessageUtils;
|
||||
import com.moez.QKSMS.data.ContactHelper;
|
||||
import com.moez.QKSMS.data.Conversation;
|
||||
import com.moez.QKSMS.ui.MainActivity;
|
||||
import com.moez.QKSMS.ui.ThemeManager;
|
||||
|
||||
@@ -62,6 +63,7 @@ public class WidgetService extends RemoteViewsService {
|
||||
private static final int MAX_CONVERSATIONS_COUNT = 25;
|
||||
private final Context mContext;
|
||||
private final int mAppWidgetId;
|
||||
private final int mSmallWidget;
|
||||
private boolean mShouldShowViewMore;
|
||||
private Cursor mConversationCursor;
|
||||
private int mUnreadConvCount;
|
||||
@@ -70,6 +72,7 @@ public class WidgetService extends RemoteViewsService {
|
||||
public WidgetFactory(Context context, Intent intent) {
|
||||
mContext = context;
|
||||
mAppWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
|
||||
mSmallWidget = intent.getIntExtra("small_widget", 0);
|
||||
mAppWidgetManager = AppWidgetManager.getInstance(context);
|
||||
Log.v(TAG, "WidgetFactory intent: " + intent + "widget id: " + mAppWidgetId);
|
||||
}
|
||||
@@ -190,8 +193,11 @@ public class WidgetService extends RemoteViewsService {
|
||||
|
||||
Conversation conversation = Conversation.from(mContext, mConversationCursor);
|
||||
RemoteViews remoteViews = new RemoteViews(mContext.getPackageName(), R.layout.list_item_conversation_widget);
|
||||
|
||||
bindAvatar(remoteViews, conversation);
|
||||
if (mSmallWidget == 0) {
|
||||
remoteViews.setViewVisibility(R.id.avatar, View.VISIBLE);
|
||||
bindAvatar(remoteViews, conversation);
|
||||
}
|
||||
else remoteViews.setViewVisibility(R.id.avatar, View.GONE);
|
||||
bindIndicators(remoteViews, conversation);
|
||||
bindDate(remoteViews, conversation);
|
||||
bindName(remoteViews, conversation);
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
<string name="pref_vibration_summary">Vibrate when new messages are received</string>
|
||||
<string name="pref_notification_call">Call button</string>
|
||||
<string name="pref_notification_call_summary">Call the sender of a message right from the notification</string>
|
||||
<string name="pref_dimiss_read">Mark as read</string>
|
||||
<string name="pref_dismiss_read_summary">Mark message as read when notification is cleared</string>
|
||||
|
||||
<string name="pref_delayed">Delayed messaging</string>
|
||||
<string name="pref_delayed_summary">Wait before sending your messages, so you have a chance to review them</string>
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<Preference
|
||||
android:defaultValue="false"
|
||||
android:key="pref_key_notification_call" />
|
||||
<Preference
|
||||
android:defaultValue="false"
|
||||
android:key="pref_key_dismiss_read" />
|
||||
|
||||
<!-- QKSMS+ -->
|
||||
<Preference
|
||||
|
||||
@@ -71,5 +71,13 @@
|
||||
android:summary="@string/pref_notification_call_summary"
|
||||
android:title="@string/pref_notification_call"
|
||||
android:widgetLayout="@layout/view_checkbox" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:dependency="pref_key_notifications"
|
||||
android:key="pref_key_dismiss_read"
|
||||
android:layout="@layout/list_item_preference"
|
||||
android:summary="@string/pref_dismiss_read_summary"
|
||||
android:title="@string/pref_dimiss_read"
|
||||
android:widgetLayout="@layout/view_checkbox" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:initialLayout="@layout/widget"
|
||||
android:minHeight="220dp"
|
||||
android:minWidth="220dp"
|
||||
android:minHeight="110dp"
|
||||
android:minWidth="180dp"
|
||||
android:previewImage="@mipmap/ic_launcher_teal"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# QKSMS
|
||||
|
||||
QKSMS is an open source replacement to the [stock messaging app](https://github.com/android/platform_packages_apps_mms) on Android. It is currently available on the Google Play Store
|
||||
QKSMS is an open source replacement to the [stock messaging app](https://github.com/android/platform_packages_apps_mms) on Android. It is currently available on the Google Play Store.
|
||||
|
||||
[](https://travis-ci.org/qklabs/qksms)
|
||||
|
||||
@@ -13,31 +13,31 @@ QKSMS is an open source replacement to the [stock messaging app](https://github.
|
||||
|
||||
# Contributing to QKSMS
|
||||
|
||||
We highly encourage contributions to QKSMS; we want to make it as easy and streamlined as possible. If you have any suggestions on how we can improve our workflow, please feel free to contact me
|
||||
We highly encourage contributions to QKSMS; we want to make it as easy and streamlined as possible. If you have any suggestions on how we can improve our workflow, please feel free to contact me.
|
||||
|
||||
Quite a bit of old code still needs to be cleaned up and refactored, so keep that in mind as you're digging through the source. If you find something that's just really crappy, let me know and I'll put it higher up on my list of stuff to clean up. I'll be focusing on improving code quality of existing code over the next couple weeks
|
||||
Quite a bit of old code still needs to be cleaned up and refactored, so keep that in mind as you're digging through the source. If you find something that's just really crappy, let me know and I'll put it higher up on my list of stuff to clean up. I'll be focusing on improving code quality of existing code over the next couple weeks.
|
||||
|
||||
### Collaboration
|
||||
|
||||
We use GitHub issues to keep track of bugs and feature requests, but we communicate using [Slack](https://qklabs.slack.com/). To join the Slack group, send an email to team@qklabs.com with the subject `QK Labs Slack Invite` (no need to enter a body, we'll send an invite to your email address). If you plan on contributing at some point, we highly recommend joining the slack group because it gives you a direct way to communicate with the rest of the contributors
|
||||
We use GitHub issues to keep track of bugs and feature requests, but we communicate using [Slack](https://qklabs.slack.com/). To join the Slack group, send an email to team@qklabs.com with the subject `QK Labs Slack Invite` (no need to enter a body, we'll send an invite to your email address). If you plan on contributing at some point, we highly recommend joining the slack group because it gives you a direct way to communicate with the rest of the contributors.
|
||||
|
||||
### Funds
|
||||
|
||||
If you'd like to donate to help support the project, you can donate via [PayPal here](http://bit.ly/QKSMSDonation)
|
||||
If you'd like to donate to help support the project, you can donate via [PayPal here](http://bit.ly/QKSMSDonation).
|
||||
|
||||
### Translations
|
||||
|
||||
Please do not perform translations directly on the source files. Pull requests for translations will not be accepted. If you would like to do translations for QKSMS, join the translation project on Crowdin: https://crowdin.com/project/qksms
|
||||
Please do not perform translations directly on the source files. Pull requests for translations will not be accepted. If you would like to do translations for QKSMS, join the translation project on Crowdin: https://crowdin.com/project/qksms.
|
||||
|
||||
### Development
|
||||
|
||||
We encourage you to make pull requests. Whenever you make one, we'll review the code and test it to make sure that it fits the code style guidelines, and achieves what the pull request intends. We'll discuss any problems or potential improvements, and we'll merge it when we're both (or any number of willing participants) happy with the code
|
||||
We encourage you to make pull requests. Whenever you make one, we'll review the code and test it to make sure that it fits the code style guidelines, and achieves what the pull request intends. We'll discuss any problems or potential improvements, and we'll merge it when we're both (or any number of willing participants) happy with the code.
|
||||
|
||||
If you're new, we recommend that you look through the issues and try to fix some of the more simple sounding bugs to familiarize yourself with the codebase
|
||||
If you're new, we recommend that you look through the issues and try to fix some of the more simple sounding bugs to familiarize yourself with the codebase.
|
||||
|
||||
If you'd like to work on a new feature, please create an issue so we can discuss the idea together before implementation begins.
|
||||
|
||||
To learn about pull requests, please refer to the following guide: https://help.github.com/articles/using-pull-requests/
|
||||
To learn about pull requests, please refer to the following guide: https://help.github.com/articles/using-pull-requests/.
|
||||
|
||||
### Code style
|
||||
|
||||
@@ -45,7 +45,7 @@ We follow the code style guidelines set by Google for contributors to AOSP: http
|
||||
|
||||
The current codebase is far from being 100% at this standard, but updating existing code to follow the unified guidelines can be a good way to introduce yourself to the codebase and start getting familiar with it.
|
||||
|
||||
Any new code written should follow these guidelines
|
||||
Any new code written should follow these guidelines.
|
||||
|
||||
# Bug Reports / Feature Requests
|
||||
|
||||
@@ -103,4 +103,4 @@ QKSMS is developed and maintained by [Moez Bhatti](https://github.com/moezbhatti
|
||||
|
||||
# License
|
||||
|
||||
QKSMS is released under the **The GNU General Public License v3.0 (GPLv3)**, which can be found in the `LICENSE` file in the root of this project
|
||||
QKSMS is released under the **The GNU General Public License v3.0 (GPLv3)**, which can be found in the `LICENSE` file in the root of this project.
|
||||
|
||||
Reference in New Issue
Block a user