Skip to content

Commit

Permalink
Remove Activity usage.
Browse files Browse the repository at this point in the history
Pull retention magic from Maven.
Rename resources.
  • Loading branch information
dmfs committed Nov 13, 2018
1 parent 509010c commit d10d9dc
Show file tree
Hide file tree
Showing 29 changed files with 26 additions and 343 deletions.
29 changes: 1 addition & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ This is a nice and simple color picker for Android. It allows to show any number

## Example code

### Use as a dialog

To show the dialog, just get an instance, add a number of palettes and call the show method.
```java
ColorPickerDialogFragment d = new ColorPickerDialogFragment();
Expand Down Expand Up @@ -43,31 +41,6 @@ The calling activity or fragment should implement `ColorPickerDialogFragment.Col
// handle cancelled color picker dialog
}
```
### Use via Intent

Alternatively you can use the picker via `Intent`. To do so just include the following dependency

```
implementation "com.github.dmfs.color-picker:colorpicker-activity:1.1"
```

and call the dialog like:
```java
ColorPickerActivity.start(context, CODE_PICK_COLOR);
```
This will call an intent with the action `org.openintents.action.PICK_COLOR` allowing the user to use his preferred color picker (if it supports the Open Intent).

In `onActivityResult(int, int, Intent)` you can get the picked color like this:
```java
@Override
protected void onActivityResult(int code, int result, Intent data)
{
if (result == RESULT_OK && code == CODE_PICK_COLOR)
{
Integer color = ColorPickerActivity.getColor(data);
}
}
```

## Screen shots

Expand All @@ -84,4 +57,4 @@ In `onActivityResult(int, int, Intent)` you can get the picked color like this:

## License

Copyright (c) dmfs GmbH 2017, licensed under Apache 2 (see `LICENSE`).
Copyright (c) dmfs GmbH 2018, licensed under Apache 2 (see `LICENSE`).
22 changes: 0 additions & 22 deletions app/build.gradle

This file was deleted.

18 changes: 0 additions & 18 deletions app/src/main/AndroidManifest.xml

This file was deleted.

Binary file removed app/src/main/res/drawable-hdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-mdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/drawable-xhdpi/ic_launcher.png
Binary file not shown.
5 changes: 0 additions & 5 deletions app/src/main/res/values/strings.xml

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/res/values/styles.xml

This file was deleted.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.1'
}
}

Expand Down
1 change: 0 additions & 1 deletion colorpicker-activity/.gitignore

This file was deleted.

26 changes: 0 additions & 26 deletions colorpicker-activity/build.gradle

This file was deleted.

21 changes: 0 additions & 21 deletions colorpicker-activity/proguard-rules.pro

This file was deleted.

16 changes: 0 additions & 16 deletions colorpicker-activity/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions colorpicker-activity/src/main/res/values/styles.xml

This file was deleted.

4 changes: 3 additions & 1 deletion colorpicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.github.dmfs.bolts:color-bolts:2b1b95d'
compile files('libs/android-retention-magic-1.2.2.jar')
implementation 'com.github.dmfs:retention-magic:1.3'

// TODO: replace or covert to Gradle project so we can pull it from Maven
compile files('libs/drawablepagertabstrip.jar')
}
Binary file removed colorpicker/libs/android-retention-magic-1.2.2.jar
Binary file not shown.
4 changes: 1 addition & 3 deletions colorpicker/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.dmfs.android.colorpicker">

</manifest>
<manifest package="org.dmfs.android.colorpicker"/>
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void setTitle(int title)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.org_dmfs_colorpickerdialog_fragment, container);
View view = inflater.inflate(R.layout.dmfs_colorpickerdialog_fragment, container);
mPager = view.findViewById(R.id.pager);
mPagerAdapter = new PalettesPagerAdapter(getResources(), getChildFragmentManager(), mPalettes);
mPagerAdapter.notifyDataSetChanged();
Expand Down Expand Up @@ -175,7 +175,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState)
if (Build.VERSION.SDK_INT >= 21)
{
// set a background with round corners
result.getWindow().setBackgroundDrawable(ContextCompat.getDrawable(getContext(), R.drawable.colorpicker_dialog_background));
result.getWindow().setBackgroundDrawable(ContextCompat.getDrawable(getContext(), R.drawable.dmfs_colorpicker_dialog_background));
// ensure we still have the right drop shadow in place
ViewCompat.setElevation(result.getWindow().getDecorView(), 24);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bun
/*
* TODO: build the layout programmatically to get rid of the resources, so we can distribute this in a single jar
*/
final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.org_dmfs_colorpickerdialog_palette_grid, container, false);
final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.dmfs_colorpickerdialog_palette_grid, container, false);
final GridView gridview = (GridView) rootView.findViewById(android.R.id.content);

mAdapter = new PaletteGridAdapter(getActivity(), mPalette);
Expand Down
Loading

0 comments on commit d10d9dc

Please sign in to comment.