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 ScrollingActivity extends AppCompatActivity { | |
private SectionsPagerAdapter mSectionsPagerAdapter; | |
private ViewPager mViewPager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_scrolling); |
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
Android SDK have special flag for it. | |
https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SECURE | |
Just declare it in your Activity like this: | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); | |
super.onCreate(savedInstanceState); |
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
<!--https://github.com/lasemcode/android-login-screen/blob/v1.0/app/src/main/res/layout/login_activity.xml--> | |
<EditText | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginTop="50dp" | |
android:background="#D81B60" | |
android:drawableLeft="@drawable/ic_user_24dp" | |
android:drawablePadding="16dp" | |
android:drawableTint="@android:color/white" | |
android:hint="Username" |
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
final LocationManager lm = (LocationManager) getContext().getSystemService(Context.LOCATION_SERVICE); | |
if (Build.VERSION.SDK_INT >= 24) { | |
lm.registerGnssStatusCallback(new GnssStatus.Callback() { | |
@Override public void onStarted() { | |
super.onStarted(); | |
Log.d(TAG, "gps started"); | |
updateGpsView(); | |
} | |
}); | |
} else { |
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 static boolean isGpsEnabled(){ | |
LocationManager lm = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); | |
boolean gps_enabled = false; | |
boolean network_enabled = false; | |
try { | |
gps_enabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); | |
} catch(Exception ex) {} |
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 static boolean isLocationEnabled(Context context) { | |
int locationMode = 0; | |
String locationProviders; | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ | |
try { | |
locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); | |
} catch (SettingNotFoundException e) { | |
e.printStackTrace(); |
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
Edit /etc/config/network. Under “WAN” section, set the configuration with: | |
config 'interface' 'wan' | |
option 'ifname' 'eth0.2' | |
option 'proto' 'pppoe' | |
option 'username' 'your-own-username' | |
option 'password' 'your-own-password' | |
option 'defaultroute' '1' | |
option 'peerdns' '1' | |
Force a re-dial |
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
#!/bin/bash | |
# atlassian-heap-dump.sh - dump a heap using GDB for a crashed application | |
# Accepts a single argument: the PID of the JVM | |
# Author: James Gray ([email protected]) | |
# Copyright Atlassian P/L | |
# License: MIT | |
# Are we root? | |
if [ $UID -ne 0 ]; then |
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
#!/bin/sh | |
# Oneliner by @Coornail, modifications by @ErikBjare | |
watch -n1 -d "curl -s https://btc-e.com/api/2/btc_usd/ticker | json_pp | tail --line=+2 | head --line=12" |
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
#!/bin/sh | |
# Requires jq | |
# Remember to chmod +x! | |
# | |
# Add the following cron-job (using "crontab -e") to run at hourly intervals: | |
# 0 * * * * export DISPLAY=:0.0 && /bin/bash <SCRIPT_PATH_GOES_HERE> > /dev/null 2>&1 | |
# Change <SCRIPT_PATH_GOES_HERE> to the appropriate name | |
BTCE_PRICE="$(curl -s https://btc-e.com/api/2/btc_usd/ticker | jq '.ticker.last')" |
NewerOlder