<commit_before># Turn Layout Manager

A simple carousel for RecyclerView.

![Demo](https://github.com/cdflynn/turn-layout-manager/blob/master/app/img/turn_demo.gif?raw=true)

## Usage

Just create a new `TurnLayoutManager` using the constructor:
```java
TurnLayoutManager(context,              // provide a context
                  Gravity.START,        // from which direction should the list items orbit? 
                  Orientation.VERTICAL, // Is this a vertical or horizontal scroll?
                  radius,               // The radius of the item rotation
                  peek,                 // Extra offset distance
                  shouldRotate);        // should list items angle towards the center? true/false.
```

Just like a `LinearLayoutManager`, a `TurnLayoutManager` specifies an orientation, either `VERTICAL` or `HORIZONTAL` for vertical and horizontal scrolling respectively.  

In addition to orientation, supply a `Gravity` (either `START` or `END`).  Together, these define the axis of rotation.

```
Gravity.START
Orientation.VERTICAL

┏─────────┓
┃ x       ┃
┃  x      ┃
┃   x     ┃
┃   x     ┃
┃   x     ┃
┃  x      ┃
┃ x       ┃
┗─────────┛
```

```
Gravity.END
Orientation.VERTICAL
┏─────────┓
┃       x ┃
┃      x  ┃
┃     x   ┃
┃     x   ┃
┃     x   ┃
┃      x  ┃
┃       x ┃
┗─────────┛
     
```

```
Gravity.START
Orientation.HORIZONTAL
┏─────────┓
┃x       x┃
┃ x     x ┃
┃   xxx   ┃
┃         ┃
┃         ┃
┃         ┃
┃         ┃
┗─────────┛

```

```
Gravity.END
Orientation.HORIZONTAL
┏─────────┓
┃         ┃
┃         ┃
┃         ┃
┃         ┃
┃   xxx   ┃
┃ x     x ┃
┃x       x┃
┗─────────┛
```

## Install

Add the JitPack repository to your root build.gradle
```
	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
```

Add the dependency to your module's build.gradle
```
dependencies {
	        implementation 'com.github.cdflynn:turn-layout-manager:v1.3.1'
	}
```

## How It Works

`TurnLayoutManager` uses the base functionality of `LinearLayoutManager` with some slight modifications.  Child views are positioned normally as `LinearLayoutManager` does, but they're offset along the rotation radius and peek distance.  This involves some trade offs.<commit_msg>Indentation fixing (#9)<commit_after># Turn Layout Manager

A simple carousel for RecyclerView.

![Demo](https://github.com/cdflynn/turn-layout-manager/blob/master/app/img/turn_demo.gif?raw=true)

## Usage

Just create a new `TurnLayoutManager` using the constructor:
```java
TurnLayoutManager(context,              // provide a context
                  Gravity.START,        // from which direction should the list items orbit? 
                  Orientation.VERTICAL, // Is this a vertical or horizontal scroll?
                  radius,               // The radius of the item rotation
                  peek,                 // Extra offset distance
                  shouldRotate);        // should list items angle towards the center? true/false.
```

Just like a `LinearLayoutManager`, a `TurnLayoutManager` specifies an orientation, either `VERTICAL` or `HORIZONTAL` for vertical and horizontal scrolling respectively.  

In addition to orientation, supply a `Gravity` (either `START` or `END`).  Together, these define the axis of rotation.

```
Gravity.START
Orientation.VERTICAL

┏─────────┓
┃ x       ┃
┃  x      ┃
┃   x     ┃
┃   x     ┃
┃   x     ┃
┃  x      ┃
┃ x       ┃
┗─────────┛
```

```
Gravity.END
Orientation.VERTICAL
┏─────────┓
┃       x ┃
┃      x  ┃
┃     x   ┃
┃     x   ┃
┃     x   ┃
┃      x  ┃
┃       x ┃
┗─────────┛
     
```

```
Gravity.START
Orientation.HORIZONTAL
┏─────────┓
┃x       x┃
┃ x     x ┃
┃   xxx   ┃
┃         ┃
┃         ┃
┃         ┃
┃         ┃
┗─────────┛

```

```
Gravity.END
Orientation.HORIZONTAL
┏─────────┓
┃         ┃
┃         ┃
┃         ┃
┃         ┃
┃   xxx   ┃
┃ x     x ┃
┃x       x┃
┗─────────┛
```

## Install

Add the JitPack repository to your root build.gradle
```
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
```

Add the dependency to your module's build.gradle
```
dependencies {
    implementation 'com.github.cdflynn:turn-layout-manager:v1.3.1'
}
```

## How It Works

`TurnLayoutManager` uses the base functionality of `LinearLayoutManager` with some slight modifications.  Child views are positioned normally as `LinearLayoutManager` does, but they're offset along the rotation radius and peek distance.  This involves some trade offs.
{'fraction_non_alphanumeric': 0.14244572441293754, 'fraction_numerical': 0.0015507310589277803, 'mean_word_length': 2.1463414634146343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2419722', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1483, 'n_words': 503}