new release

This commit is contained in:
Page Asgardius 2022-12-27 18:16:39 -07:00
parent 1ac83482f4
commit 0e62408f1d
15 changed files with 58 additions and 165 deletions

View file

@ -9,8 +9,8 @@ android {
applicationId "asgardius.page.s3manager" applicationId "asgardius.page.s3manager"
minSdk 23 minSdk 23
targetSdk 33 targetSdk 33
versionCode 49 versionCode 50
versionName "0.4.3" versionName "0.4.4"
setProperty("archivesBaseName", "s3-manager-$versionName") setProperty("archivesBaseName", "s3-manager-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -30,9 +30,9 @@ public class Share extends AppCompatActivity {
AWSCredentials myCredentials; AWSCredentials myCredentials;
AmazonS3 s3client; AmazonS3 s3client;
Calendar mycal; Calendar mycal;
EditText datepick, monthpick, yearpick, hourpick, minutepick; EditText datepick, hourpick, minutepick;
int date, month, year, hour, minute; int date, hour, minute;
Button share, external; Button share;
GeneratePresignedUrlRequest request; GeneratePresignedUrlRequest request;
Date expiration; Date expiration;
URL objectURL; URL objectURL;
@ -73,12 +73,9 @@ public class Share extends AppCompatActivity {
setContentView(R.layout.activity_share); setContentView(R.layout.activity_share);
mycal = Calendar.getInstance(); mycal = Calendar.getInstance();
datepick = (EditText)findViewById(R.id.Date); datepick = (EditText)findViewById(R.id.Date);
monthpick = (EditText)findViewById(R.id.Month);
yearpick = (EditText)findViewById(R.id.Year);
hourpick = (EditText)findViewById(R.id.Hour); hourpick = (EditText)findViewById(R.id.Hour);
minutepick = (EditText)findViewById(R.id.Minute); minutepick = (EditText)findViewById(R.id.Minute);
share = (Button)findViewById(R.id.share); share = (Button)findViewById(R.id.share);
external = (Button)findViewById(R.id.open_in);
endpoint = getIntent().getStringExtra("endpoint"); endpoint = getIntent().getStringExtra("endpoint");
username = getIntent().getStringExtra("username"); username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
@ -106,64 +103,49 @@ public class Share extends AppCompatActivity {
public void onClick(View view) { public void onClick(View view) {
//buttonaction //buttonaction
try { try {
if (datepick.getText().toString().equals("") || monthpick.getText().toString().equals("") || if (datepick.getText().toString().equals("")) {
yearpick.getText().toString().equals("") || hourpick.getText().toString().equals("") || date = 0;
minutepick.getText().toString().equals("")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.null_expiration_date), Toast.LENGTH_SHORT).show();
} else { } else {
date = Integer.parseInt(datepick.getText().toString()); date = Integer.parseInt(datepick.getText().toString());
month = Integer.parseInt(monthpick.getText().toString());
year = Integer.parseInt(yearpick.getText().toString());
hour = Integer.parseInt(hourpick.getText().toString());
minute = Integer.parseInt(minutepick.getText().toString());
mycal.set(Calendar.YEAR, year);
mycal.set(Calendar.MONTH, month-1);
mycal.set(Calendar.DATE, date);
mycal.set(Calendar.HOUR, hour);
mycal.set(Calendar.MINUTE, minute);
mycal.set(Calendar.SECOND, 0);
expiration = mycal.getTime();
//System.out.println(expiration);
request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
objectURL = s3client.generatePresignedUrl(request);
//System.out.println(URLify(objectURL.toString()));
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, URLify(objectURL.toString()));
startActivity(Intent.createChooser(shareIntent, "choose one"));
} }
} catch (Exception e) { if (hourpick.getText().toString().equals("")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show(); hour = 0;
}
}
});
external.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
//buttonaction
try {
if (mediafile) {
expiration = new Date();
mycal.setTime(expiration);
//System.out.println("today is " + mycal.getTime());
mycal.add(Calendar.HOUR, videotime);
//System.out.println("Expiration date: " + mycal.getTime());
expiration = mycal.getTime();
request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
} else { } else {
request = new GeneratePresignedUrlRequest(bucket, object); hour = Integer.parseInt(hourpick.getText().toString());
} }
if (minutepick.getText().toString().equals("")) {
minute = 0;
} else {
minute = Integer.parseInt(minutepick.getText().toString());
}
expiration = new Date();
System.out.println("today is " + mycal.getTime());
mycal.setTime(expiration);
if (date == 0 && hour == 0 && minute == 0) {
if (mediafile) {
mycal.add(Calendar.HOUR, videotime);
} else {
mycal.add(Calendar.MINUTE, 15);
}
} else {
mycal.add(Calendar.DATE, date);
mycal.add(Calendar.HOUR, hour);
mycal.add(Calendar.MINUTE, minute);
}
System.out.println("Expiration date: " + mycal.getTime());
expiration = mycal.getTime();
//System.out.println(expiration);
request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
objectURL = s3client.generatePresignedUrl(request); objectURL = s3client.generatePresignedUrl(request);
//System.out.println(URLify(objectURL.toString())); //System.out.println(URLify(objectURL.toString()));
Intent shareIntent = new Intent(Intent.ACTION_SEND); Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain"); shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, URLify(objectURL.toString())); shareIntent.putExtra(Intent.EXTRA_TEXT, URLify(objectURL.toString()));
startActivity(Intent.createChooser(shareIntent, "choose one")); startActivity(Intent.createChooser(shareIntent, "choose one"));
} catch (Exception e) { } catch (Exception e) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
}
} }
}
}); });
} }

