|
|
|
@ -95,6 +95,7 @@ import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -160,7 +161,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
|
|
|
|
|
private final static int REQUEST_CODE_OPEN_NODE = 102;
|
|
|
|
|
private final static int REQUEST_CODE_NEW_NODE = 103;
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
//维护
|
|
|
|
|
@Override
|
|
|
|
|
public Window getWindow() {
|
|
|
|
|
return super.getWindow();
|
|
|
|
@ -171,9 +172,16 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
setContentView(layout.note_list);
|
|
|
|
|
|
|
|
|
|
//维护
|
|
|
|
|
//getWindow().setBackgroundDrawableResource(R.drawable.);
|
|
|
|
|
|
|
|
|
|
Drawable drawable= getResources().getDrawable(list_background);
|
|
|
|
|
BitmapDrawable bd = (BitmapDrawable) drawable;
|
|
|
|
|
Bitmap b = bd.getBitmap();
|
|
|
|
|
File path = new File(getCacheDir() + "/SampleCropImage.jpeg");
|
|
|
|
|
try {
|
|
|
|
|
OutputStream os = new FileOutputStream(path);
|
|
|
|
|
b.compress(Bitmap.CompressFormat.JPEG, 100, os);
|
|
|
|
|
os.close();
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initResources();
|
|
|
|
|
|
|
|
|
@ -184,34 +192,6 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//维护
|
|
|
|
|
static void saveBitmap(String name, Bitmap bm, Context mContext) {
|
|
|
|
|
Log.d("Save Bitmap", "Ready to save picture");
|
|
|
|
|
//指定我们想要存储文件的地址
|
|
|
|
|
String TargetPath = mContext.getFilesDir() + "/images/";
|
|
|
|
|
Log.d("Save Bitmap", "Save Path=" + TargetPath);
|
|
|
|
|
//判断指定文件夹的路径是否存在
|
|
|
|
|
//if (!FileUtils.fileIsExist(TargetPath)) {
|
|
|
|
|
//Log.d("Save Bitmap", "TargetPath isn't exist");
|
|
|
|
|
// } else {
|
|
|
|
|
//如果指定文件夹创建成功,那么我们则需要进行图片存储操作
|
|
|
|
|
File saveFile = new File(TargetPath, name);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
FileOutputStream saveImgOut = new FileOutputStream(saveFile);
|
|
|
|
|
// compress - 压缩的意思
|
|
|
|
|
bm.compress(Bitmap.CompressFormat.JPEG, 80, saveImgOut);
|
|
|
|
|
//存储完成后需要清除相关的进程
|
|
|
|
|
saveImgOut.flush();
|
|
|
|
|
saveImgOut.close();
|
|
|
|
|
Log.d("Save Bitmap", "The picture is save to your phone!");
|
|
|
|
|
} catch (IOException ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//维护
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//维护
|
|
|
|
|
@Override
|
|
|
|
@ -222,24 +202,16 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
|
|
|
|
|
if(sharedPreferences.getInt("DEFAULT",0)==1)
|
|
|
|
|
getWindow().setBackgroundDrawableResource(R.drawable.list_background);
|
|
|
|
|
else{
|
|
|
|
|
Uri selectedImage= Uri.parse(sharedPreferences.getString("PERSONAL_URI",null));
|
|
|
|
|
|
|
|
|
|
Bitmap bitmap = BitmapFactory.decodeFile(selectedImage.toString());
|
|
|
|
|
|
|
|
|
|
//Toast.makeText(this, URi, Toast.LENGTH_SHORT).show();
|
|
|
|
|
|
|
|
|
|
Bitmap bitmap = BitmapFactory.decodeFile(getCacheDir() + "/SampleCropImage.jpeg");
|
|
|
|
|
Drawable drawable =new BitmapDrawable(bitmap);
|
|
|
|
|
getWindow().setBackgroundDrawable(drawable);
|
|
|
|
|
Bitmap bitmap0 = BitmapFactory.decodeFile(selectedImage.toString());
|
|
|
|
|
|
|
|
|
|
//Toast.makeText(this, URi, Toast.LENGTH_SHORT).show();
|
|
|
|
|
//Toast.makeText(this, "failed to get image", Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
getWindow().setBackgroundDrawableResource(R.drawable.list_background);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//else
|
|
|
|
|
//Toast.makeText(this, "failed to get image", Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|