Skip to content

Instantly share code, notes, and snippets.

View yava555's full-sized avatar
🏠
Working from home

yava yava555

🏠
Working from home
View GitHub Profile
@yava555
yava555 / UserEmailFeedbackIntent.java
Created August 1, 2012 06:55
UserEmailFeedbackIntent
String subject = "鲜果联播Android版" + getResources().getString(R.string.app_version) + "用户反馈";
Intent backIntent = new Intent(Intent.ACTION_VIEW);
String email_address="mailto:"+"lianbo.xianguo@gmail.com";
backIntent.setData(Uri.parse(email_address));
String networkStatus = "";
if (CommonUtils.isWifiConnected(XgPadPreferenceActivity.this)) {
networkStatus = "WI-FI";
} else if (CommonUtils.isNetworkConnected(XgPadPreferenceActivity.this)) {
networkStatus = "2G/3G";
}
@yava555
yava555 / RoundCornerImage.java
Created August 3, 2012 09:34
AndroidRoundCornerImage
public Bitmap getRoundedCornerBitmap(Bitmap bitmap) {
if (bitmap == null) {
return null;
}
if (layoutId==R.layout.appwidget_small_one_layout && styleOneBitmap == null) {
styleOneBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.appwidget_one);
}
if (layoutId==R.layout.appwidget_small_two_layout && styleTwoBitmap == null) {
@yava555
yava555 / DouBanFMDownloader.py
Created August 22, 2012 10:12
豆瓣红心歌曲下载
# coding: utf-8
from BeautifulSoup import BeautifulSoup
import cookielib
import eyeD3
import json
import os
import re
import urllib
import urllib2
@yava555
yava555 / LeftToRightFinishGesture.java
Last active December 14, 2015 23:39
LeftToRightFinishGesture [Android] [Carbon App]
package dl.utils;
import android.app.Activity;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import java.io.PrintStream;
public class LeftToRightFinishGesture extends GestureDetector.SimpleOnGestureListener
{
private Activity mActivity;
package com.xianguo.xreader.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
import android.annotation.SuppressLint;
public class RelativeTime {
private static final long ONE_DAY = 86400000L;
@yava555
yava555 / EndlessScrollListener.java
Created March 30, 2013 14:09
[Android][ListView]Scroll Loading
public class EndlessScrollListener implements OnScrollListener {
//只剩2个未显示时加载
private int visibleThreshold = 2;
private int previousTotal = 0;
private boolean loading = true;
public EndlessScrollListener() {
}
public EndlessScrollListener(int visibleThreshold) {
@yava555
yava555 / ViewPagerRemoveItem.java
Last active December 16, 2015 11:08
ViewPager Remove Item
//-----------------------------------------------------------------------------
// Add "view" to right end of "views".
// Returns the position of the new view.
// The app should call this to add pages; not used by ViewPager.
public int addView (View v)
{
return addView (v, views.size());
}
//-----------------------------------------------------------------------------
@yava555
yava555 / BucketHelper.java
Last active December 16, 2021 20:17
BucketHelp extract from Gallery3D App
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
@yava555
yava555 / ByteStreams.java
Created July 19, 2013 04:28
ByteStreams copy stream
/*
* Copyright (c) 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
@yava555
yava555 / ProgressWebView.java
Created July 31, 2013 09:16
ProgressWebView WebView
package com.cleanmaster.photosync.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebView;
import android.widget.ProgressBar;
public class ProgressWebView extends WebView {
private ProgressBar mProgressbar;