Remove MainActivity and use activity-alias

pull/183/head
Alinson S. Xavier 9 years ago
parent 132dce8919
commit 4e952dd87a

@ -50,22 +50,28 @@
android:value="AEdPqrEAAAAI6aeWncbnMNo8E5GWeZ44dlc5cQ7tCROwFhOtiw"/> android:value="AEdPqrEAAAAI6aeWncbnMNo8E5GWeZ44dlc5cQ7tCROwFhOtiw"/>
<activity <activity
android:name=".activities.habits.list.ListHabitsActivity"
android:exported="true"
android:label="@string/main_activity_title"
android:launchMode="singleTop"/>
<activity-alias
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/main_activity_title" android:label="@string/main_activity_title"
android:launchMode="singleTop"> android:launchMode="singleTop"
android:targetActivity=".activities.habits.list.ListHabitsActivity">
<intent-filter android:label="@string/app_name"> <intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </intent-filter>
</activity> </activity-alias>
<activity <activity
android:name=".activities.habits.show.ShowHabitActivity" android:name=".activities.habits.show.ShowHabitActivity"
android:label="@string/title_activity_show_habit"> android:label="@string/title_activity_show_habit">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/> android:value=".activities.habits.list.ListHabitsActivity"/>
</activity> </activity>
<activity <activity
@ -73,7 +79,7 @@
android:label="@string/settings"> android:label="@string/settings">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/> android:value=".activities.habits.list.ListHabitsActivity"/>
</activity> </activity>
<activity <activity
@ -94,7 +100,7 @@
android:label="@string/about"> android:label="@string/about">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity"/> android:value=".activities.habits.list.ListHabitsActivity"/>
</activity> </activity>
<receiver <receiver
@ -167,19 +173,25 @@
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<action android:name="org.isoron.uhabits.ACTION_TOGGLE_REPETITION"/> <action android:name="org.isoron.uhabits.ACTION_TOGGLE_REPETITION"/>
<data android:host="org.isoron.uhabits" android:scheme="content"/> <data
android:host="org.isoron.uhabits"
android:scheme="content"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<action android:name="org.isoron.uhabits.ACTION_ADD_REPETITION"/> <action android:name="org.isoron.uhabits.ACTION_ADD_REPETITION"/>
<data android:host="org.isoron.uhabits" android:scheme="content"/> <data
android:host="org.isoron.uhabits"
android:scheme="content"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<action android:name="org.isoron.uhabits.ACTION_REMOVE_REPETITION"/> <action android:name="org.isoron.uhabits.ACTION_REMOVE_REPETITION"/>
<data android:host="org.isoron.uhabits" android:scheme="content"/> <data
android:host="org.isoron.uhabits"
android:scheme="content"/>
</intent-filter> </intent-filter>
</receiver> </receiver>

@ -1,34 +0,0 @@
/*
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
*
* This file is part of Loop Habit Tracker.
*
* Loop Habit Tracker 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 3 of the License, or (at your
* option) any later version.
*
* Loop Habit Tracker 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.isoron.uhabits;
import org.isoron.uhabits.activities.habits.list.ListHabitsActivity;
/**
* Application that starts upon clicking the launcher icon.
*/
public class MainActivity extends ListHabitsActivity
{
/*
* Since changing the main activity on the manifest file causes things to
* break we always point the launcher icon to this activity instead, and
* redirect to the desired one using inheritance.
*/
}

@ -26,6 +26,7 @@ import android.support.v7.app.*;
import android.view.*; import android.view.*;
import org.isoron.uhabits.*; import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.habits.list.*;
import static android.R.anim.*; import static android.R.anim.*;
@ -80,7 +81,7 @@ abstract public class BaseActivity extends AppCompatActivity
public void restartWithFade() public void restartWithFade()
{ {
new Handler().postDelayed(() -> { new Handler().postDelayed(() -> {
Intent intent = new Intent(this, MainActivity.class); Intent intent = new Intent(this, ListHabitsActivity.class);
finish(); finish();
overridePendingTransition(fade_in, fade_out); overridePendingTransition(fade_in, fade_out);
startActivity(intent); startActivity(intent);

Loading…
Cancel
Save