Collapse header if the device has no touchscreen

The header can't be collpased without a touchscreen, so collapse
it if we detect that the current device has no touchscreen.
This commit is contained in:
Gabriele M
2017-07-17 12:25:49 +02:00
parent 1af40da839
commit 1f0aa4e79b
2 changed files with 10 additions and 0 deletions

View File

@@ -138,6 +138,11 @@ public class UpdatesActivity extends AppCompatActivity {
}
}
});
if (!Utils.hasTouchscreen(this)) {
// This can't be collapsed without a touchscreen
appBar.setExpanded(false);
}
}
@Override

View File

@@ -17,6 +17,7 @@ package org.lineageos.updater.misc;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@@ -280,4 +281,8 @@ public class Utils {
zipFile.close();
return isAB;
}
public static boolean hasTouchscreen(Context context) {
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN);
}
}