Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
import android.widget.Toast;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;

import link.standen.michael.slideshow.listener.OnSwipeTouchListener;
import link.standen.michael.slideshow.model.FileItem;
Expand Down Expand Up @@ -67,6 +70,7 @@ public class ImageActivity extends BaseActivity implements ImageStrategy.ImageSt
private static boolean SKIP_LONG_LOAD;
private static boolean PRELOAD_IMAGES;
private static boolean DELETE_WARNING;
private static boolean SHOW_CLOCK;

private static final int LOCATION_DETAIL_MAX_LENGTH = 35;

Expand All @@ -76,6 +80,7 @@ public class ImageActivity extends BaseActivity implements ImageStrategy.ImageSt
private static final int LONG_LOAD_WARNING_DELAY = 5000;
private View snackbarPlayingView;
private View snackbarStoppedView;
private View clockText;
private boolean isLoading = false;
private Snackbar loadingSnackbar = null;
private final Handler loadingHandler = new Handler();
Expand Down Expand Up @@ -129,6 +134,22 @@ public void run() {
}
};

private static final int CLOCK_REFRESH_INT = 1000;
private final Handler clockHandler = new Handler();
private final Runnable clockRunnable = new Runnable() {
public void run() {
clockHandler.postDelayed(clockRunnable, CLOCK_REFRESH_INT);
SimpleDateFormat clockFormat = new SimpleDateFormat("hh:mm aa");
Date currentTime = Calendar.getInstance().getTime();
TextView t = (TextView) clockText;
String clockString = clockFormat.format(currentTime);
if(clockString.substring(0,1).equals("0")){
clockString = clockString.substring(1);
}
t.setText(clockString);
}
};

/**
* Some older devices needs a small delay between UI widget updates
* and a change of the status and navigation bar.
Expand Down Expand Up @@ -194,6 +215,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

mVisible = true;
clockText = findViewById(R.id.clockText);
mControlsView = findViewById(R.id.fullscreen_content_controls);
mContentView = findViewById(R.id.fullscreen_content);
mDetailsView = findViewById(R.id.image_details1); // Visible during slideshow play
Expand Down Expand Up @@ -337,6 +359,8 @@ public void onClick(View v) {

// Show the first image
loadImage(imagePosition, false);
//Start clock
clockHandler.postDelayed(clockRunnable, CLOCK_REFRESH_INT);
}

/**
Expand Down Expand Up @@ -455,6 +479,8 @@ private void loadPreferences(){
Log.d(TAG, String.format("PRELOAD_IMAGES: %b", PRELOAD_IMAGES));
DELETE_WARNING = preferences.getBoolean("delete_warning", true);
Log.d(TAG, String.format("DELETE_WARNING: %b", DELETE_WARNING));
SHOW_CLOCK = preferences.getBoolean("show_clock", true);
Log.d(TAG, String.format("SHOW_CLOCK: %b", SHOW_CLOCK));
// List prefs
int action_on_complete = Arrays.asList(getResources().getStringArray(R.array.pref_list_values_action_on_complete)).indexOf(
preferences.getString("action_on_complete", getResources().getString(R.string.pref_default_value_action_on_complete)));
Expand Down Expand Up @@ -767,6 +793,9 @@ private void hide() {
actionBar.hide();
}
mControlsView.setVisibility(View.GONE);
if(SHOW_CLOCK) {
clockText.setVisibility(View.VISIBLE);
}
mVisible = false;

// Schedule a runnable to remove the status and navigation bar after a delay
Expand All @@ -782,6 +811,7 @@ private void show() {
mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
mDetailsView.setVisibility(View.GONE);
clockText.setVisibility(View.INVISIBLE);
mVisible = true;

// Schedule a runnable to display UI elements after a delay
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/layout/activity_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
android:contentDescription="@string/image_description"/>

<!-- Image Details Overlay -->

<TextView
android:id="@+id/clockText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30px"
android:shadowColor="@color/clock_shadow"
android:shadowDx="5"
android:shadowDy="5"
android:shadowRadius="5"
android:textColor="@color/clock_text"
android:textSize="80sp"
android:visibility="invisible" />

<LinearLayout
android:id="@+id/image_details1"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -125,6 +139,7 @@
android:textColor="@color/primary"/>

</LinearLayout>

</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<color name="accent">#E040FB</color>
<color name="primary_text">#212121</color>
<color name="secondary_text">#757575</color>
<color name="clock_text">#FFFFFF</color>
<color name="clock_shadow">#88000000</color>
<color name="icons">#FFFFFF</color>
<color name="divider">#BDBDBD</color>

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,8 @@
<string name="pref_description_delete_warning">Display a warning pop up before deleting an image.
Disable at your own risk.
</string>

<string name="pref_title_show_clock">Show clock</string>
<string name="pref_description_show_clock">Display a clock over the slideshow.
</string>
</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,10 @@
android:summary="@string/pref_description_delete_warning"
android:title="@string/pref_title_delete_warning"/>

<SwitchPreference
android:defaultValue="false"
android:key="show_clock"
android:summary="@string/pref_description_show_clock"
android:title="@string/pref_title_show_clock"/>

</PreferenceScreen>