Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #4341 use camelCase for views referenced from code
Browse files Browse the repository at this point in the history
  • Loading branch information
nikit19 authored and ekager committed Aug 3, 2019
1 parent 1cb9f88 commit 671727c
Show file tree
Hide file tree
Showing 27 changed files with 86 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CreateCollectionFragment : DialogFragment() {
}

collectionCreationComponent = CollectionCreationComponent(
view.create_collection_wrapper,
view.createCollectionWrapper,
ActionBusFactory.get(this),
FenixViewModelProvider.create(
this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class CrashReporterFragment : Fragment() {

val selectedSession = requireComponents.core.sessionManager.selectedSession

restore_tab_button.setOnClickListener {
restoreTabButton.setOnClickListener {
selectedSession?.let { session -> closeFragment(true, session, crash) }
}

close_tab_button.setOnClickListener {
closeTabButton.setOnClickListener {
selectedSession?.let { session -> closeFragment(false, session, crash) }
}
}
Expand All @@ -67,7 +67,7 @@ class CrashReporterFragment : Fragment() {

private fun submitReportIfNecessary(crash: Crash) {
var didSubmitCrashReport = false
if (Settings.getInstance(context!!).isCrashReportingEnabled && send_crash_checkbox.isChecked) {
if (Settings.getInstance(context!!).isCrashReportingEnabled && sendCrashCheckbox.isChecked) {
requireComponents.analytics.crashReporter.submitReport(crash)
didSubmitCrashReport = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ExceptionsFragment : Fragment() {
}
exceptionsInteractor =
ExceptionsInteractor(::openLearnMore, ::deleteOneItem, ::deleteAllItems)
exceptionsView = ExceptionsView(view.exceptions_layout, exceptionsInteractor)
exceptionsView = ExceptionsView(view.exceptionsLayout, exceptionsInteractor)
return view
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler, Accou
::deleteMulti
)

bookmarkView = BookmarkView(view.bookmark_layout, bookmarkInteractor)
signInView = SignInView(view.bookmark_layout, bookmarkInteractor)
bookmarkView = BookmarkView(view.bookmarkLayout, bookmarkInteractor)
signInView = SignInView(view.bookmarkLayout, bookmarkInteractor)
return view
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class AddBookmarkFolderFragment : Fragment() {
sharedViewModel.selectedFolder = sharedViewModel.selectedFolder
?: requireComponents.core.bookmarksStorage.getTree(BookmarkRoot.Mobile.id)
launch(Main) {
bookmark_add_folder_parent_selector.text = sharedViewModel.selectedFolder!!.title
bookmark_add_folder_parent_selector.setOnClickListener {
bookmarkAddFolderParentSelector.text = sharedViewModel.selectedFolder!!.title
bookmarkAddFolderParentSelector.setOnClickListener {
nav(
R.id.bookmarkAddFolderFragment,
AddBookmarkFolderFragmentDirections
Expand All @@ -77,14 +77,14 @@ class AddBookmarkFolderFragment : Fragment() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.confirm_add_folder_button -> {
if (bookmark_add_folder_title_edit.text.isNullOrBlank()) {
bookmark_add_folder_title_edit.error =
if (bookmarkAddFolderTitleEdit.text.isNullOrBlank()) {
bookmarkAddFolderTitleEdit.error =
getString(R.string.bookmark_empty_title_error)
return true
}
lifecycleScope.launch(IO) {
val newGuid = requireComponents.core.bookmarksStorage.addFolder(
sharedViewModel.selectedFolder!!.guid, bookmark_add_folder_title_edit.text.toString(), null
sharedViewModel.selectedFolder!!.guid, bookmarkAddFolderTitleEdit.text.toString(), null
)
sharedViewModel.selectedFolder = requireComponents.core.bookmarksStorage.getTree(newGuid)
requireComponents.analytics.metrics.track(Event.AddBookmarkFolder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class EditBookmarkFragment : Fragment() {
when (bookmarkNode?.type) {
BookmarkNodeType.FOLDER -> {
activity?.title = getString(R.string.edit_bookmark_folder_fragment_title)
bookmark_url_edit.visibility = View.GONE
bookmark_url_label.visibility = View.GONE
bookmarkUrlEdit.visibility = View.GONE
bookmarkUrlLabel.visibility = View.GONE
}
BookmarkNodeType.ITEM -> {
activity?.title = getString(R.string.edit_bookmark_fragment_title)
Expand All @@ -94,8 +94,8 @@ class EditBookmarkFragment : Fragment() {
}

if (bookmarkNode != null) {
bookmark_name_edit.setText(bookmarkNode!!.title)
bookmark_url_edit.setText(bookmarkNode!!.url)
bookmarkNameEdit.setText(bookmarkNode!!.title)
bookmarkUrlEdit.setText(bookmarkNode!!.url)

if (sharedViewModel.selectedFolder != null && bookmarkNode?.title != null) {
val bookmarkPair = Pair(bookmarkNode?.title, bookmarkNode?.url)
Expand All @@ -106,8 +106,8 @@ class EditBookmarkFragment : Fragment() {

bookmarkParent?.let { node ->
launch(Main) {
bookmark_folder_selector.text = node.title
bookmark_folder_selector.setOnClickListener {
bookmarkFolderSelector.text = node.title
bookmarkFolderSelector.setOnClickListener {
sharedViewModel.selectedFolder = null
nav(
R.id.bookmarkEditFragment,
Expand All @@ -124,14 +124,14 @@ class EditBookmarkFragment : Fragment() {

override fun onPause() {
super.onPause()
bookmark_name_edit.hideKeyboard()
bookmark_url_edit.hideKeyboard()
bookmarkNameEdit.hideKeyboard()
bookmarkUrlEdit.hideKeyboard()
}

private fun updateBookmarkFromObservableInput() {
Observable.combineLatest(
bookmark_name_edit.textChanges().skipInitialValue(),
bookmark_url_edit.textChanges().skipInitialValue(),
bookmarkNameEdit.textChanges().skipInitialValue(),
bookmarkUrlEdit.textChanges().skipInitialValue(),
BiFunction { name: CharSequence, url: CharSequence ->
Pair(name.toString(), url.toString())
})
Expand Down Expand Up @@ -208,7 +208,7 @@ class EditBookmarkFragment : Fragment() {
}
} catch (e: UrlParseFailed) {
launch(Main) {
bookmark_url_edit.error = getString(R.string.bookmark_invalid_url_error)
bookmarkUrlEdit.error = getString(R.string.bookmark_invalid_url_error)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SelectBookmarkFolderFragment : Fragment(), AccountObserver {
findNavController(),
sharedViewModel
)
signInView = SignInView(view.select_bookmark_layout, bookmarkInteractor)
signInView = SignInView(view.selectBookmarkLayout, bookmarkInteractor)

return view
}
Expand Down Expand Up @@ -88,7 +88,7 @@ class SelectBookmarkFolderFragment : Fragment(), AccountObserver {
}
activity?.title = bookmarkNode?.title ?: getString(R.string.library_bookmarks)
val adapter = SelectBookmarkFolderAdapter(sharedViewModel)
recylerView_bookmark_folders.adapter = adapter
recylerViewBookmarkFolders.adapter = adapter
adapter.updateData(bookmarkNode)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), BackHandler {
::invalidateOptionsMenu,
::deleteHistoryItems
)
historyView = HistoryView(view.history_layout, historyInteractor)
historyView = HistoryView(view.historyLayout, historyInteractor)

return view
}
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class SearchFragment : Fragment(), BackHandler {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

search_scan_button.visibility = if (context?.hasCamera() == true) View.VISIBLE else View.GONE
searchScanButton.visibility = if (context?.hasCamera() == true) View.VISIBLE else View.GONE
layoutComponents(view.search_layout)

qrFeature.set(
Expand All @@ -119,7 +119,7 @@ class SearchFragment : Fragment(), BackHandler {
requestPermissions(permissions, REQUEST_CODE_CAMERA_PERMISSIONS)
},
onScanResult = { result ->
search_scan_button.isChecked = false
searchScanButton.isChecked = false
activity?.let {
AlertDialog.Builder(it).apply {
val spannable = resources.getSpannable(
Expand Down Expand Up @@ -153,15 +153,15 @@ class SearchFragment : Fragment(), BackHandler {
view = view
)

view.search_scan_button.setOnClickListener {
view.searchScanButton.setOnClickListener {
toolbarView.view.clearFocus()
requireComponents.analytics.metrics.track(Event.QRScannerOpened)
qrFeature.get()?.scan(R.id.container)
}

view.toolbar_wrapper.clipToOutline = false

search_shortcuts_button.setOnClickListener {
searchShortcutsButton.setOnClickListener {
val isOpen = searchStore.state.showShortcutEnginePicker
searchStore.dispatch(SearchAction.ShowSearchShortcutEnginePicker(!isOpen))

Expand Down Expand Up @@ -204,7 +204,7 @@ class SearchFragment : Fragment(), BackHandler {
override fun onBackPressed(): Boolean {
return when {
qrFeature.onBackPressed() -> {
view?.search_scan_button?.isChecked = false
view?.searchScanButton?.isChecked = false
toolbarView.view.requestFocus()
true
}
Expand All @@ -217,21 +217,21 @@ class SearchFragment : Fragment(), BackHandler {
val draw = BitmapDrawable(resources, searchIcon)
val iconSize = resources.getDimension(R.dimen.preference_icon_drawable_size).toInt()
draw.setBounds(0, 0, iconSize, iconSize)
search_engine_icon?.backgroundDrawable = draw
searchEngineIcon?.backgroundDrawable = draw
}

private fun updateSearchWithLabel(searchState: SearchState) {
search_with_shortcuts.visibility = if (searchState.showShortcutEnginePicker) View.VISIBLE else View.GONE
searchWithShortcuts.visibility = if (searchState.showShortcutEnginePicker) View.VISIBLE else View.GONE
}

private fun updateSearchShortuctsIcon(searchState: SearchState) {
with(requireContext()) {
val showShortcuts = searchState.showShortcutEnginePicker
search_shortcuts_button?.isChecked = showShortcuts
searchShortcutsButton?.isChecked = showShortcuts

val color = if (showShortcuts) R.attr.contrastText else R.attr.primaryText

search_shortcuts_button.compoundDrawables[0]?.setTint(getColorFromAttr(color))
searchShortcutsButton.compoundDrawables[0]?.setTint(getColorFromAttr(color))
}
}

Expand All @@ -244,7 +244,7 @@ class SearchFragment : Fragment(), BackHandler {
if (context.isPermissionGranted(Manifest.permission.CAMERA)) {
permissionDidUpdate = true
} else {
view?.search_scan_button?.isChecked = false
view?.searchScanButton?.isChecked = false
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/org/mozilla/fenix/search/SearchLayouts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal fun SearchFragment.setInExperimentConstraints(layout: ConstraintLayout)
toolbar_wrapper {
connect(
TOP to TOP of UNSET,
BOTTOM to TOP of pill_wrapper
BOTTOM to TOP of pillWrapper
)
}
awesomeBar {
Expand All @@ -46,7 +46,7 @@ internal fun SearchFragment.setInExperimentConstraints(layout: ConstraintLayout)
)
}
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = true
pill_wrapper {
pillWrapper {
connect(
BOTTOM to BOTTOM of PARENT_ID
)
Expand All @@ -63,20 +63,20 @@ internal fun SearchFragment.setOutOfExperimentConstraints(layout: ConstraintLayo
BOTTOM to TOP of UNSET
)
}
search_with_shortcuts {
searchWithShortcuts {
connect(
TOP to BOTTOM of toolbar_wrapper
)
}
awesomeBar {
connect(
TOP to TOP of UNSET,
TOP to BOTTOM of search_with_shortcuts,
BOTTOM to TOP of pill_wrapper
TOP to BOTTOM of searchWithShortcuts,
BOTTOM to TOP of pillWrapper
)
}
(awesomeBar.layoutManager as? LinearLayoutManager)?.reverseLayout = false
pill_wrapper {
pillWrapper {
connect(
BOTTOM to BOTTOM of PARENT_ID
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PairFragment : Fragment(), BackHandler {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

pair_instructions.text = HtmlCompat.fromHtml(getString(R.string.pair_instructions),
pairInstructions.text = HtmlCompat.fromHtml(getString(R.string.pair_instructions),
HtmlCompat.FROM_HTML_MODE_LEGACY)

qrFeature.set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SignOutFragment : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

view.sign_out_disconnect.setOnClickListener {
view.signOutDisconnect.setOnClickListener {
requireComponents.analytics.metrics.track(Event.SyncAccountSignOut)
lifecycleScope.launch {
accountManager.logoutAsync().await()
Expand All @@ -67,7 +67,7 @@ class SignOutFragment : BottomSheetDialogFragment() {
}
}

view.sign_out_cancel.setOnClickListener {
view.signOutCancel.setOnClickListener {
dismiss()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class TurnOnSyncFragment : Fragment(), AccountObserver {

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_turn_on_sync, container, false)
view.sign_in_scan_button.setOnClickListener(getClickListenerForPairing())
view.sign_in_email_button.setOnClickListener(getClickListenerForSignIn())
view.sign_in_instructions.text = HtmlCompat.fromHtml(
view.signInScanButton.setOnClickListener(getClickListenerForPairing())
view.signInEmailButton.setOnClickListener(getClickListenerForSignIn())
view.signInInstructions.text = HtmlCompat.fromHtml(
getString(R.string.sign_in_instructions),
HtmlCompat.FROM_HTML_MODE_LEGACY
)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/mozilla/fenix/share/ShareFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ShareFragment : AppCompatDialogFragment() {
tabs = args.tabs ?: arrayOf(ShareTab(args.url!!, args.title ?: ""))

component = ShareComponent(
view.share_wrapper,
view.shareWrapper,
ActionBusFactory.get(this),
FenixViewModelProvider.create(
this,
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/fragment_add_bookmark_folder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
android:textAllCaps="true"
android:textColor="?primaryText"
android:textSize="12sp"
android:labelFor="@id/bookmark_add_folder_title_edit" />
android:labelFor="@id/bookmarkAddFolderTitleEdit" />

<org.mozilla.fenix.utils.ClearableEditText
android:id="@+id/bookmark_add_folder_title_edit"
android:id="@+id/bookmarkAddFolderTitleEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
Expand All @@ -41,7 +41,7 @@
android:textSize="12sp" />

<TextView
android:id="@+id/bookmark_add_folder_parent_selector"
android:id="@+id/bookmarkAddFolderParentSelector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_bookmark.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
tools:context="org.mozilla.fenix.library.bookmarks.BookmarkFragment">

<LinearLayout
android:id="@+id/bookmark_layout"
android:id="@+id/bookmarkLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
Expand Down

0 comments on commit 671727c

Please sign in to comment.