Skip to content

Commit 206344c

Browse files
authored
Merge pull request #80 from git03-Nguyen/dev
Dev
2 parents 8712f2b + 664771b commit 206344c

File tree

8 files changed

+21
-29
lines changed

8 files changed

+21
-29
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
android:required="false" />
88

99
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
10-
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
11-
<uses-permission android:name="android.permission.SET_WALLPAPER" />
1210
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
11+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
1312
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
14-
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> <!-- Other permissions... -->
13+
<!-- Other permissions... -->
14+
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
15+
<uses-permission android:name="android.permission.SET_WALLPAPER" />
1516
<uses-permission android:name="android.permission.INTERNET" />
1617
<uses-permission android:name="android.permission.CAMERA" />
1718
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

app/src/main/java/edu/team08/infinitegallery/main/MainActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ public static void setWindowFlag(Activity activity, final int bits, boolean on)
144144
public void changeStatusBar() {
145145
runOnUiThread(() -> {
146146
if (currentFragment instanceof PhotosFragment) {
147-
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
147+
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
148+
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
148149
setWindowFlag(this, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
149150
getWindow().setStatusBarColor(Color.TRANSPARENT);
150151
} else {

app/src/main/java/edu/team08/infinitegallery/optionphotos/PhotosAdapter.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
public class PhotosAdapter extends RecyclerView.Adapter<PhotosAdapter.ViewHolder> {
4242
private final Context context;
43-
private SparseBooleanArray selectedItemsIds;
43+
private SparseBooleanArray selectedItemsMap;
4444
private List<File> allPhotos;
4545
private final int spanCount;
4646
private boolean selectionMode;
@@ -71,7 +71,7 @@ public PhotosAdapter(Context context, List<File> allPhotos, int spanCount) {
7171
this.context = context;
7272
this.allPhotos = allPhotos;
7373

74-
selectedItemsIds = new SparseBooleanArray();
74+
selectedItemsMap = new SparseBooleanArray();
7575
this.spanCount = spanCount;
7676
this.selectionMode = false;
7777
this.selectedAll = false;
@@ -180,10 +180,10 @@ public void onClick(View v) {
180180
}
181181

182182
if (selectedAll) {
183-
selectedItemsIds.put(position, true);
183+
selectedItemsMap.put(position, true);
184184
}
185185

186-
if(selectedItemsIds.get(position)) {
186+
if(selectedItemsMap.get(position)) {
187187
holder.itemView.setBackgroundColor(0x993BF566);
188188
holder.checkbox.setVisibility(View.VISIBLE);
189189
holder.checkbox.setChecked(true);
@@ -216,43 +216,43 @@ public boolean getSelectionMode() {
216216
}
217217

218218
public void toggleSelection(int position) {
219-
if (selectedItemsIds.get(position)) {
220-
selectedItemsIds.delete(position);
219+
if (selectedItemsMap.get(position)) {
220+
selectedItemsMap.delete(position);
221221
} else {
222-
selectedItemsIds.put(position, true);
222+
selectedItemsMap.put(position, true);
223223
}
224224
notifyItemChanged(position);
225225
((MainCallbacks) context).onEmitMsgFromFragToMain("NUMBER OF SELECTIONS", String.valueOf(getSelectionsCount()));
226226
}
227227

228228
@SuppressLint("NotifyDataSetChanged")
229229
public void selectAll() {
230-
selectedItemsIds.clear();
230+
selectedItemsMap.clear();
231231
selectedAll = true;
232232
notifyDataSetChanged();
233233
}
234234

235235
@SuppressLint("NotifyDataSetChanged")
236236
public void unSelectAll() {
237-
selectedItemsIds.clear();
237+
selectedItemsMap.clear();
238238
selectedAll = false;
239239
notifyDataSetChanged();
240240
}
241241

242242
@SuppressLint("NotifyDataSetChanged")
243243
public void removeAllSelections() {
244-
selectedItemsIds.clear();
244+
selectedItemsMap.clear();
245245
notifyDataSetChanged();
246246
}
247247

248248
//Get total selected count
249249
public int getSelectionsCount() {
250-
return selectedItemsIds.size();
250+
return selectedItemsMap.size();
251251
}
252252

253253
//Return all selected ids
254254
public SparseBooleanArray getSelectedIds() {
255-
return selectedItemsIds;
255+
return selectedItemsMap;
256256
}
257257

258258

app/src/main/java/edu/team08/infinitegallery/singlephoto/ViewPagerAdapter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.view.View;
1010
import android.view.ViewGroup;
1111
import android.widget.FrameLayout;
12-
import android.widget.Toast;
1312

1413
import androidx.annotation.NonNull;
1514
import androidx.viewpager.widget.PagerAdapter;
@@ -18,7 +17,6 @@
1817

1918
import java.io.File;
2019
import java.io.FileInputStream;
21-
import java.io.FileNotFoundException;
2220
import java.io.IOException;
2321
import java.io.InputStream;
2422
import java.util.HashMap;
@@ -45,7 +43,7 @@ public ViewPagerAdapter(Context context, File[] photoFiles){
4543
static private Drawable getDrawable(String key){
4644
if(!cache.containsKey(key)){
4745
if (context instanceof SingleTrashActivity) {
48-
cache.put(key, new BitmapDrawable(context.getResources(), new TrashBinManager(context).decryptPhoto(new File(key))));
46+
cache.put(key, new BitmapDrawable(context.getResources(), new TrashBinManager(context).getTrashBitmap(new File(key))));
4947
} else {
5048
cache.put(key, Drawable.createFromPath(key));
5149
}

app/src/main/java/edu/team08/infinitegallery/trashbin/TrashAdapter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import android.widget.CheckBox;
1515
import android.widget.FrameLayout;
1616
import android.widget.ImageView;
17-
import android.widget.RelativeLayout;
1817
import android.widget.TextView;
1918

2019
import androidx.annotation.NonNull;
@@ -78,7 +77,7 @@ public void onBindViewHolder(@NonNull TrashAdapter.ViewHolder holder, @SuppressL
7877
// Set item to the ImageView using Glide library
7978
// holder.imageItem.setImageDrawable(Drawable.createFromPath(picturePath));
8079
Glide.with(context)
81-
.load(trashBinManager.decryptPhoto(trash))
80+
.load(trashBinManager.getTrashBitmap(trash))
8281
.placeholder(R.drawable.img_image_placeholder)
8382
.into(holder.imageItem);
8483
holder.imageItem.setOnClickListener(new View.OnClickListener() {

app/src/main/java/edu/team08/infinitegallery/trashbin/TrashBinManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import androidx.security.crypto.EncryptedFile;
1212
import androidx.security.crypto.MasterKey;
1313

14-
import java.io.ByteArrayOutputStream;
1514
import java.io.File;
1615
import java.io.FileInputStream;
1716
import java.io.FileOutputStream;
@@ -341,7 +340,7 @@ public List<File> checkAndCleanTrashBin() {
341340

342341
}
343342

344-
public Bitmap decryptPhoto(File src) {
343+
public Bitmap getTrashBitmap(File src) {
345344

346345
Bitmap myBitmap = null;
347346
MasterKey mainKey = null;

app/src/main/res/values-night/themes.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@
7373
<style name="Theme.MyTheme.AllPhotosTheme" parent="Theme.MyTheme">
7474
<item name="android:textColorSecondary">@color/white</item>
7575
<item name="android:windowTranslucentStatus">true</item>
76-
77-
7876
</style>
7977

8078
</resources>

app/src/main/res/values/themes.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<!-- Status bar color. -->
1616
<item name="android:windowLightStatusBar">true</item>
1717
<item name="android:statusBarColor">@color/gray_trans</item>
18-
1918
<item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
2019

2120
<item name="colorTertiary">@color/gray</item>
@@ -72,9 +71,6 @@
7271
<item name="android:textColorSecondary">@color/white</item>
7372
<item name="android:windowTranslucentStatus">true</item>
7473
<item name="android:windowLightStatusBar">false</item>
75-
76-
77-
7874
</style>
7975

8076
</resources>

0 commit comments

Comments
 (0)