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
package android.support.v7.app; | |
import android.support.v7.appcompat.R; | |
import android.content.Context; | |
import android.content.pm.ActivityInfo; | |
import android.content.pm.PackageManager; | |
import android.content.res.Configuration; | |
import android.content.res.TypedArray; | |
import android.os.Build; |
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
/* | |
* http://stackoverflow.com/a/4952066/1835650 | |
*/ | |
public static String[] generateRandomWords(int _numberOfWords) { | |
String[] randomStrings = null; | |
Random random = null; | |
try { | |
random = new Random(); | |
randomStrings = new String[_numberOfWords]; | |
for (int i = 0; i < _numberOfWords; i++) { |
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
/* | |
For opening and closing the notification-bar programmatically. Here is an example for closing. | |
<uses-permission android:name=“android.permission.EXPAND_STATUS_BAR” /> | |
It might be an unofficial info. | |
http://stackoverflow.com/questions/5029354/how-can-i-programmatically-open-close-notifications-in-android http://stackoverflow.com/questions/13766789/android-how-to-collapse-status-bar-on-android-4-2 | |
*/ | |
private static void collpasePanel(Context _context) { | |
try { |
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
public final class ToneUtil { | |
private static final int DEFAULT_INDEX = 0; | |
private final static List<String> sTones = new ArrayList<String>(); | |
private final static List<Uri> sUris = new ArrayList<Uri>(); | |
public interface OnPostToneSearchingListener { | |
void onPostToneSearching(); |
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
//one way | |
if (mAdapter != null) { | |
int count = mAdapter.getCount(); | |
SomeFragment f; | |
ViewPager vp = (ViewPager) getView().findViewById(R.id.vp_pages); | |
for (int i = 0; i < count; i++) { | |
f = (SomeFragment) mAdapter.instantiateItem(vp, i); | |
f.refresh(); | |
} | |
} |
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
/** | |
* Manager for operating APN data on the phone. | |
* | |
* Inspired by {@link http://blogs.msdn.com/b/zhengpei/archive/2009/10/13/managing-apn-data-in-google-android.aspx} | |
* | |
*/ | |
public class APNManager { | |
public static final int OPERATION_FAILED = 0x89; | |
private static final String TAG = APNManager.class.getSimpleName(); | |
private Context mContext; |
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
//See more on android source directly. https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/provider/CalendarContract.java | |
/* | |
* Util functions for accessing calendar services of Android. Although the App | |
* supports >= 2.3.3, we still show here the low-level URIs for calendar | |
* services, so that we can learn and reuse them in other projects. | |
* | |
* Inspired by | |
* https://android.googlesource.com/platform/frameworks/base/+/refs/heads | |
* /master/core/java/android/provider/CalendarContract.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
/* | |
<receiver android:name=".WifiNetworkChangedReceiver"> | |
<intent-filter> | |
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> | |
</intent-filter> | |
<intent-filter> | |
<action android:name="android.net.wifi.STATE_CHANGE" /> | |
</intent-filter> | |
</receiver> | |
*/ |
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
public final class NetworkUtils { | |
public static final byte CONNECTION_OFFLINE = 1; | |
public static final byte CONNECTION_WIFI = 2; | |
public static final byte CONNECTION_ROAMING = 3; | |
public static final byte CONNECTION_SLOW = 4; | |
public static final byte CONNECTION_FAST = 5; | |
private static String sUserId; | |
private NetworkUtils() { |
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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
TextView versionTv = (TextView) findViewById(R.id.version_tv); | |
versionTv.setText(String.format("Version Release:%s", Build.VERSION.RELEASE)); | |
TextView sdkTv = (TextView) findViewById(R.id.sdk_tv); | |
sdkTv.setText(String.format("SDK:%d", android.os.Build.VERSION.SDK_INT)); | |
TextView resolutionTv = (TextView) findViewById(R.id.resolution_tv); | |
resolutionTv.setText(String.format("Resolution(DPI): %s", getDeviceResolution())); |
OlderNewer