Skip to content

Commit

Permalink
Replace LicenseFragment with AboutLibraries
Browse files Browse the repository at this point in the history
  • Loading branch information
YtvwlD committed Jul 10, 2023
1 parent 7cdf668 commit 8342793
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 39 deletions.
4 changes: 3 additions & 1 deletion meteroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.0'
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:8.9.4"
}
}
apply plugin: 'com.android.application'
apply plugin: "com.github.spotbugs"
apply plugin: 'com.mikepenz.aboutlibraries.plugin'

dependencies {
repositories {
Expand All @@ -49,8 +51,8 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'com.squareup.picasso:picasso:2.8'
implementation "com.artit-k:license-fragment:1.3.0"
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.mikepenz:aboutlibraries:8.9.4'
}

//see https://stackoverflow.com/a/22183825/2192464
Expand Down
43 changes: 6 additions & 37 deletions meteroid/src/main/java/de/chaosdorf/meteroid/About.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,15 @@
import android.view.MenuItem;
import android.view.View;

import com.artitk.licensefragment.ListViewLicenseFragment;
import com.artitk.licensefragment.model.CustomUI;
import com.artitk.licensefragment.model.License;
import com.artitk.licensefragment.model.LicenseID;
import com.artitk.licensefragment.model.LicenseType;
import com.mikepenz.aboutlibraries.LibsBuilder;
import com.mikepenz.aboutlibraries.ui.LibsSupportFragment;

import de.chaosdorf.meteroid.databinding.ActivityAboutBinding;

public class About extends AppCompatActivity
{
private ActivityAboutBinding binding;
private ListViewLicenseFragment licenseFragment;
private LibsSupportFragment librariesFragment;
private Vibrator vibrator;
private final ObservableBoolean glassEmpty = new ObservableBoolean(false);
private static final String FALLBACK_VERSION_NAME = "UNKNOWN";
Expand Down Expand Up @@ -102,38 +99,10 @@ public boolean onLongClick(View view)
return true;
}
});
licenseFragment = ListViewLicenseFragment.newInstance(new int[] {
LicenseID.RETROFIT,
LicenseID.GSON,
LicenseID.PICASSO
});
ArrayList<License> licenseList = new ArrayList<>();
licenseList.add(new License(
this, "Android Jetpack", LicenseType.APACHE_LICENSE_20,
"2018", "The Android Open Source Project"
));
licenseList.add(new License(
this, "Material Components for Android", LicenseType.APACHE_LICENSE_20,
"2021", "The Android Open Source Project"
));
licenseFragment.addCustomLicense(licenseList);
CustomUI customLicenseUI = new CustomUI()
.setTitleBackgroundColor(
getResources().getColor(R.color.actionColor)
)
.setTitleTextColor(
getResources().getColor(android.R.color.white)
)
.setLicenseBackgroundColor(
getResources().getColor(R.color.actionColor)
)
.setLicenseTextColor(
getResources().getColor(android.R.color.white)
);
licenseFragment.setCustomUI(customLicenseUI);
getFragmentManager()
librariesFragment = new LibsBuilder().supportFragment();
getSupportFragmentManager()
.beginTransaction()
.add(R.id.license_fragment_container, licenseFragment)
.add(R.id.libraries_fragment_container, librariesFragment)
.commit();
}

Expand Down
2 changes: 1 addition & 1 deletion meteroid/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
android:autoLink="web"
android:text="https://github.com/chaosdorf/meteroid"/>

<LinearLayout android:id="@+id/license_fragment_container"
<LinearLayout android:id="@+id/libraries_fragment_container"
android:layout_margin="12dp"
android:paddingTop="@dimen/activity_vertical_margin"
android:layout_height="wrap_content"
Expand Down

0 comments on commit 8342793

Please sign in to comment.