diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..b6ba7d2 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 67c469b..fe9f706 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ # Dawn-Launcher-Android +# 曙光工艺启动器安卓版-曙光助手 + A game launcher for android under GPLv3 +一个使用GPLv3开源协议的游戏启动器 + +It is WIP. +它还在制作当中,并且目前进度缓慢 + +If you want to join us, we are welcome. +我们欢迎您加入我们的工作室 \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 7bffbb6..4d67b68 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion 26 + buildToolsVersion '26.0.1' defaultConfig { - applicationId "io.github.dawncraft.dawnlauncher" + applicationId 'io.github.dawncraft.launcher' minSdkVersion 16 - targetSdkVersion 25 - versionCode 1 - versionName "0.0.1.0" + targetSdkVersion 26 + versionCode 2 + versionName '0.0.1.1' vectorDrawables.useSupportLibrary = true } buildTypes { @@ -17,18 +17,18 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + productFlavors { + } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') - compile 'com.android.support:support-v4:25.3.1' - compile 'com.android.support:support-vector-drawable:25.3.1' - compile 'com.android.support:appcompat-v7:25.3.1' - compile 'com.android.support:design:25.3.1' - compile 'com.android.support.constraint:constraint-layout:1.0.2' + compile 'com.android.support:support-v4:26.0.0-alpha1' + compile 'com.android.support:support-vector-drawable:26.0.0-alpha1' + compile 'com.android.support:appcompat-v7:26.0.0-alpha1' + compile 'com.android.support:design:26.0.0-alpha1' compile 'com.google.code.gson:gson:2.2.4' compile 'com.jakewharton:butterknife:5.1.1' - compile 'com.ashokvarma.android:bottom-navigation-bar:1.4.1' compile 'com.nineoldandroids:library:2.4.0' compile 'com.daimajia.slider:library:1.1.5@aar' compile 'com.squareup.okhttp3:mockwebserver:3.6.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b63406a..a296913 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ + package="io.github.dawncraft.launcher"> @@ -45,15 +45,13 @@ - - + android:theme="@style/AppTheme.NoActionBar"> - + android:theme="@style/AppTheme"> + \ No newline at end of file diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/DLApplication.java b/app/src/main/java/io/github/dawncraft/launcher/DLApplication.java similarity index 79% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/DLApplication.java rename to app/src/main/java/io/github/dawncraft/launcher/DLApplication.java index 2e6ce53..d6a8237 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/DLApplication.java +++ b/app/src/main/java/io/github/dawncraft/launcher/DLApplication.java @@ -1,4 +1,4 @@ -package io.github.dawncraft.dawnlauncher; +package io.github.dawncraft.launcher; import android.app.Application; diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/FriendsFragment.java b/app/src/main/java/io/github/dawncraft/launcher/ui/FriendsFragment.java similarity index 75% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/ui/FriendsFragment.java rename to app/src/main/java/io/github/dawncraft/launcher/ui/FriendsFragment.java index 9394316..c8e7dc8 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/FriendsFragment.java +++ b/app/src/main/java/io/github/dawncraft/launcher/ui/FriendsFragment.java @@ -1,12 +1,12 @@ -package io.github.dawncraft.dawnlauncher.ui; +package io.github.dawncraft.launcher.ui; -import android.app.Fragment; import android.os.Bundle; +import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import io.github.dawncraft.dawnlauncher.R; +import io.github.dawncraft.launcher.R; public class FriendsFragment extends Fragment { diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/GamesFragment.java b/app/src/main/java/io/github/dawncraft/launcher/ui/GamesFragment.java similarity index 75% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/ui/GamesFragment.java rename to app/src/main/java/io/github/dawncraft/launcher/ui/GamesFragment.java index 6475efd..cfc0f1e 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/GamesFragment.java +++ b/app/src/main/java/io/github/dawncraft/launcher/ui/GamesFragment.java @@ -1,12 +1,12 @@ -package io.github.dawncraft.dawnlauncher.ui; +package io.github.dawncraft.launcher.ui; -import android.app.Fragment; import android.os.Bundle; +import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import io.github.dawncraft.dawnlauncher.R; +import io.github.dawncraft.launcher.R; public class GamesFragment extends Fragment { diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/HomeFragment.java b/app/src/main/java/io/github/dawncraft/launcher/ui/HomeFragment.java similarity index 58% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/ui/HomeFragment.java rename to app/src/main/java/io/github/dawncraft/launcher/ui/HomeFragment.java index 90fb8f2..e1f4ae0 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/HomeFragment.java +++ b/app/src/main/java/io/github/dawncraft/launcher/ui/HomeFragment.java @@ -1,19 +1,19 @@ -package io.github.dawncraft.dawnlauncher.ui; +package io.github.dawncraft.launcher.ui; -import android.app.Activity; -import android.app.Fragment; import android.content.Context; import android.os.Bundle; +import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.daimajia.slider.library.SliderLayout; +import com.daimajia.slider.library.SliderTypes.BaseSliderView; import com.daimajia.slider.library.SliderTypes.TextSliderView; -import io.github.dawncraft.dawnlauncher.R; +import io.github.dawncraft.launcher.R; -public class HomeFragment extends Fragment +public class HomeFragment extends Fragment implements BaseSliderView.OnSliderClickListener { protected Context mActivity; SliderLayout sliderShow; @@ -24,10 +24,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa View view = inflater.inflate(R.layout.fragment_home, container, false); // Add slider sliderShow = (SliderLayout) view.findViewById(R.id.slider); -// TextSliderView textSliderView = new TextSliderView(mActivity); -// textSliderView.description("示范图片") -// .image("http://img3.imgtn.bdimg.com/it/u=1798501903,126021128&fm=23&gp=0.jpg"); -// sliderShow.addSlider(textSliderView); + TextSliderView textSliderView = new TextSliderView(mActivity); + textSliderView.description("示范图片") + .image("http://img.tuku.cn/file_thumb/201504/m2015041616571244.jpg") + .setOnSliderClickListener(this); + sliderShow.addSlider(textSliderView); return view; } @@ -45,4 +46,10 @@ public void onDestroy() sliderShow.stopAutoCycle(); super.onDestroy(); } + + @Override + public void onSliderClick(BaseSliderView slider) + { + + } } diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/MainActivity.java b/app/src/main/java/io/github/dawncraft/launcher/ui/MainActivity.java similarity index 51% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/ui/MainActivity.java rename to app/src/main/java/io/github/dawncraft/launcher/ui/MainActivity.java index 51e65e7..682f944 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/MainActivity.java +++ b/app/src/main/java/io/github/dawncraft/launcher/ui/MainActivity.java @@ -1,9 +1,11 @@ -package io.github.dawncraft.dawnlauncher.ui; +package io.github.dawncraft.launcher.ui; -import android.app.Fragment; -import android.app.FragmentTransaction; import android.content.Intent; import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; +import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; @@ -13,13 +15,10 @@ import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.support.design.widget.BottomNavigationView; -import com.ashokvarma.bottomnavigation.BadgeItem; -import com.ashokvarma.bottomnavigation.BottomNavigationBar; -import com.ashokvarma.bottomnavigation.BottomNavigationItem; - -import io.github.dawncraft.dawnlauncher.R; -import io.github.dawncraft.dawnlauncher.utils.Util; +import io.github.dawncraft.launcher.R; +import io.github.dawncraft.launcher.utils.Util; public class MainActivity extends AppCompatActivity { @@ -32,29 +31,15 @@ public class MainActivity extends AppCompatActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + this.setContentView(R.layout.activity_main); + this.fragmentHome = new HomeFragment(); + this.fragmentGames = new GamesFragment(); + this.fragmentFriends = new FriendsFragment(); // Set tool bar Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar); - setSupportActionBar(toolbar); - // Set tab bar - BadgeItem badgeItem = new BadgeItem(); - badgeItem.setHideOnSelect(true) - .setText("new") - .setBackgroundColorResource(R.color.colorAccent) - .setBorderWidth(0); - BottomNavigationBar bottomBar = (BottomNavigationBar) findViewById(R.id.main_tabbar); - TabListener tabListener = new TabListener(); - bottomBar.setBarBackgroundColor(R.color.white) - .addItem(new BottomNavigationItem(R.mipmap.ic_home, R.string.tab_home).setActiveColorResource(R.color.colorLight)) - .addItem(new BottomNavigationItem(R.mipmap.ic_games, R.string.tab_games).setActiveColorResource(R.color.colorLight).setBadgeItem(badgeItem)) - .addItem(new BottomNavigationItem(R.mipmap.ic_friends, R.string.tab_friends).setActiveColorResource(R.color.colorLight)) - .setFirstSelectedPosition(0) - .setMode(BottomNavigationBar.MODE_FIXED) - .setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC) - .setTabSelectedListener(tabListener) - .initialise(); + this.setSupportActionBar(toolbar); // Set menu - DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.main_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); @@ -64,14 +49,16 @@ protected void onCreate(Bundle savedInstanceState) listview.setAdapter(new ArrayAdapter<>(this, R.layout.list_item_menu, getResources().getStringArray(R.array.menu_items))); listview.setOnItemClickListener(new MenuListener()); - // Set main content - tabListener.onTabSelected(0); + // Set tab bar(Don't forget to add BadgeItem :) + BottomNavigationView bottomNavigation = (BottomNavigationView) findViewById(R.id.main_tabbar); + bottomNavigation.setOnNavigationItemSelectedListener(new TabListener()); + bottomNavigation.setSelectedItemId(R.id.menu_home); } @Override public void onBackPressed() { - DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.main_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); @@ -96,7 +83,7 @@ private class MenuListener implements ListView.OnItemClickListener @Override public void onItemClick(AdapterView parent, View view, int position, long id) { - DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.main_layout); switch(position) { default: Util.toast(MainActivity.this, "错误,无此项目:" + position); break; @@ -108,34 +95,31 @@ public void onItemClick(AdapterView parent, View view, int position, long id) } } - private class TabListener implements BottomNavigationBar.OnTabSelectedListener + private class TabListener implements BottomNavigationView.OnNavigationItemSelectedListener { @Override - public void onTabSelected(int position) + public boolean onNavigationItemSelected(@NonNull MenuItem item) { - FragmentTransaction transaction = getFragmentManager().beginTransaction(); - switch (position) + BottomNavigationView bottomNavigation = (BottomNavigationView) findViewById(R.id.main_tabbar); + bottomNavigation.getMenu().getItem(0).setChecked(false); + bottomNavigation.getMenu().getItem(1).setChecked(false); + bottomNavigation.getMenu().getItem(2).setChecked(false); + item.setChecked(true); + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + switch (item.getItemId()) { - case 0: - if (fragmentHome == null) fragmentHome = new HomeFragment(); - transaction.replace(R.id.main_content, fragmentHome); + case R.id.menu_home: + transaction.replace(R.id.main_content_layout, fragmentHome); break; - case 1: - if (fragmentGames == null) fragmentGames = new GamesFragment(); - transaction.replace(R.id.main_content, fragmentGames); + case R.id.menu_games: + transaction.replace(R.id.main_content_layout, fragmentGames); break; - case 2: - if (fragmentFriends == null) fragmentFriends = new FriendsFragment(); - transaction.replace(R.id.main_content, fragmentFriends); + case R.id.menu_friends: + transaction.replace(R.id.main_content_layout, fragmentFriends); break; } transaction.commit(); + return false; } - - @Override - public void onTabUnselected(int position) {} - - @Override - public void onTabReselected(int position) {} } } diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/SettingsActivity.java b/app/src/main/java/io/github/dawncraft/launcher/ui/SettingsActivity.java similarity index 95% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/ui/SettingsActivity.java rename to app/src/main/java/io/github/dawncraft/launcher/ui/SettingsActivity.java index 7feb3a2..4e64c64 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/SettingsActivity.java +++ b/app/src/main/java/io/github/dawncraft/launcher/ui/SettingsActivity.java @@ -1,4 +1,4 @@ -package io.github.dawncraft.dawnlauncher.ui; +package io.github.dawncraft.launcher.ui; import android.content.Intent; import android.os.Bundle; @@ -8,10 +8,8 @@ import android.preference.PreferenceManager; import android.view.MenuItem; -import io.github.dawncraft.dawnlauncher.R; -import io.github.dawncraft.dawnlauncher.ui.base.AppCompatPreferenceActivity; - -import java.util.List; +import io.github.dawncraft.launcher.R; +import io.github.dawncraft.launcher.ui.base.AppCompatPreferenceActivity; public class SettingsActivity extends AppCompatPreferenceActivity { diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/SplashActivity.java b/app/src/main/java/io/github/dawncraft/launcher/ui/SplashActivity.java similarity index 91% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/ui/SplashActivity.java rename to app/src/main/java/io/github/dawncraft/launcher/ui/SplashActivity.java index 3e0f54a..6f0083b 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/SplashActivity.java +++ b/app/src/main/java/io/github/dawncraft/launcher/ui/SplashActivity.java @@ -1,4 +1,4 @@ -package io.github.dawncraft.dawnlauncher.ui; +package io.github.dawncraft.launcher.ui; import android.content.Intent; import android.support.v7.app.AppCompatActivity; @@ -8,7 +8,7 @@ import com.squareup.picasso.Picasso; -import io.github.dawncraft.dawnlauncher.R; +import io.github.dawncraft.launcher.R; public class SplashActivity extends AppCompatActivity { diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/base/AppCompatPreferenceActivity.java b/app/src/main/java/io/github/dawncraft/launcher/ui/base/AppCompatPreferenceActivity.java similarity index 98% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/ui/base/AppCompatPreferenceActivity.java rename to app/src/main/java/io/github/dawncraft/launcher/ui/base/AppCompatPreferenceActivity.java index bd0fbae..e4c63be 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/ui/base/AppCompatPreferenceActivity.java +++ b/app/src/main/java/io/github/dawncraft/launcher/ui/base/AppCompatPreferenceActivity.java @@ -1,4 +1,4 @@ -package io.github.dawncraft.dawnlauncher.ui.base; +package io.github.dawncraft.launcher.ui.base; import android.content.res.Configuration; import android.os.Bundle; diff --git a/app/src/main/java/io/github/dawncraft/dawnlauncher/utils/Util.java b/app/src/main/java/io/github/dawncraft/launcher/utils/Util.java similarity index 97% rename from app/src/main/java/io/github/dawncraft/dawnlauncher/utils/Util.java rename to app/src/main/java/io/github/dawncraft/launcher/utils/Util.java index cf4dc55..ca1bde1 100644 --- a/app/src/main/java/io/github/dawncraft/dawnlauncher/utils/Util.java +++ b/app/src/main/java/io/github/dawncraft/launcher/utils/Util.java @@ -1,4 +1,4 @@ -package io.github.dawncraft.dawnlauncher.utils; +package io.github.dawncraft.launcher.utils; import android.content.Context; import android.support.annotation.StringRes; diff --git a/app/src/main/res/drawable/menu_image.xml b/app/src/main/res/drawable/image_menu.xml similarity index 100% rename from app/src/main/res/drawable/menu_image.xml rename to app/src/main/res/drawable/image_menu.xml diff --git a/app/src/main/res/drawable/selector_main_bottom.xml b/app/src/main/res/drawable/selector_main_bottom.xml new file mode 100644 index 0000000..62c5244 --- /dev/null +++ b/app/src/main/res/drawable/selector_main_bottom.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a2b7ef5..29966f9 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" - android:id="@+id/drawer_layout" + android:id="@+id/main_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" @@ -15,7 +15,7 @@ android:background="@android:color/white"> - + android:layout_height="1dp" + android:background="?attr/colorPrimary" /> - + + android:layout_height="?attr/actionBarSize" + app:menu="@menu/menu_tab" + app:itemIconTint="@drawable/selector_main_bottom" + app:itemTextColor="@drawable/selector_main_bottom" + app:itemBackground="@color/white" /> + android:layout_below="@id/main_toolbar_layout" + android:layout_above="@id/main_tabbar_layout" /> - + + + + + diff --git a/app/src/main/res/mipmap-hdpi/Thumbs.db b/app/src/main/res/mipmap-hdpi/Thumbs.db deleted file mode 100644 index 2f1e55d..0000000 Binary files a/app/src/main/res/mipmap-hdpi/Thumbs.db and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/Thumbs.db b/app/src/main/res/mipmap-mdpi/Thumbs.db deleted file mode 100644 index 0855ab5..0000000 Binary files a/app/src/main/res/mipmap-mdpi/Thumbs.db and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_friends.png b/app/src/main/res/mipmap-mdpi/ic_friends.png deleted file mode 100644 index 57da32a..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_friends.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_games.png b/app/src/main/res/mipmap-mdpi/ic_games.png deleted file mode 100644 index 50b102a..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_games.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_home.png b/app/src/main/res/mipmap-mdpi/ic_home.png deleted file mode 100644 index 9f2c3d2..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_home.png and /dev/null differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3578711..d67ca87 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -4,4 +4,6 @@ #f57c00 #ffd600 #ffffff + #D3D3D3 + #808080 diff --git a/build.gradle b/build.gradle index 1ea4bd0..c2eea8e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0' + classpath 'com.android.tools.build:gradle:2.3.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files