Skip to content

Commit

Permalink
Fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
DA-XIA committed May 31, 2017
1 parent 16ec156 commit 3c274d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ protected Integer doInBackground(Long... params) {
@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
progressDialog.dismiss();
if (result == SaveDiaryTask.RESULT_INSERT_SUCCESSFUL) {
Toast.makeText(mContext, mContext.getString(R.string.toast_diary_insert_successful), Toast.LENGTH_LONG).show();
callBack.onDiarySaved();
} else {
Toast.makeText(mContext, mContext.getString(R.string.toast_diary_insert_fail), Toast.LENGTH_LONG).show();
}
progressDialog.dismiss();
callBack.onDiarySaved();
}

private void savePhoto(String filename) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth
setDiaryTime();
TimePickerFragment timePickerFragment = TimePickerFragment.newInstance(calendar.getTimeInMillis());
timePickerFragment.setOnTimeSetListener(this);
timePickerFragment.show(getFragmentManager(), "timePickerFragment");
timePickerFragment.show(getActivity().getSupportFragmentManager(), "timePickerFragment");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import android.content.res.Resources;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;

import java.text.DecimalFormat;

/**
* Created by daxia on 2016/9/23.
*/
Expand All @@ -21,8 +20,8 @@ public class ScreenHelper {
public static float getScreenRatio(Activity activity) {
DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
DecimalFormat mDecimalFormat = new DecimalFormat("#.##");
float ScreenRatio = Float.valueOf(mDecimalFormat.format(metrics.heightPixels / metrics.widthPixels));
float ScreenRatio = (float) metrics.heightPixels / (float) metrics.widthPixels;
Log.e("Test", "screenRation = " + ScreenRatio);
return ScreenRatio;
}

Expand Down

0 comments on commit 3c274d9

Please sign in to comment.