Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkourlas committed Jun 28, 2024
1 parent 16aacad commit ae1f515
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion voipms-sms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ android {
variantFilter { variant ->
def names = variant.flavors*.name
def isDemo = (names.contains("demoSending")
|| names.contains("demoNotSending"))
|| names.contains("demoNotSending"))
def isRelease = variant.buildType.name == "release"
def isPrimary = names.contains("primary")
if (isDemo && (isPrimary || isRelease)) {
Expand Down
6 changes: 2 additions & 4 deletions voipms-sms/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@
</activity>
<activity
android:name=".preferences.activities.MarkdownPreferencesActivity"
android:exported="false">
</activity>
android:exported="false" />
<activity
android:name=".preferences.activities.NetworkPreferencesActivity"
android:exported="false"
Expand Down Expand Up @@ -240,8 +239,7 @@
android:name=".signIn.SignInActivity"
android:exported="false"
android:label="@string/sign_in_name"
android:parentActivityName=".preferences.activities.PreferencesActivity">
</activity>
android:parentActivityName=".preferences.activities.PreferencesActivity" />

<!-- BROADCAST RECEIVERS -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@ class ConversationRecyclerViewAdapter(
parent, false
)
}

R.layout.conversation_item_outgoing -> {
LayoutInflater.from(parent.context)
.inflate(
R.layout.conversation_item_outgoing,
parent, false
)
}

else -> throw Exception("Unknown view type $viewType")
}
return MessageViewHolder(itemView, viewType)
Expand Down Expand Up @@ -517,6 +519,7 @@ class ConversationRecyclerViewAdapter(
notifyItemRemoved(newIdx)
oldIdx += 1
}

comparison > 0 -> {
// Add new message
_messageItems.add(
Expand All @@ -526,6 +529,7 @@ class ConversationRecyclerViewAdapter(
notifyItemInserted(newIdx)
newIdx += 1
}

else -> {
// Even though the view might not need to be changed,
// update the underlying message anyways just to be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class MessageTextView @JvmOverloads constructor(
}
longClick = false
}

MotionEvent.ACTION_DOWN -> {
Selection.setSelection(
buffer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,14 @@ class ConversationsRecyclerViewAdapter<T>(
notifyItemInserted(newIdx)
newIdx += 1
}

comparison > 0 -> {
// Remove old message
_conversationItems.removeAt(newIdx)
notifyItemRemoved(newIdx)
oldIdx += 1
}

else -> {
// Update the underlying message
conversationItems[newIdx].message = newMessages[newIdx]
Expand Down Expand Up @@ -581,10 +583,12 @@ class ConversationsRecyclerViewAdapter<T>(
emptyTextView.text = activity.getString(
R.string.conversations_no_dids
)

activity is ConversationsArchivedActivity ->
emptyTextView.text = activity.getString(
R.string.conversations_archived_no_messages
)

else -> emptyTextView.text = activity.getString(
R.string.conversations_no_messages
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ class NewConversationActivity : AppCompatActivity(), View.OnClickListener {
when {
dids.isEmpty() -> // Silently fail if no DID set
return

dids.size > 1 -> {
var selectedIndex = 0
AlertDialog.Builder(this).apply {
Expand Down Expand Up @@ -372,6 +373,7 @@ class NewConversationActivity : AppCompatActivity(), View.OnClickListener {
show()
}
}

else -> {
intent.putExtra(
getString(R.string.conversation_did),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,14 @@ class NewConversationRecyclerViewAdapter(
notifyItemRemoved(newIdx)
oldIdx += 1
}

comparison > 0 -> {
// Add new contact
_contactItems.add(newIdx, newContactItems[newIdx])
notifyItemInserted(newIdx)
newIdx += 1
}

else -> {
// Replace existing contact, just to be safe
_contactItems[newIdx] = newContactItems[newIdx]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ class AppearancePreferencesFragment : PreferenceFragmentCompat(),
AppCompatDelegate
.MODE_NIGHT_FOLLOW_SYSTEM
)

LIGHT -> AppCompatDelegate.setDefaultNightMode(
AppCompatDelegate.MODE_NIGHT_NO
)

DARK -> AppCompatDelegate.setDefaultNightMode(
AppCompatDelegate.MODE_NIGHT_YES
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class DatabasePreferencesFragment : PreferenceFragmentCompat() {
}
true
}

getString(
R.string.preferences_database_export_key
) ->
Expand All @@ -129,6 +130,7 @@ class DatabasePreferencesFragment : PreferenceFragmentCompat() {
}
true
}

getString(
R.string.preferences_database_clean_up_key
) ->
Expand All @@ -137,6 +139,7 @@ class DatabasePreferencesFragment : PreferenceFragmentCompat() {
cleanUp()
true
}

getString(
R.string.preferences_database_delete_key
) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class SynchronizationPreferencesFragment : PreferenceFragmentCompat(),
}
true
}

getString(R.string.preferences_sync_interval_key) ->
preference.onPreferenceChangeListener =
Preference.OnPreferenceChangeListener { _, newValue ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class SignInActivity : AppCompatActivity() {
error
)
}

valid == false -> {
// If valid is false, then some error occurred
toggleControls(enabled = true)
Expand All @@ -84,6 +85,7 @@ class SignInActivity : AppCompatActivity() {
)
)
}

valid == true -> {
// If we managed to verify the credentials, then we
// save them and try to enable all of the DIDs in the
Expand Down Expand Up @@ -305,6 +307,7 @@ class SignInActivity : AppCompatActivity() {
}
return super.onOptionsItemSelected(item)
}

else -> super.onOptionsItemSelected(item)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class RetrieveDidsWorker(context: Context, params: WorkerParameters) :
"invalid_credentials" -> applicationContext.getString(
R.string.preferences_dids_error_api_error_invalid_credentials
)

else -> applicationContext.getString(
R.string.preferences_dids_error_api_error,
response.status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,27 +255,35 @@ class SendMessageWorker(context: Context, params: WorkerParameters) :
"invalid_credentials" -> applicationContext.getString(
R.string.send_message_error_api_error_invalid_credentials
)

"invalid_dst" -> applicationContext.getString(
R.string.send_message_error_api_error_invalid_dst
)

"invalid_sms" -> applicationContext.getString(
R.string.send_message_error_api_error_invalid_sms
)

"limit_reached" -> applicationContext.getString(
R.string.send_message_error_api_error_limit_reached
)

"message_empty" -> applicationContext.getString(
R.string.send_message_error_api_error_message_empty
)

"missing_sms" -> applicationContext.getString(
R.string.send_message_error_api_error_missing_sms
)

"sms_failed" -> applicationContext.getString(
R.string.send_message_error_api_error_sms_failed
)

"sms_toolong" -> applicationContext.getString(
R.string.send_message_error_api_error_sms_toolong
)

else -> applicationContext.getString(
R.string.send_message_error_api_error, response?.status
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ class VerifyCredentialsWorker(context: Context, params: WorkerParameters) :
"invalid_credentials" -> applicationContext.getString(
R.string.verify_credentials_error_api_error_invalid_credentials
)

"missing_credentials" -> applicationContext.getString(
R.string.verify_credentials_error_api_error_missing_credentials
)

else -> applicationContext.getString(
R.string.verify_credentials_error_api_error,
response.status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,13 @@ class FastScroller private constructor(
startDrag()
return true
}

MotionEvent.ACTION_MOVE -> {
if (mDragging) {
return true
}
}

MotionEvent.ACTION_CANCEL, MotionEvent.ACTION_UP -> {
if (mDragging) {
cancelDrag()
Expand Down

0 comments on commit ae1f515

Please sign in to comment.