|
|
|
@ -44,10 +44,11 @@ import fr.mobdev.goblim.objects.Img;
|
|
|
|
|
|
|
|
|
|
public class MultiLinkActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
private ArrayList<String> sharedUrls;
|
|
|
|
|
private ArrayList<String> sharedHashs;
|
|
|
|
|
private List<String> deleteUrls;
|
|
|
|
|
private MultiLinkAdapter adapter;
|
|
|
|
|
private List<Img> images;
|
|
|
|
|
private String baseUrl;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
@ -68,7 +69,7 @@ public class MultiLinkActivity extends AppCompatActivity {
|
|
|
|
|
RecyclerView listView = (RecyclerView) findViewById(R.id.link_list);
|
|
|
|
|
listView.setAdapter(adapter);
|
|
|
|
|
|
|
|
|
|
sharedUrls = new ArrayList<>();
|
|
|
|
|
sharedHashs = new ArrayList<>();
|
|
|
|
|
deleteUrls = new ArrayList<>();
|
|
|
|
|
images = new ArrayList<>();
|
|
|
|
|
|
|
|
|
@ -89,6 +90,7 @@ public class MultiLinkActivity extends AppCompatActivity {
|
|
|
|
|
Img image = Database.getInstance(getApplicationContext()).getImage(id);
|
|
|
|
|
images.add(image);
|
|
|
|
|
String url = image.getUrl();
|
|
|
|
|
baseUrl = url;
|
|
|
|
|
String shortHash = image.getShortHash();
|
|
|
|
|
String realShortHash = image.getRealShortHash();
|
|
|
|
|
String token = image.getToken();
|
|
|
|
@ -101,12 +103,14 @@ public class MultiLinkActivity extends AppCompatActivity {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//add a / at the end of the url before adding the hash
|
|
|
|
|
if(!url.endsWith("/"))
|
|
|
|
|
if(!url.endsWith("/")) {
|
|
|
|
|
url = url.concat("/");
|
|
|
|
|
String sharedUrl = url.concat(shortHash);
|
|
|
|
|
baseUrl = baseUrl.concat("/");
|
|
|
|
|
}
|
|
|
|
|
baseUrl = baseUrl.concat("gallery#");
|
|
|
|
|
String deleteUrl = url.concat("d/"+realShortHash+"/"+token);
|
|
|
|
|
|
|
|
|
|
sharedUrls.add(sharedUrl);
|
|
|
|
|
sharedHashs.add(shortHash);
|
|
|
|
|
deleteUrls.add(deleteUrl);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
@ -132,9 +136,9 @@ public class MultiLinkActivity extends AppCompatActivity {
|
|
|
|
|
Intent sendIntent = new Intent();
|
|
|
|
|
sendIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
|
|
|
|
|
List<Integer> selected = adapter.getSelecteds();
|
|
|
|
|
String output = "";
|
|
|
|
|
String output = baseUrl;
|
|
|
|
|
for(Integer index : selected) {
|
|
|
|
|
output += sharedUrls.get(index)+"\n";
|
|
|
|
|
output += sharedHashs.get(index)+",";
|
|
|
|
|
}
|
|
|
|
|
sendIntent.putExtra(Intent.EXTRA_TEXT, output);
|
|
|
|
|
sendIntent.setType("text/plain");
|
|
|
|
@ -148,9 +152,9 @@ public class MultiLinkActivity extends AppCompatActivity {
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
|
|
|
|
List<Integer> selected = adapter.getSelecteds();
|
|
|
|
|
String output = "";
|
|
|
|
|
String output = baseUrl;
|
|
|
|
|
for(Integer index : selected) {
|
|
|
|
|
output += sharedUrls.get(index)+"\n";
|
|
|
|
|
output += sharedHashs.get(index)+",";
|
|
|
|
|
}
|
|
|
|
|
android.content.ClipData clip = android.content.ClipData.newPlainText("Copied URL", output);
|
|
|
|
|
clipboard.setPrimaryClip(clip);
|
|
|
|
|