]> Pileus Git - ~andy/freeotp/commitdiff
Clean up some formatting issues
authorNathaniel McCallum <npmccallum@redhat.com>
Fri, 18 Oct 2013 03:44:07 +0000 (23:44 -0400)
committerNathaniel McCallum <npmccallum@redhat.com>
Fri, 18 Oct 2013 03:44:07 +0000 (23:44 -0400)
src/org/fedorahosted/freeotp/CircleProgressBar.java
src/org/fedorahosted/freeotp/MainActivity.java
src/org/fedorahosted/freeotp/Token.java
src/org/fedorahosted/freeotp/TokenAdapter.java

index 0734e40ea27afc1d902cbea1378ee427e8168c8e..95c556ab2ad6ac27818fbe04095457807e2fc7dc 100644 (file)
@@ -50,12 +50,12 @@ public class CircleProgressBar extends ProgressBar {
                super(context);
                setup();
        }
                super(context);
                setup();
        }
-       
+
        private void setup() {
                paint = new Paint();
         rectf = new RectF();
         rect = new Rect();
        private void setup() {
                paint = new Paint();
         rectf = new RectF();
         rect = new Rect();
-        
+
         paint.setColor(0x33333300);
         paint.setAlpha(0x99);
         paint.setAntiAlias(true);
         paint.setColor(0x33333300);
         paint.setAlpha(0x99);
         paint.setAntiAlias(true);
@@ -69,7 +69,7 @@ public class CircleProgressBar extends ProgressBar {
                rect.top += getPaddingTop() + 2;
                rect.right -= getPaddingRight() + 2;
                rect.bottom -= getPaddingBottom() + 2;
                rect.top += getPaddingTop() + 2;
                rect.right -= getPaddingRight() + 2;
                rect.bottom -= getPaddingBottom() + 2;
-               
+
                rectf.set(rect);
                canvas.drawArc(rectf, -90, getProgress() * 360 / getMax(), true, paint);
        }
                rectf.set(rect);
                canvas.drawArc(rectf, -90, getProgress() * 360 / getMax(), true, paint);
        }
index e8451d0c21728313dc6e539a5a658437c158cd92..d7bb6fbc3f8b8d78404c8feb1e9da4c6f9b65b5b 100644 (file)
@@ -44,8 +44,6 @@ import java.util.List;
 
 import org.fedorahosted.freeotp.Token.TokenUriInvalidException;
 
 
 import org.fedorahosted.freeotp.Token.TokenUriInvalidException;
 
-import android.net.Uri;
-import android.os.Bundle;
 import android.app.AlertDialog;
 import android.app.ListActivity;
 import android.content.ActivityNotFoundException;
 import android.app.AlertDialog;
 import android.app.ListActivity;
 import android.content.ActivityNotFoundException;
@@ -53,6 +51,8 @@ import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.net.Uri;
+import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.MenuItem.OnMenuItemClickListener;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.MenuItem.OnMenuItemClickListener;
@@ -93,8 +93,9 @@ public class MainActivity extends ListActivity {
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         getMenuInflater().inflate(R.menu.main, menu);
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         getMenuInflater().inflate(R.menu.main, menu);
-        
+
         menu.findItem(R.id.action_add).setOnMenuItemClickListener(new OnMenuItemClickListener() {
         menu.findItem(R.id.action_add).setOnMenuItemClickListener(new OnMenuItemClickListener() {
+                       @Override
                        public boolean onMenuItemClick(MenuItem item) {
                                Intent i = new Intent(ACTION_SCAN);
                                i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                        public boolean onMenuItemClick(MenuItem item) {
                                Intent i = new Intent(ACTION_SCAN);
                                i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
@@ -114,6 +115,7 @@ public class MainActivity extends ListActivity {
                                        .setTitle(R.string.install_title)
                                        .setMessage(R.string.install_message)
                                        .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
                                        .setTitle(R.string.install_title)
                                        .setMessage(R.string.install_message)
                                        .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
+                                               @Override
                                                public void onClick(DialogInterface dialogInterface, int i) {
                                                        Uri uri = Uri.parse("market://details?id=" + PROVIDERS.get(0));
                                                        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                                                public void onClick(DialogInterface dialogInterface, int i) {
                                                        Uri uri = Uri.parse("market://details?id=" + PROVIDERS.get(0));
                                                        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
@@ -125,6 +127,7 @@ public class MainActivity extends ListActivity {
                                                }
                                        })
                                        .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
                                                }
                                        })
                                        .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
+                                               @Override
                                                public void onClick(DialogInterface dialogInterface, int i) {
                                                        return;
                                                }
                                                public void onClick(DialogInterface dialogInterface, int i) {
                                                        return;
                                                }
@@ -137,8 +140,9 @@ public class MainActivity extends ListActivity {
 
         return true;
     }
 
         return true;
     }
-    
-    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+
+    @Override
+       public void onActivityResult(int requestCode, int resultCode, Intent intent) {
         if (resultCode == RESULT_OK) {
             try {
                                ta.add(this, intent.getStringExtra("SCAN_RESULT"));
         if (resultCode == RESULT_OK) {
             try {
                                ta.add(this, intent.getStringExtra("SCAN_RESULT"));
index 49de1181e253da164bf187cca00cec737f60a064..a42d36f92ec4c6783c4dd030358b1e758f82604a 100644 (file)
@@ -32,35 +32,35 @@ import java.util.Locale;
 import javax.crypto.Mac;
 import javax.crypto.spec.SecretKeySpec;
 
 import javax.crypto.Mac;
 import javax.crypto.spec.SecretKeySpec;
 
-import com.google.android.apps.authenticator.Base32String;
-import com.google.android.apps.authenticator.Base32String.DecodingException;
-
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.net.Uri;
 
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.net.Uri;
 
+import com.google.android.apps.authenticator.Base32String;
+import com.google.android.apps.authenticator.Base32String.DecodingException;
+
 public class Token {
        public static class TokenUriInvalidException extends Exception {
                private static final long serialVersionUID = -1108624734612362345L;
        }
 public class Token {
        public static class TokenUriInvalidException extends Exception {
                private static final long serialVersionUID = -1108624734612362345L;
        }
-       
+
        public static enum TokenType {
                HOTP, TOTP
        }
        public static enum TokenType {
                HOTP, TOTP
        }
-       
-       private String issuerInt;
-       private String issuerExt;
-       private String label;
+
+       private final String issuerInt;
+       private final String issuerExt;
+       private final String label;
        private TokenType type;
        private String algo;
        private byte[] key;
        private int digits;
        private long counter;
        private int period;
        private TokenType type;
        private String algo;
        private byte[] key;
        private int digits;
        private long counter;
        private int period;
-       
+
        public static List<Token> getTokens(Context ctx) {
                SharedPreferences prefs = ctx.getSharedPreferences(Token.class.getName(), Context.MODE_PRIVATE);
        public static List<Token> getTokens(Context ctx) {
                SharedPreferences prefs = ctx.getSharedPreferences(Token.class.getName(), Context.MODE_PRIVATE);
-               
+
                List<Token> tokens = new ArrayList<Token>();
                for (String key : prefs.getAll().keySet()) {
                        try {
                List<Token> tokens = new ArrayList<Token>();
                for (String key : prefs.getAll().keySet()) {
                        try {
@@ -71,21 +71,21 @@ public class Token {
                                e.printStackTrace();
                        }
                }
                                e.printStackTrace();
                        }
                }
-               
+
                return tokens;
        }
 
        private Token(Uri uri) throws TokenUriInvalidException, NoSuchAlgorithmException {
                if (!uri.getScheme().equals("otpauth"))
                        throw new TokenUriInvalidException();
                return tokens;
        }
 
        private Token(Uri uri) throws TokenUriInvalidException, NoSuchAlgorithmException {
                if (!uri.getScheme().equals("otpauth"))
                        throw new TokenUriInvalidException();
-               
+
                if (uri.getAuthority().equals("totp"))
                        type = TokenType.TOTP;
                else if (uri.getAuthority().equals("hotp"))
                        type = TokenType.HOTP;
                else
                        throw new TokenUriInvalidException();
                if (uri.getAuthority().equals("totp"))
                        type = TokenType.TOTP;
                else if (uri.getAuthority().equals("hotp"))
                        type = TokenType.HOTP;
                else
                        throw new TokenUriInvalidException();
-               
+
                String path = uri.getPath();
                if (path == null)
                        throw new TokenUriInvalidException();
                String path = uri.getPath();
                if (path == null)
                        throw new TokenUriInvalidException();
@@ -95,12 +95,12 @@ public class Token {
                        path = path.substring(1);
                if (path.length() == 0)
                        throw new TokenUriInvalidException();
                        path = path.substring(1);
                if (path.length() == 0)
                        throw new TokenUriInvalidException();
-               
+
                int i = path.indexOf(':');
                issuerExt = i < 0 ? "" : path.substring(0, i);
                issuerInt = uri.getQueryParameter("issuer");
                label = path.substring(i >= 0 ? i + 1 : 0);
                int i = path.indexOf(':');
                issuerExt = i < 0 ? "" : path.substring(0, i);
                issuerInt = uri.getQueryParameter("issuer");
                label = path.substring(i >= 0 ? i + 1 : 0);
-               
+
                algo = uri.getQueryParameter("algorithm");
                if (algo == null)
                        algo = "sha1";
                algo = uri.getQueryParameter("algorithm");
                if (algo == null)
                        algo = "sha1";
@@ -109,7 +109,7 @@ public class Token {
             !algo.equals("SHA512") && !algo.equals("MD5"))
                        throw new TokenUriInvalidException();
                Mac.getInstance("Hmac" + algo);
             !algo.equals("SHA512") && !algo.equals("MD5"))
                        throw new TokenUriInvalidException();
                Mac.getInstance("Hmac" + algo);
-               
+
                try {
                        String d = uri.getQueryParameter("digits");
                        if (d == null)
                try {
                        String d = uri.getQueryParameter("digits");
                        if (d == null)
@@ -120,7 +120,7 @@ public class Token {
                } catch (NumberFormatException e) {
                        throw new TokenUriInvalidException();
                }
                } catch (NumberFormatException e) {
                        throw new TokenUriInvalidException();
                }
-               
+
                switch (type) {
                case HOTP:
                        try {
                switch (type) {
                case HOTP:
                        try {
@@ -143,7 +143,7 @@ public class Token {
                        }
                        break;
                }
                        }
                        break;
                }
-               
+
                try {
                        String s = uri.getQueryParameter("secret");
                        key = Base32String.decode(s);
                try {
                        String s = uri.getQueryParameter("secret");
                        key = Base32String.decode(s);
@@ -151,25 +151,25 @@ public class Token {
                        throw new TokenUriInvalidException();
                }
        }
                        throw new TokenUriInvalidException();
                }
        }
-       
+
        private String getHOTP(long counter) {
                // Encode counter in network byte order
                ByteBuffer bb = ByteBuffer.allocate(8);
                bb.putLong(counter);
        private String getHOTP(long counter) {
                // Encode counter in network byte order
                ByteBuffer bb = ByteBuffer.allocate(8);
                bb.putLong(counter);
-               
+
                // Create digits divisor
                int div = 1;
                for (int i = digits; i > 0; i--)
                        div *= 10;
                // Create digits divisor
                int div = 1;
                for (int i = digits; i > 0; i--)
                        div *= 10;
-               
+
                // Create the HMAC
                try {
                        Mac mac = Mac.getInstance("Hmac" + algo);
                        mac.init(new SecretKeySpec(key, "Hmac" + algo));
                // Create the HMAC
                try {
                        Mac mac = Mac.getInstance("Hmac" + algo);
                        mac.init(new SecretKeySpec(key, "Hmac" + algo));
-                       
+
                        // Do the hashing
                        byte[] digest = mac.doFinal(bb.array());
                        // Do the hashing
                        byte[] digest = mac.doFinal(bb.array());
-                       
+
                        // Truncate
                        int binary;
                        int off = digest[digest.length - 1] & 0xf;
                        // Truncate
                        int binary;
                        int off = digest[digest.length - 1] & 0xf;
@@ -178,12 +178,12 @@ public class Token {
                        binary |= (digest[off + 2] & 0xff) << 0x08;
                        binary |= (digest[off + 3] & 0xff) << 0x00;
                        binary  = binary % div;
                        binary |= (digest[off + 2] & 0xff) << 0x08;
                        binary |= (digest[off + 3] & 0xff) << 0x00;
                        binary  = binary % div;
-                       
+
                        // Zero pad
                        String hotp = Integer.toString(binary);
                        while (hotp.length() != digits)
                                hotp = "0" + hotp;
                        // Zero pad
                        String hotp = Integer.toString(binary);
                        while (hotp.length() != digits)
                                hotp = "0" + hotp;
-                       
+
                        return hotp;
                } catch (InvalidKeyException e) {
                        e.printStackTrace();
                        return hotp;
                } catch (InvalidKeyException e) {
                        e.printStackTrace();
@@ -193,11 +193,11 @@ public class Token {
 
                return "";
        }
 
                return "";
        }
-       
+
        public Token(String uri) throws TokenUriInvalidException, NoSuchAlgorithmException {
                this(Uri.parse(uri));
        }
        public Token(String uri) throws TokenUriInvalidException, NoSuchAlgorithmException {
                this(Uri.parse(uri));
        }
-       
+
        private String getId() {
                String id;
                if (issuerInt != null && !issuerInt.equals(""))
        private String getId() {
                String id;
                if (issuerInt != null && !issuerInt.equals(""))
@@ -206,20 +206,20 @@ public class Token {
                        id = issuerExt + ":" + label;
                else
                        id = label;
                        id = issuerExt + ":" + label;
                else
                        id = label;
-               
+
                return id;
        }
                return id;
        }
-       
+
        public void remove(Context ctx) {
                SharedPreferences prefs = ctx.getSharedPreferences(Token.class.getName(), Context.MODE_PRIVATE);
                prefs.edit().remove(getId()).apply();
        }
        public void remove(Context ctx) {
                SharedPreferences prefs = ctx.getSharedPreferences(Token.class.getName(), Context.MODE_PRIVATE);
                prefs.edit().remove(getId()).apply();
        }
-       
+
        public void save(Context ctx) {
                SharedPreferences prefs = ctx.getSharedPreferences(Token.class.getName(), Context.MODE_PRIVATE);
                prefs.edit().putString(getId(), toString()).apply();
        }
        public void save(Context ctx) {
                SharedPreferences prefs = ctx.getSharedPreferences(Token.class.getName(), Context.MODE_PRIVATE);
                prefs.edit().putString(getId(), toString()).apply();
        }
-       
+
        public String getTitle() {
                String title = "";
                if (issuerExt != null && !issuerExt.equals(""))
        public String getTitle() {
                String title = "";
                if (issuerExt != null && !issuerExt.equals(""))
@@ -227,7 +227,7 @@ public class Token {
                title += label;
                return title;
        }
                title += label;
                return title;
        }
-       
+
        public String getCurrentTokenValue(Context ctx, boolean increment) {
                if (type == TokenType.HOTP) {
                        if (increment) {
        public String getCurrentTokenValue(Context ctx, boolean increment) {
                if (type == TokenType.HOTP) {
                        if (increment) {
@@ -240,17 +240,17 @@ public class Token {
                                String placeholder = "";
                                for (int i = 0; i < digits; i++)
                                        placeholder += "-";
                                String placeholder = "";
                                for (int i = 0; i < digits; i++)
                                        placeholder += "-";
-                               
+
                                return placeholder;
                        }
                }
                                return placeholder;
                        }
                }
-               
+
                return getHOTP(System.currentTimeMillis() / 1000 / period);
        }
                return getHOTP(System.currentTimeMillis() / 1000 / period);
        }
-       
+
        public Uri toUri() {
                String issuerLabel = !issuerExt.equals("") ? issuerExt + ":" + label : label;
        public Uri toUri() {
                String issuerLabel = !issuerExt.equals("") ? issuerExt + ":" + label : label;
-               
+
                Uri.Builder builder = new Uri.Builder()
                        .scheme("otpauth")
                        .path(issuerLabel)
                Uri.Builder builder = new Uri.Builder()
                        .scheme("otpauth")
                        .path(issuerLabel)
@@ -258,7 +258,7 @@ public class Token {
                        .appendQueryParameter("issuer", issuerInt == null ? issuerExt : issuerInt)
                        .appendQueryParameter("algorithm", algo)
                        .appendQueryParameter("digits", Integer.toString(digits));
                        .appendQueryParameter("issuer", issuerInt == null ? issuerExt : issuerInt)
                        .appendQueryParameter("algorithm", algo)
                        .appendQueryParameter("digits", Integer.toString(digits));
-               
+
                switch (type) {
                case HOTP:
                        builder.authority("hotp");
                switch (type) {
                case HOTP:
                        builder.authority("hotp");
@@ -269,22 +269,22 @@ public class Token {
                        builder.appendQueryParameter("period", Integer.toString(period));
                        break;
                }
                        builder.appendQueryParameter("period", Integer.toString(period));
                        break;
                }
-               
+
                return builder.build();
        }
                return builder.build();
        }
-       
+
        public TokenType getType() {
                return type;
        }
        public TokenType getType() {
                return type;
        }
-       
+
        // Progress is on a scale from 0 - 1000.
        public int getProgress() {
                int p = period * 10;
        // Progress is on a scale from 0 - 1000.
        public int getProgress() {
                int p = period * 10;
-               
+
                long time = System.currentTimeMillis() / 100;
                return (int) ((time % p) * 1000 / p);
        }
                long time = System.currentTimeMillis() / 100;
                return (int) ((time % p) * 1000 / p);
        }
-       
+
        @Override
        public String toString() {
                return toUri().toString();
        @Override
        public String toString() {
                return toUri().toString();
index 06a3f3bbc0c7859fe072e68b3d7b7a45eb6e2131..56ceebc0b9a2221ed6d295d3f8ad08da0009109a 100644 (file)
@@ -50,39 +50,40 @@ public class TokenAdapter extends BaseAdapter {
                private static interface OnTickListener {
                        public void tick(ProgressBar pb);
                }
                private static interface OnTickListener {
                        public void tick(ProgressBar pb);
                }
-               
-               private Map<ProgressBar, OnTickListener> map = new HashMap<ProgressBar, OnTickListener>();
-               
+
+               private final Map<ProgressBar, OnTickListener> map = new HashMap<ProgressBar, OnTickListener>();
+
                @Override
                public void handleMessage(Message msg) {
                        for (ProgressBar pb : map.keySet())
                                map.get(pb).tick(pb);
                @Override
                public void handleMessage(Message msg) {
                        for (ProgressBar pb : map.keySet())
                                map.get(pb).tick(pb);
-                       
+
                        sendEmptyMessageDelayed(0, 200);
                }
                        sendEmptyMessageDelayed(0, 200);
                }
-               
+
                public void set(ProgressBar pb, OnTickListener otl) {
                        map.put(pb, otl);
                }
        }
                public void set(ProgressBar pb, OnTickListener otl) {
                        map.put(pb, otl);
                }
        }
-       
-       private List<Token> tokens = new ArrayList<Token>();
-       private Ticker ticker = new Ticker();
-       
+
+       private final List<Token> tokens = new ArrayList<Token>();
+       private final Ticker ticker = new Ticker();
+
        private void sort() {
                Collections.sort(tokens, new Comparator<Token>() {
        private void sort() {
                Collections.sort(tokens, new Comparator<Token>() {
+                       @Override
                        public int compare(Token lhs, Token rhs) {
                                return lhs.getTitle().compareTo(rhs.getTitle());
                        }
                });
        }
                        public int compare(Token lhs, Token rhs) {
                                return lhs.getTitle().compareTo(rhs.getTitle());
                        }
                });
        }
-       
+
        public TokenAdapter(Context ctx) {
                tokens.addAll(Token.getTokens(ctx));
                ticker.sendEmptyMessageDelayed(0, 200);
                sort();
        }
        public TokenAdapter(Context ctx) {
                tokens.addAll(Token.getTokens(ctx));
                ticker.sendEmptyMessageDelayed(0, 200);
                sort();
        }
-       
+
        @Override
        public int getCount() {
                return tokens.size();
        @Override
        public int getCount() {
                return tokens.size();
@@ -101,28 +102,29 @@ public class TokenAdapter extends BaseAdapter {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
                final Context ctx = parent.getContext();
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
                final Context ctx = parent.getContext();
-               
+
                if (convertView == null) {
                        switch (getItem(position).getType()) {
                        case HOTP:
                                convertView = View.inflate(ctx, R.layout.hotp, null);
                                break;
                if (convertView == null) {
                        switch (getItem(position).getType()) {
                        case HOTP:
                                convertView = View.inflate(ctx, R.layout.hotp, null);
                                break;
-                               
+
                        case TOTP:
                                convertView = View.inflate(ctx, R.layout.totp, null);
                                break;
                        }
                }
                        case TOTP:
                                convertView = View.inflate(ctx, R.layout.totp, null);
                                break;
                        }
                }
-               
+
                final Token item = getItem(position);
                final TextView code = (TextView) convertView.findViewById(R.id.code);
                final TextView title = (TextView) convertView.findViewById(R.id.title);
                final ImageButton ib = (ImageButton) convertView.findViewById(R.id.button);
                final Token item = getItem(position);
                final TextView code = (TextView) convertView.findViewById(R.id.code);
                final TextView title = (TextView) convertView.findViewById(R.id.title);
                final ImageButton ib = (ImageButton) convertView.findViewById(R.id.button);
-               
+
                code.setText(item.getCurrentTokenValue(ctx, false));
                title.setText(item.getTitle());
                code.setText(item.getCurrentTokenValue(ctx, false));
                title.setText(item.getTitle());
-               
+
                ib.setOnClickListener(new OnClickListener() {
                ib.setOnClickListener(new OnClickListener() {
+                       @Override
                        public void onClick(View v) {
                                String delmsg = ctx.getString(R.string.delete_message);
 
                        public void onClick(View v) {
                                String delmsg = ctx.getString(R.string.delete_message);
 
@@ -132,16 +134,18 @@ public class TokenAdapter extends BaseAdapter {
                                .setIcon(android.R.drawable.ic_delete)
                                .setPositiveButton(R.string.delete,
                                                new DialogInterface.OnClickListener() {
                                .setIcon(android.R.drawable.ic_delete)
                                .setPositiveButton(R.string.delete,
                                                new DialogInterface.OnClickListener() {
+                                                       @Override
                                                        public void onClick(DialogInterface dialog, int which) {
                                                                tokens.remove(tokens.indexOf(item));
                                                                item.remove(ctx);
                                                                notifyDataSetChanged();
                                                                dialog.dismiss();
                                                        }
                                                        public void onClick(DialogInterface dialog, int which) {
                                                                tokens.remove(tokens.indexOf(item));
                                                                item.remove(ctx);
                                                                notifyDataSetChanged();
                                                                dialog.dismiss();
                                                        }
-       
+
                                                })
                                .setNegativeButton(android.R.string.cancel,
                                                new DialogInterface.OnClickListener() {
                                                })
                                .setNegativeButton(android.R.string.cancel,
                                                new DialogInterface.OnClickListener() {
+                                                       @Override
                                                        public void onClick(DialogInterface dialog, int which) {
                                                                dialog.cancel();
                                                        }
                                                        public void onClick(DialogInterface dialog, int which) {
                                                                dialog.cancel();
                                                        }
@@ -154,15 +158,17 @@ public class TokenAdapter extends BaseAdapter {
                case HOTP:
                        ImageButton hotp = (ImageButton) convertView.findViewById(R.id.hotpButton);
                        hotp.setOnClickListener(new OnClickListener() {
                case HOTP:
                        ImageButton hotp = (ImageButton) convertView.findViewById(R.id.hotpButton);
                        hotp.setOnClickListener(new OnClickListener() {
+                               @Override
                                public void onClick(View v) {
                                        code.setText(item.getCurrentTokenValue(ctx, true));
                                }
                        });
                        break;
                                public void onClick(View v) {
                                        code.setText(item.getCurrentTokenValue(ctx, true));
                                }
                        });
                        break;
-                       
+
                case TOTP:
                        ProgressBar pb = (ProgressBar) convertView.findViewById(R.id.totpProgressBar);
                        ticker.set(pb, new Ticker.OnTickListener() {
                case TOTP:
                        ProgressBar pb = (ProgressBar) convertView.findViewById(R.id.totpProgressBar);
                        ticker.set(pb, new Ticker.OnTickListener() {
+                               @Override
                                public void tick(ProgressBar pb) {
                                        int max = pb.getMax();
                                        int pro = item.getProgress();
                                public void tick(ProgressBar pb) {
                                        int max = pb.getMax();
                                        int pro = item.getProgress();
@@ -173,15 +179,15 @@ public class TokenAdapter extends BaseAdapter {
                        });
                        break;
                }
                        });
                        break;
                }
-               
+
                return convertView;
        }
                return convertView;
        }
-       
+
        @Override
        public int getViewTypeCount() {
                return 2;
        }
        @Override
        public int getViewTypeCount() {
                return 2;
        }
-       
+
        @Override
        public int getItemViewType(int position) {
                switch (getItem(position).getType()) {
        @Override
        public int getItemViewType(int position) {
                switch (getItem(position).getType()) {
@@ -193,7 +199,7 @@ public class TokenAdapter extends BaseAdapter {
                        return -1;
                }
        }
                        return -1;
                }
        }
-       
+
        public void add(Context ctx, String uri) throws NoSuchAlgorithmException, TokenUriInvalidException {
                Token t = new Token(uri);
                t.save(ctx);
        public void add(Context ctx, String uri) throws NoSuchAlgorithmException, TokenUriInvalidException {
                Token t = new Token(uri);
                t.save(ctx);