-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of ListingFragment and MainActivity
- Loading branch information
sicarelli
committed
Jul 17, 2015
1 parent
e19b1e4
commit 8aa7b95
Showing
9 changed files
with
262 additions
and
306 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
77 changes: 77 additions & 0 deletions
77
materialup/src/main/java/io/jari/materialup/factories/CategoryFactory.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,77 @@ | ||
package io.jari.materialup.factories; | ||
|
||
import android.content.Context; | ||
import android.content.res.Resources; | ||
|
||
import com.github.florent37.materialviewpager.header.HeaderDesign; | ||
|
||
import io.jari.materialup.R; | ||
import io.jari.materialup.enums.PageTypes; | ||
import io.jari.materialup.ui.fragments.CategoryFragment; | ||
|
||
/** | ||
* Created by rsicarelli on 7/15/15. | ||
*/ | ||
public class CategoryFactory { | ||
|
||
public static CategoryFragment getFragForPosition(int position, Context context) { | ||
Resources res = context.getResources(); | ||
switch (position) { | ||
case PageTypes.TYPE_ALL: | ||
return CategoryFragment.newInstance(context.getString(R.string.all)); | ||
case PageTypes.TYPE_CONCEPTS: | ||
return CategoryFragment.newInstance(context.getString(R.string.concepts)); | ||
case PageTypes.TYPE_LIVE: | ||
return CategoryFragment.newInstance(context.getString(R.string.live)); | ||
case PageTypes.TYPE_RESOURCES: | ||
return CategoryFragment.newInstance(context.getString(R.string.resources)); | ||
case PageTypes.TYPE_FREEBIES: | ||
return CategoryFragment.newInstance(context.getString(R.string.freebies)); | ||
} | ||
return null; | ||
} | ||
|
||
public static String getTitleForPosition(int position) { | ||
switch (position) { | ||
case PageTypes.TYPE_ALL: | ||
return "All"; | ||
case PageTypes.TYPE_CONCEPTS: | ||
return "Concepts"; | ||
case PageTypes.TYPE_LIVE: | ||
return "Live"; | ||
case PageTypes.TYPE_RESOURCES: | ||
return "Resources"; | ||
case PageTypes.TYPE_FREEBIES: | ||
return "Freebies"; | ||
} | ||
return ""; | ||
} | ||
|
||
public static HeaderDesign getHeaderDesign(int position) { | ||
switch (position) { | ||
|
||
case PageTypes.TYPE_ALL: | ||
return HeaderDesign.fromColorResAndDrawable( | ||
R.color.primary, | ||
null); | ||
case PageTypes.TYPE_CONCEPTS: | ||
return HeaderDesign.fromColorResAndDrawable( | ||
R.color.red_600, | ||
null); | ||
case PageTypes.TYPE_LIVE: | ||
return HeaderDesign.fromColorResAndDrawable( | ||
R.color.teal_600, | ||
null); | ||
case PageTypes.TYPE_RESOURCES: | ||
return HeaderDesign.fromColorResAndDrawable( | ||
R.color.yellow_600, | ||
null); | ||
case PageTypes.TYPE_FREEBIES: | ||
return HeaderDesign.fromColorResAndDrawable( | ||
R.color.orange_600, | ||
null); | ||
} | ||
|
||
return null; | ||
} | ||
} |
47 changes: 0 additions & 47 deletions
47
materialup/src/main/java/io/jari/materialup/factories/ListingFactory.java
This file was deleted.
Oops, something went wrong.
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.