This file contains hidden or 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
{ | |
"formatVersion": 1, | |
"database": { | |
"version": 1, | |
"identityHash": "99c7946712f93a4d723efbe10a500eb0", | |
"entities": [ | |
{ | |
"tableName": "users", | |
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`userid` INTEGER NOT NULL, `username` TEXT, PRIMARY KEY(`userid`))", | |
"fields": [ |
This file contains hidden or 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
{ | |
"formatVersion": 1, | |
"database": { | |
"version": 2, | |
"identityHash": "99c7946712f93a4d723efbe10a500eb0", | |
"entities": [ | |
{ | |
"tableName": "Users", | |
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`mId` INTEGER NOT NULL, `mUserName` TEXT, PRIMARY KEY(`mId`))", | |
"fields": [ |
This file contains hidden or 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
public abstract class CyclePagerAdapter<T> extends PagerAdapter implements ViewPager.OnPageChangeListener { | |
protected List<T> mItemList = null; | |
private WeakReference<CycleViewPager> mViewPagerRef = null; | |
public CyclePagerAdapter(@NonNull List<T> list, @NonNull CycleViewPager cycleViewPager) { | |
if (list.size() <= 1) { | |
// needn't to support infinite cycle | |
mItemList = new ArrayList<>(list); | |
} else { | |
// refer: https://maniacdev.com/2013/08/tutorial-how-to-create-an-infinite-scrolling-uicollectionview |
This file contains hidden or 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
public class CycleViewPager extends ViewPager { | |
public CycleViewPager(Context context) { | |
super(context); | |
} | |
public CycleViewPager(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} |
This file contains hidden or 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
Class Aclass { | |
private void methodToOptimize() { | |
Cclass cclass = new Cclass(); | |
new AsyncTask<Cclass, Void, Void>() { | |
@Override | |
protected Void doInBackground(Cclass... params) { | |
return null; | |
} | |
}.execute(new Cclass[]{cclass}); |
This file contains hidden or 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
Class Aclass { | |
private void methodToOptimize() { | |
Bclass bclass = new Bclass(); | |
bclass.methodCalledOnce(); | |
} | |
} |
This file contains hidden or 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
Class Bclass { | |
static class Cclass { | |
} | |
public void methodCalledOnce() { | |
Cclass cclass = new Cclass(); | |
new AsyncTask<Cclass, Void, Void>() { | |
@Override | |
protected Void doInBackground(Cclass... params) { |
This file contains hidden or 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
- (void)containerViewPanGestureRecognized:(UIPanGestureRecognizer *)gestureRecognizer | |
{ | |
switch (gestureRecognizer.state) { | |
case UIGestureRecognizerStateBegan: { | |
self.originalLocation = [gestureRecognizer locationInView:self.contentView]; | |
break; | |
} | |
case UIGestureRecognizerStateChanged: { | |
CGFloat newX = [gestureRecognizer locationInView:self].x - self.originalLocation.x; |
This file contains hidden or 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
// assume request is original request you want wkwebview to load | |
NSMutableURLRequest *mutableRequest = [request mutableCopy]; | |
[mutableRequest setValue:"CookieKey = CookieValue" forHTTPHeaderField:@"Cookie"]; | |
// navigates to a requested URL | |
[self.webView loadRequest:mutableRequest]; |