Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*.iml
.gradle
.gradle/**
/local.properties
/.idea/workspace.xml
/.idea/libraries
.idea/**
.DS_Store
/build
/captures
.externalNativeBuild
.externalNativeBuild
19 changes: 0 additions & 19 deletions .idea/gradle.xml

This file was deleted.

38 changes: 0 additions & 38 deletions .idea/misc.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

11 changes: 5 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@

buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.android.tools.build:gradle:8.13.2'
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
google()
maven { url 'https://jitpack.io' }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
tasks.register('clean', Delete) {
delete rootProject.getBuildDir()
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

android.useAndroidX=true
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue May 23 13:29:02 CEST 2017
#Thu Feb 12 15:07:28 CET 2026
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
46 changes: 31 additions & 15 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

plugins {
id 'maven-publish'
id 'com.android.library'
}
group = 'com.github.franmontiel'
version = '1.0.1'
version = '1.1.1'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
namespace = 'com.franmontiel.attributionpresenter'
compileSdkVersion 36

defaultConfig {
minSdkVersion 15
targetSdkVersion 28
minSdkVersion 29
targetSdkVersion 35
versionCode 2
versionName "1.0.1"
versionName "1.0.2"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand All @@ -33,13 +40,22 @@ android {
}
}

publishing {
publications {
release(MavenPublication) {
groupId = 'com.franmontiel.attributionpresenter'
artifactId = 'library'
version = '1.1.0'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android:flexbox:0.2.7'

testImplementation 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'com.google.android.material:material:1.13.0'
implementation 'androidx.activity:activity:1.12.4'
testImplementation 'junit:junit:4.13.2'
}
10 changes: 5 additions & 5 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2017 Francisco José Montiel Navarro.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,11 +14,12 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.franmontiel.attributionpresenter">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity android:name=".AttributionActivity"></activity>
<activity
android:name=".AttributionActivity"
android:exported="false" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.franmontiel.attributionpresenter;

import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class AttributionActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
package com.franmontiel.attributionpresenter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -40,16 +42,18 @@
*/
public final class AttributionAdapter extends BaseAdapter {

private List<Attribution> items;
private final List<Attribution> items;
@LayoutRes
private int itemLayout;
private final int itemLayout;
@LayoutRes
private int licenseLayout;
private final int licenseLayout;
@Nullable
private final OnAttributionClickListener onAttributionClickListener;
@Nullable
private final OnLicenseClickListener onLicenseClickListener;



AttributionAdapter(Collection<Attribution> attributions,
@LayoutRes int itemLayout,
@LayoutRes int licenseLayout,
Expand Down Expand Up @@ -84,9 +88,9 @@ public View getView(int position, View convertView, final ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(itemLayout, parent, false);
holder = new ViewHolder();
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.copyrightNotices = (TextView) convertView.findViewById(R.id.copyrightNotices);
holder.licensesLayout = (ViewGroup) convertView.findViewById(R.id.licensesLayout);
holder.name = convertView.findViewById(R.id.name);
holder.copyrightNotices = convertView.findViewById(R.id.copyrightNotices);
holder.licensesLayout = convertView.findViewById(R.id.licensesLayout);

if (holder.name == null || holder.copyrightNotices == null || holder.licensesLayout == null) {
throw new IllegalStateException("Item layout must contain all of the following required views:\n" +
Expand Down Expand Up @@ -124,7 +128,7 @@ public void onClick(View v) {

private void addLicense(final Context context, ViewGroup licensesLayout, final LicenseInfo licenseInfo) {
View inflatedView = LayoutInflater.from(context).inflate(licenseLayout, licensesLayout, false);
TextView licenseTextView = (TextView) inflatedView.findViewById(R.id.license);
TextView licenseTextView = inflatedView.findViewById(R.id.license);

if (licenseTextView == null) {
throw new IllegalStateException("LicenseInfo layout does not contain a required TextView with android:id=\"@+id/licenseInfo\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;

import com.franmontiel.attributionpresenter.entities.Attribution;
import com.franmontiel.attributionpresenter.entities.Library;
Expand All @@ -36,12 +36,12 @@
*/
public final class AttributionPresenter {

private Context context;
private SortedSet<Attribution> attributions;
private final Context context;
private final SortedSet<Attribution> attributions;
private final int itemLayout;
private final int licenseLayout;
private OnAttributionClickListener onAttributionClickListener;
private OnLicenseClickListener onLicenseClickListener;
private final OnAttributionClickListener onAttributionClickListener;
private final OnLicenseClickListener onLicenseClickListener;

private AttributionAdapter attributionAdapter;

Expand Down Expand Up @@ -91,8 +91,8 @@ public AttributionAdapter getAdapter() {
}

public static class Builder {
private Context context;
private SortedSet<Attribution> attributions;
private final Context context;
private final SortedSet<Attribution> attributions;
@LayoutRes
private int itemLayout;
@LayoutRes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.franmontiel.attributionpresenter.entities;

import android.support.annotation.NonNull;
import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -26,10 +26,10 @@
*/
public final class Attribution implements Comparable<Attribution> {

private String name;
private List<String> copyrightNotices;
private List<LicenseInfo> licensesInfo;
private String website;
private final String name;
private final List<String> copyrightNotices;
private final List<LicenseInfo> licensesInfo;
private final String website;

private Attribution(String name, List<String> copyrightNotices, List<LicenseInfo> licensesInfo, String website) {
this.name = name;
Expand Down Expand Up @@ -97,9 +97,9 @@ public int hashCode() {
}

public static class Builder {
private String name;
private List<String> copyrightNotices;
private List<LicenseInfo> licenseInfos;
private final String name;
private final List<String> copyrightNotices;
private final List<LicenseInfo> licenseInfos;
private String website;

public Builder(String name) {
Expand Down
Loading