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"
minSdk 23
targetSdk 33
versionCode 49
versionName "0.4.3"
versionCode 50
versionName "0.4.4"
setProperty("archivesBaseName", "s3-manager-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -30,9 +30,9 @@ public class Share extends AppCompatActivity {
AWSCredentials myCredentials;
AmazonS3 s3client;
Calendar mycal;
EditText datepick, monthpick, yearpick, hourpick, minutepick;
int date, month, year, hour, minute;
Button share, external;
EditText datepick, hourpick, minutepick;
int date, hour, minute;
Button share;
GeneratePresignedUrlRequest request;
Date expiration;
URL objectURL;
@ -73,12 +73,9 @@ public class Share extends AppCompatActivity {
setContentView(R.layout.activity_share);
mycal = Calendar.getInstance();
datepick = (EditText)findViewById(R.id.Date);
monthpick = (EditText)findViewById(R.id.Month);
yearpick = (EditText)findViewById(R.id.Year);
hourpick = (EditText)findViewById(R.id.Hour);
minutepick = (EditText)findViewById(R.id.Minute);
share = (Button)findViewById(R.id.share);
external = (Button)findViewById(R.id.open_in);
endpoint = getIntent().getStringExtra("endpoint");
username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password");
@ -106,64 +103,49 @@ public class Share extends AppCompatActivity {
public void onClick(View view) {
//buttonaction
try {
if (datepick.getText().toString().equals("") || monthpick.getText().toString().equals("") ||
yearpick.getText().toString().equals("") || hourpick.getText().toString().equals("") ||
minutepick.getText().toString().equals("")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.null_expiration_date), Toast.LENGTH_SHORT).show();
if (datepick.getText().toString().equals("")) {
date = 0;
} else {
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) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
}
}
});
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);
if (hourpick.getText().toString().equals("")) {
hour = 0;
} 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);
//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) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
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:layout_width="match_parent"
android:layout_height="70dp"
android:text="@string/accountadd_button"
android:textColor="?android:attr/colorBackground"
android:textSize="24sp" />
android:text="@string/accountadd_button" />
<Button
android:id="@+id/testaccount"
android:layout_width="match_parent"
android:layout_height="70dp"
android:text="@string/accounttest_button"
android:textColor="?android:attr/colorBackground"
android:textSize="24sp" />
android:text="@string/accounttest_button" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

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

View file

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

View file

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

View file

@ -19,7 +19,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/expiration_date"
android:text="@string/expiration_time"
android:textAlignment="center"
android:textSize="25sp" />
@ -44,48 +44,6 @@
android:textColorHint="?attr/colorOnSecondary"
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
android:id="@+id/Hour"
android:layout_width="0dp"
@ -112,32 +70,12 @@
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayoutSubmit"
<Button
android:id="@+id/share"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_margin="20dp"
android:orientation="horizontal"
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>
android:text="@string/file_share"
tools:ignore="MissingConstraints" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -74,7 +74,7 @@
<string name="share_hour">HH</string>
<string name="share_minute">MM</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="invalid_expiration_date">La fecha de caducidad debe ser inferior a 7 días</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="Image">Image</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_minute">MM</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