Skip to content
This repository has been archived by the owner on Sep 8, 2019. It is now read-only.

Commit

Permalink
- new Icon
Browse files Browse the repository at this point in the history
- fixed crash, when opening the FileExplorer
  • Loading branch information
kollerlukas committed Mar 11, 2017
1 parent 5f8b0e5 commit 6a5a8fa
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public static boolean isPathPermanentlyExcluded(String path) {
}

public static boolean searchDir(String path) {
if (path == null) {
return false;
}
boolean search = true;
for (int i = 0; i < Provider.permanentlyExcludedPaths.length; i++) {
if (path.contains(Provider.permanentlyExcludedPaths[i])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ public static StorageRoot[] loadRoots(Activity context) {
ArrayList<StorageRoot> temp = new ArrayList<>();

StorageRoot externalStorage
= new StorageRoot(Environment.getExternalStorageDirectory().getPath());
= new StorageRoot(Environment
.getExternalStorageDirectory().getPath());
externalStorage.setName(context.getString(R.string.storage));
temp.add(externalStorage);

Expand All @@ -145,14 +146,17 @@ public void loadDir(final Activity context, String dirPath,

threads = new ArrayList<>();

AdaptableThread.Callback adaptableThreadCallback = new AdaptableThread.Callback() {
AdaptableThread.Callback adaptableThreadCallback
= new AdaptableThread.Callback() {
@Override
public void done(AdaptableThread thread, ItemLoader.Result result,
ArrayList<File> filesToSearch) {
File_POJO files = result.files;
boolean filesContainMedia = false;
for (int i = 0; i < files.getChildren().size(); i++) {
if (MediaType.isMedia(context, files.getChildren().get(i).getPath())) {
if (files.getChildren().get(i) != null &&
MediaType.isMedia(context,
files.getChildren().get(i).getPath())) {
filesContainMedia = true;
break;
}
Expand Down Expand Up @@ -205,12 +209,15 @@ private static File[] getRemovableStorageRoots(Context context) {
ArrayList<File> rootsArrayList = new ArrayList<>();

for (int i = 0; i < roots.length; i++) {
String path = roots[i].getPath();
int index = path.lastIndexOf("/Android/data/");
if (index > 0) {
path = path.substring(0, index);
if (!path.equals(Environment.getExternalStorageDirectory().getPath())) {
rootsArrayList.add(new File(path));
if (roots[i] != null) {
String path = roots[i].getPath();
int index = path.lastIndexOf("/Android/data/");
if (index > 0) {
path = path.substring(0, index);
if (!path.equals(Environment
.getExternalStorageDirectory().getPath())) {
rootsArrayList.add(new File(path));
}
}
}
}
Expand All @@ -226,7 +233,8 @@ private static File[] getDirectoriesToSearch(Context context) {
File[] dirs = dir.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return Provider.searchDir(file.getPath());
return file != null
&& Provider.searchDir(file.getPath());
}
});

Expand All @@ -235,7 +243,8 @@ public boolean accept(File file) {
temp.addAll(Arrays.asList(dirs));
File[] removableStorageRoots = getRemovableStorageRoots(context);
for (int i = 0; i < removableStorageRoots.length; i++) {
Log.d("StorageRetriever", "removableStorageRoot: " + removableStorageRoots[i].getPath());
Log.d("StorageRetriever", "removableStorageRoot: "
+ removableStorageRoots[i].getPath());
File root = removableStorageRoots[i];
File[] files = root.listFiles();
if (files != null) {
Expand Down
22 changes: 19 additions & 3 deletions app/src/main/java/us/koller/cameraroll/ui/AboutActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package us.koller.cameraroll.ui;

import android.app.ActivityManager;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.PorterDuff;
import android.os.Build;
import android.os.Bundle;
Expand Down Expand Up @@ -59,7 +62,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

ImageView headerImage = (ImageView) findViewById(R.id.header_image);
Glide.with(this)
.load("http://koller.us/Lukas/camera_roll/logo_guidelines.png")
.load("http://koller.us/Lukas/camera_roll/new_logo.png")
.into(headerImage);

TextView version = (TextView) findViewById(R.id.version);
Expand Down Expand Up @@ -137,10 +140,10 @@ public void onGlobalLayout() {
toolbar.getPaddingEnd(),
toolbar.getPaddingBottom());

aboutText.setPadding(aboutText.getPaddingStart(),
/*aboutText.setPadding(aboutText.getPaddingStart(),
aboutText.getPaddingTop(),
aboutText.getPaddingEnd(),
aboutText.getPaddingBottom() + windowInsets[3]);
aboutText.getPaddingBottom() + windowInsets[3]);*/

View viewGroup = findViewById(R.id.swipeBackView);
ViewGroup.MarginLayoutParams viewGroupParams
Expand All @@ -162,6 +165,10 @@ public void onGlobalLayout() {
}
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setupTaskDescription();
}

setSystemUiFlags();
}

Expand All @@ -173,6 +180,15 @@ private void setSystemUiFlags() {
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void setupTaskDescription() {
Bitmap overviewIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_round);
setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.app_name),
overviewIcon,
ContextCompat.getColor(this, R.color.colorPrimary)));
overviewIcon.recycle();
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/us/koller/cameraroll/ui/AlbumActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -880,10 +880,10 @@ public void onSaveInstanceState(Bundle outState) {

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void setupTaskDescription() {
Bitmap overviewIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
Bitmap overviewIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_round);
setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.app_name),
overviewIcon,
ContextCompat.getColor(this, R.color.colorAccent)));
ContextCompat.getColor(this, R.color.colorPrimary)));
overviewIcon.recycle();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.ActivityManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.os.Build;
Expand Down Expand Up @@ -244,6 +247,10 @@ public boolean onPreDraw() {
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setupTaskDescription();
}

//load files
if (savedInstanceState != null
&& savedInstanceState.containsKey(CURRENT_DIR)
Expand Down Expand Up @@ -359,6 +366,15 @@ public void run() {
filesProvider.loadDir(this, path, callback);
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void setupTaskDescription() {
Bitmap overviewIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_round);
setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.app_name),
overviewIcon,
ContextCompat.getColor(this, R.color.colorPrimary)));
overviewIcon.recycle();
}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Expand Down
22 changes: 13 additions & 9 deletions app/src/main/java/us/koller/cameraroll/ui/ItemActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ public void onGlobalLayout() {

VideoViewHolder.onBottomInset(windowInsets);

rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
rootView.getViewTreeObserver()
.removeOnGlobalLayoutListener(this);
}
});
}
Expand All @@ -353,11 +354,10 @@ public void onGlobalLayout() {
setupTaskDescription();
}

if (view_only || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
if (view_only
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
|| savedInstanceState != null) {
albumItem.isSharedElement = false;
}

if (view_only || savedInstanceState != null) {
//config was changed
//skipping sharedElement transition
((ViewPagerAdapter) viewPager.getAdapter())
Expand All @@ -374,6 +374,10 @@ public boolean onInstantiateItem(ViewHolder viewHolder) {
}
});
}

/*if (view_only || savedInstanceState != null) {
}*/
}

@Override
Expand Down Expand Up @@ -755,11 +759,11 @@ public void run() {

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void setupTaskDescription() {
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
Bitmap overviewIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_round);
setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.app_name),
icon,
ContextCompat.getColor(this, R.color.colorAccent)));
icon.recycle();
overviewIcon,
ContextCompat.getColor(this, R.color.colorPrimary)));
overviewIcon.recycle();
}


Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/us/koller/cameraroll/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
Expand Down Expand Up @@ -369,10 +370,10 @@ public boolean onOptionsItemSelected(MenuItem item) {

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void setupTaskDescription() {
Bitmap overviewIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
Bitmap overviewIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_round);
setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.app_name),
overviewIcon,
ContextCompat.getColor(this, R.color.colorAccent)));
ContextCompat.getColor(this, R.color.colorPrimary)));
overviewIcon.recycle();
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/album_cover.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:layout_margin="16dp">

<TextView
Expand Down
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified camera_roll_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6a5a8fa

Please sign in to comment.