Skip to content

Commit

Permalink
Release/5.3.0 (#198)
Browse files Browse the repository at this point in the history
* Version update

* New changelog

* Readme update + docs in Theme

* Added theming to camera/local files fragments

* Readme update
  • Loading branch information
scana committed Nov 29, 2018
1 parent 2333a0c commit 908c303
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 11 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,15 @@
Change Log
==========
Version 5.3.0 *(2018-11-29)*
----------------------------

* [Feature] New way to open up the Filestack Picker! Use `FilestackPicker.Builder` class to customize your picker easily.
* [Feature] A way to set Picker's theme is now available. Use `Theme.Builder` class to set your own color scheme to a picker.
* [Feature] Picker's version is now available in the picker's menu. This feature can be disabled using `FilestackPicker.Builder`.
* [UI change] Files descriptions are now formatted in a better way (e.g: 15360 is now properly displayed as 15kB).
* [UI fix] Menu options are now properly hidden in places that doesn't require them.
* Tester module supports all of the new features introduced. Head to Settings to see new configuration options.

Version 5.2.0 *(2018-10-15)*
----------------------------

Expand Down
15 changes: 11 additions & 4 deletions README.md
Expand Up @@ -3,13 +3,13 @@

<p align="center">
<a href="https://bintray.com/filestack/maven/filestack-android">
<img src="https://img.shields.io/badge/bintray-v5.0.0--0.2.0-blue.svg?longCache=true&style=flat-square">
<img src="https://img.shields.io/badge/bintray-v5.3.0-blue.svg?longCache=true&style=flat-square">
</a>
<a href="https://filestack.github.io/filestack-android/">
<img src="https://img.shields.io/badge/ref-javadoc-795548.svg?longCache=true&style=flat-square">
</a>
<img src="https://img.shields.io/badge/min_sdk-19_(4.4_kitkat)-green.svg?longCache=true&style=flat-square">
<img src="https://img.shields.io/badge/target_sdk-27_(8.1_oreo)-green.svg?longCache=true&style=flat-square">
<img src="https://img.shields.io/badge/min_sdk-16_(4.1)-green.svg?longCache=true&style=flat-square">
<img src="https://img.shields.io/badge/target_sdk-28-green.svg?longCache=true&style=flat-square">
</p>

<p align="center">
Expand All @@ -21,7 +21,7 @@

## Install
```gradle
implementation 'com.filestack:filestack-android:5.1.0'
implementation 'com.filestack:filestack-android:5.3.0'
```

## Tester and Samples
Expand Down Expand Up @@ -202,6 +202,13 @@ if (savedInstanceState == null) {
}
```

## Theming
Filestack Android SDK provides a theming mechanism for Filestack Picker screen.

Setting a theme requires passing a `Theme` to `Filestack.Builder#theme(Theme)` method call.
`Theme` objects can be constructed with a `Theme.Builder` instance.
If theme is not set, a default one will be used.

## Native UI
At present this SDK doesn't offer many customization options, but the [Java
SDK][java-sdk] can be used to build a native UI. This SDK adds UI and
Expand Down
2 changes: 1 addition & 1 deletion filestack/build.gradle
Expand Up @@ -7,7 +7,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

group = 'com.filestack'
version = '5.2.0'
version = '5.3.0'
project.archivesBaseName = 'filestack-android'

