forked from upstream-mirrors/quik
Remove obsolete checks for API 23
This commit is contained in:
@@ -551,15 +551,11 @@ public class MmsConfig {
|
||||
final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(
|
||||
Context.TELEPHONY_SERVICE);
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
try {
|
||||
Method method = telephonyManager.getClass().getMethod("getLine1NumberForSubscriber", int.class);
|
||||
return (String) method.invoke(telephonyManager, subId);
|
||||
} catch (Exception e) {
|
||||
return telephonyManager.getLine1Number();
|
||||
} else {
|
||||
try {
|
||||
Method method = telephonyManager.getClass().getMethod("getLine1NumberForSubscriber", int.class);
|
||||
return (String) method.invoke(telephonyManager, subId);
|
||||
} catch (Exception e) {
|
||||
return telephonyManager.getLine1Number();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,16 +577,12 @@ public class MmsConfig {
|
||||
|
||||
String nai = "";
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
try {
|
||||
Method method = telephonyManager.getClass().getMethod("getNai", int.class);
|
||||
Method getSlotId = SubscriptionManager.class.getMethod("getSlotId", int.class);
|
||||
nai = (String) method.invoke(telephonyManager, getSlotId.invoke(null, subId));
|
||||
} catch (Exception e) {
|
||||
nai = SystemPropertiesProxy.get(context, "persist.radio.cdma.nai");
|
||||
} else {
|
||||
try {
|
||||
Method method = telephonyManager.getClass().getMethod("getNai", int.class);
|
||||
Method getSlotId = SubscriptionManager.class.getMethod("getSlotId", int.class);
|
||||
nai = (String) method.invoke(telephonyManager, getSlotId.invoke(null, subId));
|
||||
} catch (Exception e) {
|
||||
nai = SystemPropertiesProxy.get(context, "persist.radio.cdma.nai");
|
||||
}
|
||||
}
|
||||
|
||||
Timber.v("MmsConfig.getNai: nai=" + nai);
|
||||
|
||||
@@ -73,24 +73,19 @@ public class MmsConfigManager {
|
||||
public void init(final Context context) {
|
||||
mContext = context;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
mSubscriptionManager = SubscriptionManager.from(context);
|
||||
mSubscriptionManager = SubscriptionManager.from(context);
|
||||
|
||||
// TODO: When this object "finishes" we should unregister.
|
||||
IntentFilter intentFilterLoaded =
|
||||
new IntentFilter("LOADED");
|
||||
// TODO: When this object "finishes" we should unregister.
|
||||
IntentFilter intentFilterLoaded = new IntentFilter("LOADED");
|
||||
|
||||
try {
|
||||
context.registerReceiver(mReceiver, intentFilterLoaded);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
context.registerReceiver(mReceiver, intentFilterLoaded);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
load(context);
|
||||
} else {
|
||||
load(context);
|
||||
}
|
||||
|
||||
load(context);
|
||||
|
||||
// TODO: When this object "finishes" we should unregister by invoking
|
||||
// SubscriptionManager.getInstance(mContext).unregister(mOnSubscriptionsChangedListener);
|
||||
// This is not strictly necessary because it will be unregistered if the
|
||||
@@ -151,39 +146,37 @@ public class MmsConfigManager {
|
||||
*
|
||||
*/
|
||||
private void load(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
List<SubscriptionInfo> subs = mSubscriptionManager.getActiveSubscriptionInfoList();
|
||||
if (subs == null || subs.size() < 1) {
|
||||
Timber.e("MmsConfigManager.load -- empty getActiveSubInfoList");
|
||||
return;
|
||||
}
|
||||
// Load all the mms_config.xml files in a separate map and then swap with the
|
||||
// real map at the end so we don't block anyone sync'd on the real map.
|
||||
final Map<Integer, MmsConfig> newConfigMap = new ArrayMap<Integer, MmsConfig>();
|
||||
for (SubscriptionInfo sub : subs) {
|
||||
Configuration configuration = new Configuration();
|
||||
if (sub.getMcc() == 0 && sub.getMnc() == 0) {
|
||||
Configuration config = mContext.getResources().getConfiguration();
|
||||
configuration.mcc = config.mcc;
|
||||
configuration.mnc = config.mnc;
|
||||
Timber.i("MmsConfigManager.load -- no mcc/mnc for sub: " + sub +
|
||||
" using mcc/mnc from main context: " + configuration.mcc + "/" +
|
||||
configuration.mnc);
|
||||
} else {
|
||||
Timber.i("MmsConfigManager.load -- mcc/mnc for sub: " + sub);
|
||||
List<SubscriptionInfo> subs = mSubscriptionManager.getActiveSubscriptionInfoList();
|
||||
if (subs == null || subs.size() < 1) {
|
||||
Timber.e("MmsConfigManager.load -- empty getActiveSubInfoList");
|
||||
return;
|
||||
}
|
||||
// Load all the mms_config.xml files in a separate map and then swap with the
|
||||
// real map at the end so we don't block anyone sync'd on the real map.
|
||||
final Map<Integer, MmsConfig> newConfigMap = new ArrayMap<Integer, MmsConfig>();
|
||||
for (SubscriptionInfo sub : subs) {
|
||||
Configuration configuration = new Configuration();
|
||||
if (sub.getMcc() == 0 && sub.getMnc() == 0) {
|
||||
Configuration config = mContext.getResources().getConfiguration();
|
||||
configuration.mcc = config.mcc;
|
||||
configuration.mnc = config.mnc;
|
||||
Timber.i("MmsConfigManager.load -- no mcc/mnc for sub: " + sub +
|
||||
" using mcc/mnc from main context: " + configuration.mcc + "/" +
|
||||
configuration.mnc);
|
||||
} else {
|
||||
Timber.i("MmsConfigManager.load -- mcc/mnc for sub: " + sub);
|
||||
|
||||
configuration.mcc = sub.getMcc();
|
||||
configuration.mnc = sub.getMnc();
|
||||
}
|
||||
Context subContext = context.createConfigurationContext(configuration);
|
||||
configuration.mcc = sub.getMcc();
|
||||
configuration.mnc = sub.getMnc();
|
||||
}
|
||||
Context subContext = context.createConfigurationContext(configuration);
|
||||
|
||||
int subId = sub.getSubscriptionId();
|
||||
newConfigMap.put(subId, new MmsConfig(subContext, subId));
|
||||
}
|
||||
synchronized (mSubIdConfigMap) {
|
||||
mSubIdConfigMap.clear();
|
||||
mSubIdConfigMap.putAll(newConfigMap);
|
||||
}
|
||||
int subId = sub.getSubscriptionId();
|
||||
newConfigMap.put(subId, new MmsConfig(subContext, subId));
|
||||
}
|
||||
synchronized (mSubIdConfigMap) {
|
||||
mSubIdConfigMap.clear();
|
||||
mSubIdConfigMap.putAll(newConfigMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,18 +87,11 @@ public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
|
||||
mSubId = subId;
|
||||
|
||||
if (!MmsRequest.useWifi(context)) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
mNetworkRequest = new NetworkRequest.Builder()
|
||||
.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
|
||||
.addCapability(NetworkCapabilities.NET_CAPABILITY_MMS)
|
||||
.setNetworkSpecifier(Integer.toString(mSubId))
|
||||
.build();
|
||||
} else {
|
||||
mNetworkRequest = new NetworkRequest.Builder()
|
||||
.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
|
||||
.addCapability(NetworkCapabilities.NET_CAPABILITY_MMS)
|
||||
.build();
|
||||
}
|
||||
mNetworkRequest = new NetworkRequest.Builder()
|
||||
.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
|
||||
.addCapability(NetworkCapabilities.NET_CAPABILITY_MMS)
|
||||
.setNetworkSpecifier(Integer.toString(mSubId))
|
||||
.build();
|
||||
} else {
|
||||
mNetworkRequest = new NetworkRequest.Builder()
|
||||
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
|
||||
|
||||
@@ -104,12 +104,8 @@ public abstract class MmsRequest {
|
||||
private boolean ensureMmsConfigLoaded() {
|
||||
if (mMmsConfig == null) {
|
||||
final MmsConfig config;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
// Not yet retrieved from mms config manager. Try getting it.
|
||||
config = MmsConfigManager.getInstance().getMmsConfigBySubId(mSubId);
|
||||
} else {
|
||||
config = MmsConfigManager.getInstance().getMmsConfig();
|
||||
}
|
||||
// Not yet retrieved from mms config manager. Try getting it.
|
||||
config = MmsConfigManager.getInstance().getMmsConfigBySubId(mSubId);
|
||||
|
||||
if (config != null) {
|
||||
mMmsConfig = new MmsConfig.Overridden(config, mMmsConfigOverrides);
|
||||
@@ -167,11 +163,7 @@ public abstract class MmsRequest {
|
||||
result = SmsManager.MMS_ERROR_IO_ERROR;
|
||||
} else if (!isDataNetworkAvailable(context, mSubId)) {
|
||||
Timber.e("MmsRequest: in airplane mode or mobile data disabled");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
result = SmsManager.MMS_ERROR_NO_DATA_NETWORK;
|
||||
} else {
|
||||
result = 8;
|
||||
}
|
||||
result = SmsManager.MMS_ERROR_NO_DATA_NETWORK;
|
||||
} else { // Execute
|
||||
long retryDelaySecs = 2;
|
||||
// Try multiple times of MMS HTTP request
|
||||
@@ -268,11 +260,7 @@ public abstract class MmsRequest {
|
||||
fillIn.putExtra("uri", messageUri.toString());
|
||||
}
|
||||
if (result == SmsManager.MMS_ERROR_HTTP_FAILURE && httpStatusCode != 0) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
fillIn.putExtra(SmsManager.EXTRA_MMS_HTTP_STATUS, httpStatusCode);
|
||||
} else {
|
||||
fillIn.putExtra("android.telephony.extra.MMS_HTTP_STATUS", httpStatusCode);
|
||||
}
|
||||
fillIn.putExtra(SmsManager.EXTRA_MMS_HTTP_STATUS, httpStatusCode);
|
||||
}
|
||||
try {
|
||||
if (!succeeded) {
|
||||
|
||||
+13
-15
@@ -16,21 +16,19 @@ class SubscriptionIdChecker {
|
||||
|
||||
// I met a device which does not have Telephony.Mms.SUBSCRIPTION_ID event if it's API Level is 22.
|
||||
private void check(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
Cursor c = null;
|
||||
try {
|
||||
c = SqliteWrapper.query(context, context.getContentResolver(),
|
||||
Telephony.Mms.CONTENT_URI,
|
||||
new String[]{Telephony.Mms.SUBSCRIPTION_ID}, null, null, null);
|
||||
if (c != null) {
|
||||
mCanUseSubscriptionId = true;
|
||||
}
|
||||
} catch (SQLiteException e) {
|
||||
Timber.e("SubscriptionIdChecker.check() fail");
|
||||
} finally {
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
Cursor c = null;
|
||||
try {
|
||||
c = SqliteWrapper.query(context, context.getContentResolver(),
|
||||
Telephony.Mms.CONTENT_URI,
|
||||
new String[]{Telephony.Mms.SUBSCRIPTION_ID}, null, null, null);
|
||||
if (c != null) {
|
||||
mCanUseSubscriptionId = true;
|
||||
}
|
||||
} catch (SQLiteException e) {
|
||||
Timber.e("SubscriptionIdChecker.check() fail");
|
||||
} finally {
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,11 +539,6 @@ public class TransactionService extends Service implements Observer {
|
||||
|
||||
// cancel timer for renewal of lease
|
||||
mServiceHandler.removeMessages(EVENT_CONTINUE_MMS_CONNECTIVITY);
|
||||
if (mConnMgr != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
mConnMgr.stopUsingNetworkFeature(
|
||||
ConnectivityManager.TYPE_MOBILE,
|
||||
"enableMMS");
|
||||
}
|
||||
} finally {
|
||||
releaseWakeLock();
|
||||
}
|
||||
|
||||
@@ -1604,8 +1604,6 @@ public class PduPersister {
|
||||
* Check if read permissions for SMS have been granted
|
||||
*/
|
||||
private boolean checkReadSmsPermissions() {
|
||||
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M ||
|
||||
mContext.checkSelfPermission(Manifest.permission.READ_SMS) ==
|
||||
PackageManager.PERMISSION_GRANTED;
|
||||
return mContext.checkSelfPermission(Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ object SmsManagerFactory {
|
||||
fun createSmsManager(subscriptionId: Int): SmsManager {
|
||||
var manager: SmsManager? = null
|
||||
|
||||
if (subscriptionId != -1 && Build.VERSION.SDK_INT >= 22) {
|
||||
if (subscriptionId != -1) {
|
||||
try {
|
||||
manager = SmsManager.getSmsManagerForSubscriptionId(subscriptionId)
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -59,14 +59,9 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static <T> T ensureRouteToMmsNetwork(Context context, String url, String proxy, Task<T> task) throws IOException {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
return ensureRouteToMmsNetworkMarshmallow(context, task);
|
||||
} else {
|
||||
return ensureRouteToMmsNetworkLollipop(context, task);
|
||||
}
|
||||
return ensureRouteToMmsNetworkMarshmallow(context, task);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.M)
|
||||
private static <T> T ensureRouteToMmsNetworkMarshmallow(Context context, Task<T> task) throws IOException {
|
||||
final MmsNetworkManager networkManager = new MmsNetworkManager(context.getApplicationContext(), Utils.getDefaultSubscriptionId());
|
||||
final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
@@ -85,24 +80,6 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private static <T> T ensureRouteToMmsNetworkLollipop(Context context, Task<T> task) throws IOException {
|
||||
final MmsNetworkManager networkManager = new MmsNetworkManager(context.getApplicationContext(), Utils.getDefaultSubscriptionId());
|
||||
Network network = null;
|
||||
try {
|
||||
network = networkManager.acquireNetwork();
|
||||
ConnectivityManager.setProcessDefaultNetwork(network);
|
||||
return task.run();
|
||||
} catch (MmsNetworkException e) {
|
||||
throw new IOException(e);
|
||||
} finally {
|
||||
if (network != null) {
|
||||
ConnectivityManager.setProcessDefaultNetwork(null);
|
||||
}
|
||||
networkManager.releaseNetwork();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the host MMSC is reachable
|
||||
*
|
||||
@@ -381,10 +358,6 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static int getDefaultSubscriptionId() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
return SmsManager.getDefaultSmsSubscriptionId();
|
||||
} else {
|
||||
return DEFAULT_SUBSCRIPTION_ID;
|
||||
}
|
||||
return SmsManager.getDefaultSmsSubscriptionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,28 +42,7 @@ object TelephonyCompat {
|
||||
}
|
||||
|
||||
fun getOrCreateThreadId(context: Context, recipients: Collection<String>): Long {
|
||||
return if (Build.VERSION.SDK_INT >= 23) {
|
||||
Telephony.Threads.getOrCreateThreadId(context, recipients.toSet())
|
||||
} else {
|
||||
val uriBuilder = THREAD_ID_CONTENT_URI.buildUpon()
|
||||
|
||||
recipients
|
||||
.map { recipient -> if (isEmailAddress(recipient)) extractAddrSpec(recipient) else recipient }
|
||||
.forEach { recipient -> uriBuilder.appendQueryParameter("recipient", recipient) }
|
||||
|
||||
val uri = uriBuilder.build()
|
||||
|
||||
SqliteWrapper.query(context, context.contentResolver, uri, ID_PROJECTION, null, null, null)?.use { cursor ->
|
||||
if (cursor.moveToFirst()) {
|
||||
return cursor.getLong(0)
|
||||
} else {
|
||||
Timber.e("getOrCreateThreadId returned no rows!")
|
||||
}
|
||||
}
|
||||
|
||||
Timber.e("getOrCreateThreadId failed with " + recipients.size + " recipients")
|
||||
throw IllegalArgumentException("Unable to find or allocate a thread ID.")
|
||||
}
|
||||
return Telephony.Threads.getOrCreateThreadId(context, recipients.toSet())
|
||||
}
|
||||
|
||||
fun extractAddrSpec(address: String): String {
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.annotation.TargetApi
|
||||
import android.os.Build
|
||||
import android.telephony.SubscriptionInfo
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
|
||||
data class SubscriptionInfoCompat(private val subscriptionInfo: SubscriptionInfo) {
|
||||
|
||||
val subscriptionId get() = subscriptionInfo.subscriptionId
|
||||
|
||||
@@ -31,36 +31,29 @@ class SubscriptionManagerCompat @Inject constructor(context: Context, private va
|
||||
|
||||
val activeSubscriptionInfoList: List<SubscriptionInfoCompat>
|
||||
get() {
|
||||
return if (Build.VERSION.SDK_INT >= 22) {
|
||||
subscriptionManager?.activeSubscriptionInfoList?.map { SubscriptionInfoCompat(it) } ?: listOf()
|
||||
} else listOf()
|
||||
return subscriptionManager?.activeSubscriptionInfoList?.map { SubscriptionInfoCompat(it) } ?: listOf()
|
||||
}
|
||||
|
||||
init {
|
||||
subscriptionManager = if (Build.VERSION.SDK_INT >= 22) SubscriptionManager.from(context) else null
|
||||
subscriptionManager = SubscriptionManager.from(context)
|
||||
}
|
||||
|
||||
fun addOnSubscriptionsChangedListener(listener: OnSubscriptionsChangedListener) {
|
||||
if (Build.VERSION.SDK_INT >= 22) {
|
||||
subscriptionManager?.addOnSubscriptionsChangedListener(listener.listener)
|
||||
}
|
||||
subscriptionManager?.addOnSubscriptionsChangedListener(listener.listener)
|
||||
}
|
||||
|
||||
fun removeOnSubscriptionsChangedListener(listener: OnSubscriptionsChangedListener) {
|
||||
if (Build.VERSION.SDK_INT >= 22) {
|
||||
subscriptionManager?.removeOnSubscriptionsChangedListener(listener.listener)
|
||||
}
|
||||
subscriptionManager?.removeOnSubscriptionsChangedListener(listener.listener)
|
||||
}
|
||||
|
||||
abstract class OnSubscriptionsChangedListener {
|
||||
|
||||
val listener: SubscriptionManager.OnSubscriptionsChangedListener? = if (Build.VERSION.SDK_INT >= 22) {
|
||||
val listener: SubscriptionManager.OnSubscriptionsChangedListener? =
|
||||
object : SubscriptionManager.OnSubscriptionsChangedListener() {
|
||||
override fun onSubscriptionsChanged() {
|
||||
this@OnSubscriptionsChangedListener.onSubscriptionsChanged()
|
||||
}
|
||||
}
|
||||
} else null
|
||||
|
||||
abstract fun onSubscriptionsChanged()
|
||||
|
||||
|
||||
@@ -34,11 +34,7 @@ class AlarmManagerImpl @Inject constructor(private val context: Context) : Alarm
|
||||
|
||||
override fun setAlarm(date: Long, intent: PendingIntent) {
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as android.app.AlarmManager
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
alarmManager.setExactAndAllowWhileIdle(android.app.AlarmManager.RTC_WAKEUP, date, intent)
|
||||
} else {
|
||||
alarmManager.setExact(android.app.AlarmManager.RTC_WAKEUP, date, intent)
|
||||
}
|
||||
alarmManager.setExactAndAllowWhileIdle(android.app.AlarmManager.RTC_WAKEUP, date, intent)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -328,11 +328,7 @@ class MessageRepositoryImpl @Inject constructor(
|
||||
val intent = getIntentForDelayedSms(message.id)
|
||||
|
||||
val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, sendTime, intent)
|
||||
} else {
|
||||
alarmManager.setExact(AlarmManager.RTC_WAKEUP, sendTime, intent)
|
||||
}
|
||||
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, sendTime, intent)
|
||||
} else { // No delay
|
||||
val message = insertSentSms(subId, threadId, addresses.first(), strippedBody, now())
|
||||
sendSms(message)
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.moez.QKSMS.util.GlideApp
|
||||
import com.moez.QKSMS.util.tryOrNull
|
||||
import javax.inject.Inject
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
class QkChooserTargetService : ChooserTargetService() {
|
||||
|
||||
@Inject lateinit var conversationRepo: ConversationRepository
|
||||
|
||||
@@ -63,9 +63,6 @@ fun ProgressBar.setTint(color: Int) {
|
||||
fun View.setBackgroundTint(color: Int) {
|
||||
|
||||
// API 21 doesn't support this
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
background?.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||
}
|
||||
|
||||
backgroundTintList = ColorStateList.valueOf(color)
|
||||
}
|
||||
|
||||
@@ -155,11 +155,6 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
.subscribe()
|
||||
|
||||
window.callback = ComposeWindowCallback(window.callback, this)
|
||||
|
||||
// These theme attributes don't apply themselves on API 21
|
||||
if (Build.VERSION.SDK_INT <= 22) {
|
||||
messageBackground.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
||||
@@ -123,7 +123,6 @@ class ComposeWindowCallback(
|
||||
return localCallback.onSearchRequested()
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
override fun onSearchRequested(searchEvent: SearchEvent): Boolean {
|
||||
return localCallback.onSearchRequested(searchEvent)
|
||||
}
|
||||
@@ -132,7 +131,6 @@ class ComposeWindowCallback(
|
||||
return localCallback.onWindowStartingActionMode(callback)
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
override fun onWindowStartingActionMode(callback: ActionMode.Callback, i: Int): ActionMode? {
|
||||
return localCallback.onWindowStartingActionMode(callback, i)
|
||||
}
|
||||
|
||||
@@ -152,9 +152,7 @@ class MessagesAdapter @Inject constructor(
|
||||
view = layoutInflater.inflate(R.layout.message_list_item_in, parent, false)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
view.body.hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE
|
||||
}
|
||||
view.body.hyphenationFrequency = Layout.HYPHENATION_FREQUENCY_NONE
|
||||
|
||||
val partsAdapter = partsAdapterProvider.get()
|
||||
partsAdapter.clicks.subscribe(partClicks)
|
||||
|
||||
@@ -44,11 +44,6 @@ class ChipsAdapter @Inject constructor() : QkAdapter<Recipient>() {
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
val view = inflater.inflate(R.layout.contact_chip, parent, false)
|
||||
return QkViewHolder(view).apply {
|
||||
// These theme attributes don't apply themselves on API 21
|
||||
if (Build.VERSION.SDK_INT <= 22) {
|
||||
content.setBackgroundTint(view.context.resolveThemeColor(R.attr.bubbleColor))
|
||||
}
|
||||
|
||||
view.setOnClickListener {
|
||||
val chip = getItem(adapterPosition)
|
||||
showDetailedChip(view.context, chip)
|
||||
|
||||
@@ -88,11 +88,6 @@ class ContactsActivity : QkThemedActivity(), ContactsContract {
|
||||
viewModel.bindView(this)
|
||||
|
||||
contacts.adapter = contactsAdapter
|
||||
|
||||
// These theme attributes don't apply themselves on API 21
|
||||
if (Build.VERSION.SDK_INT <= 22) {
|
||||
search.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor))
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(state: ContactsState) {
|
||||
|
||||
@@ -185,11 +185,6 @@ class MainActivity : QkThemedActivity(), MainView {
|
||||
// Set the FAB compose icon color
|
||||
compose.setTint(theme.textPrimary)
|
||||
}
|
||||
|
||||
// These theme attributes don't apply themselves on API 21
|
||||
if (Build.VERSION.SDK_INT <= 22) {
|
||||
toolbarSearch.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
|
||||
@@ -74,15 +74,6 @@ class QkReplyActivity : QkThemedActivity(), QkReplyView {
|
||||
messages.adapter?.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
|
||||
override fun onChanged() = messages.scrollToPosition(adapter.itemCount - 1)
|
||||
})
|
||||
|
||||
// These theme attributes don't apply themselves on API 21
|
||||
if (Build.VERSION.SDK_INT <= 22) {
|
||||
toolbar.setBackgroundTint(resolveThemeColor(R.attr.colorPrimary))
|
||||
background.setBackgroundTint(resolveThemeColor(android.R.attr.windowBackground))
|
||||
messageBackground.setBackgroundTint(resolveThemeColor(R.attr.bubbleColor))
|
||||
composeBackgroundGradient.setBackgroundTint(resolveThemeColor(android.R.attr.windowBackground))
|
||||
composeBackgroundSolid.setBackgroundTint(resolveThemeColor(android.R.attr.windowBackground))
|
||||
}
|
||||
}
|
||||
|
||||
override fun render(state: QkReplyState) {
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
~
|
||||
~ This file is part of QKSMS.
|
||||
~
|
||||
~ QKSMS is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ QKSMS is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<!-- On Marshmallow, explicitly don't use the light status bar -->
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -19,7 +19,9 @@
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme" parent="AppBaseTheme" />
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
</style>
|
||||
|
||||
<style name="AppBaseTheme" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="android:divider">@color/separatorDark</item>
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
~
|
||||
~ This file is part of QKSMS.
|
||||
~
|
||||
~ QKSMS is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ QKSMS is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<!-- On Marshmallow, use the light status bar -->
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<item name="android:statusBarColor">@color/backgroundLight</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -31,7 +31,10 @@
|
||||
<item name="android:windowBackground">@color/backgroundDark</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme" parent="AppBaseTheme" />
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<item name="android:statusBarColor">@color/backgroundLight</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:divider">@color/separatorLight</item>
|
||||
|
||||
Reference in New Issue
Block a user