Skip to content

Commit

Permalink
adapt with 4.4, fix fragment reload and radio button issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wangguoquan committed Mar 28, 2016
1 parent c8ab85d commit 031a9d0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
33 changes: 25 additions & 8 deletions src/com/clear/vodmobile/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class MainActivity extends Activity {

private FragmentManager fragManager;
private RadioGroup radioGroup;
private int bottomTabPos = 0;

private JSONObject entryJson = null;
private JSONObject mainMenuJson;
Expand Down Expand Up @@ -256,9 +257,9 @@ protected void initViews() {

for(int i = 0; i < fragmentDataset.size(); i++) {
RadioButton rb = new RadioButton(this);

//rb.setButtonDrawable(null);
rb.setButtonDrawable(android.R.color.transparent);
rb.setBackgroundResource(R.drawable.bottombar_itembg_selector);
rb.setButtonDrawable(null);
rb.setGravity(Gravity.CENTER);

/* TODO, FIXME, replace with default empty icon */
Expand Down Expand Up @@ -332,18 +333,20 @@ public void onCheckedChanged(RadioGroup group, int checkedId) {
}
}

@Override
protected void onStart() {
super.onStart();
Log.i(TAG, "onStart called.");
}

@Override
protected void onRestart() {
Log.i(TAG, "onRestart called.");
super.onRestart();
}


@Override
protected void onStart() {
super.onStart();

Log.i(TAG, "onStart called.");
}

@Override
protected void onResume() {
Log.i(TAG, "onResume called.");
Expand Down Expand Up @@ -376,4 +379,18 @@ protected void onDestroy() {

super.onDestroy();
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
bottomTabPos = savedInstanceState.getInt("bottomTabPos");

super.onRestoreInstanceState(savedInstanceState);
}
@Override
protected void onSaveInstanceState(Bundle outState) {

outState.putInt("bottomTabPos", bottomTabPos);
}


}
3 changes: 3 additions & 0 deletions src/com/clear/vodmobile/view/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@
public class BaseFragment extends Fragment {
private static String TAG = "BaseFragment";

public BaseFragment() {

}
}
5 changes: 5 additions & 0 deletions src/com/clear/vodmobile/view/FragmentFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public class FragmentFactory {

private static final String TAG = "FragmentFactory";

/* TODO, FIXME, BUG, 4.4 Fragment reuse. only walkaround */
private static Fragment lastLiveFragment=null;
private static Fragment lastMovieTopRecommandFragment=null;
private static Fragment lastPicTextSimpleFragment=null;

/* TODO, FIXME, keep the fragment with same type & menuJson */

public static Fragment getInstanceByType(JSONObject menuJson) {
Expand Down
3 changes: 3 additions & 0 deletions src/com/clear/vodmobile/view/LiveFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,8 @@ public void onItemClick(AdapterView<?> arg0, View view, int pos, long id) {
startActivity(intent);
}
});

}


}

0 comments on commit 031a9d0

Please sign in to comment.