<commit_before># CompassAssistant
## Description
The CompassAssistant is a helper class that provides the heading of the device to
the geographic or the magnetic north by degrees. The information can be used to rotate a UI element,
for example a compass. 

## Init an CompassAssistant
There are two constructors:

### Assistant without declination
```java
CompassAssistant assistant = new CompassAssistant(context);
```

### Assistant with declination
```java
CompassAssistant assistant = new CompassAssistant(context, location);
```

The difference between them is that the first one will point to the magnetic northpole while the
second one will point to the geographic north. For the location you have to use the Location class from
the android.location package.

## Use the CompassAssistant
After you created your CompassAssistant you can use it. Add a listener to the assistant and start
it:

```java
assistant.addListener(listener);
assistant.start();
```

The listener will now evaluate the heading of the phone to north and then it will pass the degrees
to its listeners.

Don´t forget to stop your assistant if you don´t need it anymore. You can start it at every time.

## Usage Example:

```java
public class CompassActivity extends Activity implements CompassAssistant.CompassAssistantListener {

    public static final String MESSAGE_ID_KEY = "mid";

    private CompassAssistant compassAssistant;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.compass = (ImageView) findViewById(R.id.compass_view);
    }

    @Override
    protected void onResume() {
        super.onResume();

        // this assistant will point to the magnetic north. If you want to have a compass that points
        // to the geographic north, you have to put a location into the constructor.
        compassAssistant = new CompassAssistant(MessageDetailActivity.this);
        compassAssistant.addListener(MessageDetailActivity.this);
        compassAssistant.start();
            
    }

    @Override
    protected void onPause() {
        super.onPause();
        this.compassAssistant.stop();
    }

    @Override
    public void onNewDegreesToNorth(float degrees) {
        // this is not used here because we want to have a smooth moving compass.
    }

    @Override
    public void onNewSmoothedDegreesToNorth(float degrees) {

        final RotateAnimation ra = new RotateAnimation(
                currentDegree,
                -degrees,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF,
                0.5f);
        ra.setDuration(210);
        ra.setFillAfter(true);

        this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                compass.startAnimation(ra);
            }
        });

    }

    @Override
    public void onCompassStopped() {
        // the compass has stopped. Do maybe 
    }

    @Override
    public void onCompassStarted() {
        // you can do things here for example if you want to hide a loading indicator.
    }
}
```<commit_msg>correction of a mistake in README<commit_after># CompassAssistant
## Description
The CompassAssistant is a helper class that provides the heading of the device to
the geographic or the magnetic north by degrees. The information can be used to rotate a UI element,
for example a compass. 

## Init a CompassAssistant
There are two constructors:

### Assistant without declination
```java
CompassAssistant assistant = new CompassAssistant(context);
```

### Assistant with declination
```java
CompassAssistant assistant = new CompassAssistant(context, location);
```

The difference between them is that the first one will point to the magnetic northpole while the
second one will point to the geographic north. For the location you have to use the Location class from
the android.location package.

## Use the CompassAssistant
After you created your CompassAssistant you can use it. Add a listener to the assistant and start
it:

```java
assistant.addListener(listener);
assistant.start();
```

The listener will now evaluate the heading of the phone to north and then it will pass the degrees
to its listeners.

Don´t forget to stop your assistant if you don´t need it anymore. You can start it at every time.

## Usage Example:

```java
public class CompassActivity extends Activity implements CompassAssistant.CompassAssistantListener {

    public static final String MESSAGE_ID_KEY = "mid";

    private CompassAssistant compassAssistant;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.compass = (ImageView) findViewById(R.id.compass_view);
    }

    @Override
    protected void onResume() {
        super.onResume();

        // this assistant will point to the magnetic north. If you want to have a compass that points
        // to the geographic north, you have to put a location into the constructor.
        compassAssistant = new CompassAssistant(MessageDetailActivity.this);
        compassAssistant.addListener(MessageDetailActivity.this);
        compassAssistant.start();
            
    }

    @Override
    protected void onPause() {
        super.onPause();
        this.compassAssistant.stop();
    }

    @Override
    public void onNewDegreesToNorth(float degrees) {
        // this is not used here because we want to have a smooth moving compass.
    }

    @Override
    public void onNewSmoothedDegreesToNorth(float degrees) {

        final RotateAnimation ra = new RotateAnimation(
                currentDegree,
                -degrees,
                Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF,
                0.5f);
        ra.setDuration(210);
        ra.setFillAfter(true);

        this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                compass.startAnimation(ra);
            }
        });

    }

    @Override
    public void onCompassStopped() {
        // the compass has stopped. Do maybe 
    }

    @Override
    public void onCompassStarted() {
        // you can do things here for example if you want to hide a loading indicator.
    }
}
```
{'fraction_non_alphanumeric': 0.0674370745607092, 'fraction_numerical': 0.002216241886971664, 'mean_word_length': 2.8903940886699506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '586525', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1589, 'n_words': 635}