Showing last repo scan at bottom of repo list

This commit is contained in:
Michele Azzolari 2012-09-28 11:01:25 +02:00
parent 8993391b56
commit 5a5a632778
3 changed files with 55 additions and 13 deletions

View File

@ -1,18 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView android:id="@android:id/list"
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
android:layout_height="wrap_content"
android:layout_above="@+id/lastUpdateCheckCnt"
android:layout_alignParentTop="true" />
<TextView android:id="@android:id/empty"
<TextView
android:id="@android:id/empty"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:layout_height="200px"
android:layout_height="200dp"
android:text="@string/no_repo" />
<LinearLayout
android:id="@+id/lastUpdateCheckCnt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="bottom"
android:orientation="horizontal" >
<TextView
android:id="@+id/lastUpdateCheck"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="12sp" />
</LinearLayout>
<!--
</RelativeLayout><!--
* Copyright (C) 2009 Roberto Jacinto
* roberto.jacinto@caixamagica.pt
*

View File

@ -19,6 +19,8 @@
<string name="notify_updates_available">Notify when new updates are available</string>
<string name="update_apps_list">Update app list from repositories automatically
</string>
<string name="last_update_check">Last repo scan: %s</string>
<string name="never">never</string>
<string name="automatic_repo_scan">Automatic repo scan</string>
<string name="app_name">F-Droid</string>
<string name="about_title">About F-Droid</string>

View File

@ -21,6 +21,7 @@ package org.fdroid.fdroid;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Date;
import java.util.Formatter;
import java.util.HashMap;
import java.util.List;
@ -28,11 +29,14 @@ import java.util.Map;
import java.util.Vector;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.app.AlertDialog.Builder;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@ -41,6 +45,7 @@ import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
public class ManageRepo extends ListActivity {
@ -57,6 +62,20 @@ public class ManageRepo extends ListActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.repolist);
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
TextView tv_lastCheck = (TextView)findViewById(R.id.lastUpdateCheck);
long lastUpdate = prefs.getLong("lastUpdateCheck", 0);
String s_lastUpdateCheck = "";
if(lastUpdate == 0) {
s_lastUpdateCheck = getString(R.string.never);
} else {
Date d = new Date(lastUpdate);
s_lastUpdateCheck = DateFormat.getDateFormat(this).format(d) +
" " + DateFormat.getTimeFormat(this).format(d);
}
tv_lastCheck.setText(getString(R.string.last_update_check,s_lastUpdateCheck));
}
@Override