Fix issue with install more voice

This commit is contained in:
Victor Shcherb 2015-01-15 10:34:14 +01:00
parent 003f7c1baf
commit dbcab4f919
2 changed files with 11 additions and 7 deletions

View file

@ -367,6 +367,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
if (MORE_VALUE.equals(newValue)) {
// listPref.set(oldValue); // revert the change..
final Intent intent = new Intent(this, DownloadActivity.class);
intent.putExtra(DownloadActivity.TAB_TO_OPEN, DownloadActivity.DOWNLOAD_TAB);
intent.putExtra(DownloadActivity.FILTER_CAT, DownloadActivityType.VOICE_FILE.getTag());
startActivity(intent);
} else {

View file

@ -6,7 +6,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import android.app.FragmentManager;
import net.osmand.IndexConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
@ -50,6 +49,7 @@ public class DownloadActivity extends BaseDownloadActivity {
private String initialFilter = "";
private boolean singleTab;
public static final String FILTER_KEY = "filter";
public static final String FILTER_CAT = "filter_cat";
@ -59,6 +59,7 @@ public class DownloadActivity extends BaseDownloadActivity {
public static final String DOWNLOAD_TAB = "download";
public static final String UPDATES_TAB = "updates";
public static final String SINGLE_TAB = "SINGLE_TAB";
private List<DownloadActivityType> downloadTypes = new ArrayList<DownloadActivityType>();
@Override
@ -134,9 +135,8 @@ public class DownloadActivity extends BaseDownloadActivity {
});
final List<DownloadActivityType> downloadTypes = getDownloadTypes();
downloadTypes = createDownloadTypes();
final Intent intent = getIntent();
setType(downloadTypes.get(0));
if (intent != null && intent.getExtras() != null) {
final String filter = intent.getExtras().getString(FILTER_KEY);
if (filter != null) {
@ -147,12 +147,12 @@ public class DownloadActivity extends BaseDownloadActivity {
if (filterCat != null) {
DownloadActivityType type = DownloadActivityType.getIndexType(filterCat.toLowerCase());
if (type != null) {
setType(type);
downloadTypes.remove(type);
downloadTypes.add(0, type);
}
}
}
changeType(downloadTypes.get(0));
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -195,8 +195,6 @@ public class DownloadActivity extends BaseDownloadActivity {
return localIndexInfos;
}
public void setType(DownloadActivityType type) { this.type = type;}
public void changeType(final DownloadActivityType tp) {
//invalidateOptionsMenu();
if (downloadListIndexThread != null && type != tp) {
@ -338,8 +336,13 @@ public class DownloadActivity extends BaseDownloadActivity {
// getExpandableListView().scrollTo(x, y);
// }
}
public List<DownloadActivityType> getDownloadTypes() {
return downloadTypes;
}
public List<DownloadActivityType> createDownloadTypes() {
List<DownloadActivityType> items = new ArrayList<DownloadActivityType>();
items.add(DownloadActivityType.NORMAL_FILE);
items.add(DownloadActivityType.VOICE_FILE);