diff --git a/app/src/main/java/net/bierbaumer/otp_authenticator/MainActivity.java b/app/src/main/java/net/bierbaumer/otp_authenticator/MainActivity.java index dd2fb53d..2f9ce131 100644 --- a/app/src/main/java/net/bierbaumer/otp_authenticator/MainActivity.java +++ b/app/src/main/java/net/bierbaumer/otp_authenticator/MainActivity.java @@ -7,6 +7,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Handler; +import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; @@ -33,10 +34,11 @@ public class MainActivity extends AppCompatActivity implements ActionMode.Callb private ArrayList entries; private EntriesAdapter adapter; + private FloatingActionButton fab; private Entry nextSelection = null; private void showNoAccount(){ - Snackbar noAccountSnackbar = Snackbar.make(findViewById(R.id.listView), R.string.no_accounts, Snackbar.LENGTH_INDEFINITE) + Snackbar noAccountSnackbar = Snackbar.make(fab, R.string.no_accounts, Snackbar.LENGTH_INDEFINITE) .setAction("Add", new View.OnClickListener() { @Override public void onClick(View view) { @@ -62,6 +64,14 @@ public class MainActivity extends AppCompatActivity implements ActionMode.Callb Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); + fab = (FloatingActionButton) findViewById(R.id.action_scan); + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + scanQRCode(); + } + }); + final ListView listView = (ListView) findViewById(R.id.listView); final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar); @@ -137,9 +147,9 @@ public class MainActivity extends AppCompatActivity implements ActionMode.Callb adapter.notifyDataSetChanged(); - Snackbar.make(findViewById(R.id.listView), "Account added", Snackbar.LENGTH_LONG).show(); + Snackbar.make(fab, "Account added", Snackbar.LENGTH_LONG).show(); } catch (Exception e) { - Snackbar.make(findViewById(R.id.listView), "Invalid QR Code", Snackbar.LENGTH_LONG).setCallback(new Snackbar.Callback() { + Snackbar.make(fab, "Invalid QR Code", Snackbar.LENGTH_LONG).setCallback(new Snackbar.Callback() { @Override public void onDismissed(Snackbar snackbar, int event) { super.onDismissed(snackbar, event); @@ -169,18 +179,13 @@ public class MainActivity extends AppCompatActivity implements ActionMode.Callb public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); - if (id == R.id.action_scan) { - scanQRCode(); - - return true; - } else if(id == R.id.action_about){ + if(id == R.id.action_about){ WebView view = (WebView) LayoutInflater.from(this).inflate(R.layout.dialog_about, null); view.loadUrl("file:///android_res/raw/about.html"); new AlertDialog.Builder(this).setView(view).show(); return true; } - return super.onOptionsItemSelected(item); } @@ -214,7 +219,7 @@ public class MainActivity extends AppCompatActivity implements ActionMode.Callb public void onClick(DialogInterface dialog, int whichButton) { entries.remove(adapter.getCurrentSelection()); - Snackbar.make(findViewById(R.id.listView), "Account removed", Snackbar.LENGTH_LONG).setCallback(new Snackbar.Callback() { + Snackbar.make(fab, "Account removed", Snackbar.LENGTH_LONG).setCallback(new Snackbar.Callback() { @Override public void onDismissed(Snackbar snackbar, int event) { super.onDismissed(snackbar, event); diff --git a/app/src/main/java/net/bierbaumer/otp_authenticator/MyApplication.java b/app/src/main/java/net/bierbaumer/otp_authenticator/MyApplication.java index 58f84c9f..5af3ae27 100644 --- a/app/src/main/java/net/bierbaumer/otp_authenticator/MyApplication.java +++ b/app/src/main/java/net/bierbaumer/otp_authenticator/MyApplication.java @@ -7,8 +7,6 @@ public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); - PRNGFixes.apply(); - Log.e("AAA", "AAAA"); } } diff --git a/app/src/main/res/drawable-hdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_add_white_24dp.png new file mode 100755 index 00000000..481643ec Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_add_white_24dp.png new file mode 100755 index 00000000..977dd342 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png new file mode 100755 index 00000000..67042105 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png new file mode 100755 index 00000000..72cedcad Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a27d769f..aafc3bd3 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -19,7 +19,6 @@ android:layout_height="wrap_content"> - + diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 7069ab90..7f252914 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -1,12 +1,5 @@ - + xmlns:app="http://schemas.android.com/apk/res-auto">