Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert resource renaming #227

Merged
merged 2 commits into from
Feb 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions library-no-op/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Jeff Gilfelt.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest
package="com.chuckerteam.chucker">
</manifest>
2 changes: 1 addition & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<application>
<activity
android:name="com.chuckerteam.chucker.internal.ui.MainActivity"
android:label="@string/name"
android:label="@string/chucker_name"
android:launchMode="singleTask"
android:taskAffinity="com.chuckerteam.chucker.task"
android:theme="@style/Chucker.Theme" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,23 @@ internal object FormatUtils {
}

fun getShareText(context: Context, transaction: HttpTransaction): String {
var text = "${context.getString(R.string.url)}: ${transaction.url}\n"
text += "${context.getString(R.string.method)}: ${transaction.method}\n"
text += "${context.getString(R.string.protocol)}: ${transaction.protocol}\n"
text += "${context.getString(R.string.status)}: ${transaction.status}\n"
text += "${context.getString(R.string.response)}: ${transaction.responseSummaryText}\n"
text += "${context.getString(R.string.ssl)}: " +
"${context.getString(if (transaction.isSsl) R.string.yes else R.string.no)}\n"
var text = "${context.getString(R.string.chucker_url)}: ${transaction.url}\n"
text += "${context.getString(R.string.chucker_method)}: ${transaction.method}\n"
text += "${context.getString(R.string.chucker_protocol)}: ${transaction.protocol}\n"
text += "${context.getString(R.string.chucker_status)}: ${transaction.status}\n"
text += "${context.getString(R.string.chucker_response)}: ${transaction.responseSummaryText}\n"
text += "${context.getString(R.string.chucker_ssl)}: " +
"${context.getString(if (transaction.isSsl) R.string.chucker_yes else R.string.chucker_no)}\n"
text += "\n"
text += "${context.getString(R.string.request_time)}: ${transaction.requestDateString}\n"
text += "${context.getString(R.string.response_time)}: ${transaction.responseDateString}\n"
text += "${context.getString(R.string.duration)}: ${transaction.durationString}\n"
text += "${context.getString(R.string.chucker_request_time)}: ${transaction.requestDateString}\n"
text += "${context.getString(R.string.chucker_response_time)}: ${transaction.responseDateString}\n"
text += "${context.getString(R.string.chucker_duration)}: ${transaction.durationString}\n"
text += "\n"
text += "${context.getString(R.string.request_size)}: ${transaction.requestSizeString}\n"
text += "${context.getString(R.string.response_size)}: ${transaction.responseSizeString}\n"
text += "${context.getString(R.string.total_size)}: ${transaction.totalSizeString}\n"
text += "${context.getString(R.string.chucker_request_size)}: ${transaction.requestSizeString}\n"
text += "${context.getString(R.string.chucker_response_size)}: ${transaction.responseSizeString}\n"
text += "${context.getString(R.string.chucker_total_size)}: ${transaction.totalSizeString}\n"
text += "\n"
text += "---------- ${context.getString(R.string.request)} ----------\n\n"
text += "---------- ${context.getString(R.string.chucker_request)} ----------\n\n"

var headers = formatHeaders(transaction.getParsedRequestHeaders(), false)

Expand All @@ -122,11 +122,11 @@ internal object FormatUtils {
text += if (transaction.isRequestBodyPlainText) {
transaction.getFormattedRequestBody()
} else {
context.getString(R.string.body_omitted)
context.getString(R.string.chucker_body_omitted)
}

text += "\n\n"
text += "---------- ${context.getString(R.string.response)} ----------\n\n"
text += "---------- ${context.getString(R.string.chucker_response)} ----------\n\n"

headers = formatHeaders(transaction.getParsedResponseHeaders(), false)

Expand All @@ -137,7 +137,7 @@ internal object FormatUtils {
text += if (transaction.isResponseBodyPlainText) {
transaction.getFormattedResponseBody()
} else {
context.getString(R.string.body_omitted)
context.getString(R.string.chucker_body_omitted)
}

return text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ internal class IOUtils(private val context: Context) {
try {
body = buffer.readString(maxBytes, charset)
} catch (e: EOFException) {
body += context.getString(R.string.body_unexpected_eof)
body += context.getString(R.string.chucker_body_unexpected_eof)
}

if (bufferSize > maxContentLength) {
body += context.getString(R.string.body_content_truncated)
body += context.getString(R.string.chucker_body_content_truncated)
}
return body
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ internal class NotificationHelper(val context: Context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val transactionsChannel = NotificationChannel(
TRANSACTIONS_CHANNEL_ID,
context.getString(R.string.networks_notification_category),
context.getString(R.string.chucker_networks_notification_category),
NotificationManager.IMPORTANCE_LOW
)
val errorsChannel = NotificationChannel(
ERRORS_CHANNEL_ID,
context.getString(R.string.errors_notification_category),
context.getString(R.string.chucker_errors_notification_category),
NotificationManager.IMPORTANCE_LOW
)
notificationManager.createNotificationChannels(listOf(transactionsChannel, errorsChannel))
Expand Down Expand Up @@ -98,9 +98,9 @@ internal class NotificationHelper(val context: Context) {
NotificationCompat.Builder(context, TRANSACTIONS_CHANNEL_ID)
.setContentIntent(transactionsScreenIntent)
.setLocalOnly(true)
.setSmallIcon(R.drawable.ic_transaction_notification_24dp)
.setColor(ContextCompat.getColor(context, R.color.color_primary))
.setContentTitle(context.getString(R.string.http_notification_title))
.setSmallIcon(R.drawable.chucker_ic_transaction_notification)
.setColor(ContextCompat.getColor(context, R.color.chucker_color_primary))
.setContentTitle(context.getString(R.string.chucker_http_notification_title))
.setAutoCancel(true)
.addAction(createClearAction(ClearDatabaseService.ClearAction.Transaction))
val inboxStyle = NotificationCompat.InboxStyle()
Expand Down Expand Up @@ -133,8 +133,8 @@ internal class NotificationHelper(val context: Context) {
NotificationCompat.Builder(context, ERRORS_CHANNEL_ID)
.setContentIntent(errorsScreenIntent)
.setLocalOnly(true)
.setSmallIcon(R.drawable.ic_error_notifications_24dp)
.setColor(ContextCompat.getColor(context, R.color.status_error))
.setSmallIcon(R.drawable.chucker_ic_error_notifications)
.setColor(ContextCompat.getColor(context, R.color.chucker_status_error))
.setContentTitle(throwable.clazz)
.setAutoCancel(true)
.setContentText(throwable.message)
Expand All @@ -145,15 +145,15 @@ internal class NotificationHelper(val context: Context) {

private fun createClearAction(clearAction: ClearDatabaseService.ClearAction):
NotificationCompat.Action {
val clearTitle = context.getString(R.string.clear)
val clearTitle = context.getString(R.string.chucker_clear)
val deleteIntent = Intent(context, ClearDatabaseService::class.java).apply {
putExtra(ClearDatabaseService.EXTRA_ITEM_TO_CLEAR, clearAction)
}
val intent = PendingIntent.getService(
context, INTENT_REQUEST_CODE,
deleteIntent, PendingIntent.FLAG_ONE_SHOT
)
return NotificationCompat.Action(R.drawable.ic_delete_white_24dp, clearTitle, intent)
return NotificationCompat.Action(R.drawable.chucker_ic_delete_white, clearTitle, intent)
}

fun dismissTransactionsNotification() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright (C) 2017 Jeff Gilfelt.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.chuckerteam.chucker.internal.ui

import android.os.Bundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ internal class HomePageAdapter(context: Context, fragmentManager: FragmentManage
override fun getPageTitle(position: Int): CharSequence? =
context.get()?.getString(
if (position == SCREEN_HTTP_INDEX) {
R.string.tab_network
R.string.chucker_tab_network
} else {
R.string.tab_errors
R.string.chucker_tab_errors
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal class MainActivity :

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setContentView(R.layout.chucker_activity_main)

val toolbar = findViewById<Toolbar>(R.id.toolbar)
setSupportActionBar(toolbar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal class ErrorActivity : BaseChuckerActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_error)
setContentView(R.layout.chucker_activity_error)
setSupportActionBar(findViewById(R.id.toolbar))
supportActionBar?.setDisplayHomeAsUpEnabled(true)

Expand Down Expand Up @@ -61,7 +61,7 @@ internal class ErrorActivity : BaseChuckerActivity() {

override fun onCreateOptionsMenu(menu: Menu): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.error, menu)
inflater.inflate(R.menu.chucker_error, menu)
return super.onCreateOptionsMenu(menu)
}

Expand All @@ -76,7 +76,7 @@ internal class ErrorActivity : BaseChuckerActivity() {

private fun share(throwable: RecordedThrowable) {
val throwableDetailsText = getString(
R.string.share_error_content,
R.string.chucker_share_error_content,
throwable.formattedDate,
throwable.clazz,
throwable.tag,
Expand All @@ -86,8 +86,8 @@ internal class ErrorActivity : BaseChuckerActivity() {
startActivity(
ShareCompat.IntentBuilder.from(this)
.setType(MIME_TYPE)
.setChooserTitle(getString(R.string.share_error_title))
.setSubject(getString(R.string.share_error_subject))
.setChooserTitle(getString(R.string.chucker_share_error_title))
.setSubject(getString(R.string.chucker_share_error_subject))
.setText(throwableDetailsText)
.createChooserIntent()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class ErrorAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ErrorViewHolder {
val view =
LayoutInflater.from(parent.context)
.inflate(R.layout.list_item_error, parent, false)
.inflate(R.layout.chucker_list_item_error, parent, false)
return ErrorViewHolder(view)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class ErrorListFragment : Fragment() {
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_error_list, container, false).apply {
return inflater.inflate(R.layout.chucker_fragment_error_list, container, false).apply {
tutorialView = findViewById(R.id.tutorial)
findViewById<TextView>(R.id.link).movementMethod = LinkMovementMethod.getInstance()

Expand Down Expand Up @@ -70,7 +70,7 @@ internal class ErrorListFragment : Fragment() {
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.errors_list, menu)
inflater.inflate(R.menu.chucker_errors_list, menu)
super.onCreateOptionsMenu(menu, inflater)
}

Expand All @@ -85,12 +85,12 @@ internal class ErrorListFragment : Fragment() {

private fun askForConfirmation() {
AlertDialog.Builder(requireContext())
.setTitle(R.string.clear)
.setMessage(R.string.clear_error_confirmation)
.setPositiveButton(R.string.clear) { _, _ ->
.setTitle(R.string.chucker_clear)
.setMessage(R.string.chucker_clear_error_confirmation)
.setPositiveButton(R.string.chucker_clear) { _, _ ->
viewModel.clearErrors()
}
.setNegativeButton(R.string.cancel, null)
.setNegativeButton(R.string.chucker_cancel, null)
.show()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class TransactionActivity : BaseChuckerActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_transaction)
setContentView(R.layout.chucker_activity_transaction)

val transactionId = intent.getLongExtra(EXTRA_TRANSACTION_ID, 0)

Expand Down Expand Up @@ -54,7 +54,7 @@ internal class TransactionActivity : BaseChuckerActivity() {
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.transaction, menu)
menuInflater.inflate(R.menu.chucker_transaction, menu)
return super.onCreateOptionsMenu(menu)
}

Expand All @@ -63,13 +63,13 @@ internal class TransactionActivity : BaseChuckerActivity() {
R.id.share_text -> {
viewModel.transaction.value?.let {
share(getShareText(this, it))
} ?: showToast(getString(R.string.request_not_ready))
} ?: showToast(getString(R.string.chucker_request_not_ready))
true
}
R.id.share_curl -> {
viewModel.transaction.value?.let {
share(getShareCurlCommand(it))
} ?: showToast(getString(R.string.request_not_ready))
} ?: showToast(getString(R.string.chucker_request_not_ready))
true
}
else -> {
Expand All @@ -91,8 +91,8 @@ internal class TransactionActivity : BaseChuckerActivity() {
startActivity(
ShareCompat.IntentBuilder.from(this)
.setType(MIME_TYPE)
.setChooserTitle(getString(R.string.share_transaction_title))
.setSubject(getString(R.string.share_transaction_subject))
.setChooserTitle(getString(R.string.chucker_share_transaction_title))
.setSubject(getString(R.string.chucker_share_transaction_subject))
.setText(transactionDetailsText)
.createChooserIntent()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ internal class TransactionAdapter internal constructor(
) : RecyclerView.Adapter<TransactionAdapter.ViewHolder>() {
private var transactions: List<HttpTransactionTuple> = arrayListOf()

private val colorDefault: Int = ContextCompat.getColor(context, R.color.status_default)
private val colorRequested: Int = ContextCompat.getColor(context, R.color.status_requested)
private val colorError: Int = ContextCompat.getColor(context, R.color.status_error)
private val color500: Int = ContextCompat.getColor(context, R.color.status_500)
private val color400: Int = ContextCompat.getColor(context, R.color.status_400)
private val color300: Int = ContextCompat.getColor(context, R.color.status_300)
private val colorDefault: Int = ContextCompat.getColor(context, R.color.chucker_status_default)
private val colorRequested: Int = ContextCompat.getColor(context, R.color.chucker_status_requested)
private val colorError: Int = ContextCompat.getColor(context, R.color.chucker_status_error)
private val color500: Int = ContextCompat.getColor(context, R.color.chucker_status_500)
private val color400: Int = ContextCompat.getColor(context, R.color.chucker_status_400)
private val color300: Int = ContextCompat.getColor(context, R.color.chucker_status_300)

override fun getItemCount(): Int = transactions.size

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val itemView =
LayoutInflater.from(parent.context)
.inflate(R.layout.list_item_transaction, parent, false)
.inflate(R.layout.chucker_list_item_transaction, parent, false)
return ViewHolder(itemView)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class TransactionListFragment :
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_transaction_list, container, false)
val view = inflater.inflate(R.layout.chucker_fragment_transaction_list, container, false)
tutorialView = view.findViewById(R.id.tutorial)
view.findViewById<TextView>(R.id.link).movementMethod = LinkMovementMethod.getInstance()

Expand All @@ -66,7 +66,7 @@ internal class TransactionListFragment :
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.transactions_list, menu)
inflater.inflate(R.menu.chucker_transactions_list, menu)
val searchMenuItem = menu.findItem(R.id.search)
val searchView = searchMenuItem.actionView as SearchView
searchView.setOnQueryTextListener(this)
Expand All @@ -77,14 +77,14 @@ internal class TransactionListFragment :
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return if (item.itemId == R.id.clear) {
AlertDialog.Builder(requireContext())
.setTitle(R.string.clear)
.setMessage(R.string.clear_http_confirmation)
.setTitle(R.string.chucker_clear)
.setMessage(R.string.chucker_clear_http_confirmation)
.setPositiveButton(
R.string.clear
R.string.chucker_clear
) { _, _ ->
viewModel.clearTransactions()
}
.setNegativeButton(R.string.cancel, null)
.setNegativeButton(R.string.chucker_cancel, null)
.show()
true
} else {
Expand Down
Loading