Removed lazy class SmsTransportDetails

Moved constants into SmsCharacterCalculator.

Closes #4788
This commit is contained in:
Philippe Laferriere 2015-11-20 15:58:29 -05:00 committed by Moxie Marlinspike
parent eebe227a20
commit 03faff443c
2 changed files with 6 additions and 30 deletions

View File

@ -1,25 +0,0 @@
/**
* Copyright (C) 2011 Whisper Systems
* Copyright (C) 2014 Open Whisper Systems
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms.sms;
public class SmsTransportDetails {
public static final int SMS_SIZE = 160;
public static final int MULTIPART_SMS_SIZE = 153;
}

View File

@ -16,18 +16,19 @@
*/
package org.thoughtcrime.securesms.util;
import org.thoughtcrime.securesms.sms.SmsTransportDetails;
public class SmsCharacterCalculator extends CharacterCalculator {
public static final int SMS_SIZE = 160;
public static final int MULTIPART_SMS_SIZE = 153;
@Override
public CharacterState calculateCharacters(int charactersSpent) {
int maxMessageSize;
if (charactersSpent <= SmsTransportDetails.SMS_SIZE) {
maxMessageSize = SmsTransportDetails.SMS_SIZE;
if (charactersSpent <= SMS_SIZE) {
maxMessageSize = SMS_SIZE;
} else {
maxMessageSize = SmsTransportDetails.MULTIPART_SMS_SIZE;
maxMessageSize = MULTIPART_SMS_SIZE;
}
int messagesSpent = charactersSpent / maxMessageSize;