55
66import android .content .Intent ;
77import android .os .Bundle ;
8- import android .support .design .widget .FloatingActionButton ;
98import android .support .v7 .app .AppCompatActivity ;
10- import android .support .v7 .widget .Toolbar ;
119import android .view .View ;
1210import android .view .WindowManager ;
1311import android .widget .AdapterView ;
1412import android .widget .ArrayAdapter ;
13+ import android .widget .Button ;
1514import android .widget .CheckBox ;
1615import android .widget .EditText ;
1716import android .widget .Spinner ;
2120
2221import de .t_dankworth .secscanqr .R ;
2322import de .t_dankworth .secscanqr .activities .MainActivity ;
23+ import de .t_dankworth .secscanqr .util .GeneralHandler ;
2424
2525/**
2626 * Created by Thore Dankworth
27- * Last Update: 16.01 .2019
27+ * Last Update: 13.12 .2019
2828 * Last Update by Thore Dankworth
2929 *
3030 * This class is all about the geo location to QR-Code Generate Activity. In this Class the functionality of generating a QR-Code Picture is covered.
@@ -35,6 +35,7 @@ public class GeoGeneratorActivity extends AppCompatActivity implements AdapterVi
3535 CheckBox cbLatitude , cbLongtitude ;
3636 Boolean north = true , east = true ;
3737 int format ;
38+ Button btnGenerate ;
3839 String latitude , longtitude , geo ;
3940 MultiFormatWriter multiFormatWriter ;
4041
@@ -50,42 +51,15 @@ protected void onCreate(Bundle savedInstanceState) {
5051 super .onCreate (savedInstanceState );
5152 getWindow ().setFlags (WindowManager .LayoutParams .FLAG_SECURE ,
5253 WindowManager .LayoutParams .FLAG_SECURE );
54+ GeneralHandler generalHandler = new GeneralHandler (this );
55+ generalHandler .loadTheme ();
5356 setContentView (R .layout .activity_geo_generator );
54- Toolbar toolbar = (Toolbar ) findViewById (R .id .toolbar );
55- setSupportActionBar (toolbar );
5657 tfLatitude = (EditText ) findViewById (R .id .tfLatitude );
5758 tfLongtitude = (EditText ) findViewById (R .id .tfLongtitude );
5859 cbLatitude = (CheckBox ) findViewById (R .id .cbLatitude );
5960 cbLongtitude = (CheckBox ) findViewById (R .id .cbLongtitude );
60- getSupportActionBar ().setDisplayHomeAsUpEnabled (true );
61-
62- //Setup the Spinner Menu for the different formats
63- Spinner spinner = (Spinner ) findViewById (R .id .spinner );
64- spinner .setOnItemSelectedListener (this );
65- ArrayAdapter <CharSequence > adapter = ArrayAdapter .createFromResource (this ,
66- R .array .formats_geo_array , android .R .layout .simple_spinner_item );
67- adapter .setDropDownViewResource (android .R .layout .simple_spinner_dropdown_item );
68- spinner .setAdapter (adapter );
69-
70- //If the device were rotated then restore information
71- if (savedInstanceState != null ){
72- latitude = (String ) savedInstanceState .get (STATE_LATITUDE );
73- tfLatitude .setText (latitude );
74- longtitude = (String ) savedInstanceState .get (STATE_LONGTITUDE );
75- tfLongtitude .setText (longtitude );
76- north = (Boolean ) savedInstanceState .get (STATE_NORTH );
77- if (!north ){
78- cbLatitude .setChecked (false );
79- }
80- east = (Boolean ) savedInstanceState .get (STATE_EAST );
81- if (!east ){
82- cbLongtitude .setChecked (false );
83- }
84- }
85-
86- //OnClickListener for the "+" Button and functionality
87- FloatingActionButton fab = (FloatingActionButton ) findViewById (R .id .fab );
88- fab .setOnClickListener (new View .OnClickListener () {
61+ btnGenerate = (Button ) findViewById (R .id .btnGenerateGeo );
62+ btnGenerate .setOnClickListener (new View .OnClickListener () {
8963 @ Override
9064 public void onClick (View view ) {
9165 latitude = tfLatitude .getText ().toString ().trim ();
@@ -111,6 +85,29 @@ public void onClick(View view) {
11185 }
11286 }
11387 });
88+
89+ //Setup the Spinner Menu for the different formats
90+ Spinner spinner = (Spinner ) findViewById (R .id .spinner );
91+ spinner .setOnItemSelectedListener (this );
92+ ArrayAdapter <CharSequence > adapter = ArrayAdapter .createFromResource (this , R .array .formats_geo_array , R .layout .spinner_item );
93+ adapter .setDropDownViewResource (android .R .layout .simple_spinner_dropdown_item );
94+ spinner .setAdapter (adapter );
95+
96+ //If the device were rotated then restore information
97+ if (savedInstanceState != null ){
98+ latitude = (String ) savedInstanceState .get (STATE_LATITUDE );
99+ tfLatitude .setText (latitude );
100+ longtitude = (String ) savedInstanceState .get (STATE_LONGTITUDE );
101+ tfLongtitude .setText (longtitude );
102+ north = (Boolean ) savedInstanceState .get (STATE_NORTH );
103+ if (!north ){
104+ cbLatitude .setChecked (false );
105+ }
106+ east = (Boolean ) savedInstanceState .get (STATE_EAST );
107+ if (!east ){
108+ cbLongtitude .setChecked (false );
109+ }
110+ }
114111 }
115112
116113 /**
0 commit comments