Skip to content

Commit

Permalink
Merge branch 'release/v1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Feb 2, 2016
2 parents bb30c6b + fceb149 commit de051a8
Show file tree
Hide file tree
Showing 20 changed files with 94 additions and 67 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ You can try it out here [Google Play](https://play.google.com/store/apps/details
#Include in your project
##Using Maven
```javascript
compile('com.mikepenz:fastadapter:1.0.1@aar') {
compile('com.mikepenz:fastadapter:1.0.2@aar') {
transitive = true
}
```
Expand Down
13 changes: 7 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
defaultConfig {
minSdkVersion 11
targetSdkVersion 23
versionCode 101
versionName '1.0.1'
versionCode 102
versionName '1.0.2'

applicationVariants.all { variant ->
variant.outputs.each { output ->
Expand Down Expand Up @@ -51,7 +51,7 @@ dependencies {

//used to generate the drawer on the left
//https://github.com/mikepenz/MaterialDrawer
compile('com.mikepenz:materialdrawer:5.0.0.b22-SNAPSHOT@aar') {
compile('com.mikepenz:materialdrawer:5.0.0.b24-SNAPSHOT@aar') {
transitive = true
exclude module: "fastadapter"
}
Expand All @@ -60,8 +60,9 @@ dependencies {
compile 'com.mikepenz:itemanimators:0.2.1@aar'
//used to generate the Open Source section
//https://github.com/mikepenz/AboutLibraries
compile('com.mikepenz:aboutlibraries:5.3.6@aar') {
compile('com.mikepenz:aboutlibraries:5.5.0@aar') {
transitive = true
exclude module: "fastadapter"
}
//used to display the icons in the drawer
//https://github.com/mikepenz/Android-Iconics
Expand All @@ -78,12 +79,12 @@ dependencies {

//Used to provide the FastScrollBar
//https://github.com/krimin-killr21/MaterialScrollBar
compile 'com.turingtechnologies.materialscrollbar:lib:7.1.0'
compile 'com.turingtechnologies.materialscrollbar:lib:7.1.1'

//https://github.com/JakeWharton/butterknife
compile 'com.jakewharton:butterknife:7.0.1'

//used to load the images in the ImageListSample
//https://github.com/bumptech/glide
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
}
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
android:label="@string/app_name"
android:theme="@style/CustomTheme">
<!-- android:supportsRtl="true" -->
<activity android:name=".SampleActivity">
<activity
android:name=".SampleActivity"
android:theme="@style/MaterialDrawerTheme.Light.TranslucentStatus">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -25,7 +27,7 @@
android:name=".MultiselectSampleActivity"
android:label="@string/sample_multi_select" />
<activity
android:name=".CollapsibleSampleActivity"
android:name=".ExpandableSampleActivity"
android:label="@string/sample_collapsible" />
<activity
android:name=".StickyHeaderSampleActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.mikepenz.fastadapter.app;

import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.view.LayoutInflaterCompat;
import android.support.v4.view.ViewCompat;
Expand Down Expand Up @@ -51,15 +49,13 @@ public class AdvancedSampleActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
//as we use an icon from Android-Iconics via xml we add the IconicsLayoutInflater
//https://github.com/mikepenz/Android-Iconics
LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down Expand Up @@ -213,17 +209,11 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {

@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(UIUtils.getThemeColorFromAttrOrRes(AdvancedSampleActivity.this, R.attr.colorPrimaryDark, R.color.material_drawer_primary_dark));
}
return true;
}

@Override
public void onDestroyActionMode(ActionMode mode) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,19 @@
import java.util.LinkedList;
import java.util.List;

public class CollapsibleSampleActivity extends AppCompatActivity {
public class ExpandableSampleActivity extends AppCompatActivity {
//save our FastAdapter
private FastItemAdapter fastItemAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
//as we use an icon from Android-Iconics via xml we add the IconicsLayoutInflater
//https://github.com/mikepenz/Android-Iconics
LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mikepenz.fastadapter.app;

import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
Expand All @@ -10,12 +11,15 @@

import com.mikepenz.fastadapter.FastAdapter;
import com.mikepenz.fastadapter.adapters.GenericItemAdapter;
import com.mikepenz.fastadapter.app.generic.IconModel;
import com.mikepenz.fastadapter.app.adapter.FastScrollIndicatorAdapter;
import com.mikepenz.fastadapter.app.generic.GenericIconItem;
import com.mikepenz.fastadapter.app.generic.IconModel;
import com.mikepenz.iconics.Iconics;
import com.mikepenz.iconics.typeface.ITypeface;
import com.mikepenz.itemanimators.SlideDownAlphaAnimator;
import com.mikepenz.materialize.MaterializeBuilder;
import com.turingtechnologies.materialscrollbar.CustomIndicator;
import com.turingtechnologies.materialscrollbar.DragScrollBar;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -28,12 +32,10 @@ public class GenericItemActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand All @@ -54,9 +56,16 @@ protected void onCreate(Bundle savedInstanceState) {

GenericItemAdapter<IconModel, GenericIconItem> itemAdapter = new GenericItemAdapter<>(GenericIconItem.class, IconModel.class);

final FastScrollIndicatorAdapter<GenericIconItem> fastScrollIndicatorAdapter = new FastScrollIndicatorAdapter<>();
rv.setAdapter(fastScrollIndicatorAdapter.wrap(itemAdapter.wrap(fastAdapter)));

DragScrollBar materialScrollBar = new DragScrollBar(this, rv, true);
materialScrollBar.setHandleColour(ContextCompat.getColor(this, R.color.colorAccent));
materialScrollBar.setHandleOffColour(ContextCompat.getColor(this, R.color.colorAccent));
materialScrollBar.addIndicator(new CustomIndicator(this), true);

rv.setLayoutManager(gridLayoutManager);
rv.setItemAnimator(new SlideDownAlphaAnimator());
rv.setAdapter(itemAdapter.wrap(fastAdapter));

//order fonts by their name
List<ITypeface> mFonts = new ArrayList<>(Iconics.getRegisteredFonts(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ public class IconGridActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
//as we use an icon from Android-Iconics via xml we add the IconicsLayoutInflater
//https://github.com/mikepenz/Android-Iconics
LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ public class ImageListActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ public class MultiTypeGenericItemActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.mikepenz.fastadapter.app;

import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
Expand Down Expand Up @@ -40,12 +38,10 @@ public class MultiselectSampleActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down Expand Up @@ -85,6 +81,13 @@ public boolean onClick(View v, IAdapter<SampleItem> adapter, SampleItem item, in
return res != null ? res : false;
}
});
mFastAdapter.withOnClickListener(new FastAdapter.OnClickListener<SampleItem>() {
@Override
public boolean onClick(View v, IAdapter<SampleItem> adapter, SampleItem item, int position) {
Toast.makeText(v.getContext(), "SelectedCount: " + mFastAdapter.getSelections().size() + " ItemsCount: " + mFastAdapter.getSelectedItems().size(), Toast.LENGTH_SHORT).show();
return false;
}
});
mFastAdapter.withOnPreLongClickListener(new FastAdapter.OnLongClickListener<SampleItem>() {
@Override
public boolean onLongClick(View v, IAdapter<SampleItem> adapter, SampleItem item, int position) {
Expand Down Expand Up @@ -159,17 +162,11 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {

@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(UIUtils.getThemeColorFromAttrOrRes(MultiselectSampleActivity.this, R.attr.colorPrimaryDark, R.color.material_drawer_primary_dark));
}
return true;
}

@Override
public void onDestroyActionMode(ActionMode mode) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ public class SampleActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
//create the activity
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down Expand Up @@ -84,7 +83,7 @@ public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
if (drawerItem.getIdentifier() == 1) {
intent = new Intent(SampleActivity.this, MultiselectSampleActivity.class);
} else if (drawerItem.getIdentifier() == 2) {
intent = new Intent(SampleActivity.this, CollapsibleSampleActivity.class);
intent = new Intent(SampleActivity.this, ExpandableSampleActivity.class);
} else if (drawerItem.getIdentifier() == 3) {
intent = new Intent(SampleActivity.this, StickyHeaderSampleActivity.class);
} else if (drawerItem.getIdentifier() == 4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ public class SimpleItemListActivity extends AppCompatActivity implements ItemTou

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ public class StickyHeaderSampleActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);

//improve ui
findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import com.mikepenz.fastadapter.AbstractAdapter;
import com.mikepenz.fastadapter.IItem;
import com.mikepenz.fastadapter.app.generic.GenericIconItem;
import com.mikepenz.fastadapter.app.items.SampleItem;
import com.turingtechnologies.materialscrollbar.ICustomAdapter;
import com.turingtechnologies.materialscrollbar.INameableAdapter;

import java.util.List;
Expand All @@ -12,7 +14,7 @@
* This is a FastAdapter adapter implementation for the awesome Sticky-Headers lib by timehop
* https://github.com/timehop/sticky-headers-recyclerview
*/
public class FastScrollIndicatorAdapter<Item extends IItem> extends AbstractAdapter<Item> implements INameableAdapter {
public class FastScrollIndicatorAdapter<Item extends IItem> extends AbstractAdapter<Item> implements INameableAdapter, ICustomAdapter {
@Override
public Character getCharacterForElement(int position) {
IItem item = getItem(position);
Expand All @@ -23,6 +25,16 @@ public Character getCharacterForElement(int position) {
return ' ';
}

@Override
public String getCustomStringForElement(int position) {
IItem item = getItem(position);
if (item instanceof GenericIconItem && ((GenericIconItem) item).getModel().icon.getName() != null) {
//based on the position we set the headers text
return ((GenericIconItem) item).getModel().icon.getName();
}
return "";
}

/**
* REQUIRED FOR THE FastAdapter. Set order to < 0 to tell the FastAdapter he can ignore this one.
**/
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="CustomTheme" parent="MaterialDrawerTheme.Light.TranslucentStatus">
<style name="CustomTheme" parent="MaterialDrawerTheme.Light">
<!-- CAB :D -->
<item name="windowActionModeOverlay">true</item>
</style>
Expand Down
Loading

0 comments on commit de051a8

Please sign in to comment.