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
10 changes: 0 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
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: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
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.3.0-blue.svg?longCache=true&style=flat-square">
<img src="https://img.shields.io/badge/bintray-v5.0.0--0.2.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-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">
<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">
</p>

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

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

## Tester and Samples
Expand Down Expand Up @@ -202,13 +202,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

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

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

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

Expand Down
21 changes: 0 additions & 21 deletions filestack/src/main/java/com/filestack/android/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,47 +47,26 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,22 @@
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 @@ -37,21 +32,10 @@
*/
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 @@ -74,14 +58,10 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,20 @@
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 @@ -38,13 +32,11 @@
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, Theme theme) {
public static Fragment newInstance(boolean allowMultipleFiles) {
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 @@ -53,12 +45,7 @@ public static Fragment newInstance(boolean allowMultipleFiles, Theme theme) {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) {
View view = inflater.inflate(R.layout.filestack__fragment_local_files, container, false);
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()));
view.findViewById(R.id.select_gallery).setOnClickListener(this);
return view;
}

Expand Down