Skip to content

Commit

Permalink
Merge branch 'release/1.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkil committed Dec 4, 2013
2 parents 3559150 + b0f9140 commit fe4ecf1
Show file tree
Hide file tree
Showing 37 changed files with 1,379 additions and 56 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ Change Log
==========


Version 1.3.2 *(In development)*
Version 1.4.0 *(2013-12-04)*
--------------------------------
* ...
* Implemented `ProgressListFragment` & `SherlockProgressListFragment`.
* Rename `GridFragment` to `ProgressGridFragment`.
* Rename `SherlockGridFragment` to `SherlockProgressGridFragment`.


Version 1.3.1 *(2013-10-28)*
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ Android-ProgressFragment library is now pushed to Maven Central as a AAR, so you
ProgressFragment:
``` xml
dependencies {
compile 'com.github.johnkil.android-progressfragment:progressfragment:1.3.1'
compile 'com.github.johnkil.android-progressfragment:progressfragment:1.4.0'
}
```

SherlockProgressFragment:
``` xml
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile('com.github.johnkil.android-progressfragment:sherlockprogressfragment:1.3.1') {
compile 'com.android.support:support-v4:19.0.0'
compile('com.github.johnkil.android-progressfragment:sherlockprogressfragment:1.4.0') {
exclude module: 'support-v4'
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ allprojects {
}
}

// apply plugin: 'android-reporting'
apply plugin: 'android-reporting'
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=1.3.1-SNAPSHOT
VERSION_CODE=5
VERSION_NAME=1.4.0-SNAPSHOT
VERSION_CODE=6
GROUP=com.github.johnkil.android-progressfragment

POM_DESCRIPTION=Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data
Expand Down
6 changes: 3 additions & 3 deletions progressfragment-sample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.devspark.progressfragment.sample"
android:versionCode="5"
android:versionName="1.3.1">
android:versionCode="6"
android:versionName="1.4.0">

<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="17"/>
android:targetSdkVersion="19"/>

<application
android:allowBackup="true"
Expand Down
9 changes: 7 additions & 2 deletions progressfragment-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ dependencies {
}

android {
compileSdkVersion 18
buildToolsVersion '18.1.0'
compileSdkVersion 19
buildToolsVersion '19.0.0'

defaultConfig {
minSdkVersion 4
targetSdkVersion 19
}

sourceSets {
main {
Expand Down
2 changes: 1 addition & 1 deletion progressfragment-sample/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
target=android-19
android.library.reference.1=../progressfragment

14 changes: 14 additions & 0 deletions progressfragment-sample/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@
</string>
<string name="empty">No Data</string>
<string name="loading">Loading&#8230;</string>

<string-array name="sweets">
<item>Apple Pie</item>
<item>Banana Bread</item>
<item>Cupcake</item>
<item>Donut</item>
<item>Eclair</item>
<item>Froyo</item>
<item>Gingerbread</item>
<item>Honeycomb</item>
<item>Ice Cream Sandwich</item>
<item>Jelly Bean</item>
<item>KitKat</item>
</string-array>


</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright (C) 2013 Evgeny Shishkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.devspark.progressfragment.sample;

import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;

import com.devspark.progressfragment.ProgressGridFragment;

/**
* Sample implementation of {@link com.devspark.progressfragment.ProgressGridFragment}.
*
* @author Evgeny Shishkin
*/
public class DefaultProgressGridFragment extends ProgressGridFragment {
private Handler mHandler;
private Runnable mShowContentRunnable = new Runnable() {

@Override
public void run() {
setGridAdapter(new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.sweets)));
setGridShown(true);
}

};

public static DefaultProgressGridFragment newInstance() {
DefaultProgressGridFragment fragment = new DefaultProgressGridFragment();
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getGridView().setNumColumns(2);
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Setup text for empty content
setEmptyText(R.string.empty);
obtainData();
}

@Override
public void onDestroyView() {
super.onDestroyView();
mHandler.removeCallbacks(mShowContentRunnable);
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.refresh, menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_refresh:
obtainData();
return true;
default:
return super.onOptionsItemSelected(item);
}
}

private void obtainData() {
// Show indeterminate progress
setGridShown(false);

mHandler = new Handler();
mHandler.postDelayed(mShowContentRunnable, 3000);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright (C) 2013 Evgeny Shishkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.devspark.progressfragment.sample;

import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.ArrayAdapter;

import com.devspark.progressfragment.ProgressListFragment;

/**
* Sample implementation of {@link com.devspark.progressfragment.ProgressListFragment}.
*
* @author Evgeny Shishkin
*/
public class DefaultProgressListFragment extends ProgressListFragment {
private Handler mHandler;
private Runnable mShowContentRunnable = new Runnable() {

@Override
public void run() {
setListAdapter(new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.sweets)));
setListShown(true);
}

};

public static DefaultProgressListFragment newInstance() {
DefaultProgressListFragment fragment = new DefaultProgressListFragment();
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Setup text for empty content
setEmptyText(R.string.empty);
obtainData();
}

@Override
public void onDestroyView() {
super.onDestroyView();
mHandler.removeCallbacks(mShowContentRunnable);
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.refresh, menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_refresh:
obtainData();
return true;
default:
return super.onOptionsItemSelected(item);
}
}

private void obtainData() {
// Show indeterminate progress
setListShown(false);

mHandler = new Handler();
mHandler.postDelayed(mShowContentRunnable, 3000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
public class MainActivity extends ListActivity {

private String[] examples = new String[]{"Default", "Empty content", "Custom layout"};
private String[] examples = new String[]{"Default", "Empty content", "Custom layout", "List", "Grid"};

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -51,6 +51,12 @@ protected void onListItemClick(ListView l, View v, int position, long id) {
case 2:
intent.putExtra(ProgressActivity.EXTRA_FRAGMENT, ProgressActivity.FRAGMENT_CUSTOM_LAYOUT);
break;
case 3:
intent.putExtra(ProgressActivity.EXTRA_FRAGMENT, ProgressActivity.FRAGMENT_LIST);
break;
case 4:
intent.putExtra(ProgressActivity.EXTRA_FRAGMENT, ProgressActivity.FRAGMENT_GRID);
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class ProgressActivity extends FragmentActivity {
public static final int FRAGMENT_DEFAULT = 0;
public static final int FRAGMENT_EMPTY_CONTENT = 1;
public static final int FRAGMENT_CUSTOM_LAYOUT = 2;
public static final int FRAGMENT_LIST = 3;
public static final int FRAGMENT_GRID = 4;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
Expand All @@ -57,6 +59,12 @@ protected void onCreate(Bundle savedInstanceState) {
case FRAGMENT_CUSTOM_LAYOUT:
fragment = CustomLayoutProgressFragment.newInstance();
break;
case FRAGMENT_LIST:
fragment = DefaultProgressListFragment.newInstance();
break;
case FRAGMENT_GRID:
fragment = DefaultProgressGridFragment.newInstance();
break;
default:
fragment = DefaultProgressFragment.newInstance();
break;
Expand Down
6 changes: 3 additions & 3 deletions progressfragment/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.devspark.progressfragment"
android:versionCode="5"
android:versionName="1.3.1">
android:versionCode="6"
android:versionName="1.4.0">

<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="17"/>
android:targetSdkVersion="19"/>

<application/>

Expand Down
11 changes: 8 additions & 3 deletions progressfragment/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
apply plugin: 'android-library'

dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:support-v4:19.0.0'
}

android {
compileSdkVersion 18
buildToolsVersion '18.1.0'
compileSdkVersion 19
buildToolsVersion '19.0.0'

defaultConfig {
minSdkVersion 4
targetSdkVersion 19
}

sourceSets {
main {
Expand Down
2 changes: 1 addition & 1 deletion progressfragment/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

android.library=true
# Project target.
target=android-17
target=android-19
Loading

0 comments on commit fe4ecf1

Please sign in to comment.