mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Ability to launch welcome activity again
This commit is contained in:
parent
fc2afc7edd
commit
bcca6b15e5
6 changed files with 48 additions and 13 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.view.ViewPager;
|
||||
|
||||
|
|
@ -7,12 +9,14 @@ import com.viewpagerindicator.CirclePageIndicator;
|
|||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
||||
import fr.free.nrw.commons.theme.BaseActivity;
|
||||
|
||||
public class WelcomeActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.welcomePager) ViewPager pager;
|
||||
@BindView(R.id.welcomePagerIndicator) CirclePageIndicator indicator;
|
||||
|
||||
private WelcomePagerAdapter adapter = new WelcomePagerAdapter();
|
||||
|
||||
@Override
|
||||
|
|
@ -20,9 +24,6 @@ public class WelcomeActivity extends BaseActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_welcome);
|
||||
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
ButterKnife.bind(this);
|
||||
|
||||
pager.setAdapter(adapter);
|
||||
|
|
@ -40,4 +41,9 @@ public class WelcomeActivity extends BaseActivity {
|
|||
adapter.setCallback(null);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public static void startYourself(Context context) {
|
||||
Intent welcomeIntent = new Intent(context, WelcomeActivity.class);
|
||||
context.startActivity(welcomeIntent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (prefs.getBoolean("firstrun", true)) {
|
||||
startWelcomeIntent();
|
||||
WelcomeActivity.startYourself(this);
|
||||
prefs.edit().putBoolean("firstrun", false).apply();
|
||||
}
|
||||
if (app.getCurrentAccount() != null) {
|
||||
|
|
@ -121,11 +121,6 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private void startWelcomeIntent() {
|
||||
Intent welcomeIntent = new Intent(this, WelcomeActivity.class);
|
||||
startActivity(welcomeIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
try {
|
||||
|
|
@ -215,8 +210,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
}
|
||||
|
||||
public void startMainActivity() {
|
||||
Intent intent = new Intent(this, ContributionsActivity.class);
|
||||
startActivity(intent);
|
||||
ContributionsActivity.startYourself(this);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ public class ContributionsActivity
|
|||
}
|
||||
|
||||
public static void startYourself(Context context) {
|
||||
Intent settingsIntent = new Intent(context, ContributionsActivity.class);
|
||||
context.startActivity(settingsIntent);
|
||||
Intent contributionsIntent = new Intent(context, ContributionsActivity.class);
|
||||
context.startActivity(contributionsIntent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import fr.free.nrw.commons.AboutActivity;
|
|||
import fr.free.nrw.commons.BuildConfig;
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.WelcomeActivity;
|
||||
import fr.free.nrw.commons.auth.LoginActivity;
|
||||
import fr.free.nrw.commons.contributions.ContributionsActivity;
|
||||
import fr.free.nrw.commons.nearby.NearbyActivity;
|
||||
|
|
@ -51,6 +52,9 @@ public class NavigationBaseFragment extends Fragment {
|
|||
@BindView(R.id.logout_item)
|
||||
LinearLayout logoutItem;
|
||||
|
||||
@BindView(R.id.introduction_item)
|
||||
LinearLayout introductionItem;
|
||||
|
||||
private DrawerLayout drawerLayout;
|
||||
private RelativeLayout drawerPane;
|
||||
|
||||
|
|
@ -106,6 +110,12 @@ public class NavigationBaseFragment extends Fragment {
|
|||
NearbyActivity.startYourself(getActivity());
|
||||
}
|
||||
|
||||
@OnClick(R.id.introduction_item)
|
||||
protected void onInfoItemClicked() {
|
||||
closeDrawer();
|
||||
WelcomeActivity.startYourself(getActivity());
|
||||
}
|
||||
|
||||
@OnClick(R.id.feedback_item)
|
||||
protected void onFeedbackItemClicked() {
|
||||
closeDrawer();
|
||||
|
|
|
|||
|
|
@ -124,6 +124,30 @@
|
|||
android:textSize="@dimen/hamburger_menu_item" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/introduction_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="@drawable/hamburger_item_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:src="@drawable/ic_info_outline_black_24dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:text="@string/navigation_item_info"
|
||||
android:letterSpacing="0.02"
|
||||
android:textColor="@color/main_background_dark"
|
||||
android:textSize="@dimen/hamburger_menu_item" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/feedback_item"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ Tap this message (or hit back) to skip this step.</string>
|
|||
<string name="navigation_item_settings">Settings</string>
|
||||
<string name="navigation_item_feedback">Feedback</string>
|
||||
<string name="navigation_item_logout">Logout</string>
|
||||
<string name="navigation_item_info">Introduction</string>
|
||||
|
||||
<string name="nearby_info_menu_commons_article">Commons Article</string>
|
||||
<string name="nearby_info_menu_wikidata_article">WikiData Article</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue