Skip to content

Commit

Permalink
Release 1.2.0
Browse files Browse the repository at this point in the history
- SDK 28
- Android Studio 3.2
- Gradle 4.10.2
- AndroidX 1.0.0
  • Loading branch information
davideas committed Sep 30, 2018
1 parent c62560f commit 74c28fd
Show file tree
Hide file tree
Showing 12 changed files with 163 additions and 155 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# FlipView

###### GMail-like View & beyond - v1.1.3 built on 2017.03.07
###### GMail-like View & beyond - v1.2.0 built on 2018.09.30 with AndroidX

#### Concept
FlipView is a ViewGroup (FrameLayout) that is designed to display 2 views/layouts by flipping
Expand Down Expand Up @@ -35,7 +35,7 @@ which means you can call all public functions of these two Android views.
Import the library into your project using JCenter
```
dependencies {
implementation 'eu.davidea:flipview:1.1.3'
implementation 'eu.davidea:flipview:1.2.0'
}
```
#### Pull requests / Issues / Improvement requests
Expand All @@ -45,9 +45,9 @@ Feel free to contribute and ask!
Supported attributes with _default_ values:
``` xml
<eu.davidea.flipview.FlipView
xmlns:app="http://schemas.android.com/apk/res-auto"
android usual attrs
(see below).../>
xmlns:app="http://schemas.android.com/apk/res-auto"
android usual attrs
(see below).../>
```
|**ViewAnimator**||
|:---|:---|
Expand Down Expand Up @@ -98,9 +98,10 @@ Supported attributes with _default_ values:

# Change Log
###### Latest release
[v1.1.3](https://github.com/davideas/FlipView/releases) - 2017.03.07
[v1.2.0](https://github.com/davideas/FlipView/releases) - 2018.09.30

###### Old releases
[v1.1.3](https://github.com/davideas/FlipView/releases/tag/1.1.3) - 2017.03.07 |
[v1.1.2](https://github.com/davideas/FlipView/releases/tag/1.1.2) - 2016.11.30 |
[v1.1.1](https://github.com/davideas/FlipView/releases/tag/1.1.1) - 2016.04.07<br/>
[v1.1.0](https://github.com/davideas/FlipView/releases/tag/1.1.0) - 2015.11.05 |
Expand Down
41 changes: 23 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ ext {
developerEmail = 'dave.dna@gmail.com'

// Library
libraryCode = 5
libraryVersion = '1.1.3'
libraryDate = " of 2017.03.07"
libraryCode = 6
libraryVersion = '1.2.0'
libraryDate = " of 2018.09.30"
libraryName = 'FlipView'
libraryDescription = 'Flipping views like GMail & beyond'

Expand All @@ -20,21 +20,26 @@ ext {
siteUrl = 'https://github.com/davideas/FlipView'
gitUrl = 'https://github.com/davideas/FlipView.git'

// Support and Build tools version
// SDK and Build tools version
minSdk = 14
targetSdk = 27
buildTools = "27.0.3"
supportLibrary = '27.1.1'
targetSdk = 28 // Android Pie
buildTools = "28.0.3"

// Support Libraries dependencies
supportDependencies = [
design : "com.android.support:design:${supportLibrary}",
recyclerview: "com.android.support:recyclerview-v7:${supportLibrary}",
cardview : "com.android.support:cardview-v7:${supportLibrary}",
appcompat : "com.android.support:appcompat-v7:${supportLibrary}",
customtabs : "com.android.support:customtabs:${supportLibrary}",
support : "com.android.support:support-v13:${supportLibrary}",
annotations : "com.android.support:support-annotations:${supportLibrary}"
// AndroidX
androidxVer = "1.0.0"
constraintVer = "1.1.2"
androidx = [
recyclerView : "androidx.recyclerview:recyclerview:${androidxVer}",
appCompat : "androidx.appcompat:appcompat:${androidxVer}",
cardView : "androidx.cardview:cardview:${androidxVer}",
annotation : "androidx.annotation:annotation:${androidxVer}",
constraintLayout: "com.android.support.constraint:constraint-layout:${constraintVer}"
]

// Google Material
googleVer = "1.0.0"
google = [
material: "com.google.android.material:material:${androidxVer}"
]

licenseName = 'The Apache Software License, Version 2.0'
Expand All @@ -48,8 +53,8 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
8 changes: 3 additions & 5 deletions flipview-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ android {
dependencies {
//See main build.gradle for values & versions
implementation project(':flipview')
implementation(supportDependencies.appcompat) {
transitive = true
}
implementation supportDependencies.recyclerview
implementation supportDependencies.design
implementation androidx.appCompat
implementation androidx.recyclerView
implementation google.material

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package eu.davidea.examples.flipview;

import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -9,6 +8,7 @@
import java.util.ArrayList;
import java.util.List;

import androidx.recyclerview.widget.RecyclerView;
import eu.davidea.flipview.FlipView;

public class FlipViewAdapter extends RecyclerView.Adapter<FlipViewAdapter.FlipViewHolder> {
Expand Down
211 changes: 107 additions & 104 deletions flipview-app/src/main/java/eu/davidea/examples/flipview/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,125 +1,128 @@
package eu.davidea.examples.flipview;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatCheckBox;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import eu.davidea.flipview.FlipView;
import eu.davidea.utils.Utils;

@SuppressWarnings("ConstantConditions")
public class MainActivity extends AppCompatActivity {

private static final String HTTPS = "https://";
private static final String URL = "github.com/davideas/FlipView";
private static final int ITEMS = 15;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//Enable DEBUG logs at runtime
FlipView.enableLogs(true);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, URL, Snackbar.LENGTH_LONG)
.setAction("Github", new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(HTTPS+URL));
startActivity(Intent.createChooser(intent, getString(R.string.intent_chooser)));
}
}).show();
}
});

initializeRecyclerView();

//Example to set background color to the front layout programmatically
FlipView flipView = (FlipView) findViewById(R.id.flip_horizontal_oval_view_big);
flipView.setChildBackgroundColor(FlipView.FRONT_VIEW_INDEX, Color.RED);

//Handling flipping programmatically
AppCompatCheckBox enableCheckBox = (AppCompatCheckBox) findViewById(R.id.flag_enable);
enableCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//FlipView to enable/disable
findViewById(R.id.flip_layout).setEnabled(!isChecked);
FlipView flipView = (FlipView) findViewById(R.id.flip_horizontal_oval_view_locked);
flipView.setClickable(isChecked);//View was set not clickable in the layout!

if (isChecked) {
flipView.setChildBackgroundColor(0, getResources().getColor(R.color.colorAccent));
flipView.setFrontImage(R.drawable.ic_lock_open_white_24dp);
findViewById(R.id.triangle).setBackgroundResource(R.drawable.triangle_red);
} else {
flipView.setChildBackgroundDrawable(0, R.drawable.circle_light_stroke);
flipView.setFrontImage(R.drawable.ic_lock_white_24dp);
findViewById(R.id.triangle).setBackgroundResource(R.drawable.triangle_green);
}
Log.d(MainActivity.class.getSimpleName(), isChecked ? "Layout pinned, FlipView unlocked" : "Layout auto-flip, FlipView locked");
}
});
}

private void initializeRecyclerView() {
FlipViewAdapter adapter = new FlipViewAdapter(ITEMS);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new GridLayoutManager(this, ITEMS/3));
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
}

public void showList(View view) {
CheckBox checkBoxReset = (CheckBox) findViewById(R.id.checkbox_reset);
if (checkBoxReset.isChecked()) FlipView.resetLayoutAnimationDelay();
initializeRecyclerView();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_about) {
MessageDialog.newInstance(
R.drawable.ic_info_grey600_24dp,
getString(R.string.about_title),
getString(R.string.about_body,
Utils.getVersionName(this),
Utils.getVersionCode(this)) )
.show(getFragmentManager(), MessageDialog.TAG);
return true;
}

return super.onOptionsItemSelected(item);
}
private static final String HTTPS = "https://";
private static final String URL = "github.com/davideas/FlipView";
private static final int ITEMS = 15;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//Enable DEBUG logs at runtime
FlipView.enableLogs(true);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, URL, Snackbar.LENGTH_LONG)
.setAction("Github", new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(HTTPS + URL));
startActivity(Intent.createChooser(intent, getString(R.string.intent_chooser)));
}
}).show();
}
});

