Skip to content

Commit

Permalink
Merge branch 'release/v5.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Jun 15, 2015
2 parents 9a83ff8 + 64f9aed commit 61fea18
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 69 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ You can find anything you search for in the wiki. (If not open an issue)
The AboutLibraries Library is pushed to [Maven Central](http://search.maven.org/#search|ga|1|g%3A%22com.mikepenz%22), so you just need to add the following dependency to your `build.gradle`. It seems it is also required to add the support dependencies to the application. If it works without, you should be fine too :).

```javascript
compile('com.mikepenz:aboutlibraries:5.0.3@aar') {
compile('com.mikepenz:aboutlibraries:5.0.4@aar') {
transitive = true
}
```
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=5.0.3
VERSION_CODE=503
VERSION_NAME=5.0.4
VERSION_CODE=504
GROUP=com.mikepenz

POM_DESCRIPTION=AboutLibraries Library
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 10
targetSdkVersion 22
versionCode 503
versionName '5.0.3'
versionCode 504
versionName '5.0.4'
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,30 @@ public static LibsConfiguration getInstance() {
* LOGIC FOR THE LISTENER
*/
private LibsListener listener = null;
private LibsUIListener uiListener = null;

public void setListener(LibsListener libsListener) {
this.listener = libsListener;
}

public LibsListener getListener() {
return listener;
}

public void removeListener() {
this.listener = null;
}

public LibsListener getListener() {
return listener;
public LibsUIListener getUiListener() {
return uiListener;
}

public void setUiListener(LibsUIListener uiListener) {
this.uiListener = uiListener;
}

public void removeUiListener() {
this.uiListener = null;
}

/**
Expand All @@ -47,6 +60,13 @@ public void reset() {
SINGLETON = null;
}


public interface LibsUIListener {
View preOnCreateView(View view);

View postOnCreateView(View view);
}

public interface LibsListener {
void onIconClicked(View v);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.mikepenz.aboutlibraries.Libs;
import com.mikepenz.aboutlibraries.LibsBuilder;
import com.mikepenz.aboutlibraries.LibsConfiguration;
import com.mikepenz.aboutlibraries.R;
import com.mikepenz.aboutlibraries.entity.Library;
import com.mikepenz.aboutlibraries.ui.adapter.LibsRecyclerViewAdapter;
Expand Down Expand Up @@ -103,6 +104,11 @@ public void onAttach(Activity activity) {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_opensource, container, false);

//allows to modify the view before creating
if (LibsConfiguration.getInstance().getUiListener() != null) {
view = LibsConfiguration.getInstance().getUiListener().preOnCreateView(view);
}

// init CardView
mRecyclerView = (RecyclerView) view.findViewById(R.id.cardListView);
mRecyclerView.setLayoutManager(new LinearLayoutManager(LibsFragment.this.getActivity()));
Expand All @@ -112,6 +118,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

generateAboutThisAppSection();

//allows to modify the view after creating
if (LibsConfiguration.getInstance().getUiListener() != null) {
view = LibsConfiguration.getInstance().getUiListener().postOnCreateView(view);
}

return view;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class LibsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.V
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;

private RippleForegroundListener rippleForegroundListener = new RippleForegroundListener(R.id.rippleForegroundListenerView);

private List<Library> libs = new LinkedList<Library>();

private boolean header = false;
Expand Down Expand Up @@ -192,9 +194,6 @@ public void onClick(View v) {

final Library library = getItem(position);

RippleForegroundListener rippleForegroundListener = new RippleForegroundListener();
rippleForegroundListener.setCardView(holder.card);

//Set texts
holder.libraryName.setText(library.getLibraryName());
holder.libraryCreator.setText(library.getAuthor());
Expand Down Expand Up @@ -471,7 +470,7 @@ public ViewHolder(View itemView) {
libraryDescription.setTextColor(UIUtils.getThemeColorFromAttrOrRes(itemView.getContext(), R.attr.about_libraries_text_openSource, R.color.about_libraries_text_openSource));

libraryBottomDivider = itemView.findViewById(R.id.libraryBottomDivider);
libraryDescriptionDivider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(itemView.getContext(), R.attr.about_libraries_dividerLight_openSource, R.color.about_libraries_dividerLight_openSource));
libraryBottomDivider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(itemView.getContext(), R.attr.about_libraries_dividerLight_openSource, R.color.about_libraries_dividerLight_openSource));
libraryBottomContainer = itemView.findViewById(R.id.libraryBottomContainer);

libraryVersion = (TextView) itemView.findViewById(R.id.libraryVersion);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,66 @@
package com.mikepenz.aboutlibraries.util;

import android.support.v7.widget.CardView;
import android.annotation.SuppressLint;
import android.os.Build;
import android.view.MotionEvent;
import android.view.View;

/**
* Created by mikepenz on 16.04.15.
*/
public class RippleForegroundListener implements View.OnTouchListener {
CardView cardView;
private int rippleViewId = -1;

public RippleForegroundListener setCardView(CardView cardView) {
this.cardView = cardView;
return this;
/**
* @param rippleViewId the id of the view which contains the rippleDrawable
*/
public RippleForegroundListener(int rippleViewId) {
this.rippleViewId = rippleViewId;
}

@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
// Convert to card view coordinates. Assumes the host view is
// a direct child and the card view is not scrollable.
// Convert to view coordinates. Assumes the host view is
// a direct child and the view is not scrollable.
float x = event.getX() + v.getLeft();
float y = event.getY() + v.getTop();

if (android.os.Build.VERSION.SDK_INT >= 21) {
// Simulate motion on the card view.
cardView.drawableHotspotChanged(x, y);
final View rippleView = findRippleView(v);
//if we were not able to find the view to display the ripple on, continue.
if (rippleView == null) {
return false;
}

// Simulate pressed state on the card view.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Simulate motion on the view.
rippleView.drawableHotspotChanged(x, y);
}

// Simulate pressed state on the view.
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
cardView.setPressed(true);
rippleView.setPressed(true);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
cardView.setPressed(false);
rippleView.setPressed(false);
break;
}

// Pass all events through to the host view.
return false;
}

public View findRippleView(View view) {
if (view.getId() == rippleViewId) {
return view;
} else {
if (view.getParent() instanceof View) {
return findRippleView((View) view.getParent());
} else {
return null;
}
}
}
}
16 changes: 9 additions & 7 deletions library/src/main/res/layout/fragment_opensource.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.RecyclerView
android:id="@+id/cardListView"
android:layout_width="match_parent"
android:clipToPadding="false"
android:layout_height="match_parent"
android:clipToPadding="false"
android:divider="@null"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
/>
android:scrollbarStyle="outsideInset"
android:scrollbars="vertical" />
</FrameLayout>
67 changes: 33 additions & 34 deletions library/src/main/res/layout/listitem_opensource.xml
Original file line number Diff line number Diff line change
@@ -1,106 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@id/rippleForegroundListenerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:clickable="true"
android:foreground="?selectableItemBackground">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:orientation="vertical">
android:orientation="vertical"
android:padding="6dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:paddingLeft="8dp"
android:paddingRight="8dp">

<TextView
android:id="@+id/libraryName"
android:textSize="@dimen/textSizeLarge_openSource"
android:textStyle="normal"
android:layout_width="0dp"
android:layout_weight="5"
android:layout_height="wrap_content"
android:layout_weight="5"
android:ellipsize="end"
android:maxLines="1"
tools:text="Library name"/>
android:textSize="@dimen/textSizeLarge_openSource"
android:textStyle="normal"
tools:text="Library name" />

<TextView
android:id="@+id/libraryCreator"
android:textStyle="normal"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_weight="2"
android:gravity="right"
android:maxLines="2"
android:textSize="@dimen/textSizeSmall_openSource"
tools:text="Creator"/>
android:textStyle="normal"
tools:text="Creator" />
</LinearLayout>

<View
android:id="@+id/libraryDescriptionDivider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="4dp"/>
android:layout_marginTop="4dp" />

<TextView
android:id="@+id/libraryDescription"
android:textSize="@dimen/textSizeSmall_openSource"
android:textStyle="normal"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="20"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla in aliquet justo. Donec tincidunt, leo imperdiet pretium posuere, sapien leo auctor mi, ac scelerisque diam leo vel sapien. Morbi lobortis, sem sed molestie fermentum.">
</TextView>
android:padding="8dp"
android:textSize="@dimen/textSizeSmall_openSource"
android:textStyle="normal"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla in aliquet justo. Donec tincidunt, leo imperdiet pretium posuere, sapien leo auctor mi, ac scelerisque diam leo vel sapien. Morbi lobortis, sem sed molestie fermentum."></TextView>

<View
android:id="@+id/libraryBottomDivider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="4dp"
/>
android:layout_marginTop="4dp" />

<LinearLayout
android:id="@+id/libraryBottomContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingTop="4dp"
android:paddingRight="8dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:paddingTop="4dp">

<TextView
android:id="@+id/libraryVersion"
android:textStyle="normal"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:maxLines="1"
android:textSize="@dimen/textSizeSmall_openSource"
tools:text="Version"/>
android:textStyle="normal"
tools:text="Version" />

<TextView
android:id="@+id/libraryLicense"
android:textStyle="normal"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:maxLines="1"
android:textSize="@dimen/textSizeSmall_openSource"
tools:text="License"/>
android:textStyle="normal"
tools:text="License" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
4 changes: 4 additions & 0 deletions library/src/main/res/values/ids.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="rippleForegroundListenerView" type="id" />
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Most modern apps feature an "Used Library"-Section and for this some information of those libs is required. As it gets annoying to copy those strings always to your app I have developed this small helper library to provide the required information.
]]>
</string>
<string name="library_AboutLibraries_libraryVersion">5.0.3</string>
<string name="library_AboutLibraries_libraryVersion">5.0.4</string>
<string name="library_AboutLibraries_libraryWebsite">https://github.com/mikepenz/AboutLibraries</string>
<string name="library_AboutLibraries_licenseId">apache_2_0</string>
<string name="library_AboutLibraries_isOpenSource">true</string>
Expand Down
Loading

0 comments on commit 61fea18

Please sign in to comment.