Skip to content
This repository has been archived by the owner on Jan 13, 2020. It is now read-only.

Commit

Permalink
* update to latest support libs
Browse files Browse the repository at this point in the history
* update all dependencies
* update gradle to 2.8
* update build tools
* fix api and change to new domain for the sample dataa
  • Loading branch information
mikepenz committed Nov 1, 2015
1 parent 7bb7b89 commit 68fd4a7
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 67 deletions.
42 changes: 22 additions & 20 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ try {
}

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "com.mikepenz.unsplash"
minSdkVersion 16
targetSdkVersion 21
versionCode 185
versionName "1.8.5"
targetSdkVersion 22
versionCode 190
versionName "1.9.0"
}
buildTypes {
debug {
Expand Down Expand Up @@ -54,32 +54,34 @@ android {
}

dependencies {
compile 'com.koushikdutta.ion:ion:2.0.5'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:palette-v7:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.koushikdutta.ion:ion:2.1.6'

compile 'com.android.support:palette-v7:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'

compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'io.reactivex:rxandroid:0.24.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'io.reactivex:rxandroid:1.0.1'

compile 'com.nispok:snackbar:2.10.1'
compile 'com.nispok:snackbar:2.11.0'
compile 'com.gu:option:1.3'

compile 'com.github.lzyzsd:circleprogress:1.0.1@aar'
compile 'com.github.lzyzsd:circleprogress:1.2.0@aar'
compile 'com.github.xiprox.errorview:library:1.0.0'

compile 'com.google.android.apps.muzei:muzei-api:+'

compile 'com.mikepenz.iconics:library:0.7.5@aar'
compile('com.mikepenz.aboutlibraries:library:4.5.8@aar') {
compile('com.mikepenz:aboutlibraries:5.2.6@aar') {
transitive = true
}
compile('com.mikepenz.materialdrawer:library:2.0.0@aar') {
compile('com.mikepenz:materialdrawer:4.4.4@aar') {
transitive = true
}
compile 'com.mikepenz:iconics-core:1.7.9@aar'
compile 'com.mikepenz:google-material-typeface:1.2.0.1@aar'
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1@aar'
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support.v4.content.FileProvider;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
Expand All @@ -38,8 +38,8 @@
import com.koushikdutta.ion.ProgressCallback;
import com.koushikdutta.ion.Response;
import com.koushikdutta.ion.future.ResponseFuture;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.iconics.typeface.FontAwesome;
import com.mikepenz.unsplash.R;
import com.mikepenz.unsplash.fragments.DirectoryChooserFragment;
import com.mikepenz.unsplash.fragments.ImagesFragment;
Expand All @@ -55,7 +55,7 @@
import java.io.InputStream;


public class DetailActivity extends ActionBarActivity {
public class DetailActivity extends AppCompatActivity {
private static final int ACTIVITY_CROP = 13451;
private static final int ACTIVITY_SHARE = 13452;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;

import com.mikepenz.aboutlibraries.Libs;
import com.mikepenz.aboutlibraries.LibsBuilder;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.iconics.typeface.FontAwesome;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.holder.StringHolder;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.SectionDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
Expand All @@ -23,7 +24,7 @@
import com.mikepenz.unsplash.network.UnsplashApi;


public class MainActivity extends ActionBarActivity {
public class MainActivity extends AppCompatActivity {
public enum Category {
ALL(1000),
FEATURED(1001),
Expand All @@ -42,7 +43,7 @@ private Category(int id) {
}
}

public Drawer.Result result;
public Drawer result;

private OnFilterChangedListener onFilterChangedListener;

Expand All @@ -59,7 +60,7 @@ protected void onCreate(Bundle savedInstanceState) {
toolbar.setTitleTextColor(Color.WHITE);
setSupportActionBar(toolbar);

result = new Drawer()
result = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.withHeader(R.layout.header)
Expand All @@ -75,38 +76,41 @@ protected void onCreate(Bundle savedInstanceState) {
new PrimaryDrawerItem().withName(R.string.category_technology).withIdentifier(Category.TECHNOLOGY.id).withIcon(GoogleMaterial.Icon.gmd_local_see)
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l, IDrawerItem drawerItem) {
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
if (drawerItem != null) {
if (drawerItem instanceof Nameable) {
toolbar.setTitle(((Nameable) drawerItem).getNameRes());
toolbar.setTitle(((Nameable) drawerItem).getName().getText(MainActivity.this));
}
if (onFilterChangedListener != null) {
onFilterChangedListener.onFilterChanged(drawerItem.getIdentifier());
}
}

return false;
}
})
.build();

//disable scrollbar :D it's ugly
result.getListView().setVerticalScrollBarEnabled(false);
result.getRecyclerView().setVerticalScrollBarEnabled(false);
}

/**
* @param images
*/
public void setCategoryCount(ImageList images) {
if (result.getDrawerItems() != null && result.getDrawerItems().size() == 9 && images != null && images.getData() != null) {
result.updateBadge(images.getData().size() + "", 0);
result.updateBadge(UnsplashApi.countFeatured(images.getData()) + "", 1);

result.updateBadge(UnsplashApi.countCategory(images.getData(), Category.BUILDINGS.id) + "", 3);
result.updateBadge(UnsplashApi.countCategory(images.getData(), Category.FOOD.id) + "", 4);
result.updateBadge(UnsplashApi.countCategory(images.getData(), Category.NATURE.id) + "", 5);
result.updateBadge(UnsplashApi.countCategory(images.getData(), Category.OBJECTS.id) + "", 6);
result.updateBadge(UnsplashApi.countCategory(images.getData(), Category.PEOPLE.id) + "", 7);
result.updateBadge(UnsplashApi.countCategory(images.getData(), Category.TECHNOLOGY.id) + "", 8);
result.updateBadge(Category.ALL.id, new StringHolder(images.getData().size() + ""));
result.updateBadge(Category.FEATURED.id, new StringHolder(UnsplashApi.countFeatured(images.getData()) + ""));

result.updateBadge(Category.BUILDINGS.id, new StringHolder(UnsplashApi.countCategory(images.getData(), Category.BUILDINGS.id) + ""));
result.updateBadge(Category.FOOD.id, new StringHolder(UnsplashApi.countCategory(images.getData(), Category.FOOD.id) + ""));
result.updateBadge(Category.NATURE.id, new StringHolder(UnsplashApi.countCategory(images.getData(), Category.NATURE.id) + ""));
result.updateBadge(Category.OBJECTS.id, new StringHolder(UnsplashApi.countCategory(images.getData(), Category.OBJECTS.id) + ""));
result.updateBadge(Category.PEOPLE.id, new StringHolder(UnsplashApi.countCategory(images.getData(), Category.PEOPLE.id) + ""));
result.updateBadge(Category.TECHNOLOGY.id, new StringHolder(UnsplashApi.countCategory(images.getData(), Category.TECHNOLOGY.id) + ""));
}
}

Expand All @@ -115,8 +119,8 @@ public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);

menu.findItem(R.id.action_open_source).setIcon(new IconicsDrawable(this, FontAwesome.Icon.faw_github).color(Color.WHITE).actionBarSize());
menu.findItem(R.id.action_shuffle).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_shuffle).paddingDp(1).color(Color.WHITE).actionBarSize());
menu.findItem(R.id.action_open_source).setIcon(new IconicsDrawable(this, FontAwesome.Icon.faw_github).color(Color.WHITE).actionBar());
menu.findItem(R.id.action_shuffle).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_shuffle).paddingDp(1).color(Color.WHITE).actionBar());

return true;
}
Expand All @@ -125,10 +129,10 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_open_source) {
new Libs.Builder()
new LibsBuilder()
.withFields(R.string.class.getFields())
.withActivityTitle(getString(R.string.action_open_source))
.withActivityTheme(R.style.MaterialDrawerTheme_ActionBar)
.withActivityTheme(R.style.MaterialDrawerTheme)
.withLibraries("rxJava", "rxAndroid")
.start(this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import rx.Observable;

public class UnsplashApi {
public static final String ENDPOINT = "http://wallsplash.lanora.io";
public static final String ENDPOINT = "http://lanora.eu/projects/wallsplash/";
private final UnsplashService mWebService;

public static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); //2015-01-18 15:48:56
Expand Down
34 changes: 15 additions & 19 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<RelativeLayout
android:id="@+id/activity_main_toolbar_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<android.support.v7.widget.Toolbar
android:id="@+id/activity_main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:paddingTop="@dimen/tool_bar_top_padding">
<android.support.v7.widget.Toolbar
android:id="@+id/activity_main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"/>
</RelativeLayout>
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<fragment android:name="com.mikepenz.unsplash.fragments.ImagesFragment"
android:id="@+id/ly_last_images_fragment"
android:layout_gravity="center"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
<fragment
android:id="@+id/ly_last_images_fragment"
android:name="com.mikepenz.unsplash.fragments.ImagesFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />

</LinearLayout>

Expand Down
7 changes: 6 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:1.1.0'
classpath 'com.android.tools.build:gradle:1.3.1'
}
}

Expand All @@ -14,5 +14,10 @@ allprojects {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'http://guardian.github.com/maven/repo-releases' }
maven { url "https://jitpack.io" }
}
}

task wrapper(type: Wrapper) {
gradleVersion = '2.8'
}

0 comments on commit 68fd4a7

Please sign in to comment.