1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-26 09:48:46 +00:00

Better position long press help texts, long press icon shows about

This commit is contained in:
M66B 2016-02-19 11:07:04 +01:00
parent ca85cad3af
commit 4ac98761bc

View file

@ -135,12 +135,25 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
// Icon, no title
getSupportActionBar().setTitle(null);
ivIcon.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
menu_about();
return true;
}
});
// Netguard is busy
ivQueue.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
int location[] = new int[2];
actionView.getLocationOnScreen(location);
Toast toast = Toast.makeText(ActivityMain.this, R.string.msg_queue, Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP, actionView.getLeft(), actionView.getBottom());
toast.setGravity(
Gravity.TOP | Gravity.LEFT,
location[0] + ivQueue.getLeft(),
Math.round(location[1] + ivQueue.getBottom() - toast.getView().getPaddingTop()));
toast.show();
return true;
}
@ -207,8 +220,13 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
ivMetered.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
int location[] = new int[2];
actionView.getLocationOnScreen(location);
Toast toast = Toast.makeText(ActivityMain.this, R.string.msg_metered, Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP, actionView.getLeft(), actionView.getBottom());
toast.setGravity(
Gravity.TOP | Gravity.LEFT,
location[0] + ivMetered.getLeft(),
Math.round(location[1] + ivMetered.getBottom() - toast.getView().getPaddingTop()));
toast.show();
return true;
}