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

RTL Support #208

Merged
merged 15 commits into from
Feb 25, 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
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext {
kotlinVersion = '1.3.61'
androidGradleVersion = '3.5.3'
androidGradleVersion = '3.6.0'

// Google libraries
appCompatVersion = '1.1.0'
constraintLayoutVersion = '1.1.3'
materialComponentsVersion = '1.1.0-rc02'
materialComponentsVersion = '1.1.0'
roomVersion = '2.2.3'
lifecycleVersion = '2.2.0'

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ org.gradle.jvmargs=-Xmx1536m
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

android.useAndroidX=true
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, because 3.6.0 plugin throws error without it.


VERSION_NAME=3.1.2
# 3*100*100 + 1*100 + 2 => 30102
VERSION_CODE=30102
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
android:launchMode="singleTask"
android:taskAffinity="com.chuckerteam.chucker.task"
android:theme="@style/Chucker.Theme" />

<activity android:name="com.chuckerteam.chucker.internal.ui.transaction.TransactionActivity"
android:theme="@style/Chucker.Theme"
android:parentActivityName="com.chuckerteam.chucker.internal.ui.MainActivity"/>

Comment on lines +11 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: whitespace change here that can be reverted

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I`ve added it for readability.

<activity android:name="com.chuckerteam.chucker.internal.ui.error.ErrorActivity"
android:theme="@style/Chucker.Theme"
android:parentActivityName="com.chuckerteam.chucker.internal.ui.MainActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ internal class MainActivity :
super.onCreate(savedInstanceState)
setContentView(R.layout.chucker_activity_main)

val toolbar = findViewById<Toolbar>(R.id.toolbar)
val toolbar = findViewById<Toolbar>(R.id.chuckerTransactionToolbar)
setSupportActionBar(toolbar)
toolbar.subtitle = applicationName

viewModel = ViewModelProvider(this).get(MainViewModel::class.java)

viewPager = findViewById(R.id.viewPager)
viewPager = findViewById(R.id.chuckerMainViewPager)
viewPager.adapter = HomePageAdapter(this, supportFragmentManager)

val tabLayout = findViewById<TabLayout>(R.id.tabLayout)
val tabLayout = findViewById<TabLayout>(R.id.chuckerMainTabLayout)
tabLayout.setupWithViewPager(viewPager)

viewPager.addOnPageChangeListener(object : TabLayout.TabLayoutOnPageChangeListener(tabLayout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ internal class ErrorActivity : BaseChuckerActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.chucker_activity_error)
setSupportActionBar(findViewById(R.id.toolbar))
setSupportActionBar(findViewById(R.id.chuckerErrorToolbar))
supportActionBar?.setDisplayHomeAsUpEnabled(true)

title = findViewById(R.id.toolbar_title)
tag = findViewById(R.id.tag)
clazz = findViewById(R.id.clazz)
message = findViewById(R.id.message)
date = findViewById(R.id.date)
stacktrace = findViewById(R.id.stacktrace)
title = findViewById(R.id.chuckerErrorToolbarTitle)
tag = findViewById(R.id.chuckerItemErrorTag)
clazz = findViewById(R.id.chuckerItemErrorClazz)
message = findViewById(R.id.chuckerItemErrorMessage)
date = findViewById(R.id.chuckerItemErrorDate)
stacktrace = findViewById(R.id.chuckerErrorStacktrace)
date.visibility = View.GONE

throwableId = intent.getLongExtra(EXTRA_THROWABLE_ID, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ internal class ErrorAdapter(
itemView: View
) : RecyclerView.ViewHolder(itemView), View.OnClickListener {

private val tagView: TextView = itemView.findViewById(R.id.tag)
private val clazzView: TextView = itemView.findViewById(R.id.clazz)
private val messageView: TextView = itemView.findViewById(R.id.message)
private val dateView: TextView = itemView.findViewById(R.id.date)
private val tagView: TextView = itemView.findViewById(R.id.chuckerItemErrorTag)
private val clazzView: TextView = itemView.findViewById(R.id.chuckerItemErrorClazz)
private val messageView: TextView = itemView.findViewById(R.id.chuckerItemErrorMessage)
private val dateView: TextView = itemView.findViewById(R.id.chuckerItemErrorDate)
private var throwableId: Long? = null

init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ internal class ErrorListFragment : Fragment() {

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
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()
tutorialView = findViewById(R.id.chuckerErrorsTutorialView)
findViewById<TextView>(R.id.chuckerErrorsTutorialLink).movementMethod = LinkMovementMethod.getInstance()

val recyclerView = findViewById<RecyclerView>(R.id.list)
val recyclerView = findViewById<RecyclerView>(R.id.chuckerErrorsRecyclerView)
recyclerView.addItemDecoration(DividerItemDecoration(context, VERTICAL))
adapter = ErrorAdapter(listener)
recyclerView.adapter = adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ internal class TransactionActivity : BaseChuckerActivity() {
viewModel = ViewModelProvider(this, TransactionViewModelFactory(transactionId))
.get(TransactionViewModel::class.java)

val toolbar = findViewById<Toolbar>(R.id.toolbar)
val toolbar = findViewById<Toolbar>(R.id.chuckerTransactionToolbar)
setSupportActionBar(toolbar)
title = findViewById(R.id.toolbar_title)
title = findViewById(R.id.chuckerTransactionToolbarTitle)

supportActionBar?.setDisplayHomeAsUpEnabled(true)

findViewById<ViewPager>(R.id.viewpager)?.let { viewPager ->
findViewById<ViewPager>(R.id.chuckerTransactionViewPager)?.let { viewPager ->
setupViewPager(viewPager)
findViewById<TabLayout>(R.id.tabs).setupWithViewPager(viewPager)
findViewById<TabLayout>(R.id.chuckerTransactionTabLayout).setupWithViewPager(viewPager)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ internal class TransactionAdapter internal constructor(
}

inner class ViewHolder(val view: View) : RecyclerView.ViewHolder(view) {
private val code: TextView = view.findViewById(R.id.code)
private val path: TextView = view.findViewById(R.id.path)
private val host: TextView = view.findViewById(R.id.host)
private val start: TextView = view.findViewById(R.id.time_start)
private val duration: TextView = view.findViewById(R.id.duration)
private val size: TextView = view.findViewById(R.id.size)
private val ssl: ImageView = view.findViewById(R.id.ssl)
private val code: TextView = view.findViewById(R.id.chuckerTransactionItemCode)
private val path: TextView = view.findViewById(R.id.chuckerTransactionItemPath)
private val host: TextView = view.findViewById(R.id.chuckerTransactionItemHost)
private val start: TextView = view.findViewById(R.id.chuckerTransactionItemTimeStart)
private val duration: TextView = view.findViewById(R.id.chuckerTransactionItemDuration)
private val size: TextView = view.findViewById(R.id.chuckerTransactionItemSize)
private val ssl: ImageView = view.findViewById(R.id.chuckerTransactionItemSsl)

@SuppressLint("SetTextI18n")
fun bind(transaction: HttpTransactionTuple) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ internal class TransactionListFragment :
savedInstanceState: Bundle?
): View? {
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()
tutorialView = view.findViewById(R.id.chuckerTransactionsTutorialView)
view.findViewById<TextView>(R.id.chuckerTransactionsLink).movementMethod = LinkMovementMethod.getInstance()

val recyclerView = view.findViewById<RecyclerView>(R.id.list)
val recyclerView = view.findViewById<RecyclerView>(R.id.chuckerTransactionsRecyclerView)
val context = view.context
recyclerView.addItemDecoration(
DividerItemDecoration(context, DividerItemDecoration.VERTICAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ internal class TransactionOverviewFragment : Fragment() {
): View? =
inflater.inflate(R.layout.chucker_fragment_transaction_overview, container, false)
.also {
url = it.findViewById(R.id.url)
method = it.findViewById(R.id.method)
protocol = it.findViewById(R.id.protocol)
status = it.findViewById(R.id.status)
response = it.findViewById(R.id.response)
ssl = it.findViewById(R.id.ssl)
requestTime = it.findViewById(R.id.request_time)
responseTime = it.findViewById(R.id.response_time)
duration = it.findViewById(R.id.duration)
requestSize = it.findViewById(R.id.request_size)
responseSize = it.findViewById(R.id.response_size)
totalSize = it.findViewById(R.id.total_size)
url = it.findViewById(R.id.chuckerTransactionOverviewUrl)
method = it.findViewById(R.id.chuckerTransactionOverviewMethod)
protocol = it.findViewById(R.id.chuckerTransactionOverviewProtocol)
status = it.findViewById(R.id.chuckerTransactionOverviewStatus)
response = it.findViewById(R.id.chuckerTransactionOverviewResponse)
ssl = it.findViewById(R.id.chuckerTransactionOverviewSsl)
requestTime = it.findViewById(R.id.chuckerTransactionOverviewRequestTime)
responseTime = it.findViewById(R.id.chuckerTransactionOverviewResponseTime)
duration = it.findViewById(R.id.chuckerTransactionOverviewDuration)
requestSize = it.findViewById(R.id.chuckerTransactionOverviewRequestSize)
responseSize = it.findViewById(R.id.chuckerTransactionOverviewResponseSize)
totalSize = it.findViewById(R.id.chuckerTransactionOverviewTotalSize)
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ internal sealed class TransactionPayloadViewHolder(view: View) : RecyclerView.Vi
abstract fun bind(item: TransactionPayloadItem)

internal class HeaderViewHolder(view: View) : TransactionPayloadViewHolder(view) {
private val headersView: TextView = view.findViewById(R.id.headers)
private val headersView: TextView = view.findViewById(R.id.chuckerTransactionResponseHeaders)
override fun bind(item: TransactionPayloadItem) {
if (item is TransactionPayloadItem.HeaderItem) {
headersView.text = item.headers
Expand All @@ -105,7 +105,7 @@ internal sealed class TransactionPayloadViewHolder(view: View) : RecyclerView.Vi
}

internal class BodyLineViewHolder(view: View) : TransactionPayloadViewHolder(view) {
private val bodyLineView: TextView = view.findViewById(R.id.body_line)
private val bodyLineView: TextView = view.findViewById(R.id.chuckerTransactionResponseBodyLine)
override fun bind(item: TransactionPayloadItem) {
if (item is TransactionPayloadItem.BodyLineItem) {
bodyLineView.text = item.line
Expand All @@ -114,7 +114,7 @@ internal sealed class TransactionPayloadViewHolder(view: View) : RecyclerView.Vi
}

internal class ImageViewHolder(view: View) : TransactionPayloadViewHolder(view) {
private val binaryDataView: ImageView = view.findViewById(R.id.binary_data)
private val binaryDataView: ImageView = view.findViewById(R.id.chuckerTransactionResponseBinaryData)
override fun bind(item: TransactionPayloadItem) {
if (item is TransactionPayloadItem.ImageItem) {
binaryDataView.setImageBitmap(item.image)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ internal class TransactionPayloadFragment :
savedInstanceState: Bundle?
): View? =
inflater.inflate(R.layout.chucker_fragment_transaction_payload, container, false).apply {
transactionContentList = findViewById(R.id.transaction_content)
transactionContentList = findViewById(R.id.chuckerTransactionResponseRecyclerView)
transactionContentList.isNestedScrollingEnabled = false
progressLoading = findViewById(R.id.progress_loading_transaction)
progressLoading = findViewById(R.id.chuckerTransactionLoadingProgress)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -182,8 +182,8 @@ internal class TransactionPayloadFragment :
AsyncTask<Pair<Int, HttpTransaction>, Unit, List<TransactionPayloadItem>>() {

override fun onPreExecute() {
val progressBar: ProgressBar? = fragment.view?.findViewById(R.id.progress_loading_transaction)
val recyclerView: RecyclerView? = fragment.view?.findViewById(R.id.transaction_content)
val progressBar: ProgressBar? = fragment.view?.findViewById(R.id.chuckerTransactionLoadingProgress)
val recyclerView: RecyclerView? = fragment.view?.findViewById(R.id.chuckerTransactionResponseRecyclerView)
progressBar?.visibility = View.VISIBLE
recyclerView?.visibility = View.INVISIBLE
}
Expand Down Expand Up @@ -233,8 +233,8 @@ internal class TransactionPayloadFragment :
}

override fun onPostExecute(result: List<TransactionPayloadItem>) {
val progressBar: ProgressBar? = fragment.view?.findViewById(R.id.progress_loading_transaction)
val recyclerView: RecyclerView? = fragment.view?.findViewById(R.id.transaction_content)
val progressBar: ProgressBar? = fragment.view?.findViewById(R.id.chuckerTransactionLoadingProgress)
val recyclerView: RecyclerView? = fragment.view?.findViewById(R.id.chuckerTransactionResponseRecyclerView)
progressBar?.visibility = View.INVISIBLE
recyclerView?.visibility = View.VISIBLE
recyclerView?.adapter = TransactionBodyAdapter(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF999999"
android:fillColor="#fff"
android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>
13 changes: 5 additions & 8 deletions library/src/main/res/layout/chucker_activity_error.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,30 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layoutDirection="ltr"
tools:context="com.chuckerteam.chucker.internal.ui.error.ErrorActivity">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/chuckerErrorToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/Chucker.Theme">

<TextView
android:id="@+id/toolbar_title"
android:id="@+id/chuckerErrorToolbarTitle"
style="@style/Chucker.TextAppearance.TransactionTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Title" />

</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.MaterialToolbar>

<include layout="@layout/chucker_list_item_error" />

Expand All @@ -40,7 +37,7 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<TextView
android:id="@+id/stacktrace"
android:id="@+id/chuckerErrorStacktrace"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/chucker_doub_grid"
Expand Down
10 changes: 4 additions & 6 deletions library/src/main/res/layout/chucker_activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,29 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layoutDirection="ltr"
android:orientation="vertical">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/chuckerTransactionToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/Chucker.Theme" />

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:id="@+id/chuckerMainTabLayout"
style="@style/Widget.MaterialComponents.TabLayout.PrimarySurface"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</com.google.android.material.appbar.AppBarLayout>

<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:id="@+id/chuckerMainViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />

Expand Down
Loading