Skip to content

Commit

Permalink
[Add] adding gallery builder
Browse files Browse the repository at this point in the history
  • Loading branch information
mzelzoghbi committed Nov 22, 2016
1 parent 2deab82 commit 238282a
Show file tree
Hide file tree
Showing 38 changed files with 815 additions and 110 deletions.
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

11 changes: 3 additions & 8 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 0 additions & 23 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion

defaultConfig {
applicationId "com.mzelzoghbi.zgallery"
minSdkVersion 16
targetSdkVersion 24
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 1
versionName "1.0"
}
Expand All @@ -22,6 +22,6 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-beta1'
compile "com.android.support:appcompat-v7:$rootProject.ext.supportLibVersion"
compile project(':zgallery')
}
22 changes: 21 additions & 1 deletion app/src/main/java/com/mzelzoghbi/sample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,49 @@

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.mzelzoghbi.zgallery.ZGallery;
import com.mzelzoghbi.zgallery.ZGrid;
import com.mzelzoghbi.zgallery.entities.ZColor;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

private Toolbar toolbar;

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

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

}

public void gridActivity(View v) {
ZGrid.with(this, getDummyImageList())
.setToolbarColorResId(R.color.colorAccent)
.setToolbarColorResId(R.color.colorPrimary)
.setTitle("Zak Gallery")
.setToolbarTitleColor(ZColor.WHITE)
.setSpanCount(3)
.setGridImgPlaceHolder(R.color.colorPrimary)
.show();
}


public void galleryActivity(View v) {
ZGallery.with(this, getDummyImageList())
.setToolbarTitleColor(ZColor.WHITE)
.setGalleryBackgroundColor(ZColor.WHITE)
.setToolbarColorResId(R.color.colorPrimary)
.setTitle("Zak Gallery")
.show();
}

private ArrayList<String> getDummyImageList() {
ArrayList<String> imagesList = new ArrayList<>();
imagesList.add("http://static0.passel.co/wp-content/uploads/2016/08/05110349/20160731-igor-trepeshchenok-barnimages-08-768x509.jpg");
Expand Down
31 changes: 23 additions & 8 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context="com.mzelzoghbi.sample.MainActivity">

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:fitsSystemWindows="true"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:minHeight="?attr/actionBarSize" />

<Button
android:layout_margin="@dimen/normal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="gridActivity"
android:text="Grid Activity"/>
</RelativeLayout>
android:text="Grid Activity" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/normal"
android:layout_marginLeft="@dimen/normal"
android:onClick="galleryActivity"
android:text="Gallery Activity" />
</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="orange">#a95700</color>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="normal">16dp</dimen>
</resources>
14 changes: 13 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:2.2.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,9 +15,21 @@ buildscript {
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
minSdkVersion = 16
targetSdkVersion = 24
compileSdkVersion = 25

buildToolsVersion = "25.0.0"
supportLibVersion = "25.0.1"
glideVersion = "3.7.0"
photoViewLibVersion = "1.3.0"
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Tue Nov 22 16:21:50 EET 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
60 changes: 60 additions & 0 deletions import-summary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
ECLIPSE ANDROID PROJECT IMPORT SUMMARY
======================================

Ignored Files:
--------------
The following files were *not* copied into the new Gradle project; you
should evaluate whether these are still needed in your project and if
so manually move them:

* pom.xml

Replaced Jars with Dependencies:
--------------------------------
The importer recognized the following .jar files as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the .jar file in your project was of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the jar replacement in the import wizard and try again:

android-support-v4.jar => com.android.support:support-v4:18.+

Moved Files:
------------
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:

* AndroidManifest.xml => ViewPagerIndicator/src/main/AndroidManifest.xml
* res/ => ViewPagerIndicator/src/main/res/
* src/ => ViewPagerIndicator/src/main/java/

Missing Android Support Repository:
-----------------------------------
Some useful libraries, such as the Android Support Library, are
installed from a special Maven repository, which should be installed
via the SDK manager.

It looks like this library is missing from your SDK installation at:
null

To install it, open the SDK manager, and in the Extras category,
select "Android Support Repository". You may also want to install the
"Google Repository" if you want to use libraries like Google Play
Services.

Next Steps:
-----------
You can now build the project. The Gradle project needs network
connectivity to download dependencies.

Bugs:
-----
If for some reason your project does not build, and you determine that
it is due to a bug or limitation of the Eclipse to Gradle importer,
please file a bug at http://b.android.com with category
Component-Tools.

(This import summary is for your information only, and can be deleted
after import once you are satisfied with the results.)
18 changes: 11 additions & 7 deletions zgallery/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion

defaultConfig {
minSdkVersion 16
targetSdkVersion 24
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 1
versionName "1.0"
}
Expand All @@ -21,7 +21,11 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-beta1'
compile('com.github.bumptech.glide:glide:3.7.0') { ext.optional = true }
compile('com.android.support:recyclerview-v7:23.4.0') { ext.optional = true }
compile "com.android.support:appcompat-v7:$rootProject.ext.supportLibVersion"
compile "com.android.support:support-v4:$rootProject.ext.supportLibVersion"
compile("com.github.bumptech.glide:glide:$rootProject.ext.glideVersion") { ext.optional = true }
compile("com.android.support:recyclerview-v7:$rootProject.ext.supportLibVersion") { ext.optional = true }
compile("com.github.chrisbanes:PhotoView:$rootProject.ext.photoViewLibVersion") { ext.optional = false }
compile("com.android.support:recyclerview-v7:$rootProject.ext.supportLibVersion") { ext.optional = true }
compile("com.android.support:design:$rootProject.ext.supportLibVersion") { ext.optional = true }
}
10 changes: 5 additions & 5 deletions zgallery/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mzelzoghbi.zgallery">
package="com.mzelzoghbi.zgallery">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
>
<activity android:name=".ZGridActivity"/>
android:supportsRtl="true">
<activity android:name=".activities.ZGridActivity" />
<activity android:name=".activities.ZGalleryActivity" />
</application>

</manifest>
3 changes: 3 additions & 0 deletions zgallery/src/main/java/com/mzelzoghbi/zgallery/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ public class IntentPassingParams {
public static final String TOOLBAR_COLOR_ID = "toolbarColorId";
public static final String TITLE = "title";
public static final String IMG_PLACEHOLDER = "placeholder";
public static final String TOOLBAR_TITLE_COLOR = "toolbarTitleColor";
public static final String SELECTED_IMG_POS = "selectedImgPos";
public static final String BG_COLOR = "bgColor";
}
}
Loading

0 comments on commit 238282a

Please sign in to comment.