Skip to content

Commit

Permalink
Update gradle, ndk version, translations, version and fastlane
Browse files Browse the repository at this point in the history
- Fix some deprecated features in the “build.gradle” file;
- Update Readme and screenshots;
- Support for Reproducible Builds;
  • Loading branch information
BlackyHawky committed Dec 10, 2024
1 parent e00a0d7 commit 9613c72
Show file tree
Hide file tree
Showing 31 changed files with 358 additions and 228 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ output.json
# Keystore files
*.jks
*.keystore
keystore.properties

# Google Services (e.g. APIs or Firebase)
google-services.json
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Clock is a privacy-conscious open-source clock, based on AOSP Clock.
* Backup and restore settings;
* Material design;
* Dynamic colors for Android 12+;
* Support for [Reproducible Builds](https://reproducible-builds.org/). See the discussion [here](https://github.com/BlackyHawky/Clock/issues/140).

## Common Issues
* Problem encountered with bedtime mode as this is an experimental feature;
Expand Down
61 changes: 44 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,66 @@ android {
applicationId "com.best.deskclock"
minSdk 23
targetSdk 34
versionCode 2012
versionName '2.10.1'
versionCode 2013
versionName '2.11'
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

lintOptions {
abortOnError false
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

ext {
APP_NAME = "@string/app_label"
APP_NAME_DEBUG = "@string/app_label_debug"
signingConfigs {
release {
if (keystorePropertiesFile.exists()) {
storeFile = file("$rootDir/keystore.jks")
storePassword = keystoreProperties["storePassword"]
keyAlias = keystoreProperties["keyAlias"]
keyPassword = keystoreProperties["keyPassword"]
} else {
println "Keystore properties file not found. No signing configuration will be applied."
}
}
}

buildTypes {
release {
debuggable false
manifestPlaceholders = [appName: APP_NAME]
manifestPlaceholders = [appName: "@string/app_label"]
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.findByName("release")
} else {
signingConfig null
}
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

debug {
manifestPlaceholders = [appName: APP_NAME_DEBUG]
manifestPlaceholders = [appName: "@string/app_label_debug"]
versionNameSuffix "-debug"
applicationIdSuffix ".debug"
}
archivesBaseName = "Clock_" + defaultConfig.versionName
}

applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
def suffix = variant.buildType.versionNameSuffix ?:
keystorePropertiesFile.exists() ? "-release" : "-unsigned"
output.outputFileName = "Clock_${defaultConfig.versionName}${suffix}.apk"
}
}

lintOptions {
abortOnError false
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

buildFeatures {
Expand All @@ -52,7 +79,7 @@ android {
includeInBundle = false
}

ndkVersion '27.0.12077973'
ndkVersion '27.2.12479018'

namespace 'com.best.deskclock'
}
Expand Down
33 changes: 16 additions & 17 deletions app/src/main/java/com/best/deskclock/AlarmClockFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ public final class AlarmClockFragment extends DeskClockFragment implements

// Views
private ViewGroup mMainLayout;
private RecyclerView mRecyclerView;
private TextView mAlarmsEmptyView;
private AlarmRecyclerView mRecyclerView;

// Data
private Loader<?> mCursorLoader;
Expand Down Expand Up @@ -135,8 +134,19 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
// Inflate the layout for this fragment
final View v = inflater.inflate(R.layout.alarm_clock, container, false);
mContext = requireContext();

mMainLayout = v.findViewById(R.id.main);
mRecyclerView = v.findViewById(R.id.alarms_recycler_view);
TextView alarmsEmptyView = v.findViewById(R.id.alarms_empty_view);
final Drawable noAlarmsIcon = Utils.toScaledBitmapDrawable(mContext, R.drawable.ic_alarm_off, 2.5f);
assert noAlarmsIcon != null;
noAlarmsIcon.setTint(MaterialColors.getColor(
mContext, com.google.android.material.R.attr.colorOnSurfaceVariant, Color.BLACK));
alarmsEmptyView.setCompoundDrawablesWithIntrinsicBounds(null, noAlarmsIcon, null, null);
alarmsEmptyView.setCompoundDrawablePadding(Utils.toPixel(30, mContext));
mEmptyViewController = new EmptyViewController(mMainLayout, mRecyclerView, alarmsEmptyView);
mAlarmUpdateHandler = new AlarmUpdateHandler(mContext, this, mMainLayout);
mAlarmTimeClickHandler = new AlarmTimeClickHandler(this, savedState, mAlarmUpdateHandler);
mItemAdapter = new ItemAdapter<>();
mLayoutManager = new LinearLayoutManager(mContext) {
@Override
protected void calculateExtraLayoutSpace(@NonNull RecyclerView.State state,
Expand All @@ -148,20 +158,14 @@ protected void calculateExtraLayoutSpace(@NonNull RecyclerView.State state,

}
};

mRecyclerView.setLayoutManager(mLayoutManager);
// Set a bottom padding to prevent alarm list from being hidden by the FAB
final int bottomPadding = Utils.isTablet(mContext)
? Utils.toPixel(110, mContext)
: Utils.toPixel(95, mContext);
mRecyclerView.setPadding(0, 0, 0, bottomPadding);

mMainLayout = v.findViewById(R.id.main);
mAlarmUpdateHandler = new AlarmUpdateHandler(mContext, this, mMainLayout);
mAlarmsEmptyView = v.findViewById(R.id.alarms_empty_view);
mEmptyViewController = new EmptyViewController(mMainLayout, mRecyclerView, mAlarmsEmptyView);
mAlarmTimeClickHandler = new AlarmTimeClickHandler(this, savedState, mAlarmUpdateHandler);

mItemAdapter = new ItemAdapter<>();
mItemAdapter.setHasStableIds();
mItemAdapter.withViewTypes(new CollapsedAlarmViewHolder.Factory(inflater),
null, CollapsedAlarmViewHolder.VIEW_TYPE);
Expand All @@ -188,10 +192,12 @@ protected void calculateExtraLayoutSpace(@NonNull RecyclerView.State state,
mExpandedAlarmId = Alarm.INVALID_ID;
}
});

final ScrollPositionWatcher scrollPositionWatcher = new ScrollPositionWatcher();
mRecyclerView.addOnLayoutChangeListener(scrollPositionWatcher);
mRecyclerView.addOnScrollListener(scrollPositionWatcher);
mRecyclerView.setAdapter(mItemAdapter);

final ItemAnimator itemAnimator = new ItemAnimator();
itemAnimator.setChangeDuration(150L);
itemAnimator.setMoveDuration(150L);
Expand Down Expand Up @@ -418,13 +424,6 @@ private void setAdapterItems(final List<AlarmItemHolder> items, final long updat
if (noAlarms) {
// Ensure the drop shadow is hidden when no alarms exist.
setTabScrolledToTop(true);
final Drawable noAlarmsIcon = Utils.toScaledBitmapDrawable(mContext, R.drawable.ic_alarm_off, 2.5f);
if (noAlarmsIcon != null) {
noAlarmsIcon.setTint(MaterialColors.getColor(
mContext, com.google.android.material.R.attr.colorOnSurfaceVariant, Color.BLACK));
}
mAlarmsEmptyView.setCompoundDrawablesWithIntrinsicBounds(null, noAlarmsIcon, null, null);
mAlarmsEmptyView.setCompoundDrawablePadding(Utils.toPixel(30, mContext));
}

// Expand the correct alarm.
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/res/layout/alarm_clock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
android:id="@+id/alarms_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:descendantFocusability="beforeDescendants"
android:fadingEdgeLength="0dp"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
android:splitMotionEvents="false" />
android:clipToPadding="false" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/alarms_empty_view"
Expand Down
9 changes: 4 additions & 5 deletions app/src/main/res/values-de/cities.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 The Android Open Source Project
modified
SPDX-License-Identifier: Apache-2.0 AND GPL-3.0-only
-->

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
--><resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="C1" msgid="3622720549928625541">"<xliff:g id="SEPARATOR">=</xliff:g>Abidjan<xliff:g id="TIMEZONE">|Africa/Abidjan</xliff:g>"</string>
<string name="C2" msgid="9073993995416728918">"<xliff:g id="SEPARATOR">=</xliff:g>Accra<xliff:g id="TIMEZONE">|Africa/Accra</xliff:g>"</string>
<string name="C3" msgid="5172979423931428620">"<xliff:g id="SEPARATOR">=</xliff:g>Addis Abeba<xliff:g id="TIMEZONE">|Africa/Addis_Ababa</xliff:g>"</string>
Expand Down Expand Up @@ -346,4 +344,5 @@
<string name="C346" msgid="2947674392768816097">"J<xliff:g id="SEPARATOR">=</xliff:g>Jaunde<xliff:g id="TIMEZONE">|Africa/Douala</xliff:g>"</string>
<string name="C347" msgid="6291282205599716861">"D<xliff:g id="SEPARATOR">=</xliff:g>Distrikt Yaren<xliff:g id="TIMEZONE">|Pacific/Nauru</xliff:g>"</string>
<string name="C348" msgid="8462071023392592539">"Y<xliff:g id="SEPARATOR">=</xliff:g>Eriwan<xliff:g id="TIMEZONE">|Asia/Yerevan</xliff:g>"</string>
</resources>
<string name="C349">P<xliff:g id="SEPARATOR">=</xliff:g>Ponta Delgada<xliff:g id="timezone">|Atlantic/Azores</xliff:g></string>
</resources>
Loading

0 comments on commit 9613c72

Please sign in to comment.