diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-04-07 23:28:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-07 23:28:14 +0200 |
commit | e578f4ca93f6292f62e4b4c7fa11d17fe0b27c71 (patch) | |
tree | 383ed908c22d51fd789b8db814a4dc17e7d5dfb7 | |
parent | fc40da28a7a9146cd1e3c11e5169477ba85399c1 (diff) | |
download | AntennaPod-e578f4ca93f6292f62e4b4c7fa11d17fe0b27c71.zip |
CI tweaks (#7069)
- Run Checkstyle with gradle to make it easier for users
- No longer needs different configuration for new code
- Exclude current violations
- Fix some violations that somehow couldn't be specified in the exclusion file
- Print SpotBugs/Lint/Checkstly violations in GitHub format
- Then the CI run gets annotated on the web UI
44 files changed, 501 insertions, 625 deletions
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ef44d874d..bcf581997 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,6 +9,7 @@ --> - [ ] I have read the contribution guidelines: https://github.com/AntennaPod/AntennaPod/blob/develop/CONTRIBUTING.md#submit-a-pull-request - [ ] I have performed a self-review of my code +- [ ] I have run the automated code checks using `./gradlew checkstyle spotbugsPlayDebug spotbugsDebug :app:lintPlayDebug` - [ ] My code follows the style guidelines of the AntennaPod project: https://github.com/AntennaPod/AntennaPod/wiki/Code-style - [ ] I have mentioned the corresponding issue and the relevant keyword (e.g., "Closes: #xy") in the description (see https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) - [ ] If it is a core feature, I have added automated tests diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 9dbfdcf1a..6431f3125 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -7,36 +7,8 @@ on: branches: [ master, develop ] jobs: - code-style: - name: "Code Style" - runs-on: ubuntu-latest - timeout-minutes: 45 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Checkstyle - run: | - curl -s -L https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.3.1/checkstyle-10.3.1-all.jar > checkstyle.jar - find . -name "*\.java" | xargs java -Dconfig_loc=config/checkstyle -jar checkstyle.jar -c config/checkstyle/checkstyle.xml - - name: Find PR Base Commit - id: vars - run: | - git fetch origin develop - echo "branchBaseCommit=$(git merge-base origin/develop HEAD)" >> $GITHUB_OUTPUT - - name: Diff-Checkstyle - run: | - curl -s -L https://github.com/yangziwen/diff-check/releases/download/0.0.7/diff-checkstyle.jar > diff-checkstyle.jar - java -Dconfig_loc=config/checkstyle -jar diff-checkstyle.jar -c config/checkstyle/checkstyle-new-code.xml --git-dir . --base-rev ${{ steps.vars.outputs.branchBaseCommit }} - - name: XML of changed files - run: | - curl -s -L https://github.com/ByteHamster/android-xml-formatter/releases/download/1.1.0/android-xml-formatter.jar > android-xml-formatter.jar - git diff --name-only ${{ steps.vars.outputs.branchBaseCommit }} --diff-filter=AM | { grep "res/layout/" || true; } | xargs java -jar android-xml-formatter.jar - test $(git diff | wc -l) -eq 0 || (echo -e "\n\n===== Found XML code style violations! See output below how to fix them. =====\n\n" && git --no-pager diff --color=always && false) - wrapper-validation: name: "Gradle Wrapper Validation" - needs: code-style runs-on: ubuntu-latest timeout-minutes: 45 steps: @@ -45,11 +17,12 @@ jobs: static-analysis: name: "Static Code Analysis" - needs: code-style runs-on: ubuntu-latest timeout-minutes: 45 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up JDK 17 uses: actions/setup-java@v4 with: @@ -62,14 +35,24 @@ jobs: ~/.gradle/caches ~/.gradle/wrapper key: gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} - - name: Lint :app module recursively - run: ./gradlew :app:lintPlayRelease - - name: SpotBugs - run: ./gradlew spotbugsPlayDebug spotbugsDebug + - name: Configure parallel build + run: echo "org.gradle.parallel=true" >> local.properties + - name: XML code style + run: | + curl -s -L https://github.com/ByteHamster/android-xml-formatter/releases/download/1.1.0/android-xml-formatter.jar > android-xml-formatter.jar + find . -wholename "*/res/layout/*.xml" | xargs java -jar android-xml-formatter.jar + test $(git diff | wc -l) -eq 0 || (echo -e "\n\n===== Found XML code style violations! See output below how to fix them. =====\n\n" && git --no-pager diff --color=always && false) + - name: Checkstyle, Lint, SpotBugs + run: ./gradlew checkstyle :app:lintPlayDebug spotbugsPlayDebug spotbugsDebug + - name: Generate readable error messages for GitHub + if: failure() + run: | + git diff --name-only | xargs -I '{}' echo "::error file={},line=1,endLine=1,title=XML Format::Run android-xml-formatter.jar on this file or view CI output to see how it should be formatted." + python .github/workflows/errorPrinter.py unit-test: name: "Unit Test: ${{ matrix.variant }}" - needs: code-style + needs: static-analysis runs-on: ubuntu-latest timeout-minutes: 45 strategy: @@ -101,6 +84,8 @@ jobs: ~/.gradle/caches ~/.gradle/wrapper key: gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + - name: Configure parallel build + run: echo "org.gradle.parallel=true" >> local.properties - name: Create temporary release keystore run: keytool -noprompt -genkey -v -keystore "app/keystore" -alias alias -storepass password -keypass password -keyalg RSA -validity 10 -dname "CN=antennapod.org, OU=dummy, O=dummy, L=dummy, S=dummy, C=US" - name: Build @@ -116,7 +101,7 @@ jobs: emulator-test: name: "Emulator Test" - needs: code-style + needs: static-analysis runs-on: macOS-latest timeout-minutes: 45 env: @@ -135,6 +120,8 @@ jobs: ~/.gradle/caches ~/.gradle/wrapper key: gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + - name: Configure parallel build + run: echo "org.gradle.parallel=true" >> local.properties - name: Build with Gradle run: ./gradlew assemblePlayDebugAndroidTest - name: Android Emulator test diff --git a/.github/workflows/errorPrinter.py b/.github/workflows/errorPrinter.py new file mode 100644 index 000000000..c83b9b3ad --- /dev/null +++ b/.github/workflows/errorPrinter.py @@ -0,0 +1,48 @@ +#!/bin/python +from xml.dom import minidom +import os.path +import glob +from pathlib import Path + +if os.path.isfile('app/build/reports/lint-results-playDebug.xml'): + dom = minidom.parse('app/build/reports/lint-results-playDebug.xml') + issues = dom.getElementsByTagName('issue') + for issue in issues: + locations = issue.getElementsByTagName('location') + for location in locations: + print(location.attributes['file'].value + ":" + location.attributes['line'].value + " " + issue.attributes['summary'].value) + print("::error file=" + location.attributes['file'].value + + ",line=" + location.attributes['line'].value + + ",endLine=" + location.attributes['line'].value + + ",title=Lint::" + issue.attributes['summary'].value + ". " + issue.attributes['explanation'].value.replace('\n', ' ')) + print() + +if os.path.isfile('build/reports/checkstyle/checkstyle.xml'): + dom = minidom.parse('build/reports/checkstyle/checkstyle.xml') + files = dom.getElementsByTagName('file') + for f in files: + errors = f.getElementsByTagName('error') + for error in errors: + print(f.attributes['name'].value + ":" + error.attributes['line'].value + " " + error.attributes['message'].value) + print("::error file=" + f.attributes['name'].value + + ",line=" + error.attributes['line'].value + + ",endLine=" + error.attributes['line'].value + + ",title=Checkstyle::" + error.attributes['message'].value) + print() + + +for filename in glob.iglob('**/build/reports/spotbugs/*.xml', recursive=True): + filenamePath = Path(filename) + dom = minidom.parse(filename) + instance = dom.getElementsByTagName('BugInstance') + for inst in instance: + lines = inst.getElementsByTagName('SourceLine') + longMessage = inst.getElementsByTagName('LongMessage')[0].firstChild.nodeValue + for line in lines: + if "primary" in line.attributes: + print(line.attributes['sourcepath'].value + ": " + longMessage) + print("::error file=" + str(filenamePath.parent.parent.parent.parent.absolute()) + "/src/main/java/" + line.attributes['sourcepath'].value + + ",line=" + line.attributes['start'].value + + ",endLine=" + line.attributes['end'].value + + ",title=SpotBugs::" + longMessage.replace('\n', ' ')) + print() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 201e98545..3c6ef5259 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,8 @@ Submit a pull request - Get coding :) - If possible, add unit tests for your pull request and make sure that they pass. - Please do not upgrade dependencies or build tools unless you have a good reason for it. Doing so can easily introduce bugs that are hard to track down. - - Please follow our code style. You can use Checkstyle within Android Studio using our [configuration file](https://github.com/AntennaPod/AntennaPod/blob/develop/config/checkstyle/checkstyle-new-code.xml). + - Please follow our code style. You can use Checkstyle within Android Studio using our [configuration file](https://github.com/AntennaPod/AntennaPod/blob/develop/config/checkstyle/checkstyle.xml). + - To check the code style locally, run `./gradlew checkstyle spotbugsPlayDebug spotbugsDebug :app:lintPlayDebug` - Please only change the English string resources. Translations are handled on [Transifex](https://www.transifex.com/antennapod/antennapod/). - Open the PR - Mention the corresponding issue in the pull request text, so that it can be closed once your pull request has been merged. If you use [special keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue), GitHub will close the issue(s) automatically. diff --git a/app/build.gradle b/app/build.gradle index 5b4fdf6b4..2abb66ccf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,13 +47,11 @@ android { } lint { - disable 'ObsoleteLintCustomCheck', 'CheckResult', 'UnusedAttribute', 'BatteryLife', 'InflateParams', - 'RestrictedApi', 'TrustAllX509TrustManager', 'ExportedReceiver', 'AllowBackup', 'VectorDrawableCompat', - 'StaticFieldLeak', 'UseCompoundDrawables', 'NestedWeights', 'Overdraw', 'UselessParent', 'TextFields', - 'AlwaysShowAction', 'Autofill', 'ClickableViewAccessibility', 'ContentDescription', + disable 'CheckResult', 'MissingMediaBrowserServiceIntentFilter', 'UnusedAttribute', 'InflateParams', + 'RestrictedApi', 'ExportedReceiver', 'NotifyDataSetChanged', 'UseCompoundDrawables', 'NestedWeights', + 'Overdraw', 'UselessParent', 'TextFields', 'AlwaysShowAction', 'Autofill', 'ClickableViewAccessibility', 'KeyboardInaccessibleWidget', 'LabelFor', 'SetTextI18n', 'HardcodedText', 'RelativeOverlap', - 'RtlCompat', 'RtlHardcoded', 'MissingMediaBrowserServiceIntentFilter', 'VectorPath', - 'InvalidPeriodicWorkRequestInterval', 'NotifyDataSetChanged', 'RtlEnabled' + 'RtlHardcoded', 'RtlEnabled', 'ContentDescription' } androidResources { diff --git a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java index 9aedbb493..d37ef3b07 100644 --- a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java @@ -7,9 +7,7 @@ import java.io.IOException; /** * Utility methods for FeedGenerator */ -class GeneratorUtil { - private GeneratorUtil(){} - +abstract class GeneratorUtil { public static void addPaymentLink(XmlSerializer xml, String paymentLink, boolean withNamespace) throws IOException { String ns = (withNamespace) ? "http://www.w3.org/2005/Atom" : null; xml.startTag(ns, "link"); diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ProxyDialog.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ProxyDialog.java index ca4b4b5e5..6086f5cb1 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ProxyDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/ProxyDialog.java @@ -173,10 +173,12 @@ public class ProxyDialog { private final TextWatcher requireTestOnChange = new TextWatcher() { @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } @Override - public void onTextChanged(CharSequence s, int start, int before, int count) {} + public void onTextChanged(CharSequence s, int start, int before, int count) { + } @Override public void afterTextChanged(Editable s) { diff --git a/app/src/main/java/de/danoeh/antennapod/ui/view/LockableBottomSheetBehavior.java b/app/src/main/java/de/danoeh/antennapod/ui/view/LockableBottomSheetBehavior.java index aa506aaea..13fcd2715 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/view/LockableBottomSheetBehavior.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/view/LockableBottomSheetBehavior.java @@ -13,7 +13,8 @@ import com.google.android.material.bottomsheet.ViewPagerBottomSheetBehavior; public class LockableBottomSheetBehavior<V extends View> extends ViewPagerBottomSheetBehavior<V> { private boolean isLocked = false; - public LockableBottomSheetBehavior() {} + public LockableBottomSheetBehavior() { + } public LockableBottomSheetBehavior(Context context, AttributeSet attrs) { super(context, attrs); diff --git a/app/src/main/res/layout/alternate_urls_dropdown_item.xml b/app/src/main/res/layout/alternate_urls_dropdown_item.xml index 82de8a02f..3c4dcc7fc 100644 --- a/app/src/main/res/layout/alternate_urls_dropdown_item.xml +++ b/app/src/main/res/layout/alternate_urls_dropdown_item.xml @@ -2,7 +2,7 @@ <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" - style="?android:attr/spinnerDropDownItemStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingVertical="8dp" /> + android:paddingVertical="8dp" + style="?android:attr/spinnerDropDownItemStyle" /> diff --git a/app/src/main/res/layout/alternate_urls_item.xml b/app/src/main/res/layout/alternate_urls_item.xml index 9fdb50e33..54e05b49d 100644 --- a/app/src/main/res/layout/alternate_urls_item.xml +++ b/app/src/main/res/layout/alternate_urls_item.xml @@ -2,8 +2,8 @@ <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" - style="?android:attr/spinnerItemStyle" android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLines="3" - android:textAlignment="inherit" /> + android:textAlignment="inherit" + style="?android:attr/spinnerItemStyle" /> diff --git a/app/src/main/res/layout/bug_report.xml b/app/src/main/res/layout/bug_report.xml index e97e85265..447ce911f 100644 --- a/app/src/main/res/layout/bug_report.xml +++ b/app/src/main/res/layout/bug_report.xml @@ -1,28 +1,30 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="16dp"> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="16dp"> + <Button - android:id="@+id/btn_open_bug_tracker" - android:text="@string/open_bug_tracker" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> + android:id="@+id/btn_open_bug_tracker" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/open_bug_tracker" /> <Button - android:id="@+id/btn_copy_log" - android:text="@string/copy_to_clipboard" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> + android:id="@+id/btn_copy_log" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/copy_to_clipboard" /> <TextView - android:layout_marginTop="8dp" - android:id="@+id/crash_report_logs" - android:textIsSelectable="true" - android:textSize="12sp" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1"/> + android:id="@+id/crash_report_logs" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginTop="8dp" + android:textIsSelectable="true" + android:textSize="12sp" + android:layout_weight="1" /> </LinearLayout> diff --git a/app/src/main/res/layout/checkbox_do_not_show_again.xml b/app/src/main/res/layout/checkbox_do_not_show_again.xml index 15f26e8b4..9953f9afc 100644 --- a/app/src/main/res/layout/checkbox_do_not_show_again.xml +++ b/app/src/main/res/layout/checkbox_do_not_show_again.xml @@ -1,17 +1,18 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:paddingTop="8dp" - android:paddingBottom="8dp"> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingTop="8dp" + android:paddingBottom="8dp"> <CheckBox - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/checkbox_do_not_show_again" - android:text="@string/checkbox_do_not_show_again"/> + android:id="@+id/checkbox_do_not_show_again" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/checkbox_do_not_show_again" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/app/src/main/res/layout/edit_text_dialog.xml b/app/src/main/res/layout/edit_text_dialog.xml index b442b92ce..49e2b8fbb 100644 --- a/app/src/main/res/layout/edit_text_dialog.xml +++ b/app/src/main/res/layout/edit_text_dialog.xml @@ -1,15 +1,16 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="16dp"> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="16dp"> <EditText - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:inputType="text" - android:ems="10" - android:id="@+id/urlEditText" /> + android:id="@+id/urlEditText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="text" + android:ems="10" /> </LinearLayout> diff --git a/app/src/main/res/layout/ellipsize_start_listitem.xml b/app/src/main/res/layout/ellipsize_start_listitem.xml index 1b6c48152..fcdf85809 100644 --- a/app/src/main/res/layout/ellipsize_start_listitem.xml +++ b/app/src/main/res/layout/ellipsize_start_listitem.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" @@ -19,4 +19,4 @@ tools:background="@android:color/holo_green_dark" tools:text="List item title" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/app/src/main/res/layout/empty_view_layout.xml b/app/src/main/res/layout/empty_view_layout.xml index c6de8d2d0..e02c5debe 100644 --- a/app/src/main/res/layout/empty_view_layout.xml +++ b/app/src/main/res/layout/empty_view_layout.xml @@ -1,36 +1,37 @@ -<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:gravity="center"
- android:layout_centerInParent="true"
- android:paddingLeft="40dp"
- android:paddingRight="40dp"
- xmlns:tools="http://schemas.android.com/tools">
-
- <ImageView
- android:id="@+id/emptyViewIcon"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:visibility="gone"
- tools:src="@drawable/ic_feed"
- tools:visibility="visible"/>
-
- <TextView
- android:id="@+id/emptyViewTitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- tools:text="Title"
- android:textSize="16sp"
- android:textColor="?android:attr/textColorPrimary"/>
-
- <TextView
- android:id="@+id/emptyViewMessage"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="14sp"
- tools:text="Message"
- android:textAlignment="center"/>
-
-</LinearLayout>
\ No newline at end of file +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:gravity="center" + android:layout_centerInParent="true" + android:paddingLeft="40dp" + android:paddingRight="40dp"> + + <ImageView + android:id="@+id/emptyViewIcon" + android:layout_width="32dp" + android:layout_height="32dp" + android:visibility="gone" + tools:src="@drawable/ic_feed" + tools:visibility="visible" /> + + <TextView + android:id="@+id/emptyViewTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="16sp" + android:textColor="?android:attr/textColorPrimary" + tools:text="Title" /> + + <TextView + android:id="@+id/emptyViewMessage" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="14sp" + android:textAlignment="center" + tools:text="Message" /> + +</LinearLayout> diff --git a/app/src/main/res/layout/feed_pref_skip_dialog.xml b/app/src/main/res/layout/feed_pref_skip_dialog.xml index db76a3426..98c1dabe8 100644 --- a/app/src/main/res/layout/feed_pref_skip_dialog.xml +++ b/app/src/main/res/layout/feed_pref_skip_dialog.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" > + android:orientation="vertical"> <TextView android:id="@+id/labelSkipIntro" @@ -15,7 +16,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal" > + android:orientation="horizontal"> <EditText android:id="@+id/etxtSkipIntro" @@ -51,7 +52,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal" > + android:orientation="horizontal"> <EditText android:id="@+id/etxtSkipEnd" @@ -73,6 +74,7 @@ android:layout_marginLeft="8dp" android:layout_marginRight="24dp" android:text="@string/time_seconds" /> + </LinearLayout> </LinearLayout> diff --git a/app/src/main/res/layout/secondary_action.xml b/app/src/main/res/layout/secondary_action.xml index e5bff480e..1c2bd203a 100644 --- a/app/src/main/res/layout/secondary_action.xml +++ b/app/src/main/res/layout/secondary_action.xml @@ -1,29 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_marginRight="12dp" - android:layout_marginEnd="12dp" - android:id="@+id/secondaryActionButton" - android:background="?selectableItemBackgroundBorderless" - android:clickable="true" - android:focusable="false" - android:focusableInTouchMode="false" > +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/secondaryActionButton" + android:layout_width="48dp" + android:layout_height="48dp" + android:layout_marginRight="12dp" + android:layout_marginEnd="12dp" + android:background="?selectableItemBackgroundBorderless" + android:clickable="true" + android:focusable="false" + android:focusableInTouchMode="false"> <ImageView - android:id="@+id/secondaryActionIcon" - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center" - tools:ignore="ContentDescription" - tools:src="@sample/secondaryaction"/> + android:id="@+id/secondaryActionIcon" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center" + tools:ignore="ContentDescription" + tools:src="@sample/secondaryaction" /> <de.danoeh.antennapod.ui.common.CircularProgressBar - android:id="@+id/secondaryActionProgress" - android:layout_width="40dp" - android:layout_gravity="center" - android:layout_height="40dp" - app:foregroundColor="?attr/action_icon_color"/> + android:id="@+id/secondaryActionProgress" + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_gravity="center" + app:foregroundColor="?attr/action_icon_color" /> + </FrameLayout> diff --git a/app/src/main/res/layout/simple_list_item_multiple_choice_on_start.xml b/app/src/main/res/layout/simple_list_item_multiple_choice_on_start.xml index f10df5c96..7de6e2541 100644 --- a/app/src/main/res/layout/simple_list_item_multiple_choice_on_start.xml +++ b/app/src/main/res/layout/simple_list_item_multiple_choice_on_start.xml @@ -17,8 +17,8 @@ See the License for the specific language governing permissions and limitations under the License. --> - -<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" +<CheckedTextView + xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeightSmall" @@ -31,5 +31,4 @@ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingRight="?android:attr/listPreferredItemPaddingRight" android:maxLines="2" - android:ellipsize="end" - /> + android:ellipsize="end" /> diff --git a/app/src/main/res/layout/simplechapter_item.xml b/app/src/main/res/layout/simplechapter_item.xml index 276ce48bc..c85db3c21 100644 --- a/app/src/main/res/layout/simplechapter_item.xml +++ b/app/src/main/res/layout/simplechapter_item.xml @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="center_vertical" - android:baselineAligned="false" - android:descendantFocusability="blocksDescendants"> + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical" + android:baselineAligned="false" + android:descendantFocusability="blocksDescendants"> <ImageView android:id="@+id/imgvCover" @@ -17,57 +17,59 @@ android:importantForAccessibility="no" android:layout_marginLeft="16dp" android:layout_marginStart="16dp" - tools:src="@tools:sample/avatars"/> + tools:src="@tools:sample/avatars" /> <LinearLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" - android:layout_marginRight="@dimen/listitem_threeline_textrightpadding" - android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding" - android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" - android:layout_marginLeft="16dp" - android:layout_marginStart="16dp" - android:layout_weight="1" - android:orientation="vertical"> + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" + android:layout_marginRight="@dimen/listitem_threeline_textrightpadding" + android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding" + android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" + android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" + android:layout_weight="1" + android:orientation="vertical"> <TextView - android:id="@+id/txtvStart" - style="@style/AntennaPod.TextView.ListItemSecondaryTitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - tools:text="00:00:00"/> + android:id="@+id/txtvStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + style="@style/AntennaPod.TextView.ListItemSecondaryTitle" + tools:text="00:00:00" /> <TextView - android:id="@+id/txtvTitle" - style="@style/AntennaPod.TextView.ListItemPrimaryTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:text="@sample/episodes.json/data/title" - android:ellipsize="end"/> + android:id="@+id/txtvTitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ellipsize="end" + style="@style/AntennaPod.TextView.ListItemPrimaryTitle" + tools:text="@sample/episodes.json/data/title" /> <TextView - android:id="@+id/txtvLink" - android:layout_width="match_parent" - android:layout_height="wrap_content" - style="@style/AntennaPod.TextView.ListItemSecondaryTitle" - android:focusable="false" - android:focusableInTouchMode="false" - android:visibility="gone" - android:background="?attr/selectableItemBackground" - tools:visibility="visible" - tools:text="https://example.com"/> + android:id="@+id/txtvLink" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:focusable="false" + android:focusableInTouchMode="false" + android:visibility="gone" + android:background="?attr/selectableItemBackground" + style="@style/AntennaPod.TextView.ListItemSecondaryTitle" + tools:visibility="visible" + tools:text="https://example.com" /> <TextView - android:id="@+id/txtvDuration" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - style="@style/AntennaPod.TextView.ListItemSecondaryTitle" - android:focusable="false" - android:focusableInTouchMode="false" - tools:text="Duration: 00:00:00"/> + android:id="@+id/txtvDuration" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:focusable="false" + android:focusableInTouchMode="false" + style="@style/AntennaPod.TextView.ListItemSecondaryTitle" + tools:text="Duration: 00:00:00" /> + </LinearLayout> - <include layout="@layout/secondary_action"/> + <include + layout="@layout/secondary_action" /> </LinearLayout> diff --git a/config/checkstyle/checkstyle-new-code.xml b/config/checkstyle/checkstyle-new-code.xml deleted file mode 100644 index 7d7270a9c..000000000 --- a/config/checkstyle/checkstyle-new-code.xml +++ /dev/null @@ -1,235 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE module PUBLIC - "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" - "https://checkstyle.org/dtds/configuration_1_3.dtd"> -<module name = "Checker"> - <property name="charset" value="UTF-8"/> - <property name="severity" value="error"/> - <property name="fileExtensions" value="java, properties, xml"/> - - <module name="SuppressionFilter"> - <property name="file" value="${config_loc}/suppressions.xml" /> - </module> - - <module name="FileTabCharacter"> - <property name="eachLine" value="true"/> - </module> - - <module name="TreeWalker"> - <module name="OuterTypeFilename"/> - <module name="IllegalTokenText"> - <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/> - <property name="format" - value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/> - <property name="message" - value="Consider using special escape sequence instead of octal value or Unicode escaped value."/> - </module> - <module name="AvoidEscapedUnicodeCharacters"> - <property name="allowEscapesForControlCharacters" value="true"/> - <property name="allowByTailComment" value="true"/> - <property name="allowNonPrintableEscapes" value="true"/> - </module> - <module name="LineLength"> - <property name="max" value="120"/> - <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> - </module> - <module name="AvoidStarImport"/> - <module name="UnusedImports"/> - <module name="OneTopLevelClass"/> - <module name="NoLineWrap"/> - <module name="EmptyBlock"> - <property name="option" value="TEXT"/> - <property name="tokens" - value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> - </module> - <module name="NeedBraces"/> - <module name="LeftCurly"/> - <module name="RightCurly"> - <property name="id" value="RightCurlySame"/> - <property name="tokens" - value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, - LITERAL_DO"/> - </module> - <module name="RightCurly"> - <property name="id" value="RightCurlyAlone"/> - <property name="option" value="alone"/> - <property name="tokens" - value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, - INSTANCE_INIT"/> - </module> - <module name="WhitespaceAround"> - <property name="allowEmptyConstructors" value="true"/> - <property name="allowEmptyMethods" value="true"/> - <property name="allowEmptyTypes" value="true"/> - <property name="allowEmptyLoops" value="true"/> - <message key="ws.notFollowed" - value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/> - <message key="ws.notPreceded" - value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> - </module> - <module name="OneStatementPerLine"/> - <module name="MultipleVariableDeclarations"/> - <module name="ArrayTypeStyle"/> - <module name="MissingSwitchDefault"/> - <module name="FallThrough"/> - <module name="UpperEll"/> - <module name="ModifierOrder"/> - <module name="EmptyLineSeparator"> - <property name="allowNoEmptyLineBetweenFields" value="true"/> - </module> - <module name="SeparatorWrap"> - <property name="id" value="SeparatorWrapDot"/> - <property name="tokens" value="DOT"/> - <property name="option" value="nl"/> - </module> - <module name="SeparatorWrap"> - <property name="id" value="SeparatorWrapComma"/> - <property name="tokens" value="COMMA"/> - <property name="option" value="EOL"/> - </module> - <module name="SeparatorWrap"> - <!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 --> - <property name="id" value="SeparatorWrapEllipsis"/> - <property name="tokens" value="ELLIPSIS"/> - <property name="option" value="EOL"/> - </module> - <module name="SeparatorWrap"> - <!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 --> - <property name="id" value="SeparatorWrapArrayDeclarator"/> - <property name="tokens" value="ARRAY_DECLARATOR"/> - <property name="option" value="EOL"/> - </module> - <module name="SeparatorWrap"> - <property name="id" value="SeparatorWrapMethodRef"/> - <property name="tokens" value="METHOD_REF"/> - <property name="option" value="nl"/> - </module> - <module name="PackageName"> - <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> - <message key="name.invalidPattern" - value="Package name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="TypeName"> - <message key="name.invalidPattern" - value="Type name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="MemberName"> - <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> - <message key="name.invalidPattern" - value="Member name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="ParameterName"> - <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> - <message key="name.invalidPattern" - value="Parameter name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="LambdaParameterName"> - <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> - <message key="name.invalidPattern" - value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="CatchParameterName"> - <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> - <message key="name.invalidPattern" - value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="LocalVariableName"> - <property name="tokens" value="VARIABLE_DEF"/> - <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> - <message key="name.invalidPattern" - value="Local variable name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="ClassTypeParameterName"> - <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> - <message key="name.invalidPattern" - value="Class type name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="MethodTypeParameterName"> - <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> - <message key="name.invalidPattern" - value="Method type name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="InterfaceTypeParameterName"> - <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> - <message key="name.invalidPattern" - value="Interface type name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="NoFinalizer"/> - <module name="GenericWhitespace"> - <message key="ws.followed" - value="GenericWhitespace ''{0}'' is followed by whitespace."/> - <message key="ws.preceded" - value="GenericWhitespace ''{0}'' is preceded with whitespace."/> - <message key="ws.illegalFollow" - value="GenericWhitespace ''{0}'' should followed by whitespace."/> - <message key="ws.notPreceded" - value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> - </module> - <module name="Indentation"> - <property name="basicOffset" value="4"/> - <property name="braceAdjustment" value="0"/> - <property name="caseIndent" value="4"/> - <property name="throwsIndent" value="8"/> - <property name="lineWrappingIndentation" value="8"/> - <property name="arrayInitIndent" value="4"/> - </module> - <module name="AbbreviationAsWordInName"> - <property name="ignoreFinal" value="false"/> - <property name="allowedAbbreviationLength" value="1"/> - </module> - <module name="VariableDeclarationUsageDistance"/> - <module name="MethodParamPad"/> - <module name="WhitespaceAfter"/> - <module name="NoWhitespaceBefore"> - <property name="tokens" - value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/> - <property name="allowLineBreaks" value="true"/> - </module> - <module name="ParenPad"/> - <module name="OperatorWrap"> - <property name="option" value="NL"/> - <property name="tokens" - value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, - LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/> - </module> - <module name="AnnotationLocation"> - <property name="id" value="AnnotationLocationMostCases"/> - <property name="tokens" - value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/> - </module> - <module name="AnnotationLocation"> - <property name="id" value="AnnotationLocationVariables"/> - <property name="tokens" value="VARIABLE_DEF"/> - <property name="allowSamelineMultipleAnnotations" value="true"/> - </module> - <module name="NonEmptyAtclauseDescription"/> - <module name="JavadocTagContinuationIndentation"/> - <module name="JavadocParagraph"/> - <module name="AtclauseOrder"> - <property name="tagOrder" value="@param, @return, @throws, @deprecated"/> - <property name="target" - value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> - </module> - <module name="MethodName"> - <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/> - <message key="name.invalidPattern" - value="Method name ''{0}'' must match pattern ''{1}''."/> - </module> - <module name="SingleLineJavadoc"> - <property name="ignoreInlineTags" value="false"/> - </module> - <module name="EmptyCatchBlock"> - <property name="exceptionVariableName" value="expected"/> - </module> - <module name="CommentsIndentation"/> - <module name="NestedIfDepth"> - <property name="max" value="4"/> - </module> - <module name="NestedTryDepth"> - <property name="max" value="2"/> - </module> - <module name="NestedForDepth"> - <property name="max" value="2"/> - </module> - </module> -</module> diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index ffd6f6497..d6775d9e0 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -5,7 +5,7 @@ <module name = "Checker"> <property name="charset" value="UTF-8"/> <property name="severity" value="error"/> - <property name="fileExtensions" value="java, properties, xml"/> + <property name="fileExtensions" value="java"/> <module name="SuppressionFilter"> <property name="file" value="${config_loc}/suppressions.xml" /> @@ -15,6 +15,11 @@ <property name="eachLine" value="true"/> </module> + <module name="LineLength"> + <property name="max" value="120"/> + <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> + </module> + <module name="TreeWalker"> <module name="OuterTypeFilename"/> <module name="IllegalTokenText"> @@ -38,14 +43,35 @@ <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> </module> + <module name="NeedBraces"/> + <module name="LeftCurly"/> <module name="RightCurly"> <property name="id" value="RightCurlySame"/> <property name="tokens" - value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/> + value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, + LITERAL_DO"/> + </module> + <module name="RightCurly"> + <property name="id" value="RightCurlyAlone"/> + <property name="option" value="alone"/> + <property name="tokens" + value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, + INSTANCE_INIT"/> + </module> + <module name="WhitespaceAround"> + <property name="allowEmptyConstructors" value="true"/> + <property name="allowEmptyMethods" value="true"/> + <property name="allowEmptyTypes" value="true"/> + <property name="allowEmptyLoops" value="true"/> + <message key="ws.notFollowed" + value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/> + <message key="ws.notPreceded" + value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> </module> <module name="OneStatementPerLine"/> <module name="MultipleVariableDeclarations"/> <module name="ArrayTypeStyle"/> + <module name="MissingSwitchDefault"/> <module name="FallThrough"/> <module name="UpperEll"/> <module name="ModifierOrder"/> @@ -88,6 +114,16 @@ <message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''."/> </module> + <module name="MemberName"> + <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> + <message key="name.invalidPattern" + value="Member name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="ParameterName"> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" + value="Parameter name ''{0}'' must match pattern ''{1}''."/> + </module> <module name="LambdaParameterName"> <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> <message key="name.invalidPattern" @@ -98,6 +134,12 @@ <message key="name.invalidPattern" value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> </module> + <module name="LocalVariableName"> + <property name="tokens" value="VARIABLE_DEF"/> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" + value="Local variable name ''{0}'' must match pattern ''{1}''."/> + </module> <module name="ClassTypeParameterName"> <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> <message key="name.invalidPattern" @@ -133,12 +175,25 @@ <property name="lineWrappingIndentation" value="8"/> <property name="arrayInitIndent" value="4"/> </module> + <module name="AbbreviationAsWordInName"> + <property name="ignoreFinal" value="false"/> + <property name="allowedAbbreviationLength" value="1"/> + </module> + <module name="VariableDeclarationUsageDistance"/> + <module name="MethodParamPad"/> + <module name="WhitespaceAfter"/> <module name="NoWhitespaceBefore"> <property name="tokens" value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/> <property name="allowLineBreaks" value="true"/> </module> <module name="ParenPad"/> + <module name="OperatorWrap"> + <property name="option" value="NL"/> + <property name="tokens" + value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, + LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/> + </module> <module name="AnnotationLocation"> <property name="id" value="AnnotationLocationMostCases"/> <property name="tokens" @@ -149,6 +204,9 @@ <property name="tokens" value="VARIABLE_DEF"/> <property name="allowSamelineMultipleAnnotations" value="true"/> </module> + <module name="NonEmptyAtclauseDescription"/> + <module name="JavadocTagContinuationIndentation"/> + <module name="JavadocParagraph"/> <module name="AtclauseOrder"> <property name="tagOrder" value="@param, @return, @throws, @deprecated"/> <property name="target" @@ -165,6 +223,7 @@ <module name="EmptyCatchBlock"> <property name="exceptionVariableName" value="expected"/> </module> + <module name="CommentsIndentation"/> <module name="NestedIfDepth"> <property name="max" value="4"/> </module> diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml index 47256a195..b4cf55e5a 100644 --- a/config/checkstyle/suppressions.xml +++ b/config/checkstyle/suppressions.xml @@ -3,11 +3,28 @@ "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> <suppressions> - <suppress checks="MethodName" files="core/src/test/java/android/util/Log.java" /> <suppress checks="LineLength" files="strings.xml"/> <suppress checks="." files="[\\/]generated-sources[\\/]"/> <suppress checks="." files="[\\/]build[\\/]"/> <suppress checks="." files="[\\/]gen[\\/]"/> <suppress checks="." files="[\\/].idea[\\/]"/> + + <!-- Legacy code, should be gradually updated when touching these lines anyway --> + <suppress checks="LineLength" files="(VolumeAdaptionSettingTest.java|MediaMetadataRetrieverCompat.java|FeedItem.java|FeedMedia.java|FeedPreferences.java|Feed.java|DBUpgrader.java|PodDBAdapter.java|PlaybackServiceMediaPlayer.java|PlaybackService.java|LocalPSMP.java|PlaybackServiceTaskManager.java|DBWriter.java|PodcastSearchResult.java|PlaybackServiceTaskManagerTest.java|HTTPBin.java|SPAReceiver.java|UriUtil.java|FeedDiscovererTest.java|PlaybackServiceMediaPlayerTest.java|TextOnlyFeedsTest.java|ItemFragment.java|FeedSettingsFragment.java|UITestUtils.java)"/> + <suppress checks="VariableDeclarationUsageDistance" files="(FeedFilterTest.java|ChapterReader.java|FastBlurTransformation.java|GpodnetService.java|PreferencesTest.java|ItemFilterDialog.java|ItemFragment.java|PlaybackServiceMediaPlayerTest.java)"/> + <suppress checks="ParameterName" files="(FeedMedia.java)"/> + <suppress checks="WhitespaceAround" files="(FeedMedia.java|UserPreferences.java|LongList.java|IntentUtils.java|PlaybackServiceMediaPlayer.java|ShakeListener.java|LocalPSMP.java|PodcastSearchResult.java|NetworkUtils.java|UITestUtils.java|PlaybackPreferencesFragment.java|OnlineFeedViewActivity.java|QueueFragment.java|SPAReceiver.java|SkipIntroEndingChangedEvent.java|GeneratorUtil.java|RewindAfterPauseUtils.java|PlaybackController.java|AutoDownloadPreferencesFragment.java)"/> + <suppress checks="WhitespaceAfter" files="(FeedMedia.java|LongList.java|IntentUtils.java|TimeSpeedConverter.java|LocalPSMP.java|PlaybackController.java|PodcastSearchResult.java|PlaybackPreferencesFragment.java|OnlineFeedViewActivity.java|QueueFragment.java)"/> + <suppress checks="AbbreviationAsWordInName" files="(FeedItemPermutorsTest.java|DBUpgrader.java|PodDBAdapter.java|DBWriter.java|DBReader.java|RewindAfterPauseUtilTest.java|PlaybackServiceMediaPlayer.java|PlaybackService.java|LocalPSMP.java|PlaybackServiceTaskManager.java|GpodnetUploadChangesResponse.java|GpodnetEpisodeActionPostResponse.java|UrlCheckerTest.java|UriUtilTest.java|UriUtil.java|PlaybackServiceTaskManagerTest.java|SPAUtil.java|FeedDiscovererTest.java|PlaybackServiceMediaPlayerTest.java|DefaultPSMPCallback.java|UITestUtils.java|APCleanupAlgorithmTest.java|APNullCleanupAlgorithm.java|APCleanupAlgorithm.java|HTTPBin.java|UITestUtilsTest.java|FeedDiscoverer.java|SPAReceiver.java|APQueueCleanupAlgorithm.java|CancelablePSMPCallback.java)"/> + <suppress checks="NeedBraces" files="(PlaybackServiceMediaPlayerTest.java|FeedPreferences.java|DownloadRequest.java|HTTPBin.java|UITestUtils.java|SPAUtil.java)"/> + <suppress checks="NonEmptyAtclauseDescription" files="(FeedFilter.java|AspectRatioVideoView.java|Playable.java|PlaybackServiceTaskManager.java|PodcastSearchResult.java|OpmlBackupAgent.java)"/> + <suppress checks="OperatorWrapCheck" files="(Atom.java|DBUpgrader.java|PodDBAdapter.java|PlaybackController.java|GpodnetUploadChangesResponse.java|HtmlToPlainText.java|PodcastSearchResult.java|PowerConnectionReceiver.java|FeedDiscoverer.java|DBWriter.java|PlaybackService.java)"/> + <suppress checks="RightCurlyAlone" files="(UserPreferences.java|LockableBottomSheetBehavior.java|NetworkUtils.java|ProxyDialog.java|IntentUtils.java|RewindAfterPauseUtils.java|GpodnetPodcast.java|GeneratorUtil.java|PlaybackController.java|AntennapodHttpClient.java|UriUtil.java|APCleanupAlgorithm.java)"/> + <suppress checks="JavadocParagraph" files="(FeedItemPermutors.java|HtmlToPlainText.java|FeedItemMenuHandler.java|RewindAfterPauseUtils.java|PlaybackServiceMediaPlayer.java|UITestUtils.java|NestedScrollableHost.java|PlaybackService.java)"/> + <suppress checks="JavadocTagContinuationIndentation" files="(ItemEnqueuePositionCalculator.java|LongList.java|DBReader.java|LocalPSMP.java|GpodnetService.java|FeedDiscoverer.java|SPAUtil.java|PlaybackServiceMediaPlayer.java)"/> + <suppress checks="MemberName" files="(OpmlBackupAgent.java|ShakeListener.java|PlaybackController.java|AspectRatioVideoView.java|PlaybackService.java|PlaybackServiceMediaPlayerTest.java)"/> + <suppress checks="LocalVariableName" files="(ShakeListener.java|ItemEnqueuePositionCalculatorTest.java)"/> + <suppress checks="LeftCurly" files="(GpodnetPodcast.java|APCleanupAlgorithm.java|APQueueCleanupAlgorithm.java)"/> + <suppress checks="MissingSwitchDefaultCheck" files="(MainActivity.java|FeedSettingsFragment.java|QueueFragment.java|VideoplayerActivity.java|PlaybackController.java|PreferenceUpgrader.java)"/> </suppressions> diff --git a/net/common/build.gradle b/net/common/build.gradle index 57b9f5f23..4d80916d2 100644 --- a/net/common/build.gradle +++ b/net/common/build.gradle @@ -6,6 +6,10 @@ apply from: "../../playFlavor.gradle" android { namespace "de.danoeh.antennapod.net.common" + + lint { + disable 'StaticFieldLeak' + } } dependencies { diff --git a/net/common/src/main/java/de/danoeh/antennapod/net/common/NetworkUtils.java b/net/common/src/main/java/de/danoeh/antennapod/net/common/NetworkUtils.java index 179c4e13e..e0559c7ed 100644 --- a/net/common/src/main/java/de/danoeh/antennapod/net/common/NetworkUtils.java +++ b/net/common/src/main/java/de/danoeh/antennapod/net/common/NetworkUtils.java @@ -14,11 +14,9 @@ import java.util.regex.Pattern; import de.danoeh.antennapod.storage.preferences.UserPreferences; -public class NetworkUtils { +public abstract class NetworkUtils { private static final String REGEX_PATTERN_IP_ADDRESS = "([0-9]{1,3}[\\.]){3}[0-9]{1,3}"; - private NetworkUtils(){} - private static Context context; public static void init(Context context) { diff --git a/net/common/src/main/java/de/danoeh/antennapod/net/common/UriUtil.java b/net/common/src/main/java/de/danoeh/antennapod/net/common/UriUtil.java index 63fc087d6..4199f63c8 100644 --- a/net/common/src/main/java/de/danoeh/antennapod/net/common/UriUtil.java +++ b/net/common/src/main/java/de/danoeh/antennapod/net/common/UriUtil.java @@ -8,9 +8,7 @@ import java.net.URL; /** * Utility methods for dealing with URL encoding. */ -public class UriUtil { - private UriUtil() {} - +public abstract class UriUtil { public static URI getURIFromRequestUrl(String source) { // try without encoding the URI try { diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APCleanupAlgorithm.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APCleanupAlgorithm.java index bc50c8c1f..d23becdbb 100644 --- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APCleanupAlgorithm.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APCleanupAlgorithm.java @@ -121,7 +121,9 @@ public class APCleanupAlgorithm extends EpisodeCleanupAlgorithm { } @VisibleForTesting - public int getNumberOfHoursAfterPlayback() { return numberOfHoursAfterPlayback; } + public int getNumberOfHoursAfterPlayback() { + return numberOfHoursAfterPlayback; + } private static Date minusHours(Date baseDate, int numberOfHours) { Calendar cal = Calendar.getInstance(); diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetPodcast.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetPodcast.java index f09ab1244..53af3b328 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetPodcast.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetPodcast.java @@ -12,15 +12,8 @@ public class GpodnetPodcast { private final String mygpoLink; private final String author; - public GpodnetPodcast(@NonNull String url, - @NonNull String title, - @NonNull String description, - int subscribers, - String logoUrl, - String website, - String mygpoLink, - String author - ) { + public GpodnetPodcast(@NonNull String url, @NonNull String title, @NonNull String description, int subscribers, + String logoUrl, String website, String mygpoLink, String author) { this.url = url; this.title = title; this.description = description; @@ -63,7 +56,9 @@ public class GpodnetPodcast { return website; } - public String getAuthor() { return author; } + public String getAuthor() { + return author; + } public String getMygpoLink() { return mygpoLink; diff --git a/playback/base/src/main/java/de/danoeh/antennapod/playback/base/RewindAfterPauseUtils.java b/playback/base/src/main/java/de/danoeh/antennapod/playback/base/RewindAfterPauseUtils.java index 7d694f38b..3ea8e59c5 100644 --- a/playback/base/src/main/java/de/danoeh/antennapod/playback/base/RewindAfterPauseUtils.java +++ b/playback/base/src/main/java/de/danoeh/antennapod/playback/base/RewindAfterPauseUtils.java @@ -8,9 +8,7 @@ import java.util.concurrent.TimeUnit; * User might loose context if he/she pauses and resumes the media after longer time. * Media file should be "rewinded" x seconds after user resumes the playback. */ -public class RewindAfterPauseUtils { - private RewindAfterPauseUtils(){} - +public abstract class RewindAfterPauseUtils { public static final long ELAPSED_TIME_FOR_SHORT_REWIND = TimeUnit.MINUTES.toMillis(1); public static final long ELAPSED_TIME_FOR_MEDIUM_REWIND = TimeUnit.HOURS.toMillis(1); public static final long ELAPSED_TIME_FOR_LONG_REWIND = TimeUnit.DAYS.toMillis(1); diff --git a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackController.java b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackController.java index f6df19c61..cfd494ba2 100644 --- a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackController.java +++ b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackController.java @@ -224,7 +224,8 @@ public abstract class PlaybackController { }; - public void onPlaybackEnd() {} + public void onPlaybackEnd() { + } /** * Is called whenever the PlaybackService changes its status. This method diff --git a/storage/database/build.gradle b/storage/database/build.gradle index 60f385505..7faaf2540 100644 --- a/storage/database/build.gradle +++ b/storage/database/build.gradle @@ -8,7 +8,7 @@ android { namespace "de.danoeh.antennapod.storage.database" lint { - disable "StaticFieldLeak", "StringFormatCount", "StringFormatMatches", "StringFormatInvalid", "PluralsCandidate", "StringFormatTrivial" + disable "StaticFieldLeak" } } diff --git a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java index 7714337a3..9e7333a2e 100644 --- a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java +++ b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java @@ -41,9 +41,7 @@ import de.danoeh.antennapod.model.feed.SubscriptionsFilter; * init() or otherwise every public method will throw an Exception * when called. */ -public class UserPreferences { - private UserPreferences(){} - +public abstract class UserPreferences { private static final String TAG = "UserPreferences"; // User Interface diff --git a/ui/common/build.gradle b/ui/common/build.gradle index f2916593a..bb602393c 100644 --- a/ui/common/build.gradle +++ b/ui/common/build.gradle @@ -5,6 +5,10 @@ apply from: "../../common.gradle" android { namespace "de.danoeh.antennapod.ui.common" + + lint { + disable 'VectorPath' + } } dependencies { diff --git a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/IntentUtils.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/IntentUtils.java index 26c703e7b..2111fce64 100644 --- a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/IntentUtils.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/IntentUtils.java @@ -17,11 +17,9 @@ import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Locale; -public class IntentUtils { +public abstract class IntentUtils { private static final String TAG = "IntentUtils"; - private IntentUtils(){} - /* * Checks if there is at least one exported activity that can be performed for the intent */ diff --git a/ui/preferences/build.gradle b/ui/preferences/build.gradle index fd9684e56..1a76f4c64 100644 --- a/ui/preferences/build.gradle +++ b/ui/preferences/build.gradle @@ -48,13 +48,3 @@ dependencies { implementation "org.greenrobot:eventbus:$eventbusVersion" implementation 'com.github.ByteHamster:SearchPreference:v2.5.0' } - -tasks.register('copyLicense', Copy) { - from "../../LICENSE" - into "src/main/assets/" - rename { String fileName -> - fileName + ".txt" - } -} - -preBuild.dependsOn copyLicense diff --git a/ui/preferences/src/main/assets/.gitignore b/ui/preferences/src/main/assets/.gitignore deleted file mode 100644 index f4de63f77..000000000 --- a/ui/preferences/src/main/assets/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# this file is generated automatically -about.html -LICENSE.txt -CONTRIBUTORS.txt diff --git a/ui/preferences/src/main/assets/LICENSE.txt b/ui/preferences/src/main/assets/LICENSE.txt new file mode 120000 index 000000000..2a64f9d0f --- /dev/null +++ b/ui/preferences/src/main/assets/LICENSE.txt @@ -0,0 +1 @@ +../../../../../LICENSE
\ No newline at end of file diff --git a/ui/preferences/src/main/res/layout/about_teaser.xml b/ui/preferences/src/main/res/layout/about_teaser.xml index 4e7f0454f..a70653be6 100644 --- a/ui/preferences/src/main/res/layout/about_teaser.xml +++ b/ui/preferences/src/main/res/layout/about_teaser.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <ImageView - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:adjustViewBounds="true" - android:layout_height="wrap_content" - app:srcCompat="@drawable/teaser" - android:importantForAccessibility="no"/>
\ No newline at end of file + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:adjustViewBounds="true" + android:importantForAccessibility="no" + app:srcCompat="@drawable/teaser" /> diff --git a/ui/preferences/src/main/res/layout/choose_data_folder_dialog.xml b/ui/preferences/src/main/res/layout/choose_data_folder_dialog.xml index bac14a108..7de9362a3 100644 --- a/ui/preferences/src/main/res/layout/choose_data_folder_dialog.xml +++ b/ui/preferences/src/main/res/layout/choose_data_folder_dialog.xml @@ -1,12 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> <androidx.recyclerview.widget.RecyclerView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/recyclerView" /> + android:id="@+id/recyclerView" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> </LinearLayout> diff --git a/ui/preferences/src/main/res/layout/choose_data_folder_dialog_entry.xml b/ui/preferences/src/main/res/layout/choose_data_folder_dialog_entry.xml index addc63f4d..a4c64e5cd 100644 --- a/ui/preferences/src/main/res/layout/choose_data_folder_dialog_entry.xml +++ b/ui/preferences/src/main/res/layout/choose_data_folder_dialog_entry.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/root" android:layout_width="match_parent" @@ -38,9 +39,10 @@ <ProgressBar android:id="@+id/used_space" - style="?android:attr/progressBarStyleHorizontal" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + style="?android:attr/progressBarStyleHorizontal" /> + </LinearLayout> </RelativeLayout> diff --git a/ui/preferences/src/main/res/layout/gpodnetauth_device_row.xml b/ui/preferences/src/main/res/layout/gpodnetauth_device_row.xml index d39c00571..e47182372 100644 --- a/ui/preferences/src/main/res/layout/gpodnetauth_device_row.xml +++ b/ui/preferences/src/main/res/layout/gpodnetauth_device_row.xml @@ -1,13 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <FrameLayout - xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp"> + + <Button + android:id="@+id/selectDeviceButton" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="8dp"> + style="?attr/materialButtonOutlinedStyle" /> - <Button - android:id="@+id/selectDeviceButton" - android:layout_width="match_parent" - android:layout_height="wrap_content" - style="?attr/materialButtonOutlinedStyle" /> -</FrameLayout>
\ No newline at end of file +</FrameLayout> diff --git a/ui/preferences/src/main/res/layout/gpodnetauth_finish.xml b/ui/preferences/src/main/res/layout/gpodnetauth_finish.xml index 8eced7304..7abdda3e7 100644 --- a/ui/preferences/src/main/res/layout/gpodnetauth_finish.xml +++ b/ui/preferences/src/main/res/layout/gpodnetauth_finish.xml @@ -24,6 +24,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:text="@string/gpodnetauth_finish_butsyncnow"/> + android:text="@string/gpodnetauth_finish_butsyncnow" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/ui/preferences/src/main/res/layout/simple_icon_list_item.xml b/ui/preferences/src/main/res/layout/simple_icon_list_item.xml index 7ed129204..4690f7840 100644 --- a/ui/preferences/src/main/res/layout/simple_icon_list_item.xml +++ b/ui/preferences/src/main/res/layout/simple_icon_list_item.xml @@ -1,40 +1,40 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:padding="16dp"> + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:padding="16dp"> <ImageView - android:layout_width="40dp" - android:layout_height="40dp" - android:id="@+id/icon"/> + android:id="@+id/icon" + android:layout_width="40dp" + android:layout_height="40dp" /> <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:layout_marginLeft="16dp" - android:layout_gravity="center_vertical" - android:layout_marginStart="16dp"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:layout_marginLeft="16dp" + android:layout_gravity="center_vertical" + android:layout_marginStart="16dp"> <TextView - tools:text="Title" - android:textColor="?android:attr/textColorPrimary" - android:textSize="16sp" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/title"/> + android:id="@+id/title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="?android:attr/textColorPrimary" + android:textSize="16sp" + tools:text="Title" /> <TextView - tools:text="Subtitle" - android:textColor="?android:attr/textColorSecondary" - android:textSize="14sp" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/subtitle"/> + android:id="@+id/subtitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textColor="?android:attr/textColorSecondary" + android:textSize="14sp" + tools:text="Subtitle" /> </LinearLayout> diff --git a/ui/statistics/src/main/res/layout/statistics_fragment.xml b/ui/statistics/src/main/res/layout/statistics_fragment.xml index 9d9cad438..1299884b6 100644 --- a/ui/statistics/src/main/res/layout/statistics_fragment.xml +++ b/ui/statistics/src/main/res/layout/statistics_fragment.xml @@ -1,24 +1,25 @@ <?xml version="1.0" encoding="utf-8"?> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> <ProgressBar - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/progressBar" - android:layout_gravity="center"/> + android:id="@+id/progressBar" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" /> <androidx.recyclerview.widget.RecyclerView - android:id="@+id/statistics_list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:clipToPadding="false" - android:paddingBottom="@dimen/list_vertical_padding" - android:paddingTop="@dimen/list_vertical_padding" - android:scrollbarStyle="outsideOverlay" - tools:listitem="@layout/statistics_listitem"/> + android:id="@+id/statistics_list" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipToPadding="false" + android:paddingBottom="@dimen/list_vertical_padding" + android:paddingTop="@dimen/list_vertical_padding" + android:scrollbarStyle="outsideOverlay" + tools:listitem="@layout/statistics_listitem" /> </FrameLayout> diff --git a/ui/statistics/src/main/res/layout/statistics_listitem.xml b/ui/statistics/src/main/res/layout/statistics_listitem.xml index 5989595e1..803324e85 100644 --- a/ui/statistics/src/main/res/layout/statistics_listitem.xml +++ b/ui/statistics/src/main/res/layout/statistics_listitem.xml @@ -1,71 +1,72 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:background="?android:attr/selectableItemBackground"> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:background="?android:attr/selectableItemBackground"> <ImageView - android:id="@+id/imgvCover" - android:importantForAccessibility="no" - android:layout_width="40dp" - android:layout_height="40dp" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_centerVertical="true" - android:adjustViewBounds="true" - android:cropToPadding="true" - android:scaleType="fitCenter" - tools:src="@tools:sample/avatars" - tools:background="@android:color/holo_green_dark"/> + android:id="@+id/imgvCover" + android:layout_width="40dp" + android:layout_height="40dp" + android:importantForAccessibility="no" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_centerVertical="true" + android:adjustViewBounds="true" + android:cropToPadding="true" + android:scaleType="fitCenter" + tools:src="@tools:sample/avatars" + tools:background="@android:color/holo_green_dark" /> <TextView - android:id="@+id/txtvTitle" - android:lines="1" - android:ellipsize="end" - android:singleLine="true" - android:textColor="?android:attr/textColorPrimary" - android:textSize="16sp" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="16dp" - android:layout_marginStart="16dp" - android:layout_toRightOf="@id/imgvCover" - android:layout_toEndOf="@id/imgvCover" - android:layout_alignTop="@id/imgvCover" - android:layout_alignWithParentIfMissing="true" - tools:text="Feed title"/> + android:id="@+id/txtvTitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:lines="1" + android:ellipsize="end" + android:singleLine="true" + android:textColor="?android:attr/textColorPrimary" + android:textSize="16sp" + android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" + android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" + android:layout_alignTop="@id/imgvCover" + android:layout_alignWithParentIfMissing="true" + tools:text="Feed title" /> <TextView - android:id="@+id/chip" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="13sp" - android:layout_toEndOf="@+id/imgvCover" - android:layout_toRightOf="@+id/imgvCover" - android:layout_marginLeft="16dp" - android:layout_marginStart="16dp" - android:layout_below="@+id/txtvTitle" - android:layout_marginEnd="4dp" - android:layout_marginRight="4dp" - android:text="⬤" - tools:ignore="HardcodedText"/> + android:id="@+id/chip" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="13sp" + android:layout_toEndOf="@+id/imgvCover" + android:layout_toRightOf="@+id/imgvCover" + android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" + android:layout_below="@+id/txtvTitle" + android:layout_marginEnd="4dp" + android:layout_marginRight="4dp" + android:text="⬤" + tools:ignore="HardcodedText" /> <TextView - android:id="@+id/txtvValue" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:lines="1" - android:textColor="?android:attr/textColorTertiary" - android:textSize="14sp" - android:layout_toEndOf="@+id/chip" - android:layout_toRightOf="@+id/chip" - android:layout_below="@+id/txtvTitle" - tools:text="23 hours"/> + android:id="@+id/txtvValue" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:lines="1" + android:textColor="?android:attr/textColorTertiary" + android:textSize="14sp" + android:layout_toEndOf="@+id/chip" + android:layout_toRightOf="@+id/chip" + android:layout_below="@+id/txtvTitle" + tools:text="23 hours" /> </RelativeLayout> |