code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
public BottomNavigationViewInner setIconSize(float width, float height) { int count = getItemCount(); for (int i = 0; i < count; i++) { setIconSizeAt(i, width, height); } return this; }
set all item ImageView size @param width in dp @param height in dp
setIconSize
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public BottomNavigationViewInner setIconSize(float dpSize) { setItemIconSize(dp2px(getContext(),dpSize)); return this; }
set all item ImageView size @param dpSize in dp
setIconSize
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public BottomNavigationViewInner setItemHeight(int height) { // 1. get mMenuView final BottomNavigationMenuView mMenuView = getBottomNavigationMenuView(); // 2. set private final int mItemHeight in mMenuView setField(mMenuView.getClass(), mMenuView, "itemHeight", height); mMenuV...
set menu item height @param height in px
setItemHeight
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public int getItemHeight() { // 1. get mMenuView final BottomNavigationMenuView mMenuView = getBottomNavigationMenuView(); // 2. get private final int mItemHeight in mMenuView return getField(mMenuView.getClass(), mMenuView, "itemHeight"); }
get menu item height @return in px
getItemHeight
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public static int dp2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); }
dp to px @param context @param dpValue dp @return px
dp2px
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public BottomNavigationViewInner setTypeface(Typeface typeface, int style) { int count = getItemCount(); for (int i = 0; i < count; i++) { getLargeLabelAt(i).setTypeface(typeface, style); getSmallLabelAt(i).setTypeface(typeface, style); } mMenuView.updateMenuView(...
set Typeface for all item TextView @attr ref android.R.styleable#TextView_typeface @attr ref android.R.styleable#TextView_textStyle
setTypeface
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public BottomNavigationViewInner setTypeface(Typeface typeface) { int count = getItemCount(); for (int i = 0; i < count; i++) { getLargeLabelAt(i).setTypeface(typeface); getSmallLabelAt(i).setTypeface(typeface); } mMenuView.updateMenuView(); return this; ...
set Typeface for all item TextView @attr ref android.R.styleable#TextView_typeface
setTypeface
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
private <T> T getField(Class targetClass, Object instance, String fieldName) { try { Field field = targetClass.getDeclaredField(fieldName); field.setAccessible(true); return (T) field.get(instance); } catch (NoSuchFieldException e) { e.printStackTrace(); ...
get private filed in this specific object @param targetClass @param instance the filed owner @param fieldName @param <T> @return field if success, null otherwise.
getField
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
private void setField(Class targetClass, Object instance, String fieldName, Object value) { try { Field field = targetClass.getDeclaredField(fieldName); field.setAccessible(true); field.set(instance, value); } catch (NoSuchFieldException e) { e.printStackT...
change the field value @param targetClass @param instance the filed owner @param fieldName @param value
setField
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public BottomNavigationViewInner setupWithViewPager(final ViewPager viewPager) { return setupWithViewPager(viewPager, false); }
This method will link the given ViewPager and this BottomNavigationViewInner together so that changes in one are automatically reflected in the other. This includes scroll state changes and clicks. @param viewPager
setupWithViewPager
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public BottomNavigationViewInner setupWithViewPager(final ViewPager viewPager, boolean smoothScroll) { if (mViewPager != null) { // If we've already been setup with a ViewPager, remove us from it if (mPageChangeListener != null) { mViewPager.removeOnPageChangeListener(mPa...
This method will link the given ViewPager and this BottomNavigationViewInner together so that changes in one are automatically reflected in the other. This includes scroll state changes and clicks. @param viewPager @param smoothScroll whether ViewPager changed with smooth scroll animation
setupWithViewPager
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
@Override public void onPageScrollStateChanged(final int state) { }
A {@link ViewPager.OnPageChangeListener} class which contains the necessary calls back to the provided {@link BottomNavigationViewInner} so that the tab position is kept in sync. <p> <p>This class stores the provided BottomNavigationViewInner weakly, meaning that you can use {@link ViewPager#addOnPageChangeListener(Vie...
onPageScrollStateChanged
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
@Override public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) { }
A {@link ViewPager.OnPageChangeListener} class which contains the necessary calls back to the provided {@link BottomNavigationViewInner} so that the tab position is kept in sync. <p> <p>This class stores the provided BottomNavigationViewInner weakly, meaning that you can use {@link ViewPager#addOnPageChangeListener(Vie...
onPageScrolled
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
@Override public void onPageSelected(final int position) { final BottomNavigationViewInner bnve = mBnveRef.get(); if (null != bnve && !isNavigationItemClicking) bnve.setCurrentItem(position); // Log.d("onPageSelected", "--------- position " + position + " -----...
A {@link ViewPager.OnPageChangeListener} class which contains the necessary calls back to the provided {@link BottomNavigationViewInner} so that the tab position is kept in sync. <p> <p>This class stores the provided BottomNavigationViewInner weakly, meaning that you can use {@link ViewPager#addOnPageChangeListener(Vie...
onPageSelected
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public BottomNavigationViewInner setIconsMarginTop(int marginTop) { for (int i = 0; i < getItemCount(); i++) { setIconMarginTop(i, marginTop); } return this; }
set margin top for all icons @param marginTop in px
setIconsMarginTop
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
public BottomNavigationViewInner setIconMarginTop(int position, int marginTop) { /* 1. BottomNavigationItemView 2. private final int mDefaultMargin; */ BottomNavigationItemView itemView = getBottomNavigationItemView(position); setField(BottomNavigationItemView.class, ite...
set margin top for icon @param position @param marginTop in px
setIconMarginTop
java
ittianyu/BottomNavigationViewEx
widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java
MIT
@Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); }
Example local unit test, which will execute on the development machine (host). @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
addition_isCorrect
java
ittianyu/BottomNavigationViewEx
widget/src/test/java/com/ittianyu/bottomnavigationviewex/ExampleUnitTest.java
https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/test/java/com/ittianyu/bottomnavigationviewex/ExampleUnitTest.java
MIT
@Override public void onCreate() { super.onCreate(); mHandler = new Handler(); }
An {@link IntentService} subclass for handling asynchronous task requests in a service on a separate handler thread.
onCreate
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
MIT
@Override protected void onHandleIntent(Intent intent) { Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); sendBroadcast(it); this.intent = intent; if (intent == null) return; String clips = intent.getStringExtra(Intent.EXTRA_TEXT); int actionCode = inten...
An {@link IntentService} subclass for handling asynchronous task requests in a service on a separate handler thread.
onHandleIntent
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
MIT
private void shareText(final String clips) { Intent i = new Intent(); i.setAction(Intent.ACTION_SEND); i.putExtra(Intent.EXTRA_TEXT, clips); i.setType("text/plain"); Intent sendIntent = Intent.createChooser(i, getString(R.string.share_clipboard_to)); sendIntent.addFlags(I...
An {@link IntentService} subclass for handling asynchronous task requests in a service on a separate handler thread.
shareText
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
MIT
private void editText(final String clips) { Intent i = new Intent(this, ActivityEditor.class) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra(STATUE_IS_STARRED, intent.getBooleanExtra(STATUE_IS_STARRED, false) ) ....
An {@link IntentService} subclass for handling asynchronous task requests in a service on a separate handler thread.
editText
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
MIT
private void starText(final String clips) { Storage db = Storage.getInstance(this); db.changeClipStarStatus(clips); }
An {@link IntentService} subclass for handling asynchronous task requests in a service on a separate handler thread.
starText
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
MIT
private void openMainDialogActivity() { //open by this will be auto closed when copy. Intent i = new Intent(this, ActivityMainDialog.class) .putExtra(ActivityMain.EXTRA_IS_FROM_NOTIFICATION, true) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .addFlags(Intent.F...
An {@link IntentService} subclass for handling asynchronous task requests in a service on a separate handler thread.
openMainDialogActivity
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
MIT
private void changeWidgetStarredStatus() { SharedPreferences preference = PreferenceManager.getDefaultSharedPreferences(this); boolean isStarred = preference.getBoolean(AppWidget.WIDGET_IS_STARRED, false); preference.edit() .putBoolean(AppWidget.WIDGET_IS_STARRED, !isStarred) ...
An {@link IntentService} subclass for handling asynchronous task requests in a service on a separate handler thread.
changeWidgetStarredStatus
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/ClipObjectActionBridge.java
MIT
@Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { setEnabled(newState != RecyclerView.SCROLL_STATE_DRAGGING); }
This will ensure that this SwipeableRecyclerViewTouchListener is paused during list view scrolling. If a scroll listener is already assigned, the caller should still pass scroll changes through to this listener.
onScrollStateChanged
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { }
This will ensure that this SwipeableRecyclerViewTouchListener is paused during list view scrolling. If a scroll listener is already assigned, the caller should still pass scroll changes through to this listener.
onScrolled
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
public void setEnabled(boolean enabled) { mPaused = !enabled; }
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
setEnabled
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent motionEvent) { return handleTouchEvent(motionEvent); }
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
onInterceptTouchEvent
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public void onTouchEvent(RecyclerView rv, MotionEvent motionEvent) { handleTouchEvent(motionEvent); }
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
onTouchEvent
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
private boolean handleTouchEvent(MotionEvent motionEvent) { if (mViewWidth < 2) { mViewWidth = mRecyclerView.getWidth(); } switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: { if (mPaused) { break; }...
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
handleTouchEvent
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public void onAnimationEnd(Animator animation) { performDismiss(downView, downPosition); }
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
onAnimationEnd
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
private void performDismiss(final View dismissView, final int dismissPosition) { // Animate the dismissed list item to zero-height and fire the dismiss callback when // all dismissed list item animations have completed. This triggers layout on each animation // frame; in the future we may want t...
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
performDismiss
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public void onAnimationEnd(Animator animation) { --mDismissAnimationRefCount; if (mDismissAnimationRefCount > 0) return; mDismissAnimationRefCount = 0; // No active animations, process all pending dismisses. // Sort ...
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
onAnimationEnd
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public void onAnimationUpdate(ValueAnimator valueAnimator) { lp.height = (Integer) valueAnimator.getAnimatedValue(); dismissView.setLayoutParams(lp); }
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
onAnimationUpdate
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public void onAnimationEnd(Animator animation) { if (deleteAble[0]) animator.start(); }
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
onAnimationEnd
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public boolean onTouch(View v, MotionEvent event) { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: deleteAble[0] = false; --mDismissAnimationRefCount; mPendingDismisses.rem...
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures. @param enabled Whether or not to watch for gestures.
onTouch
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Override public int compareTo(@NonNull PendingDismissData other) { // Sort by descending position return other.position - position; }
Called when the item has been dismissed by swiping to the left. @param recyclerView The originating {@link android.support.v7.widget.RecyclerView}. @param reverseSortedPositions An array of positions to dismiss, sorted in descending order for convenience.
compareTo
java
heruoxin/Clip-Stack
app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
https://github.com/heruoxin/Clip-Stack/blob/master/app/src/main/java/com/catchingnow/tinyclipboardmanager/SwipeableRecyclerViewTouchListener.java
MIT
@Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); }
To work on unit tests, switch the Test Artifact in the Build Variants view.
addition_isCorrect
java
hugeterry/UpdateFun
sample/src/test/java/cn/hugeterry/updatedemo/ExampleUnitTest.java
https://github.com/hugeterry/UpdateFun/blob/master/sample/src/test/java/cn/hugeterry/updatedemo/ExampleUnitTest.java
Apache-2.0
public static UpdateFunGO init(Context context) { UpdateFunGO inst = sInst; if (inst == null) { synchronized (UpdateFunGO.class) { inst = sInst; if (inst == null) { inst = new UpdateFunGO(context); sInst = inst; ...
Created by hugeterry(http://hugeterry.cn)
init
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/UpdateFunGO.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/UpdateFunGO.java
Apache-2.0
public static void showDownloadView(Context context) { DownloadKey.saveFileName = GetAppInfo.getAppPackageName(context) + ".apk"; if (UpdateKey.DialogOrNotification == 1) { Intent intent = new Intent(); intent.setClass(context, DownLoadDialog.class); (...
Created by hugeterry(http://hugeterry.cn)
showDownloadView
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/UpdateFunGO.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/UpdateFunGO.java
Apache-2.0
public static void onResume(Context context) { if (DownloadKey.TOShowDownloadView == 2) { showDownloadView(context); } else { if (sInst != null) sInst = null; } }
Created by hugeterry(http://hugeterry.cn)
onResume
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/UpdateFunGO.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/UpdateFunGO.java
Apache-2.0
public static void onStop(Context context) { if (DownloadKey.TOShowDownloadView == 2 && UpdateKey.DialogOrNotification == 2) { download.interrupt(); } if (thread_update != null) { thread_update.interrupt(); } if (DownloadKey.ISManual) { Downloa...
Created by hugeterry(http://hugeterry.cn)
onStop
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/UpdateFunGO.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/UpdateFunGO.java
Apache-2.0
public static void showNoticeDialog(Context context) { Intent intent = new Intent(); intent.setClass(context, UpdateDialog.class); ((Activity) context).startActivityForResult(intent, 100); }
Created by hugeterry(http://hugeterry.cn)
showNoticeDialog
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/module/HandleUpdateResult.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/module/HandleUpdateResult.java
Apache-2.0
public void run() { try { URL httpUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection) httpUrl .openConnection(); conn.setRequestMethod("GET"); conn.setReadTimeout(3000); if (conn.getResponseCode() == 200) { ...
Created by hugeterry(http://hugeterry.cn)
run
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/module/Update.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/module/Update.java
Apache-2.0
private void interpretingData(String result) { try { JSONObject object = new JSONObject(result); DownloadKey.changeLog = object.getString("changelog"); DownloadKey.version = object.getString("versionShort"); DownloadKey.apkUrl = object.getString("installUrl"); ...
Created by hugeterry(http://hugeterry.cn)
interpretingData
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/module/Update.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/module/Update.java
Apache-2.0
public static String getAppName(Context context) { String appName = ""; try { PackageInfo pi = context.getPackageManager() .getPackageInfo(context.getPackageName(), 0); appName = pi.applicationInfo.loadLabel(context.getPackageManager()).toString(); ...
Created by hugeterry(http://hugeterry.cn)
getAppName
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
Apache-2.0
public static String getAppVersionName(Context context) { String versionName = ""; try { PackageInfo pi = context.getPackageManager() .getPackageInfo(context.getPackageName(), 0); versionName = pi.versionName; if (versionName == null || versionName...
Created by hugeterry(http://hugeterry.cn)
getAppVersionName
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
Apache-2.0
public static String getAppPackageName(Context context) { return context.getPackageName(); }
Created by hugeterry(http://hugeterry.cn)
getAppPackageName
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
Apache-2.0
public static Drawable getAppIcon(Context context) { try { PackageManager pm = context.getPackageManager(); ApplicationInfo info = pm.getApplicationInfo(context.getPackageName(), 0); return info.loadIcon(pm); } catch (PackageManager.NameNotFoundException e) { ...
Created by hugeterry(http://hugeterry.cn)
getAppIcon
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
Apache-2.0
public static String getAPKPackageName(Context context, String apkPath) { PackageManager pm = context.getPackageManager(); PackageInfo info = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES); if (info != null) { ApplicationInfo appInfo = info.applicationInfo; ...
Created by hugeterry(http://hugeterry.cn)
getAPKPackageName
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/GetAppInfo.java
Apache-2.0
public static void startInstall(Context context, File apkfile) { if (!apkfile.exists()) { return; } Intent intent = new Intent(Intent.ACTION_VIEW); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); ...
Created by hugeterry(http://hugeterry.cn)
startInstall
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/InstallApk.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/InstallApk.java
Apache-2.0
public static File getCacheDirectory(Context context) { File appCacheDir = null; if (MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) && hasExternalStoragePermission(context)) { appCacheDir = getExternalCacheDir(context); } if (appCacheDir == null) { ap...
Returns application cache directory. Cache directory will be created on SD card <i>("/Android/data/[app_package_name]/cache")</i> if card is mounted and app has appropriate permission. Else - Android defines cache directory on device's file system. @param context Application context @return Cache {@link File directory...
getCacheDirectory
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/StorageUtils.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/StorageUtils.java
Apache-2.0
private static File getExternalCacheDir(Context context) { File dataDir = new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data"); File appCacheDir = new File(new File(dataDir, context.getPackageName()), "cache"); if (!appCacheDir.exists()) { if (!appCacheDir...
Returns application cache directory. Cache directory will be created on SD card <i>("/Android/data/[app_package_name]/cache")</i> if card is mounted and app has appropriate permission. Else - Android defines cache directory on device's file system. @param context Application context @return Cache {@link File directory...
getExternalCacheDir
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/StorageUtils.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/StorageUtils.java
Apache-2.0
private static boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission(EXTERNAL_STORAGE_PERMISSION); return perm == PackageManager.PERMISSION_GRANTED; }
Returns application cache directory. Cache directory will be created on SD card <i>("/Android/data/[app_package_name]/cache")</i> if card is mounted and app has appropriate permission. Else - Android defines cache directory on device's file system. @param context Application context @return Cache {@link File directory...
hasExternalStoragePermission
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/utils/StorageUtils.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/utils/StorageUtils.java
Apache-2.0
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.download_dialog); close = (ImageView) findViewById(R.id.downloaddialog_close); progressBar = (ProgressBar) findViewById(R.id.downloaddialog_progress); t...
Created by hugeterry(http://hugeterry.cn)
onCreate
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/view/DownLoadDialog.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/view/DownLoadDialog.java
Apache-2.0
@Override public void onClick(View arg0) { DownloadKey.TOShowDownloadView = 1; DownloadKey.interceptFlag = true; if (DownloadKey.ISManual) { DownloadKey.LoadManual = false; } finish(); }
Created by hugeterry(http://hugeterry.cn)
onClick
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/view/DownLoadDialog.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/view/DownLoadDialog.java
Apache-2.0
@Override public void onClick(View arg0) { DownloadKey.TOShowDownloadView = 2; finish(); }
Created by hugeterry(http://hugeterry.cn)
onClick
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/view/UpdateDialog.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/view/UpdateDialog.java
Apache-2.0
@Override public void onClick(View arg0) { DownloadKey.TOShowDownloadView = 1; if (DownloadKey.ISManual) { DownloadKey.LoadManual = false; } finish(); }
Created by hugeterry(http://hugeterry.cn)
onClick
java
hugeterry/UpdateFun
updatefun/src/main/java/cn/hugeterry/updatefun/view/UpdateDialog.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/main/java/cn/hugeterry/updatefun/view/UpdateDialog.java
Apache-2.0
@Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); }
To work on unit tests, switch the Test Artifact in the Build Variants view.
addition_isCorrect
java
hugeterry/UpdateFun
updatefun/src/test/java/cn/hugeterry/updatefun/ExampleUnitTest.java
https://github.com/hugeterry/UpdateFun/blob/master/updatefun/src/test/java/cn/hugeterry/updatefun/ExampleUnitTest.java
Apache-2.0
public final void setAccountAuthenticatorResult(Bundle result) { mResultBundle = result; }
Set the result that is to be sent as the result of the request that caused this Activity to be launched. If result is null or this method is never called then the request will be canceled. @param result this is returned as the result of the AbstractAccountAuthenticator request
setAccountAuthenticatorResult
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
Apache-2.0
@Override public void finish() { if (mAccountAuthenticatorResponse != null) { // send the result bundle back if set, otherwise send an error. if (mResultBundle != null) { mAccountAuthenticatorResponse.onResult(mResultBundle); } else { mAcco...
Sends the result or a GithubConstants.ERROR_CODE_CANCELED error if a result isn't present.
finish
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
Apache-2.0
@Override public void showProgress() { progressDialog = builder.show(); }
Sends the result or a GithubConstants.ERROR_CODE_CANCELED error if a result isn't present.
showProgress
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
Apache-2.0
@Override public void hideProgress() { progressDialog.dismiss(); }
Sends the result or a GithubConstants.ERROR_CODE_CANCELED error if a result isn't present.
hideProgress
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
Apache-2.0
@Override public void tokenCreated(String token) { TDUtils.event(R.string.td_event_login_success); String accountName = username.getText().toString(); String accountPassword = password.getText().toString(); PreferenceUtils.putString(this, PreferenceUtils.Key.ACCOUNT, accountName); ...
Sends the result or a GithubConstants.ERROR_CODE_CANCELED error if a result isn't present.
tokenCreated
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
Apache-2.0
@Override public void onError(String msg) { ToastUtils.showMsg(this, msg); TDUtils.event(R.string.td_event_login_fail); }
Sends the result or a GithubConstants.ERROR_CODE_CANCELED error if a result isn't present.
onError
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/activity/LoginActivity.java
Apache-2.0
public static CollaboratorsFragment getInstance(String user,String repo){ L.i(TAG, "create Fragment"); CollaboratorsFragment collaboratorsFragment = new CollaboratorsFragment(); Bundle bundle = new Bundle(); bundle.putString("user", user); bundle.putString("repo", repo); ...
Created by Quinn on 8/6/15. Show who stars or forks X repo
getInstance
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
Apache-2.0
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dataItems = new ArrayList<User>(); adapter = new UsersAdapter(dataItems); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
onCreate
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
Apache-2.0
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater,container,savedInstanceState); recyclerView.setAdapter(adapter); presenter = new CollaboratorsPresenterImpl(this.getActivity(),this); ...
Created by Quinn on 8/6/15. Show who stars or forks X repo
onCreateView
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
Apache-2.0
@Override public void setItems(List items) { super.setItems(items); for(Object user:items){ dataItems.add((User)user); } loading = false; if(items.size() < GithubImpl.DEFAULT_PAGE_SIZE) haveMore = false; adapter.notifyDataSetChanged(); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
setItems
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
Apache-2.0
@Override public void intoItem(int position) { super.intoItem(position); Bundle bundle = new Bundle(); bundle.putSerializable("user",(User)dataItems.get(position)); UserInfoActivity.launch(this.getActivity(), bundle); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
intoItem
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
Apache-2.0
@Override public void onItemClick(View view, int position) { intoItem(position); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
onItemClick
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/CollaboratorsFragment.java
Apache-2.0
public static ForkersFragment getInstance(String user,String repo){ ForkersFragment forkersFragment = new ForkersFragment(); Bundle bundle = new Bundle(); bundle.putString("user", user); bundle.putString("repo", repo); forkersFragment.setArguments(bundle); return forkersF...
Created by Quinn on 8/6/15. Show who stars or forks X repo
getInstance
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
Apache-2.0
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dataItems = new ArrayList<User>(); adapter = new UsersAdapter(dataItems); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
onCreate
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
Apache-2.0
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater,container,savedInstanceState); recyclerView.setAdapter(adapter); presenter = new ForkersPresenterImpl(this.getActivity(),this); adapte...
Created by Quinn on 8/6/15. Show who stars or forks X repo
onCreateView
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
Apache-2.0
@Override public void setItems(List items) { super.setItems(items); for(Object user:items){ dataItems.add((User)user); } loading = false; if(items.size() < GithubImpl.DEFAULT_PAGE_SIZE) haveMore = false; adapter.notifyDataSetChanged(); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
setItems
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
Apache-2.0
@Override public void intoItem(int position) { super.intoItem(position); Bundle bundle = new Bundle(); bundle.putSerializable("user",(User)dataItems.get(position)); UserInfoActivity.launch(this.getActivity(), bundle); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
intoItem
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
Apache-2.0
@Override public void onItemClick(View view, int position) { intoItem(position); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
onItemClick
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/ForkersFragment.java
Apache-2.0
@Override public void intoItem(int position) { super.intoItem(position); Bundle bundle = new Bundle(); bundle.putSerializable("repo", (Repository) dataItems.get(position)); RepoActivity.launch(this.getActivity(), bundle); }
first item mean the total_count ,not a real repo
intoItem
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/SearchRepoFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/SearchRepoFragment.java
Apache-2.0
@Override public void onItemClick(View view, int position) { intoItem(position); }
first item mean the total_count ,not a real repo
onItemClick
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/SearchRepoFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/SearchRepoFragment.java
Apache-2.0
@Override public void intoItem(int position) { super.intoItem(position); Bundle bundle = new Bundle(); bundle.putSerializable("user", (User) dataItems.get(position)); UserInfoActivity.launch(this.getActivity(), bundle); }
first item mean the total_count ,not a real user
intoItem
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/SearchUserFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/SearchUserFragment.java
Apache-2.0
@Override public void onItemClick(View view, int position) { intoItem(position); }
first item mean the total_count ,not a real user
onItemClick
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/SearchUserFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/SearchUserFragment.java
Apache-2.0
public static StargazersFragment getInstance(String user,String repo){ L.i(TAG, "create Fragment"); StargazersFragment stargazersFragment = new StargazersFragment(); Bundle bundle = new Bundle(); bundle.putString("user", user); bundle.putString("repo", repo); stargazersFr...
Created by Quinn on 8/6/15. Show who stars or forks X repo
getInstance
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
Apache-2.0
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dataItems = new ArrayList<User>(); adapter = new UsersAdapter(dataItems); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
onCreate
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
Apache-2.0
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater,container,savedInstanceState); recyclerView.setAdapter(adapter); presenter = new StargazersPresenterImpl(this.getActivity(),this); ad...
Created by Quinn on 8/6/15. Show who stars or forks X repo
onCreateView
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
Apache-2.0
@Override public void setItems(List items) { super.setItems(items); for(Object user:items){ dataItems.add((User)user); } loading = false; if(items.size() < GithubImpl.DEFAULT_PAGE_SIZE) haveMore = false; adapter.notifyDataSetChanged(); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
setItems
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
Apache-2.0
@Override public void intoItem(int position) { super.intoItem(position); Bundle bundle = new Bundle(); bundle.putSerializable("user",(User)dataItems.get(position)); UserInfoActivity.launch(this.getActivity(), bundle); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
intoItem
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
Apache-2.0
@Override public void onItemClick(View view, int position) { intoItem(position); }
Created by Quinn on 8/6/15. Show who stars or forks X repo
onItemClick
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/ui/fragments/StargazersFragment.java
Apache-2.0
public static boolean isImage(String name) { if (TextUtils.isEmpty(name)) return false; name = name.toLowerCase(US); for (String extension : IMAGE_EXTENSIONS) if (name.endsWith(extension)) return true; return false; }
Created by Bernat on 10/09/2014 Is the the given file name a image file? @param name @return true if the name has a markdown extension, false otherwise
isImage
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/FileUtils.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/FileUtils.java
Apache-2.0
public static void i(String msg) { if (isDebug) { Log.i(TAG, msg); } }
if it is essential to print bug message. I can initial this value in the launch activity
i
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/L.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/L.java
Apache-2.0
public static void d(String msg) { if (isDebug) { Log.d(TAG, msg); } }
if it is essential to print bug message. I can initial this value in the launch activity
d
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/L.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/L.java
Apache-2.0
public static void e(String msg) { if (isDebug) { Log.i(TAG, msg); } }
if it is essential to print bug message. I can initial this value in the launch activity
e
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/L.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/L.java
Apache-2.0
public static void v(String msg) { if (isDebug) { Log.i(TAG, msg); } }
if it is essential to print bug message. I can initial this value in the launch activity
v
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/L.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/L.java
Apache-2.0
public static void i(String tag,String msg) { if (isDebug) { Log.i(tag, msg); } }
if it is essential to print bug message. I can initial this value in the launch activity
i
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/L.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/L.java
Apache-2.0
public static void d(String tag,String msg) { if (isDebug) { Log.d(tag, msg); } }
if it is essential to print bug message. I can initial this value in the launch activity
d
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/L.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/L.java
Apache-2.0
public static void e(String tag,String msg) { if (isDebug) { Log.i(tag, msg); } }
if it is essential to print bug message. I can initial this value in the launch activity
e
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/L.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/L.java
Apache-2.0
public static void v(String tag, String msg) { if (isDebug) { Log.i(tag, msg); } }
if it is essential to print bug message. I can initial this value in the launch activity
v
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/L.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/L.java
Apache-2.0
public static CharSequence getRelativeTime(final Date date) { long now = System.currentTimeMillis(); if (Math.abs(now - date.getTime()) > 60000) return DateUtils.getRelativeTimeSpanString(date.getTime(), now, MINUTE_IN_MILLIS, FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR ...
Get relative time for date @param date @return relative time
getRelativeTime
java
Leaking/WeGit
app/src/main/java/com/quinn/githubknife/utils/TimeUtils.java
https://github.com/Leaking/WeGit/blob/master/app/src/main/java/com/quinn/githubknife/utils/TimeUtils.java
Apache-2.0
@Override public List<Repository> searchRepo(List<String> keywords,int page) throws GithubError,AuthError { //GET /search/repositories StringBuilder keywordsParams = new StringBuilder(); for(int i = 0; i < keywords.size();i++){ if(i != keywords.size()-1) keywordsP...
Add a first item to save the total_count,It do not mean a user!!!
searchRepo
java
Leaking/WeGit
httpknife/src/main/java/com/quinn/httpknife/github/GithubImpl.java
https://github.com/Leaking/WeGit/blob/master/httpknife/src/main/java/com/quinn/httpknife/github/GithubImpl.java
Apache-2.0
@Override public String getRawContent(String owner, String repo, String path) throws GithubError,AuthError { ///repos/:owner/:repo/contents/:path String url = API_HOST + "repos/" + owner + "/" + repo + "/contents/" + path; Response response = http.get(url).headers(configreHttpHeader()).head...
Add a first item to save the total_count,It do not mean a user!!!
getRawContent
java
Leaking/WeGit
httpknife/src/main/java/com/quinn/httpknife/github/GithubImpl.java
https://github.com/Leaking/WeGit/blob/master/httpknife/src/main/java/com/quinn/httpknife/github/GithubImpl.java
Apache-2.0
@Override public List<Branch> getBranches(String owner, String repo) throws GithubError, AuthError { //GET /repos/:owner/:repo/branches String url = API_HOST + "repos/" + owner + "/" + repo + "/branches"; Response response = http.get(url).headers(configreHttpHeader()).response(); fi...
Add a first item to save the total_count,It do not mean a user!!!
getBranches
java
Leaking/WeGit
httpknife/src/main/java/com/quinn/httpknife/github/GithubImpl.java
https://github.com/Leaking/WeGit/blob/master/httpknife/src/main/java/com/quinn/httpknife/github/GithubImpl.java
Apache-2.0