反编译现有的Android应用程序

时间:2016-05-30 11:20:28

标签: java android reverse-engineering

我正在尝试反编译现有的Android应用程序。反编译后,会发生许多错误。如何修复整数值?

  

calendar.set(5,mDatePicker.getDayOfMonth());

     

calendar.set(2,mDatePicker.getMonth());

     

calendar.set(1,mDatePicker.getYear());

     

calendar.set(11,mTimePicker.getCurrentHour()的intValue());

     

calendar.set(12,mTimePicker.getCurrentMinute()的intValue());

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.DatePicker;
import android.widget.TimePicker;
import android.widget.Toast;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

public class DateTimePicker implements OnClickListener {
    private SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm", Locale.getDefault());
    private Dialog dialog;
    private Context mContext;
    private Calendar mCurrentDate;
    private DatePicker mDatePicker;
    private Calendar mMinimumDate;
    private TimePicker mTimePicker;
    private DatePickerListener<Calendar> pickerListener;

    public DateTimePicker(Context context, Calendar minimum, Calendar current, DatePickerListener<Calendar> listener) {
        mContext = context;
        mMinimumDate = minimum;
        mCurrentDate = current;
        pickerListener = listener;
        initializeView();
    }

    private void initializeView() {
        dialog = new Dialog(mContext);
        dialog.requestWindowFeature(1);
        dialog.setContentView(R.layout.dialog_date_time_picker);
        mDatePicker = (DatePicker) dialog.findViewById(R.id.datePicker2);
        mTimePicker = (TimePicker) dialog.findViewById(R.id.timePicker);
        Calendar calendar = Calendar.getInstance();
        if (calendar.get(5) == mMinimumDate.get(5) && calendar.get(2) == mMinimumDate.get(2)) {
            mDatePicker.setMinDate(System.currentTimeMillis() - 1000);
        } else {
            mDatePicker.setMinDate(mMinimumDate.getTimeInMillis());
        }
        mDatePicker.updateDate(mCurrentDate.get(1), mCurrentDate.get(2), mCurrentDate.get(5));
        mTimePicker.setIs24HourView(Boolean.valueOf(true));
        mTimePicker.setCurrentHour(Integer.valueOf(mCurrentDate.get(11)));
        mTimePicker.setCurrentMinute(Integer.valueOf(mCurrentDate.get(12)));
        dialog.findViewById(R.id.btn_cancel).setOnClickListener(this);
        dialog.findViewById(R.id.btn_ok).setOnClickListener(this);
    }

    public void show() {
        dialog.show();
    }

    public void onClick(View v) {
        if (v.getId() == R.id.btn_cancel) {
            dialog.dismiss();
            return;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.set(5, mDatePicker.getDayOfMonth());
        calendar.set(2, mDatePicker.getMonth());
        calendar.set(1, mDatePicker.getYear());
        calendar.set(11, mTimePicker.getCurrentHour().intValue());
        calendar.set(12, mTimePicker.getCurrentMinute().intValue());
        if (mMinimumDate.getTimeInMillis() > calendar.getTimeInMillis()) {
            Toast.makeText(mContext, "Date should be greater than " + dateFormat.format(mMinimumDate.getTime()), 1).show();
            return;
        }
        pickerListener.onDateSelected(calendar);
        dialog.dismiss();
    }
}

0 个答案:

没有答案