Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.res.Resources;
import android.text.format.*;
import java.nio.CharBuffer;

public class Main {
    private static int sAmPmIndex[];

    private static void getFormatTime(Context context, Time time, int i, boolean flag, CharBuffer charbuffer) {
        long l = time.toMillis(true);
        boolean flag1;
        if ((i & 1) != 0)
            flag1 = true;
        else
            flag1 = false;
        if (flag)
            charbuffer.append(DateUtils.formatDateRange(context, l, l, i));
        else if (flag1) {
            if ((i ^ 1) != 0) {
                charbuffer.append(DateUtils.formatDateRange(context, l, l, i ^ 1));
                charbuffer.append(" ");
            }
            String s = getDetailedAmPm(time.hour);
            if (time.hour > 12)
                time.hour = -12 + time.hour;
            long l1 = time.toMillis(true);
            String s1 = DateUtils.formatDateRange(context, l1, l1, 129);
            Resources resources = Resources.getSystem();
            Object aobj[] = new Object[2];
            aobj[0] = s1;
            aobj[1] = s;
            charbuffer.append(resources.getString(0x60c01f7, aobj));
        } else {
            charbuffer.append(DateUtils.formatDateRange(context, l, l, i));
        }
    }

    private static String getDetailedAmPm(int i) {
        if (sAmPmIndex == null) {
            sAmPmIndex = new int[24];
            int ai[] = Resources.getSystem().getIntArray(0x606000a);
            int j = 23;
            for (int k = -1 + ai.length; j >= 0 && k >= 0; j--) {
                if (j < ai[k])
                    k--;
                sAmPmIndex[j] = k;
            }

        }
        return Resources.getSystem().getStringArray(0x606000b)[sAmPmIndex[i]];
    }
}