initializeRecyclerView();

//Example to set background color to the front layout programmatically
FlipView flipView = (FlipView) findViewById(R.id.flip_horizontal_oval_view_big);
flipView.setChildBackgroundColor(FlipView.FRONT_VIEW_INDEX, Color.RED);

//Handling flipping programmatically
AppCompatCheckBox enableCheckBox = (AppCompatCheckBox) findViewById(R.id.flag_enable);
enableCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//FlipView to enable/disable
findViewById(R.id.flip_layout).setEnabled(!isChecked);
FlipView flipView = (FlipView) findViewById(R.id.flip_horizontal_oval_view_locked);
flipView.setClickable(isChecked);//View was set not clickable in the layout!

if (isChecked) {
flipView.setChildBackgroundColor(0, getResources().getColor(R.color.colorAccent));
flipView.setFrontImage(R.drawable.ic_lock_open_white_24dp);
findViewById(R.id.triangle).setBackgroundResource(R.drawable.triangle_red);
} else {
flipView.setChildBackgroundDrawable(0, R.drawable.circle_light_stroke);
flipView.setFrontImage(R.drawable.ic_lock_white_24dp);
findViewById(R.id.triangle).setBackgroundResource(R.drawable.triangle_green);
}
Log.d(MainActivity.class.getSimpleName(), isChecked ? "Layout pinned, FlipView unlocked" : "Layout auto-flip, FlipView locked");
}
});
}

private void initializeRecyclerView() {
FlipViewAdapter adapter = new FlipViewAdapter(ITEMS);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new GridLayoutManager(this, ITEMS / 3));
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
}

public void showList(View view) {
CheckBox checkBoxReset = (CheckBox) findViewById(R.id.checkbox_reset);
if (checkBoxReset.isChecked()) FlipView.resetLayoutAnimationDelay();
initializeRecyclerView();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@SuppressLint("StringFormatMatches")
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_about) {
MessageDialog.newInstance(
R.drawable.ic_info_grey600_24dp,
getString(R.string.about_title),
getString(R.string.about_body,
Utils.getVersionName(this),
Utils.getVersionCode(this)))
.show(getFragmentManager(), MessageDialog.TAG);
return true;
}

return super.onOptionsItemSelected(item);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import androidx.appcompat.app.AlertDialog;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
Expand Down
Loading

0 comments on commit 74c28fd

Please sign in to comment.