mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Merge branch 'master' into locationUpdate
This commit is contained in:
commit
8327aedaf1
7 changed files with 23 additions and 30 deletions
|
|
@ -27,9 +27,4 @@ public class AboutActivity extends NavigationBaseActivity {
|
|||
versionText.setText(BuildConfig.VERSION_NAME);
|
||||
initDrawer();
|
||||
}
|
||||
|
||||
public static void startYourself(Context context) {
|
||||
Intent settingsIntent = new Intent(context, AboutActivity.class);
|
||||
context.startActivity(settingsIntent);
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ import fr.free.nrw.commons.R;
|
|||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.WelcomeActivity;
|
||||
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
||||
import fr.free.nrw.commons.theme.NavigationBaseActivity;
|
||||
import timber.log.Timber;
|
||||
|
||||
import static android.view.KeyEvent.KEYCODE_ENTER;
|
||||
|
|
@ -176,7 +177,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
}
|
||||
|
||||
public void startMainActivity() {
|
||||
ContributionsActivity.startYourself(this);
|
||||
NavigationBaseActivity.startActivityWithFlags(this, ContributionsActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -352,9 +352,4 @@ public class ContributionsActivity extends AuthenticatedActivity
|
|||
public void refreshSource() {
|
||||
getSupportLoaderManager().restartLoader(0, null, this);
|
||||
}
|
||||
|
||||
public static void startYourself(Context context) {
|
||||
context.startActivity(new Intent(context, ContributionsActivity.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,4 @@ public class SettingsActivity extends NavigationBaseActivity {
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static void startYourself(Context context) {
|
||||
Intent settingsIntent = new Intent(context, SettingsActivity.class);
|
||||
context.startActivity(settingsIntent);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package fr.free.nrw.commons.theme;
|
|||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.NavigationView;
|
||||
|
|
@ -91,30 +92,25 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
|||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
final int itemId = item.getItemId();
|
||||
switch (itemId) {
|
||||
case R.id.action_home:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
if (!(this instanceof ContributionsActivity)) {
|
||||
ContributionsActivity.startYourself(this);
|
||||
}
|
||||
startActivityWithFlags(
|
||||
this, ContributionsActivity.class, Intent.FLAG_ACTIVITY_CLEAR_TOP,
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
return true;
|
||||
case R.id.action_nearby:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
if (!(this instanceof NearbyActivity)) {
|
||||
NearbyActivity.startYourself(this);
|
||||
}
|
||||
startActivityWithFlags(this, NearbyActivity.class, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
return true;
|
||||
case R.id.action_about:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
if (!(this instanceof AboutActivity)) {
|
||||
AboutActivity.startYourself(this);
|
||||
}
|
||||
startActivityWithFlags(this, AboutActivity.class, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
return true;
|
||||
case R.id.action_settings:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
if (!(this instanceof SettingsActivity)) {
|
||||
SettingsActivity.startYourself(this);
|
||||
}
|
||||
startActivityWithFlags(this, SettingsActivity.class, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
return true;
|
||||
case R.id.action_introduction:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
|
|
@ -148,6 +144,7 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
|||
.show();
|
||||
return true;
|
||||
default:
|
||||
Timber.e("Unknown option [%s] selected from the navigation menu", itemId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -164,4 +161,12 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
|||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> void startActivityWithFlags(Context context, Class<T> cls, int... flags) {
|
||||
Intent intent = new Intent(context, cls);
|
||||
for (int flag: flags) {
|
||||
intent.addFlags(flag);
|
||||
}
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,5 +195,7 @@
|
|||
<string name="give_permission">לתת הרשאה</string>
|
||||
<string name="use_external_storage">להשתמש באחסון חיצוני</string>
|
||||
<string name="use_external_storage_summary">שמירת תמונות שצולמו באמצעות מצלמה בתוך היישום במכשיר שלך</string>
|
||||
<string name="send_log_file">שליחת קובץ יומן</string>
|
||||
<string name="send_log_file_description">שליחת קובץ יומן למפתחים בדואר אלקטרוני</string>
|
||||
<string name="login_to_your_account">כניסה לחשבון שלך</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<string name="signup">Зарегистрироваться</string>
|
||||
<string name="logging_in_title">Вход в систему</string>
|
||||
<string name="logging_in_message">Пожалуйста, подождите…</string>
|
||||
<string name="login_success">Вход выполнен успешно.</string>
|
||||
<string name="login_success">Вход выполнен успешно!</string>
|
||||
<string name="login_failed">Ошибка входа в систему!</string>
|
||||
<string name="upload_failed">Файл не найден. Попробуйте другой файл.</string>
|
||||
<string name="authentication_failed">Ошибка аутентификации!</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue