-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- SDK 28 - Android Studio 3.2 - Gradle 4.10.2 - AndroidX 1.0.0
- Loading branch information
Showing
12 changed files
with
163 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,9 @@ ext { | |
developerEmail = '[email protected]' | ||
|
||
// 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' | ||
|
||
|
@@ -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' | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
211 changes: 107 additions & 104 deletions
211
flipview-app/src/main/java/eu/davidea/examples/flipview/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.