-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show album artwork in list, upgrade dependency, add new screenshot
- Loading branch information
Showing
24 changed files
with
232 additions
and
64 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
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
68 changes: 68 additions & 0 deletions
68
app/src/main/java/com/markzhai/lyrichere/ui/BaseFragment.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,68 @@ | ||
package com.markzhai.lyrichere.ui; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.LayoutRes; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import butterknife.ButterKnife; | ||
import icepick.Icepick; | ||
|
||
/** | ||
* Base Fragment with dependency injection. | ||
* <p/> | ||
* Created by zyf on 2015/9/12. | ||
*/ | ||
public class BaseFragment extends Fragment { | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
Icepick.restoreInstanceState(this, savedInstanceState); | ||
} | ||
|
||
@Override | ||
public void onSaveInstanceState(Bundle outState) { | ||
super.onSaveInstanceState(outState); | ||
Icepick.saveInstanceState(this, outState); | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
|
||
int layoutRes = getLayoutRes(); | ||
if (layoutRes == 0) { | ||
throw new IllegalArgumentException( | ||
"getLayoutRes() returned 0, which is not allowed. " | ||
+ "If you don't want to use getLayoutRes() but implement your own view for this " | ||
+ "fragment manually, then you have to override onCreateView();"); | ||
} else { | ||
return inflater.inflate(layoutRes, container, false); | ||
} | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
ButterKnife.bind(this, view); | ||
} | ||
|
||
@Override | ||
public void onDestroy() { | ||
super.onDestroy(); | ||
ButterKnife.unbind(this); | ||
} | ||
|
||
/** | ||
* Return the layout resource like R.layout.my_layout | ||
* | ||
* @return the layout resource or zero ("0"), if you don't want to have an UI | ||
*/ | ||
@LayoutRes | ||
protected int getLayoutRes() { | ||
return 0; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/markzhai/lyrichere/ui/BaseListFragment.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,39 @@ | ||
package com.markzhai.lyrichere.ui; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.ListFragment; | ||
import android.view.View; | ||
|
||
import butterknife.ButterKnife; | ||
import icepick.Icepick; | ||
|
||
/** | ||
* Base ListFragment with dependency injection. | ||
* <p/> | ||
* Created by zyf on 2015/9/12. | ||
*/ | ||
public class BaseListFragment extends ListFragment { | ||
|
||
@Override public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
Icepick.restoreInstanceState(this, savedInstanceState); | ||
} | ||
|
||
@Override public void onSaveInstanceState(Bundle outState) { | ||
super.onSaveInstanceState(outState); | ||
Icepick.saveInstanceState(this, outState); | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
ButterKnife.bind(this, view); | ||
} | ||
|
||
@Override | ||
public void onDestroy() { | ||
super.onDestroy(); | ||
ButterKnife.unbind(this); | ||
} | ||
} |
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.