Skip to content

Commit 6982ed8

Browse files
committed
Changed time output to be more easily readable
Improved layouts Fixed a bug where paused state was not interpreted on CBD based printers Updated dependencies Updated NDK
1 parent 875e32b commit 6982ed8

File tree

9 files changed

+313
-98
lines changed

9 files changed

+313
-98
lines changed

.github/workflows/dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "build-tools;33.0.1" --sdk_root=${ANDROID_SDK_ROOT}
2828

2929
- name: Install NDK
30-
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;25.1.8937393" --sdk_root=${ANDROID_SDK_ROOT}
30+
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;25.2.9519653" --sdk_root=${ANDROID_SDK_ROOT}
3131

3232
- name: Initialize gradle
3333
run: |

app/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ android {
4545
applicationId "de.sg_o.app.photonet"
4646
minSdkVersion 24
4747
targetSdkVersion 33
48-
versionCode 5
49-
versionName '0.5'
48+
versionCode 6
49+
versionName '0.6'
5050

5151
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
5252
multiDexEnabled false
@@ -85,7 +85,7 @@ android {
8585
sourceCompatibility JavaVersion.VERSION_1_8
8686
targetCompatibility JavaVersion.VERSION_1_8
8787
}
88-
ndkVersion '25.1.8937393'
88+
ndkVersion '25.2.9519653'
8989
buildFeatures {
9090
viewBinding true
9191
}
@@ -97,11 +97,11 @@ android {
9797
}
9898

9999
dependencies {
100-
implementation 'de.sg-o.lib:photoNet:0.12'
100+
implementation 'de.sg-o.lib:photoNet:0.13'
101101
implementation 'org.videolan.android:libvlc-all:3.5.1'
102102
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
103-
implementation 'androidx.appcompat:appcompat:1.5.1'
104-
implementation 'com.google.android.material:material:1.7.0'
103+
implementation 'androidx.appcompat:appcompat:1.6.1'
104+
implementation 'com.google.android.material:material:1.8.0'
105105
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
106106
implementation 'androidx.navigation:navigation-fragment:2.5.3'
107107
implementation 'androidx.navigation:navigation-ui:2.5.3'
@@ -111,6 +111,6 @@ dependencies {
111111
implementation 'androidx.vectordrawable:vectordrawable-seekable:1.0.0-beta01'
112112
implementation 'androidx.preference:preference:1.2.0'
113113
testImplementation 'junit:junit:4.13.2'
114-
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
115-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
114+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
115+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
116116
}

app/src/main/java/de/sg_o/app/photonet/AboutActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ protected void onCreate(Bundle savedInstanceState) {
9797
contributors.setText(builder.toString().trim());
9898

9999
TextView sgo = findViewById(R.id.about_sgo);
100+
TextView version = findViewById(R.id.about_version);
101+
version.setText(String.format("v%s", BuildConfig.VERSION_NAME));
100102
RecyclerView recyclerView = findViewById(R.id.about_dependencies);
101103
recyclerView.setLayoutManager(new LinearLayoutManager(this));
102104
DependencyAdapter adapter = new DependencyAdapter(this);

app/src/main/java/de/sg_o/app/photonet/ui/main/DetailsFragment.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void run() {
159159
filename.post(() -> filename.setText(formatOpenedFile(s.getOpenedFile())));
160160
progress.post(() -> progress.setText(MessageFormat.format("{0}%", (int) (s.getProgress() * 100.0f))));
161161
z.post(() -> z.setText(MessageFormat.format("{0}mm", s.getZ())));
162-
time.post(() -> time.setText(MessageFormat.format("{0}s", s.getTime())));
162+
formatTime();
163163

164164
Context context = getContext();
165165
if (context != null) {
@@ -220,7 +220,7 @@ public void onResume() {
220220
filename.setText(formatOpenedFile(s.getOpenedFile()));
221221
progress.setText(MessageFormat.format("{0}%", (int) (s.getProgress() * 100.0f)));
222222
z.setText(MessageFormat.format("{0}mm", s.getZ()));
223-
time.setText(MessageFormat.format("{0}s", s.getTime()));
223+
formatTime();
224224
}
225225
mVideoLayout.setVisibility(View.INVISIBLE);
226226
statusImage.setVisibility(View.VISIBLE);
@@ -237,6 +237,20 @@ public void onResume() {
237237
handler.postDelayed(updatePrinters, 2000);
238238
}
239239

240+
private void formatTime() {
241+
Status s = p.getStatus();
242+
if (s.getTime().getHours() > 0) {
243+
time.post(() -> time.setText(MessageFormat.format("{0}:{1}:{2}",
244+
s.getTime().getHours(), s.getTime().getMinutes(), s.getTime().getSeconds())));
245+
} else if (s.getTime().getMinutes() > 0) {
246+
time.post(() -> time.setText(MessageFormat.format("{0}m {1}s",
247+
s.getTime().getMinutes(), s.getTime().getSeconds())));
248+
} else {
249+
time.post(() -> time.setText(MessageFormat.format("{0}s",
250+
s.getTime().getSeconds())));
251+
}
252+
}
253+
240254
private String formatOpenedFile(String in) {
241255
if (in == null) return "";
242256
return in;

app/src/main/res/layout-land/fragment_details_main.xml

Lines changed: 34 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919

2020
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
2121
xmlns:app="http://schemas.android.com/apk/res-auto"
22-
xmlns:tools="http://schemas.android.com/tools"
2322
android:layout_width="match_parent"
2423
android:layout_height="match_parent"
25-
android:id="@+id/relativeLayout">
24+
android:id="@+id/details_layout">
2625

2726
<TextView
2827
android:id="@+id/details_name"
@@ -56,7 +55,7 @@
5655
android:layout_marginEnd="256dp"
5756
android:layout_marginBottom="16dp"
5857
android:contentDescription="@string/image_of_printer"
59-
app:layout_constraintBottom_toTopOf="@+id/datails_h_layout"
58+
app:layout_constraintBottom_toBottomOf="parent"
6059
app:layout_constraintEnd_toEndOf="parent"
6160
app:layout_constraintStart_toStartOf="parent"
6261
app:layout_constraintTop_toBottomOf="@id/details_ip"
@@ -71,7 +70,7 @@
7170
android:layout_marginTop="16dp"
7271
android:layout_marginEnd="256dp"
7372
android:layout_marginBottom="16dp"
74-
app:layout_constraintBottom_toTopOf="@+id/datails_h_layout"
73+
app:layout_constraintBottom_toBottomOf="parent"
7574
app:layout_constraintEnd_toEndOf="parent"
7675
app:layout_constraintStart_toStartOf="parent"
7776
app:layout_constraintTop_toBottomOf="@id/details_ip">
@@ -87,34 +86,36 @@
8786
android:id="@+id/details_status"
8887
android:layout_width="0dp"
8988
android:layout_height="wrap_content"
89+
android:layout_marginEnd="8dp"
9090
android:text="@string/details_status_unknown"
9191
android:textAlignment="center"
9292
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
9393
app:layout_constraintBottom_toTopOf="@id/details_filename"
94-
app:layout_constraintEnd_toEndOf="parent"
94+
app:layout_constraintEnd_toStartOf="@+id/linearLayout3"
9595
app:layout_constraintStart_toEndOf="@+id/details_status_image" />
9696

9797
<TextView
9898
android:id="@+id/details_filename"
9999
android:layout_width="0dp"
100100
android:layout_height="wrap_content"
101+
android:layout_marginEnd="8dp"
101102
android:layout_marginBottom="16dp"
102103
android:maxLines="1"
103104
android:minLines="1"
104105
android:text="@string/details_file_unknown"
105106
android:textAlignment="center"
106-
app:layout_constraintBottom_toTopOf="@id/datails_h_layout"
107-
app:layout_constraintEnd_toEndOf="parent"
107+
app:layout_constraintBottom_toTopOf="@+id/linearLayout4"
108+
app:layout_constraintEnd_toStartOf="@+id/linearLayout3"
108109
app:layout_constraintStart_toEndOf="@+id/details_status_image" />
109110

110111
<LinearLayout
111112
android:id="@+id/linearLayout3"
112113
android:layout_width="wrap_content"
113114
android:layout_height="wrap_content"
115+
android:layout_marginEnd="8dp"
114116
android:orientation="vertical"
115-
app:layout_constraintBottom_toTopOf="@+id/details_status"
117+
app:layout_constraintBottom_toBottomOf="parent"
116118
app:layout_constraintEnd_toEndOf="parent"
117-
app:layout_constraintStart_toEndOf="@+id/details_status_image"
118119
app:layout_constraintTop_toBottomOf="@+id/details_name">
119120

120121
<ImageButton
@@ -138,46 +139,19 @@
138139
</LinearLayout>
139140

140141
<LinearLayout
141-
android:id="@+id/datails_h_layout"
142-
android:layout_width="match_parent"
142+
android:id="@+id/linearLayout4"
143+
android:layout_width="0dp"
143144
android:layout_height="wrap_content"
144-
android:layout_marginBottom="24dp"
145+
android:layout_marginEnd="8dp"
146+
android:layout_marginBottom="16dp"
145147
android:orientation="horizontal"
146148
app:layout_constraintBottom_toBottomOf="parent"
147-
app:layout_constraintStart_toStartOf="parent">
148-
149-
<TextView
150-
android:id="@+id/progressText"
151-
android:layout_width="wrap_content"
152-
android:layout_height="wrap_content"
153-
android:layout_weight="1"
154-
android:maxWidth="60dp"
155-
android:maxLines="1"
156-
android:minWidth="60dp"
157-
android:minLines="1"
158-
android:text="@string/progress"
159-
android:textAlignment="viewEnd" />
160-
161-
<TextView
162-
android:id="@+id/details_progress"
163-
android:layout_width="wrap_content"
164-
android:layout_height="wrap_content"
165-
android:layout_weight="1"
166-
android:maxWidth="30dp"
167-
android:maxLines="1"
168-
android:minWidth="30dp"
169-
android:minLines="1"
170-
android:text="@string/details_progress_default"
171-
android:textAlignment="viewStart" />
172-
173-
<Space
174-
android:layout_width="wrap_content"
175-
android:layout_height="wrap_content"
176-
android:layout_weight="1" />
149+
app:layout_constraintEnd_toStartOf="@+id/linearLayout3"
150+
app:layout_constraintStart_toEndOf="@+id/details_status_image">
177151

178152
<TextView
179153
android:id="@+id/zText"
180-
android:layout_width="wrap_content"
154+
android:layout_width="match_parent"
181155
android:layout_height="wrap_content"
182156
android:layout_weight="1"
183157
android:maxWidth="30dp"
@@ -189,7 +163,7 @@
189163

190164
<TextView
191165
android:id="@+id/details_z"
192-
android:layout_width="wrap_content"
166+
android:layout_width="match_parent"
193167
android:layout_height="wrap_content"
194168
android:layout_weight="1"
195169
android:maxWidth="30dp"
@@ -199,14 +173,9 @@
199173
android:text="@string/details_z_default"
200174
android:textAlignment="viewStart" />
201175

202-
<Space
203-
android:layout_width="wrap_content"
204-
android:layout_height="wrap_content"
205-
android:layout_weight="1" />
206-
207176
<TextView
208177
android:id="@+id/timeText"
209-
android:layout_width="wrap_content"
178+
android:layout_width="match_parent"
210179
android:layout_height="wrap_content"
211180
android:layout_weight="1"
212181
android:maxWidth="30dp"
@@ -218,7 +187,7 @@
218187

219188
<TextView
220189
android:id="@+id/details_time"
221-
android:layout_width="wrap_content"
190+
android:layout_width="match_parent"
222191
android:layout_height="wrap_content"
223192
android:layout_weight="1"
224193
android:maxWidth="60dp"
@@ -229,4 +198,18 @@
229198
android:textAlignment="viewStart" />
230199
</LinearLayout>
231200

201+
<TextView
202+
android:id="@+id/details_progress"
203+
android:layout_width="wrap_content"
204+
android:layout_height="wrap_content"
205+
android:layout_weight="1"
206+
android:maxWidth="30dp"
207+
android:maxLines="1"
208+
android:minWidth="30dp"
209+
android:minLines="1"
210+
android:text="@string/details_progress_default"
211+
android:textAlignment="viewStart"
212+
app:layout_constraintBottom_toBottomOf="@+id/details_status_image"
213+
app:layout_constraintStart_toStartOf="@+id/details_status_image" />
214+
232215
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)