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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.iml
.gradle
.idea
/.idea
/local.properties
/.idea/workspace.xml
/.idea/libraries
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ allprojects {
Add the dependency:
```Groovy
dependencies {
compile 'com.github.yalantis:multi-selection:v0.1'
implementation 'com.github.yalantis:multi-selection:v0.2'
}
```

## How to use this library

Instructions can be found [here](https://yalantis.com/blog/how-we-created-a-multiselection-solution-for-android/) in section How to use MultiSelect

## Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation.
Expand Down
39 changes: 15 additions & 24 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
compileSdkVersion 33
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.yalantis.multiselect.demo"
targetSdkVersion 24
targetSdkVersion 33
minSdkVersion 17
versionCode 1
versionName "1.0"
jackOptions {
enabled true
additionalParameters('jack.incremental': 'true')
}
versionCode 2
versionName "1.1"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

dexOptions {
javaMaxHeapSize '4096m'
}

signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_KEYSTORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS_NAME
keyPassword RELEASE_KEY_ALIAS_PASSWORD
storeFile file("$project.rootDir/keys/keystore.jks")
storePassword "CevXpj2w6Pd_Updrkpw4"
keyAlias "multiselect"
keyPassword "CevXpj2w6Pd_Updrkpw4"
}
}

Expand All @@ -45,16 +37,15 @@ android {
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation fileTree(include: ['*.jar'], dir: 'libs')

compile project(path: ':multiselection')
implementation project(path: ':multiselection')
// in real project use this:
//compile 'com.github.yalantis:multi-selection:v0.1'
// implementation 'com.github.yalantis:multi-selection:v0.2'

compile "com.android.support:support-v4:$support_version"
compile "com.android.support:appcompat-v7:$support_version"
compile "com.android.support:recyclerview-v7:$support_version"
compile 'com.android.support:design:24.2.0'
implementation "androidx.appcompat:appcompat:$androidx_version"
implementation "androidx.recyclerview:recyclerview:$androidx_recycler_view_version"
implementation "com.google.android.material:material:$androidx_material_version"

}
repositories {
Expand Down
32 changes: 17 additions & 15 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<manifest package="com.yalantis.multiselectdemo"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yalantis.multiselectdemo">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_app"
android:label="@string/yal_ms_lib_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_app"
android:label="@string/yal_ms_lib_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".demo.DemoActivity">
<intent-filter >
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".demo.DemoActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package com.yalantis.multiselectdemo.demo;

import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.ViewGroup;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import com.google.android.material.snackbar.Snackbar;
import com.yalantis.multiselectdemo.R;
import com.yalantis.multiselectdemo.demo.model.Track;
import com.yalantis.multiselectdemo.demo.model.TrackList;
import com.yalantis.multiselection.lib.MultiSelectBuilder;
import com.yalantis.multiselection.lib.MultiSelect;
import com.yalantis.multiselection.lib.MultiSelectBuilder;

import java.util.List;

Expand All @@ -26,11 +25,11 @@ public class DemoActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setUpToolbar((Toolbar) findViewById(R.id.toolbar));
setUpToolbar(findViewById(R.id.toolbar));

MultiSelectBuilder<Track> builder = new MultiSelectBuilder<>(Track.class)
.withContext(this)
.mountOn((ViewGroup) findViewById(R.id.mount_point))
.mountOn(findViewById(R.id.mount_point))
.withSidebarWidth(46 + 8 * 2); // ImageView width with paddings

setUpAdapters(builder);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package com.yalantis.multiselectdemo.demo;

import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.yalantis.multiselectdemo.R;
import com.yalantis.multiselectdemo.demo.model.Track;
import com.yalantis.multiselection.lib.adapter.BaseLeftAdapter;

/**
* Created by Artem Kholodnyi on 9/3/16.
*/
public class LeftAdapter extends BaseLeftAdapter<Track, ViewHolder>{
public class LeftAdapter extends BaseLeftAdapter<Track, ViewHolder> {

private final Callback callback;

Expand All @@ -23,7 +24,7 @@ public LeftAdapter(Callback callback) {

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_view, parent, false);
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_view, parent, false);
return new ViewHolder(view);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import com.yalantis.multiselectdemo.demo.model.Track;
import com.yalantis.multiselection.lib.adapter.BaseRightAdapter;

import org.jetbrains.annotations.NotNull;

/**
* Created by Artem Kholodnyi on 9/6/16.
*/
Expand All @@ -28,7 +26,7 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
}

@Override
public void onBindViewHolder(@NotNull final ViewHolder holder, int position) {
public void onBindViewHolder(ViewHolder holder, int position) {
super.onBindViewHolder(holder, position);

ViewHolder.bind(holder, getItemAt(position));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.yalantis.multiselectdemo.demo;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

/**
* Created by Artem Kholodnyi on 9/6/16.
*/
Expand All @@ -16,7 +18,7 @@ public TracksItemDecorator(int size) {
}

@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
public void getItemOffsets(Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.bottom = size;
outRect.top = 0;
outRect.left = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.yalantis.multiselectdemo.demo;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.yalantis.multiselectdemo.R;
import com.yalantis.multiselectdemo.demo.model.Track;

Expand All @@ -18,9 +19,9 @@ class ViewHolder extends RecyclerView.ViewHolder {

public ViewHolder(View view) {
super(view);
track = (TextView) view.findViewById(R.id.track);
artist = (TextView) view.findViewById(R.id.artist);
avatar = (ImageView) view.findViewById(R.id.yal_ms_avatar);
track = view.findViewById(R.id.track);
artist = view.findViewById(R.id.artist);
avatar = view.findViewById(R.id.yal_ms_avatar);
}

public static void bind(ViewHolder viewHolder, Track track) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.yalantis.multiselectdemo.demo.model;

import android.support.annotation.DrawableRes;
import android.support.v4.app.Fragment;

import androidx.annotation.DrawableRes;

import java.io.Serializable;

Expand All @@ -10,7 +10,8 @@
*/
public class Track implements Comparable<Track>, Serializable {
private String trackName;
private @DrawableRes int album;
private @DrawableRes
int album;
private String artist;

public Track(String trackName, String artist, @DrawableRes int album) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Created by Artem Kholodnyi on 9/6/16.
*/
public class TrackList {
public final static List<Track> TRACKS = new ArrayList<Track>(){{
public final static List<Track> TRACKS = new ArrayList<Track>() {{
add(new Track("Dead Inside", "Muse", R.drawable.img_dead));
add(new Track("Sandman", "Hurts", R.drawable.img_sandman));
add(new Track("Doing It to Death", "The Kills", R.drawable.img_doing_it));
Expand Down
9 changes: 4 additions & 5 deletions app/src/main/res/drawable/ripple.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="@color/colorAccent">

Expand All @@ -11,9 +10,9 @@

<!-- make sure the ripple doesn't exceed the bounds -->
<!--<item android:id="@android:id/mask">-->
<!--<shape android:shape="rectangle">-->
<!--<solid android:color="?android:colorAccent" />-->
<!--</shape>-->
<!--<shape android:shape="rectangle">-->
<!--<solid android:color="?android:colorAccent" />-->
<!--</shape>-->
<!--</item>-->

</ripple>
3 changes: 1 addition & 2 deletions app/src/main/res/drawable/toolbar_bg.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#BB66CC"
android:endColor="#EE5544"
/>
android:startColor="#BB66CC" />
</shape>
44 changes: 21 additions & 23 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
>
android:background="@android:color/black">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/toolbar_bg"
android:layout_gravity="top" >
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top"
android:background="@drawable/toolbar_bg">

<TextView
android:text="@string/activity_title"
android:layout_gravity="center"
android:textStyle="bold"
android:textSize="18dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/activity_title"
android:textSize="18dp"
android:textStyle="bold" />

</android.support.v7.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>

<FrameLayout
android:id="@+id/mount_point"
android:layout_marginTop="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<FrameLayout
android:id="@+id/mount_point"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize" />

</FrameLayout>
Loading