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 class MainActivity extends AppCompatActivity { | |
private static final String TAG = "MainActivity"; | |
private static final int PERMISSION_REQUEST_READ_EXTERNAL_STORAGE = 1; | |
private Button openStorage; | |
private SharedPreferences sharedPreferences; |
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
//If User was asked permission before and denied | |
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); | |
alertDialogBuilder.setTitle("Permission needed"); | |
alertDialogBuilder.setMessage("Storage permission needed for accessing photos"); | |
alertDialogBuilder.setPositiveButton("Open Setting", new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialogInterface, int i) { | |
Intent intent = new Intent(); | |
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); |
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 class DatabaseLogger implements ILogger { | |
@Override | |
public void log(String message) { | |
//Log to Database here | |
} | |
} |
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 class InstanceFactory { | |
public static ILogger initLogger(){ | |
return new FileLogger(); | |
} | |
} |
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 class FirebaseLogin implements ILoginAuthentication { | |
private OnLoginCompleted listener; | |
public FirebaseLogin(OnLoginCompleted listener){ | |
this.listener = listener; | |
} | |
@Override | |
public void login(String username, String password) { |
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
class MySlider extends StatefulWidget { | |
@override | |
_MySliderState createState() => _MySliderState(); | |
} | |
class _MySliderState extends State<MySlider> { | |
double _value = 0.5; | |
@override | |
Widget build(BuildContext context) { |
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 | |
Widget build(BuildContext context) { | |
return SliderTheme( | |
data: SliderTheme.of(context).copyWith( | |
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 20) | |
), | |
child: Slider( | |
value: _value, | |
onChanged: (newValue){ | |
setState(() { |
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
var kCoolPurple = Color(0xFF5D37B9); | |
var kCoolGray = Colors.grey.shade200; |
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 | |
Widget build(BuildContext context) { | |
return SliderTheme( | |
data: SliderTheme.of(context).copyWith( | |
activeTrackColor: kCoolPurple, | |
inactiveTrackColor: kCoolGray, | |
thumbColor: kCoolPurple, | |
overlayShape: RoundSliderOverlayShape(overlayRadius: 1), | |
), | |
child: Slider( |
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
import 'package:flutter/material.dart'; | |
class CircleThumbShape extends SliderComponentShape { | |
final double thumbRadius; | |
const CircleThumbShape({ | |
this.thumbRadius = 6.0, | |
}); | |
OlderNewer