Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home screen widget #100

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

ericbrandwein
Copy link

Adds a widget that shows a list of the current tokens. I saw this feature in the Authy app and I liked it, so I decided to add it here.

  • Press each token to reveal its code, and copy it to clipboard
  • Press it again to hide it
  • Press the title to open the app

Fixes #26.

screenshot_20170419-010301

@npmccallum
Copy link
Contributor

@ericbrandwein Can you rebase this patch? Thanks!

@ericbrandwein
Copy link
Author

Done! If you want to change something about the widget, please let me know, or merge this to a temporary branch and edit it from there.

@psav
Copy link

psav commented Nov 20, 2017

Something I'd love is the ability like on the phone app where you can drag a shortcut for dialing a specific user, I'd love to be able to drag a specific shortcut for a particular code onto the home screen, where I can then click it and it will just pop up a notification with my code.

@npmccallum
Copy link
Contributor

@ericbrandwein This PR causes one of our tests to fail. Can you please address that?

Copy link

@olivierperez olivierperez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You PR is quite good, I've made some comments you should consider before being merged.

import android.widget.Toast;

/**
* Created by root on 18/04/17.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not root of this project 😄

import java.util.Set;

/**
* Created by root on 17/04/17.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not root again.

import java.io.IOException;

/**
* Created by root on 13/04/17.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

root again

final RemoteViews row = new RemoteViews(context.getPackageName(), R.layout.widget_row);

try {
Bitmap b = Picasso.with(context).load(token.getImage()).get();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This not how to use Picasso. Calling .get() will block the thread instead of taking advantage of assynchronous call of Picasso.

You may:

  • use .error(R.drawable.logo) to handle the error (don't use try-catch when Picassso does it for you)
  • use .into(row, R.id.widget_image, ...) to put the loaded image in the imageview

android:layout_gravity="center_vertical"
android:textColor="@android:color/white"
android:layout_height="wrap_content"
android:text="@string/app_name"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use drawableLeft directly in TextView instead of Linear+ImageView+TextView to draw a drawable on the left ?

This was referenced Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants