Skip to content

Commit

Permalink
简化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
dongjunkun committed Feb 14, 2017
1 parent 0ca3cea commit f0e4c01
Show file tree
Hide file tree
Showing 60 changed files with 3,261 additions and 1,285 deletions.
2 changes: 0 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'jp.wasabeef:recyclerview-animators:2.2.4'
compile 'com.google.code.gson:gson:2.7'
compile 'com.github.orhanobut:logger:1.12'
compile 'jp.wasabeef:picasso-transformations:2.1.0'
Expand All @@ -57,5 +58,6 @@ dependencies {
compile 'com.afollestad.material-dialogs:commons:0.9.0.2'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
}
27 changes: 9 additions & 18 deletions app/src/main/java/com/yyydjk/gank/activitys/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,8 @@
import com.yyydjk.gank.beans.GanHuo;
import com.yyydjk.gank.event.SkinChangeEvent;
import com.yyydjk.gank.fragments.AllFragment;
import com.yyydjk.gank.fragments.AndroidFragment;
import com.yyydjk.gank.fragments.AppFragment;
import com.yyydjk.gank.fragments.FrontFragment;
import com.yyydjk.gank.fragments.CommonFragment;
import com.yyydjk.gank.fragments.FuLiFragment;
import com.yyydjk.gank.fragments.IOSFragment;
import com.yyydjk.gank.fragments.MoreFragment;
import com.yyydjk.gank.fragments.ResourceFragment;
import com.yyydjk.gank.fragments.VideoFragment;
import com.yyydjk.gank.http.CallBack;
import com.yyydjk.gank.http.RequestManager;
import com.yyydjk.gank.theme.ColorRelativeLayout;
Expand Down Expand Up @@ -166,10 +160,7 @@ private void setIconDrawable(TextView view, IIcon icon) {
}

private void switchFragment(Fragment fragment) {
if (currentFragment == null || !fragment.getClass().getName().equals(currentFragment.getClass().getName())) {
getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
currentFragment = fragment;
}
getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
}

@Override
Expand Down Expand Up @@ -205,44 +196,44 @@ public void onClick(View view) {
mResideLayout.closePane();
mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_android).sizeDp(20));
mTitle.setText(R.string.android);
switchFragment(new AndroidFragment());
switchFragment(CommonFragment.newInstance("Android"));
break;
case R.id.ios:
mResideLayout.closePane();
mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_apple).sizeDp(20));
mTitle.setText(R.string.ios);
switchFragment(new IOSFragment());
switchFragment(CommonFragment.newInstance("iOS"));
break;

case R.id.video:
mResideLayout.closePane();
mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_collection_video).sizeDp(20));
mTitle.setText(R.string.video);
switchFragment(new VideoFragment());
switchFragment(CommonFragment.newInstance("休息视频"));
break;
case R.id.front:
mResideLayout.closePane();
mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_language_javascript).sizeDp(20));
mTitle.setText(R.string.front);
switchFragment(new FrontFragment());
switchFragment(CommonFragment.newInstance("前端"));
break;
case R.id.resource:
mResideLayout.closePane();
mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(FontAwesome.Icon.faw_location_arrow).sizeDp(20));
mTitle.setText(R.string.resource);
switchFragment(new ResourceFragment());
switchFragment(CommonFragment.newInstance("拓展资源"));
break;
case R.id.app:
mResideLayout.closePane();
mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_apps).sizeDp(20));
mTitle.setText(R.string.app);
switchFragment(new AppFragment());
switchFragment(CommonFragment.newInstance("App"));
break;
case R.id.more:
mResideLayout.closePane();
mIcon.setImageDrawable(new IconicsDrawable(this).color(Color.WHITE).icon(MaterialDesignIconic.Icon.gmi_more).sizeDp(20));
mTitle.setText(R.string.more);
switchFragment(new MoreFragment());
switchFragment(CommonFragment.newInstance("瞎推荐"));
break;

case R.id.about:
Expand Down
140 changes: 0 additions & 140 deletions app/src/main/java/com/yyydjk/gank/adapter/AllAdapter.java

This file was deleted.

73 changes: 0 additions & 73 deletions app/src/main/java/com/yyydjk/gank/adapter/CommonAdapter.java

This file was deleted.

68 changes: 0 additions & 68 deletions app/src/main/java/com/yyydjk/gank/adapter/FuliAdapter.java

This file was deleted.

Loading

0 comments on commit f0e4c01

Please sign in to comment.