android {
Expand Down
4 changes: 2 additions & 2 deletions filestack/src/main/java/com/filestack/android/FsActivity.java
Expand Up @@ -311,10 +311,10 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {

switch (source) {
case Sources.CAMERA:
fragment = new CameraFragment();
fragment = CameraFragment.newInstance(theme);
break;
case Sources.DEVICE:
fragment = LocalFilesFragment.newInstance(allowMultipleFiles);
fragment = LocalFilesFragment.newInstance(allowMultipleFiles, theme);
break;
}

Expand Down
21 changes: 21 additions & 0 deletions filestack/src/main/java/com/filestack/android/Theme.java
Expand Up @@ -47,26 +47,47 @@ public static class Builder {
int accentColor = Color.parseColor("#FF9800");
int textColor = Color.parseColor("#89000000");

/**
* Title of the Picker.
*/
public Builder title(String title) {
this.title = title;
return this;
}

/**
* Background color. Displayed in lists and a navigation drawer.
* Used also as a text color for toolbar title and
* buttons on authorization/local/camera screens.
* @param backgroundColor int representation of a color
*/
public Builder backgroundColor(@ColorInt int backgroundColor) {
this.backgroundColor = backgroundColor;
return this;
}

/**
* Accent color. Used as a color for toolbar, selection markers and navigation drawer items.
* @param accentColor int representation of a color
*/
public Builder accentColor(@ColorInt int accentColor) {
this.accentColor = accentColor;
return this;
}

/**
* Text color. Used as a color for text in camera/local/authorization/file list screens.
* @param textColor int representation of a color
*/
public Builder textColor(@ColorInt int textColor) {
this.textColor = textColor;
return this;
}

/**
* Builds a new theme based on provided parameters.
* @return new {@link Theme} instance
*/
public Theme build() {
return new Theme(this);
}
Expand Down
Expand Up @@ -3,22 +3,27 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ImageViewCompat;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;

import com.filestack.Sources;
import com.filestack.android.FsConstants;
import com.filestack.android.R;
import com.filestack.android.Selection;
import com.filestack.android.Theme;

import java.io.File;
import java.io.IOException;
Expand All @@ -32,10 +37,21 @@
*/
public class CameraFragment extends Fragment implements BackButtonListener, View.OnClickListener {

public static CameraFragment newInstance(Theme theme) {
Bundle args = new Bundle();
args.putParcelable(ARG_THEME, theme);
CameraFragment fragment = new CameraFragment();
fragment.setArguments(args);
return fragment;
}

private static final String TYPE_PHOTO = "photo";
private static final String TYPE_VIDEO = "video";
private static final String PREF_PATH = "path";
private static final String PREF_NAME= "name";
private static final String ARG_THEME = "theme";

private Theme theme;

@Nullable
@Override
Expand All @@ -58,10 +74,14 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
videoButton.setVisibility(View.GONE);
}
}

theme = getArguments().getParcelable(ARG_THEME);
photoButton.setTextColor(theme.getBackgroundColor());
ViewCompat.setBackgroundTintList(photoButton, ColorStateList.valueOf(theme.getAccentColor()));
ViewCompat.setBackgroundTintList(videoButton, ColorStateList.valueOf(theme.getAccentColor()));
videoButton.setTextColor(theme.getBackgroundColor());
photoButton.setOnClickListener(this);
videoButton.setOnClickListener(this);

ImageViewCompat.setImageTintList((ImageView) root.findViewById(R.id.icon), ColorStateList.valueOf(theme.getTextColor()));
return root;
}

Expand Down
Expand Up @@ -4,20 +4,26 @@
import android.content.ClipData;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.OpenableColumns;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ImageViewCompat;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;

import com.filestack.android.FsConstants;
import com.filestack.android.R;
import com.filestack.android.Selection;
import com.filestack.android.Theme;

import java.util.ArrayList;

Expand All @@ -32,11 +38,13 @@
public class LocalFilesFragment extends Fragment implements View.OnClickListener {
private static final String ARG_ALLOW_MULTIPLE_FILES = "multipleFiles";
private static final int READ_REQUEST_CODE = RESULT_FIRST_USER;
private static final String ARG_THEME = "theme";

public static Fragment newInstance(boolean allowMultipleFiles) {
public static Fragment newInstance(boolean allowMultipleFiles, Theme theme) {
Fragment fragment = new LocalFilesFragment();
Bundle args = new Bundle();
args.putBoolean(ARG_ALLOW_MULTIPLE_FILES, allowMultipleFiles);
args.putParcelable(ARG_THEME, theme);
fragment.setArguments(args);
return fragment;
}
Expand All @@ -45,7 +53,12 @@ public static Fragment newInstance(boolean allowMultipleFiles) {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) {
View view = inflater.inflate(R.layout.filestack__fragment_local_files, container, false);
view.findViewById(R.id.select_gallery).setOnClickListener(this);
Button openGalleryButton = view.findViewById(R.id.select_gallery);
openGalleryButton.setOnClickListener(this);
Theme theme = getArguments().getParcelable(ARG_THEME);
ViewCompat.setBackgroundTintList(openGalleryButton, ColorStateList.valueOf(theme.getAccentColor()));
openGalleryButton.setTextColor(theme.getBackgroundColor());
ImageViewCompat.setImageTintList((ImageView) view.findViewById(R.id.icon), ColorStateList.valueOf(theme.getTextColor()));
return view;
}

Expand Down

0 comments on commit 908c303

Please sign in to comment.