Handles intent

This commit is contained in:
stom79 2018-02-17 15:42:09 +01:00
parent 2bc75b5c06
commit c4bbd2ca87
5 changed files with 10 additions and 2 deletions

View File

@ -162,6 +162,7 @@
android:windowSoftInputMode="stateAlwaysHidden"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTask"
/>
<activity android:name=".activities.AboutActivity"
android:windowSoftInputMode="stateAlwaysHidden"

View File

@ -108,6 +108,7 @@ import fr.gouv.etalab.mastodon.fragments.TabLayoutSettingsFragment;
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
import static fr.gouv.etalab.mastodon.helper.Helper.ADD_USER_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.BACKUP_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_THEME_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_USER_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.EXTERNAL_STORAGE_REQUEST_CODE;
@ -1080,6 +1081,9 @@ public abstract class BaseMainActivity extends BaseActivity
}
}else if (extras.getInt(INTENT_ACTION) == ADD_USER_INTENT){
this.recreate();
}else if( extras.getInt(INTENT_ACTION) == BACKUP_INTENT){
Intent myIntent = new Intent(BaseMainActivity.this, OwnerStatusActivity.class);
startActivity(myIntent);
}
}else if( Intent.ACTION_SEND.equals(action) && type != null ) {
if ("text/plain".equals(type)) {

View File

@ -208,6 +208,7 @@ public class Helper {
public static final int CHANGE_THEME_INTENT = 3;
public static final int CHANGE_USER_INTENT = 4;
public static final int ADD_USER_INTENT = 5;
public static final int BACKUP_INTENT = 6;
//Settings
public static final String SET_TOOTS_PER_PAGE = "set_toots_per_page";
public static final String SET_ACCOUNTS_PER_PAGE = "set_accounts_per_page";

View File

@ -116,14 +116,14 @@ public class BackupStatusInDataBaseService extends IntentService {
}while (max_id != null && canContinue);
message = getString(R.string.data_export_success, String.valueOf(statusToBackUp), String.valueOf(backupStatus.size()));
message = getString(R.string.data_backup_success, String.valueOf(backupStatus.size()));
intentOpen = new Intent();
long notif_id = Long.parseLong(account.getId());
int notificationId = ((notif_id + 4) > 2147483647) ? (int) (2147483647 - notif_id - 4) : (int) (notif_id + 4);
String title = getString(R.string.data_export_toots, account.getAcct());
String title = getString(R.string.data_backup_toots, account.getAcct());
notify_user(getApplicationContext(), intentOpen, notificationId, BitmapFactory.decodeResource(getResources(),
R.drawable.mastodonlogo), title, message);
} catch (Exception e) {

View File

@ -409,6 +409,8 @@
<string name="show_media">Show media</string>
<string name="show_pinned">Show pinned</string>
<string name="filter_no_result">No matching result found!</string>
<string name="data_backup_toots">Backup toots for %1$s</string>
<string name="data_backup_success">%1$s new toots have been imported</string>
<string-array name="filter_select">
<item>No</item>
<item>Only</item>