mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-19 04:58:47 -04:00
IntroActivity : Allow accessing settings from intro
https://gitlab.com/AuroraOSS/AuroraStore/issues/85
This commit is contained in:
@@ -87,6 +87,7 @@ public class AuroraActivity extends AppCompatActivity {
|
||||
onNewIntent(getIntent());
|
||||
|
||||
if (!PrefUtil.getBoolean(this, Constants.PREFERENCE_DO_NOT_SHOW_INTRO)) {
|
||||
PrefUtil.putBoolean(this, Constants.PREFERENCE_DO_NOT_SHOW_INTRO, true);
|
||||
startActivity(new Intent(this, IntroActivity.class));
|
||||
finish();
|
||||
} else {
|
||||
|
||||
@@ -20,15 +20,21 @@
|
||||
|
||||
package com.aurora.store.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.aurora.store.R;
|
||||
import com.aurora.store.adapter.ViewPagerAdapter;
|
||||
import com.aurora.store.fragment.AccountsFragment;
|
||||
import com.aurora.store.fragment.intro.PermissionFragment;
|
||||
import com.aurora.store.fragment.intro.WelcomeFragment;
|
||||
import com.aurora.store.utility.Accountant;
|
||||
import com.aurora.store.utility.ThemeUtil;
|
||||
import com.aurora.store.view.CustomViewPager;
|
||||
|
||||
@@ -39,8 +45,10 @@ public class IntroActivity extends AppCompatActivity {
|
||||
|
||||
@BindView(R.id.viewpager)
|
||||
CustomViewPager viewPager;
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
|
||||
private ActionBar actionBar;
|
||||
private ThemeUtil themeUtil = new ThemeUtil();
|
||||
|
||||
@Override
|
||||
@@ -49,16 +57,47 @@ public class IntroActivity extends AppCompatActivity {
|
||||
themeUtil.onCreate(this);
|
||||
setContentView(R.layout.activity_intro);
|
||||
ButterKnife.bind(this);
|
||||
init();
|
||||
setupActionbar();
|
||||
setupViewPager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(final Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_intro, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem menuItem) {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.action_setting:
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(menuItem);
|
||||
}
|
||||
|
||||
private void setupActionbar() {
|
||||
setSupportActionBar(toolbar);
|
||||
actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayShowCustomEnabled(true);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setElevation(0f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
themeUtil.onResume(this);
|
||||
if (Accountant.isLoggedIn(this)) {
|
||||
startActivity(new Intent(this, AuroraActivity.class));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
private void setupViewPager() {
|
||||
ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
|
||||
viewPagerAdapter.addFragment(0, new WelcomeFragment());
|
||||
viewPagerAdapter.addFragment(1, new PermissionFragment());
|
||||
|
||||
@@ -375,7 +375,6 @@ public class AccountsFragment extends Fragment {
|
||||
|
||||
private void finishIntro() {
|
||||
if (getActivity() instanceof IntroActivity) {
|
||||
PrefUtil.putBoolean(context, Constants.PREFERENCE_DO_NOT_SHOW_INTRO, true);
|
||||
getActivity().startActivity(new Intent(context, AuroraActivity.class));
|
||||
getActivity().finish();
|
||||
}
|
||||
|
||||
@@ -18,16 +18,18 @@
|
||||
~
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.IntroActivity">
|
||||
|
||||
<include layout="@layout/toolbar_main" />
|
||||
|
||||
<com.aurora.store.view.CustomViewPager
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -25,20 +25,11 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.AccountsActivity">
|
||||
|
||||
<View
|
||||
android:id="@+id/gradient_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/gradient_bg"
|
||||
android:translationZ="10dp" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="-16dp"
|
||||
android:clipToPadding="false"
|
||||
android:fillViewport="true"
|
||||
android:paddingTop="@dimen/margin_normal"
|
||||
android:scrollbars="none">
|
||||
|
||||
<RelativeLayout
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2019, Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
@@ -19,76 +18,68 @@
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.IntroActivity">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
<ImageView
|
||||
android:id="@+id/perm_icon"
|
||||
android:layout_width="@dimen/icon_size_big"
|
||||
android:layout_height="@dimen/icon_size_big"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_xlarge"
|
||||
android:src="@drawable/ic_permission" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/acc_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/perm_icon"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_normal"
|
||||
android:text="@string/title_perm"
|
||||
android:textAppearance="@style/TextAppearance.Aurora.Toolbar.Title"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/perm_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/acc_txt"
|
||||
android:layout_margin="@dimen/margin_normal"
|
||||
android:text="@string/desc_perm"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="?actionBarSize">
|
||||
android:layout_above="@id/action"
|
||||
android:layout_below="@+id/perm_desc"
|
||||
android:layout_margin="@dimen/margin_normal"
|
||||
android:background="@drawable/generic_padded_bg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/perm_icon"
|
||||
android:layout_width="@dimen/icon_size_big"
|
||||
android:layout_height="@dimen/icon_size_big"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_xlarge"
|
||||
android:src="@drawable/ic_permission" />
|
||||
<LinearLayout
|
||||
android:id="@+id/permissions_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/acc_txt"
|
||||
<RelativeLayout
|
||||
android:id="@+id/action"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_next"
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/perm_icon"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_normal"
|
||||
android:text="@string/title_perm"
|
||||
android:textAppearance="@style/TextAppearance.Aurora.Toolbar.Title"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/perm_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/acc_txt"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_margin="@dimen/margin_normal"
|
||||
android:text="@string/desc_perm"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/action"
|
||||
android:layout_margin="@dimen/margin_normal"
|
||||
android:background="@drawable/generic_padded_bg"
|
||||
android:layout_below="@+id/perm_desc">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/permissions_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/action"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_next"
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_margin="@dimen/margin_normal"
|
||||
android:maxLines="1"
|
||||
android:text="@string/action_next" />
|
||||
</RelativeLayout>
|
||||
android:maxLines="1"
|
||||
android:text="@string/action_next" />
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</RelativeLayout>
|
||||
@@ -18,71 +18,62 @@
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.IntroActivity">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
<ImageView
|
||||
android:id="@+id/welcome_icon"
|
||||
android:layout_width="@dimen/icon_size_big"
|
||||
android:layout_height="@dimen/icon_size_big"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_xlarge"
|
||||
android:src="@drawable/ic_namaste_alt" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/welcome_icon"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_normal"
|
||||
android:text="@string/title_welcome"
|
||||
android:textAppearance="@style/TextAppearance.Aurora.Toolbar.Title"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="?actionBarSize">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/welcome_icon"
|
||||
android:layout_width="@dimen/icon_size_big"
|
||||
android:layout_height="@dimen/icon_size_big"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_xlarge"
|
||||
android:src="@drawable/ic_namaste_alt" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/action"
|
||||
android:layout_below="@+id/app_name"
|
||||
android:layout_margin="@dimen/margin_normal"
|
||||
android:background="@drawable/generic_padded_bg"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_log"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:typeface="monospace" />
|
||||
</ScrollView>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/action"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_next"
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/welcome_icon"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/margin_normal"
|
||||
android:text="@string/title_welcome"
|
||||
android:textAppearance="@style/TextAppearance.Aurora.Toolbar.Title"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/action"
|
||||
android:layout_below="@+id/app_name"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_margin="@dimen/margin_normal"
|
||||
android:background="@drawable/generic_padded_bg"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_log"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:typeface="monospace" />
|
||||
</ScrollView>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/action"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_next"
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_margin="@dimen/margin_normal"
|
||||
android:maxLines="1"
|
||||
android:text="@string/action_next" />
|
||||
|
||||
</RelativeLayout>
|
||||
android:maxLines="1"
|
||||
android:text="@string/action_next" />
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</RelativeLayout>
|
||||
29
app/src/main/res/menu/menu_intro.xml
Normal file
29
app/src/main/res/menu/menu_intro.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2019, Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
~ Aurora Store is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 2 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ Aurora Store is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
~
|
||||
~
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_setting"
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:title="@string/menu_setting"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
Reference in New Issue
Block a user