示例#1
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setHasOptionsMenu(true);
   mappedCategoriesPerGroup = new SparseBooleanArray();
   mAccount = Account.getInstanceFromDb(getArguments().getLong(KEY_ACCOUNTID));
   if (mAccount == null) {
     return;
   }
   mGrouping = mAccount.grouping;
   mType = mAccount.type;
   mCurrency = mAccount.currency.getCurrencyCode();
   mOpeningBalance = mAccount.openingBalance.getAmountMinor();
   aObserver = new AccountObserver(new Handler());
   ContentResolver cr = getActivity().getContentResolver();
   localizedTimeFormat = android.text.format.DateFormat.getTimeFormat(getActivity());
   // when account has changed, we might have
   // 1) to refresh the list (currency has changed),
   // 2) update current balance(opening balance has changed),
   // 3) update the bottombarcolor (color has changed)
   // 4) refetch grouping cursor (grouping has changed)
   cr.registerContentObserver(TransactionProvider.ACCOUNTS_URI, true, aObserver);
 }
示例#2
0
 public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) {
   super(context, layout, c, from, to, flags);
   dateEms = android.text.format.DateFormat.is24HourFormat(context) ? 3 : 4;
 }