- Double hamburger menus: App's navigation drawer + Google Scholar's mobile site menu
- PDF links broken: WebView doesn't properly handle PDF downloads/viewing
- Limited control: WebView wrapper limits customization and native feel
Replace WebView with native Android components that parse and display Scholar content.
┌─────────────────────────────────────────────────────────┐
│ UI Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ SearchFragment│ │ResultsFragment│ │ArticleDetail│ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
├─────────────────────────────────────────────────────────┤
│ ViewModel Layer │
│ ┌─────────────────────────────────────────────────┐ │
│ │ ScholarViewModel │ │
│ │ - searchResults: LiveData<List<Article>> │ │
│ │ - loading: LiveData<Boolean> │ │
│ └─────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────┤
│ Repository Layer │
│ ┌─────────────────────────────────────────────────┐ │
│ │ ScholarRepository │ │
│ │ - search(query): List<Article> │ │
│ │ - getArticleDetails(id): ArticleDetails │ │
│ └─────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────┤
│ Network Layer │
│ ┌──────────────────┐ ┌────────────────────────┐ │
│ │ ScholarApiClient │ │ ScholarHtmlParser │ │
│ │ (OkHttp) │ │ (Jsoup) │ │
│ └──────────────────┘ └────────────────────────┘ │
├─────────────────────────────────────────────────────────┤
│ Data Models │
│ ┌─────────┐ ┌──────────┐ ┌─────────┐ ┌────────┐ │
│ │ Article │ │ Author │ │Citation │ │PdfLink │ │
│ └─────────┘ └──────────┘ └─────────┘ └────────┘ │
└─────────────────────────────────────────────────────────┘
Create Kotlin data classes:
Article- title, authors, year, citations, abstract snippet, PDF linkAuthor- name, affiliation, profile URLSearchResult- list of articles, pagination infoPdfSource- URL, source name (publisher, arxiv, etc.)
ScholarApiClient- OkHttp client with cookie handling, user-agent spoofingScholarHtmlParser- Jsoup-based HTML parser for search results- Handle rate limiting and CAPTCHA detection
ScholarRepository- Coordinates API calls and parsing- Caching layer for recent searches
- Error handling and retry logic
ScholarViewModel- Manages UI stateSearchStatesealed class (Loading, Success, Error)- Pagination support
SearchFragment- Search bar with suggestionsResultsFragment- RecyclerView with article cardsArticleCardAdapter- Material card for each resultArticleDetailFragment- Full article view with actions
PdfHandler- Download manager integration- Intent handling for viewing PDFs
- Progress notification for downloads
- Remove WebView completely
- Update navigation drawer for native fragments
- Single hamburger menu (app's only)
// HTML Parsing
implementation("org.jsoup:jsoup:1.17.2")
// Networking
implementation("com.squareup.okhttp3:okhttp:4.12.0")
// Image Loading (for author avatars, thumbnails)
implementation("io.coil-kt:coil:2.5.0")
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")app/src/main/java/com/scholar/android/
├── ScholarApplication.kt
├── data/
│ └── model/
│ ├── Article.kt
│ ├── Author.kt
│ ├── SearchResult.kt
│ └── PdfSource.kt
├── network/
│ ├── ScholarApiClient.kt
│ └── ScholarHtmlParser.kt
├── repository/
│ └── ScholarRepository.kt
├── viewmodel/
│ └── ScholarViewModel.kt
├── ui/
│ ├── MainActivity.kt (refactored)
│ ├── search/
│ │ └── SearchFragment.kt
│ ├── results/
│ │ ├── ResultsFragment.kt
│ │ └── ArticleCardAdapter.kt
│ └── detail/
│ └── ArticleDetailFragment.kt
└── util/
├── PdfHandler.kt
├── NetworkUtils.kt
└── ScholarUrls.kt (updated)
- Create data models
- Implement ScholarApiClient
- Implement ScholarHtmlParser
- Add new dependencies
- Implement ScholarRepository
- Create ScholarViewModel
- Define state classes
- Create fragment layouts
- Implement RecyclerView adapter
- Create article card layout
- Update navigation
- Implement PdfHandler
- Update MainActivity
- Remove old WebView code
- Test integration
- Google Scholar blocking: Use realistic user-agent, respect rate limits
- HTML structure changes: Parser should be resilient, log warnings
- CAPTCHA challenges: Detect and prompt user, fallback to WebView if needed
- PDF access: Some PDFs require authentication - handle gracefully
- Single hamburger menu (app navigation only)
- Search results display in native RecyclerView
- PDF links open in PDF viewer or download
- Smooth scrolling and native feel
- Navigation drawer works correctly
- Back navigation works properly