Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Some code cleanup

  • Loading branch information...
commit a7a9d9daa7c8eed97d35c1e2eae26fe413ad7290 1 parent 620a0e3
Ryan Thomas authored
6 src/net/neonlotus/lolandroidapp/AppInfo.java
@@ -17,7 +17,6 @@
17 17 private TextView tv1, tv2, tv3;
18 18 private CheckBox mCheckbox;
19 19 Intent emailIntent;
20   - //private ChampModel mModel;
21 20 private ChampionManager championManager;
22 21
23 22 @Override
@@ -31,16 +30,11 @@ public void onCreate(Bundle savedInstanceState) {
31 30 tv2.setOnTouchListener(this);
32 31 tv3 = (TextView) findViewById(R.id.refTV);
33 32 tv3.setOnTouchListener(this);
34   - //mModel= new ChampModel(this);
35 33 championManager = new ChampionManager(getApplicationContext());
36 34
37 35 mCheckbox = (CheckBox) findViewById(R.id.checkbox);
38 36 mCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
39 37 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
40   - // save the updated result
41   - //mModel.setChampNames(mCheckbox.isChecked());
42   -
43   - //mCheckbox.
44 38
45 39 PreferenceManager.save(getApplicationContext(), mCheckbox.isChecked());
46 40 boolean nameTemp = mCheckbox.isChecked();
5 src/net/neonlotus/lolandroidapp/ChampModel.java
@@ -11,7 +11,6 @@
11 11 */
12 12 public class ChampModel {
13 13 //String arrays for either real names or fake names
14   - //private String[] mChampnames;
15 14 private String LOG = "League/ChampModel";
16 15 private String[] mRealnames;
17 16 private String[] mNicknames;
@@ -71,6 +70,4 @@ public ChampModel(Context c) {
71 70 public Integer[] getThumbIds() {
72 71 return mThumbIds;
73 72 }
74   -}
75   -
76   -//Possible function rewrite to return each individual array rather than checking and returning one
  73 +}
19 src/net/neonlotus/lolandroidapp/ChampionManager.java
@@ -14,7 +14,7 @@
14 14 */
15 15 public class ChampionManager extends Observable {
16 16 private ChampModel mChampModel;
17   - private Boolean mStatus; //todo: better name later
  17 + private boolean mStatus; //todo: better name later
18 18 private String LOG = "League/ChampManager";
19 19
20 20 public ChampionManager(Context c) {
@@ -28,12 +28,6 @@ public void setChampNames (boolean b) {
28 28 mStatus = b;
29 29 Log.d(LOG,"Set champ name manager was called");
30 30 Log.d(LOG,"mstatus is " + mStatus);
31   - //notifyObservers(); //this? nope
32   -
33   -
34   -
35   - //Log.d(LOG, "mstatus is now - " +mStatus.toString());
36   - //^ when I changed that to Boolean, and logged it out.. seems to be correctly changing from false to true based on the state of the checkbox in AppInfo...
37 31 }
38 32
39 33 public void notifyData() {
@@ -46,15 +40,12 @@ public void notifyData() {
46 40 public String[] getChampNames() {
47 41 Log.d(LOG,"get champ was called");
48 42 Log.d(LOG,"mstatus = " + mStatus);
49   - if (mStatus.booleanValue()) {
  43 + if (mStatus) {
50 44 return mChampModel.getChampNicknames();
51   - //return mChampModel.getChampNames();
52   - } /*else{
53   - //return mChampModel.getChampNames();
  45 + } else{
54 46 return mChampModel.getChampNicknames();
55   - }*/
56   - return mChampModel.getChampNames();
57   - //mstatus is always false currently... or rather, the else statement is being returned
  47 + }
  48 + //mstatus is not updating while app still running
58 49 }
59 50
60 51 public String[] getChampLore() {
5 src/net/neonlotus/lolandroidapp/GridAdapter.java
@@ -17,20 +17,15 @@
17 17 */
18 18 public class GridAdapter extends BaseAdapter {
19 19 private Context mContext;
20   - //private String[] champ_list_array;
21   - //private String[] champ_list_joke;
22 20 private ChampionManager mManager;
23 21 private String LOG = "League/GridAdapter";
24 22
25 23 public GridAdapter(Context c) {
26 24 mContext = c;
27   - //champ_list_array = mContext.getResources().getStringArray(R.array.champ_list);
28   - //champ_list_joke = mContext.getResources().getStringArray(R.array.champ_list_egg);
29 25 mManager = new ChampionManager(c);
30 26 }
31 27
32 28 public int getCount() {
33   - //return mThumbIds.length;
34 29 return mManager.getThumbIds().length;
35 30 }
36 31
17 src/net/neonlotus/lolandroidapp/Info.java
@@ -22,7 +22,6 @@
22 22
23 23 private String LOG = "League/Info";
24 24 private GridAdapter mGridAdapter;
25   - //private ChampModel mModel;
26 25 private ChampionManager mManager;
27 26
28 27 @Override
@@ -33,11 +32,8 @@ public void onCreate(Bundle savedInstanceState) {
33 32 FlurryAgent.onStartSession(this, " ");
34 33 setContentView(R.layout.champ_grid);
35 34
36   - //mModel = new ChampModel(getApplicationContext());
37   - //mModel.addObserver(this);
38 35 mManager = new ChampionManager(getApplicationContext());
39 36 mManager.addObserver(this);
40   - //mManager = new ChampionManager(getApplicationContext());
41 37
42 38 //mManager.setChampNames(PreferenceManager.get(getApplicationContext())); //set boolean on load?
43 39
@@ -50,33 +46,21 @@ public void onCreate(Bundle savedInstanceState) {
50 46 final Intent intent = new Intent(Info.this, Champion.class);
51 47 //final Bundle b = new Bundle();
52 48
53   - //final String[] champ_list_array = getResources().getStringArray(R.array.champ_list);
54   - //final String[] champ_list_joke = getResources().getStringArray(R.array.champ_list_egg);
55   - //final String[] champ_lore_array = getResources().getStringArray(R.array.champ_lore);
56   - //final String[] champ_stats_array = getResources().getStringArray(R.array.champ_stats);
57   - //final String[] champ_tag_lines = getResources().getStringArray(R.array.champ_taglines);
58   -
59 49 gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
60 50 public void onItemClick(AdapterView parent, View v, int position, long id) {
61 51 //Copying stuff from list adapter click thing
62 52 ChampObj obj = new ChampObj();
63 53 //todo: manager.getchampobj take position in
64 54
65   - //obj.setChampName(champ_list_array[position]);
66 55 obj.setChampName(mManager.getChampNames()[position]);
67   - //obj.setChampName(mModel.getChampNames()[position]);
68 56
69   - //obj.setChampStory(champ_lore_array[position]);
70   - //obj.setChampStory(mModel.getLore()[position]);
71 57 obj.setChampStory(mManager.getChampLore()[position]);
72 58 //todo: mManager.getChampLore(position)
73 59 //todo: getChampLore(int pos) { return mChampModel.getChampLore()[pos];
74 60 //todo: wiki article 'programming delegation'
75 61
76   - //obj.setChampStats(champ_stats_array[position]);
77 62 obj.setChampStats(mManager.getChampStats()[position]);
78 63
79   - //obj.setChampTags(champ_tag_lines[position]);
80 64 obj.setChampTags(mManager.getChampTags()[position]);
81 65
82 66 obj.setIndex(position);
@@ -106,6 +90,5 @@ public void update(Observable observable, Object o) {
106 90 if(mGridAdapter != null) {
107 91 mGridAdapter.notifyDataSetChanged();
108 92 }
109   - //mManager.setChampNames(PreferenceManager.get(getApplicationContext())); //watthis?
110 93 }
111 94 }
2  src/net/neonlotus/lolandroidapp/Lore.java
@@ -46,8 +46,6 @@ public void onCreate(Bundle savedInstanceState) {
46 46 //Flurry
47 47 FlurryAgent.onStartSession(this, " ");
48 48
49   - //PreferenceManager.save(getApplicationContext(),false);
50   -
51 49 //Merge Adapter thing...
52 50 adapter=new MergeAdapter();
53 51 adapter.addView(buildTop());
9 src/net/neonlotus/lolandroidapp/Main.java
@@ -44,15 +44,6 @@ public void onCreate(Bundle savedInstanceState) {
44 44 Intent moreIntent = new Intent(this, AppInfo.class);
45 45 moreSpec.setContent(moreIntent);
46 46
47   - //tab change listener? nope...
48   - /*
49   - tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener(){
50   - public void onTabChanged(String tabId) {
51   - mManager.setChampNames(PreferenceManager.get(getApplicationContext()));
52   - }});
53   - */
54   -
55   -
56 47 // Adding all TabSpec to TabHost
57 48 tabHost.addTab(loreSpec);
58 49 tabHost.addTab(champSpec);

0 comments on commit a7a9d9d

Please sign in to comment.
Something went wrong with that request. Please try again.