-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,379 additions
and
56 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
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 |
---|---|---|
|
@@ -21,4 +21,4 @@ allprojects { | |
} | ||
} | ||
|
||
// apply plugin: 'android-reporting' | ||
apply plugin: 'android-reporting' |
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
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
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
101 changes: 101 additions & 0 deletions
101
...fragment-sample/src/com/devspark/progressfragment/sample/DefaultProgressGridFragment.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 |
---|---|---|
@@ -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); | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
...fragment-sample/src/com/devspark/progressfragment/sample/DefaultProgressListFragment.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 |
---|---|---|
@@ -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); | ||
} | ||
} |
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
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
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 |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
|
||
android.library=true | ||
# Project target. | ||
target=android-17 | ||
target=android-19 |
Oops, something went wrong.