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
android { | |
... | |
def versionFile = file('version.properties') | |
Properties prop = new Properties() | |
if (versionFile.canRead()) { | |
prop.load(new FileInputStream(versionFile)) | |
} | |
else { | |
prop['VERSION_CODE']='0' | |
} |
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 LatLng getLocation() { | |
if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { | |
Toast.makeText(getApplicationContext(),"Request permission first!", Toast.LENGTH_LONG).show(); | |
return null; | |
} | |
LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(LOCATION_SERVICE); | |
Criteria criteria = new Criteria(); | |
String bestProvider = locationManager.getBestProvider(criteria, false); | |
Location location = locationManager.getLastKnownLocation(bestProvider); | |
double lat, lon; |
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
private boolean permissions_ok = false; | |
private static int LOCATION_PERMISSION_CODE = 100; | |
public void requestPermission(View view) { | |
if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { | |
permissions_ok = false; | |
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_PERMISSION_CODE); | |
} | |
else { | |
permissions_ok = true; |
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
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
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
String s = ""; | |
int counter = 1; | |
public void addLine(View view) { | |
TextView tv = findViewById(R.id.test_text); | |
s = s + "Line " + counter + "<br>"; | |
counter++; | |
tv.setText(Html.fromHtml(s, Html.FROM_HTML_MODE_LEGACY)); | |
int scrollAmount = tv.getLayout().getLineTop(tv.getLineCount()) - tv.getHeight(); |
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
TextView tv = findViewById(R.id.test_text); | |
tv.setMovementMethod(new ScrollingMovementMethod()); |
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
<TextView | |
android:id="@+id/test_text" | |
style="?attr/TextViewStyle" | |
android:layout_width="0dp" | |
android:layout_height="200dp" | |
android:layout_marginStart="5dp" | |
android:layout_marginTop="10dp" | |
android:layout_marginEnd="5dp" | |
android:layout_marginBottom="200dp" | |
android:background="#504C4C" |
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
[easyfc title="General knowledge" file="flashcards/general_k.txt"/] |
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
{ | |
"q1":{"q":"2 to the 10th?", "a":"1024"}, | |
"q2":{"q":"Value of PI?", "a":"3.14"} | |
} |
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
start="aa" | |
end="cc" | |
end=$(grep "$end" text.txt | tail -1) | |
sed -n "/$start/,/$end/p" test.txt |
NewerOlder