View file

@ -129,17 +129,13 @@
android:id="@+id/addaccount" android:id="@+id/addaccount"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:text="@string/accountadd_button" android:text="@string/accountadd_button" />
android:textColor="?android:attr/colorBackground"
android:textSize="24sp" />
<Button <Button
android:id="@+id/testaccount" android:id="@+id/testaccount"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:text="@string/accounttest_button" android:text="@string/accounttest_button" />
android:textColor="?android:attr/colorBackground"
android:textSize="24sp" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View file

@ -28,8 +28,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:text="@string/allow_all" android:text="@string/allow_all"
android:textColor="?android:attr/colorBackground"
android:textSize="24sp"
android:visibility="gone" /> android:visibility="gone" />
<Button <Button
@ -37,8 +35,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:text="@string/allow_pdf" android:text="@string/allow_pdf"
android:textColor="?android:attr/colorBackground"
android:textSize="24sp"
android:visibility="gone" /> android:visibility="gone" />
<Button <Button
@ -46,8 +42,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:text="@string/delete_cors" android:text="@string/delete_cors"
android:textColor="?android:attr/colorBackground"
android:textSize="24sp"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>

View file

@ -16,34 +16,21 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <Button
android:id="@+id/linearLayout" android:id="@+id/addaccount"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:layout_margin="20dp" android:text="@string/accountadd_button"
android:orientation="horizontal"
tools:ignore="MissingConstraints" tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="20dp"> style="?android:attr/buttonStyle" />
<Button <Button
android:id="@+id/addaccount" android:id="@+id/settings_button"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="70dp"
android:layout_weight="1" android:text="@string/settings"
android:text="@string/accountadd_button" tools:ignore="MissingConstraints"
tools:ignore="MissingConstraints" style="?android:attr/buttonStyle" />
style="?android:attr/buttonStyle" />
<Button
android:id="@+id/settings_button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/settings"
tools:ignore="MissingConstraints"
style="?android:attr/buttonStyle" />
</LinearLayout>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -69,17 +69,13 @@
android:id="@+id/saveprefs" android:id="@+id/saveprefs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:text="@string/save_settings" android:text="@string/save_settings" />
android:textColor="?android:attr/colorBackground"
android:textSize="24sp" />
<Button <Button
android:id="@+id/settings_button" android:id="@+id/settings_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:text="@string/about_button" android:text="@string/about_button" />
android:textColor="?android:attr/colorBackground"
android:textSize="24sp" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View file

@ -19,7 +19,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/expiration_date" android:text="@string/expiration_time"
android:textAlignment="center" android:textAlignment="center"
android:textSize="25sp" /> android:textSize="25sp" />
@ -44,48 +44,6 @@
android:textColorHint="?attr/colorOnSecondary" android:textColorHint="?attr/colorOnSecondary"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<EditText
android:id="@+id/Month"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:focusable="true"
android:hint="@string/share_month"
android:maxLength="2"
android:inputType="date"
android:textColorHint="?attr/colorOnSecondary"
tools:ignore="MissingConstraints" />
<EditText
android:id="@+id/Year"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:focusable="true"
android:hint="@string/share_year"
android:maxLength="4"
android:inputType="date"
android:textColorHint="?attr/colorOnSecondary"
tools:ignore="MissingConstraints" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/expiration_time"
android:textAlignment="center"
android:textSize="25sp" />
<LinearLayout
android:id="@+id/linearLayoutTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="20dp">
<EditText <EditText
android:id="@+id/Hour" android:id="@+id/Hour"
android:layout_width="0dp" android:layout_width="0dp"
@ -112,32 +70,12 @@
</LinearLayout> </LinearLayout>
<LinearLayout <Button
android:id="@+id/linearLayoutSubmit" android:id="@+id/share"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="70dp" android:layout_height="70dp"
android:layout_margin="20dp" android:text="@string/file_share"
android:orientation="horizontal" tools:ignore="MissingConstraints" />
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="20dp">
<Button
android:id="@+id/share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/file_share"
tools:ignore="MissingConstraints" />
<Button
android:id="@+id/open_in"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/file_external"
tools:ignore="MissingConstraints" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>

View file

@ -74,7 +74,7 @@
<string name="share_hour">HH</string> <string name="share_hour">HH</string>
<string name="share_minute">MM</string> <string name="share_minute">MM</string>
<string name="expiration_date">Fecha de expiración</string> <string name="expiration_date">Fecha de expiración</string>
<string name="expiration_time">Hora de expiración</string> <string name="expiration_time">Expira dentro de</string>
<string name="create_link">Crear enlace al archivo</string> <string name="create_link">Crear enlace al archivo</string>
<string name="invalid_expiration_date">La fecha de caducidad debe ser inferior a 7 días</string> <string name="invalid_expiration_date">La fecha de caducidad debe ser inferior a 7 días</string>
<string name="file_size">Tamaño del archivo</string> <string name="file_size">Tamaño del archivo</string>

View file

@ -9,7 +9,7 @@
<string name="object_list">Object list</string> <string name="object_list">Object list</string>
<string name="Image">Image</string> <string name="Image">Image</string>
<string name="expiration_date">Expiration date</string> <string name="expiration_date">Expiration date</string>
<string name="expiration_time">Expiration time</string> <string name="expiration_time">Expires within</string>
<string name="share_hour">HH</string> <string name="share_hour">HH</string>
<string name="share_minute">MM</string> <string name="share_minute">MM</string>
<string name="share_date">DD</string> <string name="share_date">DD</string>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 96 KiB