fix article timestamp in headlines displayed in UTC
use custom back button handling to prevent backstack idiocy
This commit is contained in:
parent
50810d0246
commit
8c19ec257c
@ -7,6 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
|
||||
@ -26,7 +27,6 @@ import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ToggleButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
@ -339,6 +339,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener {
|
||||
if (dv != null) {
|
||||
Date d = new Date((long)article.updated * 1000);
|
||||
DateFormat df = new SimpleDateFormat("MMM dd, HH:mm");
|
||||
df.setTimeZone(TimeZone.getDefault());
|
||||
dv.setText(df.format(d));
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
@ -175,6 +176,22 @@ public class MainActivity extends Activity implements FeedsFragment.OnFeedSelect
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
Log.d(TAG, "Overriding back button");
|
||||
|
||||
if (m_selectedArticle != null) {
|
||||
closeArticle();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
Loading…
Reference in New Issue
Block a user