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:
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user