Added empty text to ListView.

This commit is contained in:
Felix Ableitner 2014-07-24 19:06:24 +02:00
parent 03fa8133ab
commit 3f42575484
4 changed files with 23 additions and 5 deletions

View file

@ -58,7 +58,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

View file

@ -5,6 +5,7 @@ import android.app.ListActivity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView;
import java.util.List; import java.util.List;
@ -12,8 +13,6 @@ import eu.chainfire.libsuperuser.Shell;
public class MainActivity extends ListActivity { public class MainActivity extends ListActivity {
private ListView mListView;
private CertificateAdapter mCertificateAdapter; private CertificateAdapter mCertificateAdapter;
private CertificateManager mCertificateManager; private CertificateManager mCertificateManager;
@ -31,14 +30,14 @@ public class MainActivity extends ListActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mListView = getListView(); setContentView(R.layout.main_activity);
mCertificateManager = new CertificateManager(); mCertificateManager = new CertificateManager();
mMovedCertificatesStorage = new MovedCertificatesStorage(this); mMovedCertificatesStorage = new MovedCertificatesStorage(this);
mCertificateAdapter = mCertificateAdapter =
new CertificateAdapter(this, mCertificateManager, mMovedCertificatesStorage); new CertificateAdapter(this, mCertificateManager, mMovedCertificatesStorage);
mCertificateAdapter.onCertificateChanged(); mCertificateAdapter.onCertificateChanged();
mCertificateManager.setOnCertificateChangedListener(mCertificateAdapter); mCertificateManager.setOnCertificateChangedListener(mCertificateAdapter);
mListView.setAdapter(mCertificateAdapter); setListAdapter(mCertificateAdapter);
mMoveCertificatesDialog = new AlertDialog.Builder(this) mMoveCertificatesDialog = new AlertDialog.Builder(this)
.setTitle(R.string.dialog_move_certs_title) .setTitle(R.string.dialog_move_certs_title)

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cert_list_empty"
android:layout_centerInParent="true" />
</RelativeLayout>

View file

@ -15,4 +15,6 @@
<string name="dialog_no_root_message">This app requires root access to work. Make sure your device is rooted and try again.</string> <string name="dialog_no_root_message">This app requires root access to work. Make sure your device is rooted and try again.</string>
<string name="cert_list_empty">No certificates found. Please install a certificate to use this app.</string>
</resources> </resources>