Skip to content

Commit

Permalink
Merge pull request #35 from TheAndroidMaster/develop
Browse files Browse the repository at this point in the history
Version 0.0.8
  • Loading branch information
fennifith authored Jul 17, 2018
2 parents e043bcc + 4b20a0c commit 2990752
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Attribouter-lib/attribouter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'me.jfenn'
PUBLISH_ARTIFACT_ID = 'attribouter'
PUBLISH_VERSION = '0.0.7'
PUBLISH_VERSION = '0.0.8'
}

android {
Expand All @@ -12,8 +12,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 27
versionCode 7
versionName "0.0.7"
versionCode 8
versionName "0.0.8"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,12 @@ public void onClick(View v) {

ContributorInfoData first = null, second = null, third = null;
List<InfoData> remainingContributors = new ArrayList<>();
int hiddenContributors = 0;
for (ContributorInfoData contributor : contributors) {
if (contributor.isHidden)
if (contributor.isHidden) {
hiddenContributors++;
continue;
}

if (contributor.position != null) {
if (first == null && contributor.position == 1) {
Expand Down Expand Up @@ -271,12 +274,18 @@ public void onClick(View view) {
viewHolder.recycler.setAdapter(new InfoAdapter(remainingContributors));
} else viewHolder.recycler.setVisibility(View.GONE);

if (remainingContributors.size() + (first != null && second != null && third != null ? 3 : 0) < contributors.size()) {
if (remainingContributors.size() + (first != null && second != null && third != null ? 3 : 0) < contributors.size() - hiddenContributors) {
viewHolder.expand.setVisibility(View.VISIBLE);
viewHolder.expand.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new OverflowDialog(v.getContext(), contributorsTitle, new ArrayList<InfoData>(contributors)).show();
ArrayList<InfoData> overflowList = new ArrayList<>();
for (ContributorInfoData contributor : contributors) {
if (!contributor.isHidden)
overflowList.add(contributor);
}

new OverflowDialog(v.getContext(), contributorsTitle, overflowList).show();
}
});
} else viewHolder.expand.setVisibility(View.GONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public int compareTo(Context context, @NonNull LinkInfoData o) {
String name = ResourceUtils.getString(context, this.name);
String oname = ResourceUtils.getString(context, o.name);
int comparison = name != null && oname != null ? name.compareTo(oname) : 0;
return ((o.priority - priority) * 2) + (comparison / Math.abs(comparison));
return ((o.priority - priority) * 2) + (comparison != 0 ? comparison / Math.abs(comparison) : 0);
}

public static class ViewHolder extends InfoData.ViewHolder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.jfenn.attribouter.fragments;

import android.content.Context;
import android.content.res.XmlResourceParser;
import android.os.Bundle;
import android.support.annotation.NonNull;
Expand Down Expand Up @@ -139,7 +140,10 @@ public void onRequest(InfoData info, GitHubData request) {
if (!requests.contains(request)) {
requests.add(request);
request.addOnInitListener(this);
request.startInit(getContext(), gitHubToken);

Context context = getContext();
if (context != null)
request.startInit(context, gitHubToken);
} else {
int i = requests.indexOf(request);
GitHubData activeRequest = requests.get(i).merge(request);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For demonstration and experimentation, an apk of the sample project can be downl
The Gradle dependency is available through jCenter, which is used by default in Android Studio. To add the dependency to your project, copy this line into the dependencies section of your app's build.gradle file.

```gradle
implementation 'me.jfenn:attribouter:0.0.7'
implementation 'me.jfenn:attribouter:0.0.8'
```

#### Starting an Activity
Expand Down

0 comments on commit 2990752

Please sign in to comment.