sdm660-common: XiaomiParts: Add a preview image to kcal

This commit is contained in:
Stylogey 2019-10-19 19:04:14 +02:00 committed by Max Weffers
parent d9cde63c35
commit 197013de2e
No known key found for this signature in database
GPG key ID: 795F73D22FB93FAE
3 changed files with 21 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 KiB

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="160dp"
android:scaleType="centerCrop"
android:src="@drawable/preview" />
<LinearLayout
android:id="@+id/fragment_kcal"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View file

@ -32,12 +32,13 @@ public class KCalSettingsActivity extends Activity implements Utils {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_kcal);
Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content);
Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_kcal);
if (fragment == null) {
mKCalSettingsFragment = new KCalSettings();
getFragmentManager().beginTransaction()
.add(android.R.id.content, mKCalSettingsFragment)
.add(R.id.fragment_kcal, mKCalSettingsFragment)
.commit();
} else {
mKCalSettingsFragment = (KCalSettings) fragment;