diff --git a/app/build.gradle b/app/build.gradle index fde0475..99a87e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "me.gensh.helloustb" minSdkVersion 16 targetSdkVersion 26 - versionCode 108 - versionName "2.1.0-alpha1" + versionCode 110 + versionName "2.1.0-alpha3" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { diff --git a/app/src/main/assets/open_source.html b/app/src/main/assets/open_source.html index 539036f..d841cf6 100644 --- a/app/src/main/assets/open_source.html +++ b/app/src/main/assets/open_source.html @@ -43,6 +43,12 @@ line-height: 1.45; background-color: #f7f7f7 } + + + + + + @@ -62,6 +68,26 @@

PermissionsDispatcher

http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +
  • +

    butterknife

    +

    + https://github.com/JakeWharton/butterknife +

    +
    +Copyright 2013 Jake Wharton
    +
    +Licensed under the Apache License, Version 2.0 (the "License");
    +you may not use this file except in compliance with the License.
    +You may obtain a copy of the License at
    +
    +http://www.apache.org/licenses/LICENSE-2.0
    +
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    @@ -101,9 +127,7 @@ 

    Material Dialogs

  • williamchart

    - - https://github.com/diogobernardino/WilliamChart - + https://github.com/diogobernardino/WilliamChart

     License
    @@ -126,9 +150,7 @@ 

    williamchart

  • GoogleProgressBar

    - - https://github.com/jpardogo/GoogleProgressBar - + https://github.com/jpardogo/GoogleProgressBar

     Licence
    @@ -150,9 +172,7 @@ 

    GoogleProgressBar

  • SmartTabLayout

    - - https://github.com/ogaclejapan/SmartTabLayout - + https://github.com/ogaclejapan/SmartTabLayout

     LICENSE
    @@ -176,9 +196,7 @@ 

    SmartTabLayout

  • MaterialRefreshLayout

    - - https://github.com/android-cjj/Android-MaterialRefreshLayout - + https://github.com/android-cjj/Android-MaterialRefreshLayout

     License
    @@ -204,17 +222,65 @@ 

    MaterialRefreshLayout

    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    +
  • + +
  • +

    SearchView

    +

    + https://github.com/lapism/SearchView +

    +
    +Licence
    +
    +Apache License
    +Version 2.0, January 2004
    +Licensed under the Apache License, Version 2.0 (the "License");
    +you may not use this file except in compliance with the License.
    +You may obtain a copy of the License at
    +
    +http://www.apache.org/licenses/LICENSE-2.0
    +
    +Unless required by applicable law or agreed to in writing, software
    +distributed under the License is distributed on an "AS IS" BASIS,
    +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +See the License for the specific language governing permissions and
    +limitations under the License.
    +        
    +
  • + +
  • +

    flexbox-layout

    +

    + https://github.com/google/flexbox-layout +

    +
    +Licence
    +
    +Apache License
    +Version 2.0, January 2004
    +Licensed under the Apache License, Version 2.0 (the "License");
    +you may not use this file except in compliance with the License.
    +You may obtain a copy of the License at
    +
    +http://www.apache.org/licenses/LICENSE-2.0
    +
    +Unless required by applicable law or agreed to in writing, software
    +distributed under the License is distributed on an "AS IS" BASIS,
    +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +See the License for the specific language governing permissions and
    +limitations under the License.
    +        
    +
  • +
  • CircleImageView

    - - https://github.com/hdodenhof/CircleImageView - + https://github.com/hdodenhof/CircleImageView

     License
     
    -Copyright 2014 - 2016 Henning Dodenhof
    +Copyright 2014 - 2017 Henning Dodenhof
     
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
    @@ -232,9 +298,7 @@ 

    CircleImageView

  • FloatingActionButton

    - - https://github.com/Clans/FloatingActionButton - + https://github.com/Clans/FloatingActionButton

     License
    @@ -247,6 +311,29 @@ 

    FloatingActionButton

    http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
    +
  • + +
  • +

    StatusBarUtil

    +

    + https://github.com/laobie/StatusBarUtil +

    +
    +License
    +
    +Copyright 2016 Jaeger Chen
    +
    +Licensed under the Apache License, Version 2.0 (the "License");
    +you may not use this file except in compliance with the License.
    +You may obtain a copy of the License at
    +
    +	http://www.apache.org/licenses/LICENSE-2.0
    +
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    diff --git a/app/src/main/java/me/gensh/fragment/DashboardFragment.java b/app/src/main/java/me/gensh/fragment/DashboardFragment.java
    index d5e0a20..56b0d78 100644
    --- a/app/src/main/java/me/gensh/fragment/DashboardFragment.java
    +++ b/app/src/main/java/me/gensh/fragment/DashboardFragment.java
    @@ -107,7 +107,7 @@ public void onItemClick(AdapterView adapterView, View view, int position, lon
                             startActivity(network);
                             break;
                         case GRID_VIEW_ITEM_TAG_CAMPUS_CARD:
    -                        Snackbar.make(gridViewDashboard, R.string.developing, Snackbar.LENGTH_INDEFINITE).show(); //// TODO: 2017/9/14
    +                        Snackbar.make(gridViewDashboard, R.string.developing, Snackbar.LENGTH_LONG).show(); //// TODO: 2017/9/14
                             break;
                         case GRID_VIEW_ITEM_TAG_LIBRARY:
                             Intent library = new Intent(getActivity(), Library.class);
    diff --git a/app/src/main/java/me/gensh/fragment/InnovationCreditFragment.java b/app/src/main/java/me/gensh/fragment/InnovationCreditFragment.java
    index f481123..1af8339 100644
    --- a/app/src/main/java/me/gensh/fragment/InnovationCreditFragment.java
    +++ b/app/src/main/java/me/gensh/fragment/InnovationCreditFragment.java
    @@ -1,9 +1,12 @@
     package me.gensh.fragment;
     
     
    +import android.app.Activity;
     import android.content.Context;
    +import android.os.Build;
     import android.os.Bundle;
     import android.app.Fragment;
    +import android.util.Log;
     import android.view.LayoutInflater;
     import android.view.View;
     import android.view.ViewGroup;
    @@ -18,6 +21,8 @@
     
     import me.gensh.helloustb.R;
     
    +import static android.os.Build.VERSION_CODES.LOLLIPOP;
    +
     /**
      * A simple {@link Fragment} subclass.
      * Use the {@link InnovationCreditFragment#newInstance} factory method to
    @@ -77,8 +82,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
             if (listItems == null || listItems.size() == 0) {
                 Toast.makeText(getActivity(), R.string.no_innovation_credit_now, Toast.LENGTH_LONG).show();
             }
    +
             if (mListener != null) {
                 mListener.onInnovationCreditCalculated(creditSum);
    +        } else {
    +            Log.e("subTitle", "listener is null");
             }
             return view;
         }
    @@ -93,6 +101,29 @@ public void onAttach(Context context) {
             }
         }
     
    +    /**
    +     * for pre-lollipop version
    +     * see https://stackoverflow.com/questions/32604552/onattach-not-called-in-fragment  for more details.
    +     * @param activity container activity
    +     */
    +    @Override
    +    public void onAttach(Activity activity) {
    +        super.onAttach(activity);
    +        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
    +            if (activity instanceof OnInnovationCreditLoadListener) {
    +                mListener = (OnInnovationCreditLoadListener) activity;
    +            } else {
    +                throw new RuntimeException(activity.toString() + " must implement OnInnovationCreditLoadListener");
    +            }
    +        }
    +    }
    +
    +    @Override
    +    public void onDetach() {
    +        super.onDetach();
    +        mListener = null;
    +    }
    +
         /**
          * This interface must be implemented by activities that contain this
          * fragment to allow an interaction in this fragment to be communicated
    diff --git a/app/src/main/java/me/gensh/fragment/SettingsFragment.java b/app/src/main/java/me/gensh/fragment/SettingsFragment.java
    index 951a7a2..2e874cc 100644
    --- a/app/src/main/java/me/gensh/fragment/SettingsFragment.java
    +++ b/app/src/main/java/me/gensh/fragment/SettingsFragment.java
    @@ -70,6 +70,7 @@ public void onResume() {
     
             long week_start_days = preferences.getLong(Const.Settings.KEY_WEEK_START, 0);
             mPreferenceWeekNum.setValue(BasicDate.getWeekNum(week_start_days) + "");
    +        //have a think: setValue will cause a call of function onSharedPreferenceChanged. But it have no effect.todo think.
             setListSummary(mPreferenceWeekNum, "第一周");
         }
     
    @@ -79,13 +80,12 @@ public void onPause() {
             super.onPause();
         }
     
    -
         //    init MaterialListPreference
         @Override
         public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
             if (Const.Settings.KEY_WEEK_NUM.equals(key)) {
                 setWeekStart(Integer.parseInt(mPreferenceWeekNum.getValue()));
    -            BasicDate.writeLog("changed!\r\n");
    +//            BasicDate.writeLog("changed!\r\n");
                 setListSummary(mPreferenceWeekNum, "第一周");
             } else if (Const.Settings.KEY_NET_SIGN_IN_MODE.equals(key)) {
                 setListSummary(mPreferenceNetSignInMode, "普通模式");
    diff --git a/app/src/main/java/me/gensh/fragment/TodayCourseFragment.java b/app/src/main/java/me/gensh/fragment/TodayCourseFragment.java
    index 504a04f..8129c98 100644
    --- a/app/src/main/java/me/gensh/fragment/TodayCourseFragment.java
    +++ b/app/src/main/java/me/gensh/fragment/TodayCourseFragment.java
    @@ -51,7 +51,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
         @Override
         public void onResume() {
             super.onResume();
    -        showCourse();
    +        showCourse();  //if we have imported course,and then I deleted the database(or imported empty timetable),but, then the todat have no updated.todo: bug
         }
     
         @OnClick(R.id.today_course_import_or_see_all)
    diff --git a/app/src/main/java/me/gensh/helloustb/Account.java b/app/src/main/java/me/gensh/helloustb/Account.java
    index 031977a..553ebe3 100644
    --- a/app/src/main/java/me/gensh/helloustb/Account.java
    +++ b/app/src/main/java/me/gensh/helloustb/Account.java
    @@ -18,7 +18,7 @@ public class Account extends AppCompatActivity {
         protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.activity_account);
    -        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    +        Toolbar toolbar = findViewById(R.id.toolbar);
             setSupportActionBar(toolbar);
             getSupportActionBar().setDisplayShowHomeEnabled(true);
     
    diff --git a/app/src/main/java/me/gensh/helloustb/Browser.java b/app/src/main/java/me/gensh/helloustb/Browser.java
    index 16dd685..aba5d9e 100644
    --- a/app/src/main/java/me/gensh/helloustb/Browser.java
    +++ b/app/src/main/java/me/gensh/helloustb/Browser.java
    @@ -5,6 +5,7 @@
     import android.content.Context;
     import android.content.Intent;
     import android.net.Uri;
    +import android.os.Build;
     import android.os.Bundle;
     import android.os.Handler;
     import android.os.Message;
    @@ -120,7 +121,7 @@ public void handleMessage(Message msg) {
                 switch (msg.what) {
                     case 0x100://下载
     //					Toast.makeText(Browser.this,"文件"+str_msg+"下载完成", Toast.LENGTH_SHORT).show();
    -                    showNoptify(str_msg);
    +                    showNotify(str_msg);
                         break;
                 }
             }
    @@ -128,20 +129,26 @@ public void handleMessage(Message msg) {
     
     
         // 为发送通知的按钮的点击事件定义事件处理方法
    -    public void showNoptify(String FileName) {
    +    public void showNotify(String FileName) {
     
             Intent main_intent = new Intent(this, FileManager.class);
     //		 	main_intent.putExtra("open_id",1);
             PendingIntent pi = PendingIntent.getActivity(this, 0, main_intent, 0);
     
             NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
    -                .setSmallIcon(R.mipmap.ic_launcher)
                     .setContentTitle("点击打开文件")
                     .setTicker("下载成功")
                     .setContentText("文件" + FileName + "下载成功")
                     .setContentIntent(pi)
                     .setAutoCancel(true);
     
    +        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    +            mBuilder.setSmallIcon(R.drawable.ic_adjust_white_24dp);
    +            mBuilder.setColor(getResources().getColor(R.color.colorPrimary));  // TODO: 2017/9/17
    +        } else {
    +            mBuilder.setSmallIcon(R.mipmap.ic_launcher);
    +        }
    +
             nm.notify(NOTIFICATION_ID, mBuilder.build());
         }
     
    diff --git a/app/src/main/java/me/gensh/helloustb/ELearningCategory.java b/app/src/main/java/me/gensh/helloustb/ELearningCategory.java
    index 074de83..0be5507 100644
    --- a/app/src/main/java/me/gensh/helloustb/ELearningCategory.java
    +++ b/app/src/main/java/me/gensh/helloustb/ELearningCategory.java
    @@ -1,9 +1,12 @@
     package me.gensh.helloustb;
     
     import android.animation.LayoutTransition;
    +import android.os.Build;
     import android.os.Bundle;
     import android.support.annotation.Nullable;
    +import android.support.v7.app.ActionBar;
     import android.support.v7.widget.Toolbar;
    +import android.util.Log;
     import android.view.MenuItem;
     import android.view.View;
     import android.widget.Toast;
    @@ -240,5 +243,6 @@ public void changeSubtitle(@Nullable String subtitle) {
                 toolbar.setLayoutTransition(new LayoutTransition()); //animation
                 toolbar.setSubtitle(subtitle);
             }
    +
         }
     }
    diff --git a/app/src/main/java/me/gensh/helloustb/FileManager.java b/app/src/main/java/me/gensh/helloustb/FileManager.java
    index 3eb60df..ecf64be 100644
    --- a/app/src/main/java/me/gensh/helloustb/FileManager.java
    +++ b/app/src/main/java/me/gensh/helloustb/FileManager.java
    @@ -65,7 +65,7 @@ private void inti() {
                 List.add(listitem);
             }
     
    -        ListView li = (ListView)findViewById(R.id.file_list);
    +        ListView li = findViewById(R.id.file_list);
             SimpleAdapter Adapter = new SimpleAdapter(this,List,
                     R.layout.listview_file_manager,
                     new String[]{"icon","name","time","size"},
    @@ -91,7 +91,7 @@ private void openFile(File file){
                 Intent intent = new Intent();
                 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 intent.setAction(Intent.ACTION_VIEW);
    -            intent.setDataAndType(Uri.fromFile(file), type);
    +            intent.setDataAndType(Uri.fromFile(file), type);  // TODO: 2017/9/17
                 startActivity(intent);
             }else {
                 Toast.makeText(this, R.string.noApplicationToOpen, Toast.LENGTH_LONG).show();
    diff --git a/app/src/main/java/me/gensh/helloustb/MainActivity.java b/app/src/main/java/me/gensh/helloustb/MainActivity.java
    index cafe943..a8a6c73 100644
    --- a/app/src/main/java/me/gensh/helloustb/MainActivity.java
    +++ b/app/src/main/java/me/gensh/helloustb/MainActivity.java
    @@ -40,8 +40,8 @@
      */
     public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
         VersionCheckerTask checker;
    -    SearchView mSearchView;
    -    AppBarLayout appBarLayout;
    +//    SearchView mSearchView;
    +//    AppBarLayout appBarLayout;
         DrawerLayout drawer;
         View navigationHeader;
         Fragment homeFragment, dashboardFragment, settingFragment;
    @@ -73,10 +73,10 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
         protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.activity_main);
    -        appBarLayout = findViewById(R.id.app_bar_layout);
    +//        appBarLayout = findViewById(R.id.app_bar_layout);
             Toolbar toolbar = findViewById(R.id.toolbar);
             setSupportActionBar(toolbar);
    -        StatusBarUtil.setTransparent(this); //actually,it can be removed,but it will cause a bug for drawer item selection
    +//        StatusBarUtil.setTransparent(this); //actually,it can be removed,but it will cause a bug for drawer item selection;todo bugs,so removed.
     
             // drawLayout
             drawer = findViewById(R.id.drawer_layout);
    @@ -115,6 +115,7 @@ protected void onCreate(Bundle savedInstanceState) {
             navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
     
             // searchView
    +        /* //todo have bugs
             mSearchView = findViewById(R.id.searchView);
             mSearchView.setVersionMargins(SearchView.VersionMargins.TOOLBAR_SMALL);
             mSearchView.setOnOpenCloseListener(new SearchView.OnOpenCloseListener() {
    @@ -146,7 +147,7 @@ public void onSearchItemClick(View view, int position) {
                 }
             });
             mSearchView.setAdapter(searchAdapter);
    -
    +*/
             //event
             checker = new VersionCheckerTask(getString(R.string.UpdateAddress), this, true);
             checker.execute();
    @@ -191,7 +192,6 @@ protected void onDestroy() {
     
         @Override
         public boolean onCreateOptionsMenu(Menu menu) {
    -        // Inflate the menu; this adds items to the action bar if it is present.
             getMenuInflater().inflate(R.menu.menu_main, menu);
             return true;
         }
    @@ -199,13 +199,13 @@ public boolean onCreateOptionsMenu(Menu menu) {
         @Override
         public boolean onOptionsItemSelected(MenuItem item) {
             int id = item.getItemId();
    -        //noinspection SimplifiableIfStatement
             switch (id) {
                 case R.id.action_search:
    -                StatusBarUtil.setColor(MainActivity.this, getResources().getColor(R.color.white));//todo
    -                appBarLayout.setVisibility(View.INVISIBLE);
    -                mSearchView.setVisibility(View.VISIBLE);
    -                mSearchView.open(false); // enable or disable animation
    +                //todo have bugs
    +//                StatusBarUtil.setColor(MainActivity.this, getResources().getColor(R.color.white));//todo
    +//                appBarLayout.setVisibility(View.INVISIBLE);
    +//                mSearchView.setVisibility(View.VISIBLE);
    +//                mSearchView.open(false); // enable or disable animation
                     return true;
                 default:
                     return super.onOptionsItemSelected(item);
    @@ -280,15 +280,6 @@ public void onClick(View view) {
                         Intent my_center = new Intent(MainActivity.this, Account.class);
                         startActivity(my_center);
                         break;
    -
    -//                case R.id.menu_setting:
    -//                    Intent setting = new Intent(MainActivity.this, Settings.class);
    -//                    startActivity(setting);
    -//                    break;
    -//                case R.id.menu_playground:
    -//                    Intent playground=new Intent(MainActivity.this, TestActivity.class);
    -//                    startActivity(playground);
    -//                    break;
                 }
             }
         }
    diff --git a/app/src/main/java/me/gensh/helloustb/ShareApp.java b/app/src/main/java/me/gensh/helloustb/ShareApp.java
    index 6b710cb..13aadda 100644
    --- a/app/src/main/java/me/gensh/helloustb/ShareApp.java
    +++ b/app/src/main/java/me/gensh/helloustb/ShareApp.java
    @@ -18,7 +18,7 @@ public class ShareApp extends AppCompatActivity {
         protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.activity_share_app);
    -        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_share_app);
    +        Toolbar toolbar = findViewById(R.id.toolbar_share_app);
             setSupportActionBar(toolbar);
             getSupportActionBar().setDisplayShowHomeEnabled(true);
         }
    @@ -48,12 +48,11 @@ public void clickHandle(View v) {
         }
     
         private void shareMe() {
    -        // TODO Auto-generated method stub
             String appDir;
             try {
                 appDir = getPackageManager().getApplicationInfo(this.getPackageName(), 0).sourceDir;
                 appDir = "file://" + appDir;
    -            Uri uri = Uri.parse(appDir);
    +            Uri uri = Uri.parse(appDir);  // TODO: 2017/9/17
                 // 发送
                 Intent intent = new Intent(Intent.ACTION_SEND);
                 intent.putExtra(Intent.EXTRA_STREAM, uri);
    diff --git a/app/src/main/java/me/gensh/helloustb/Timetable.java b/app/src/main/java/me/gensh/helloustb/Timetable.java
    index 077a2fd..4ecc2a3 100644
    --- a/app/src/main/java/me/gensh/helloustb/Timetable.java
    +++ b/app/src/main/java/me/gensh/helloustb/Timetable.java
    @@ -3,8 +3,10 @@
     import android.app.AlertDialog;
     import android.content.Context;
     import android.content.DialogInterface;
    +import android.content.SharedPreferences;
     import android.os.AsyncTask;
     import android.os.Bundle;
    +import android.preference.PreferenceManager;
     import android.support.v4.view.ViewPager;
     import android.support.v7.widget.Toolbar;
     import android.view.LayoutInflater;
    @@ -21,6 +23,7 @@
     import me.gensh.database.StoreData;
     import me.gensh.fragment.TimetableFragment;
     import me.gensh.utils.BasicDate;
    +import me.gensh.utils.Const;
     import me.gensh.utils.LoginDialog;
     import me.gensh.utils.LoginNetworkActivity;
     
    @@ -56,6 +59,7 @@ protected void onCreate(Bundle savedInstanceState) {
             Toolbar toolbar = findViewById(R.id.timetable_toolbar);
             setSupportActionBar(toolbar);
             getSupportActionBar().setDisplayShowHomeEnabled(true);
    +        getSupportActionBar().setSubtitle(getString(R.string.timetable_week_num, getWeekNum() + 1));
             ButterKnife.bind(this);
     
             ViewGroup tab = findViewById(R.id.timetable_tab);
    @@ -73,6 +77,7 @@ protected void onCreate(Bundle savedInstanceState) {
             viewPager.setAdapter(adapter);
             viewPagerTab.setViewPager(viewPager);
     
    +        //set http response error handle.
             setErrorHandler(new ErrorHandler() {
                 @Override
                 public void onPasswordError() {
    @@ -137,6 +142,12 @@ public void onClick(DialogInterface dialog, int which) {
             }
         }
     
    +    private int getWeekNum() {
    +        SharedPreferences pre = PreferenceManager.getDefaultSharedPreferences(this);
    +        long week_start_days = pre.getLong(Const.Settings.KEY_WEEK_START, 0);
    +        return BasicDate.getWeekNum(week_start_days);
    +    }
    +
         @Override
         public void RequestResultHandler(int what, ArrayList data) {
             if (what == 0x101) { // from: verify elearning.ustb.edu.cn  password; post
    diff --git a/app/src/main/java/me/gensh/sdcard/SdCardPro.java b/app/src/main/java/me/gensh/sdcard/SdCardPro.java
    index d58af80..6691735 100644
    --- a/app/src/main/java/me/gensh/sdcard/SdCardPro.java
    +++ b/app/src/main/java/me/gensh/sdcard/SdCardPro.java
    @@ -28,11 +28,11 @@ public static void checkDirExit() {
         }
     
         //
    -    public static void createSDCardDir(String dirName) {
    +    private static void createSDCardDir(String dirName) {
             String path = getSDPath() + dirName;
    -        File Newdir = new File(path);
    -        if (!Newdir.exists()) {
    -            Newdir.mkdirs();
    +        File newDir = new File(path);
    +        if (!newDir.exists()) {
    +            newDir.mkdirs();
             }
         }
     
    diff --git a/app/src/main/java/me/gensh/service/CampusNetworkTest.java b/app/src/main/java/me/gensh/service/CampusNetworkTest.java
    index ff1a6cb..f5a5a73 100644
    --- a/app/src/main/java/me/gensh/service/CampusNetworkTest.java
    +++ b/app/src/main/java/me/gensh/service/CampusNetworkTest.java
    @@ -6,6 +6,7 @@
     import android.content.Context;
     import android.content.Intent;
     import android.content.SharedPreferences;
    +import android.os.Build;
     import android.os.Handler;
     import android.os.Message;
     import android.preference.PreferenceManager;
    @@ -102,8 +103,14 @@ private void handleActionNetworkCheck(String ssid) {
                         mBuilder.setContentTitle(getBaseContext().getString(R.string.network_notify_title))
                                 .setContentText(getBaseContext().getString(R.string.network_notify_content, ssid))
                                 .setTicker(getBaseContext().getString(R.string.network_notify_ticker))
    -                            .setAutoCancel(true)
    -                            .setSmallIcon(R.mipmap.ic_launcher);
    +                            .setAutoCancel(true);
    +
    +                    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    +                        mBuilder.setSmallIcon(R.drawable.ic_adjust_white_24dp);
    +                        mBuilder.setColor(getResources().getColor(R.color.colorPrimary));  // TODO: 2017/9/17
    +                    } else {
    +                        mBuilder.setSmallIcon(R.mipmap.ic_launcher);
    +                    }
     
                         Intent notifyIntent = new Intent(this, NetWorkSignIn.class);
                         notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
    @@ -196,8 +203,15 @@ NotificationCompat.Builder buildNotification(int title, String content) {
             mBuilder.setContentTitle(context.getString(title))
                     .setContentText(content)
                     .setTicker(context.getString(R.string.auto_sign_in_error_ticker))
    -                .setAutoCancel(true)
    -                .setSmallIcon(R.mipmap.ic_launcher);
    +                .setAutoCancel(true);
    +
    +        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    +            mBuilder.setSmallIcon(R.drawable.ic_adjust_white_24dp);
    +            mBuilder.setColor(getResources().getColor(R.color.colorPrimary));  // TODO: 2017/9/17
    +        } else {
    +            mBuilder.setSmallIcon(R.mipmap.ic_launcher);
    +        }
    +
             mNotificationManager.notify(AUTO_SIGN_IN_ERROR_NOTIFY_ID, mBuilder.build());
             return mBuilder;
         }
    diff --git a/app/src/main/java/me/gensh/service/DownloadApk.java b/app/src/main/java/me/gensh/service/DownloadApk.java
    index 0891a9d..ee44815 100644
    --- a/app/src/main/java/me/gensh/service/DownloadApk.java
    +++ b/app/src/main/java/me/gensh/service/DownloadApk.java
    @@ -4,6 +4,7 @@
     import android.app.Service;
     import android.content.Intent;
     import android.net.Uri;
    +import android.os.Build;
     import android.os.Handler;
     import android.os.IBinder;
     import android.os.Message;
    @@ -35,13 +36,19 @@ public class DownloadApk extends Service {
     
         @Override
         public void onCreate() {
    -        mBuilder = new NotificationCompat.Builder(DownloadApk.this)
    -                .setSmallIcon(R.mipmap.ic_launcher)
    +        mBuilder = new NotificationCompat.Builder(DownloadApk.this, "CHANNEL_ID")
                     .setContentTitle(getString(R.string.update_download))
                     .setTicker(getString(R.string.startDownload))
                     .setProgress(0, 0, true)
                     .setContentText(getString(R.string.update_downloading));
     
    +        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    +            mBuilder.setSmallIcon(R.drawable.ic_adjust_white_24dp);
    +            mBuilder.setColor(getResources().getColor(R.color.colorPrimary));  // TODO: 2017/9/17
    +        } else {
    +            mBuilder.setSmallIcon(R.mipmap.ic_launcher);
    +        }
    +
             mNotifyManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
             super.onCreate();
         }
    @@ -81,7 +88,7 @@ public void run() {
                                 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                 intent.setAction(Intent.ACTION_VIEW);
                                 String type = "application/vnd.android.package-archive";
    -                            intent.setDataAndType(Uri.fromFile(file), type);
    +                            intent.setDataAndType(Uri.fromFile(file), type); //// TODO: 2017/9/17
                                 startActivity(intent);
                                 downloading = false;
                                 size = 0;
    @@ -99,7 +106,6 @@ public void run() {
     
         @Override
         public IBinder onBind(Intent intent) {
    -        // TODO Auto-generated catch block
             return null;
         }
     
    @@ -122,6 +128,7 @@ public void handleMessage(Message msg) {
             }
         };
     
    +    // TODO: 2017/9/17
         public File writeToSDfromInput(String path, String fileName, InputStream inputStream) {
             File file = SdCardPro.createSDFile(path + fileName);
             OutputStream outStream;
    @@ -131,7 +138,7 @@ public File writeToSDfromInput(String path, String fileName, InputStream inputSt
                 int count;
                 while ((count = inputStream.read(buffer)) != -1) {
                     outStream.write(buffer, 0, count);
    -                upeadataNotification(count);
    +                updateNotification(count);
                 }
                 outStream.flush();
                 outStream.close();
    @@ -147,7 +154,7 @@ public File writeToSDfromInput(String path, String fileName, InputStream inputSt
             return file;
         }
     
    -    private void upeadataNotification(int count) {
    +    private void updateNotification(int count) {
             download_size += count;
             int percent = (int) (download_size / (size / 100));
             if (download_percent != percent) {
    diff --git a/app/src/main/java/me/gensh/utils/Const.java b/app/src/main/java/me/gensh/utils/Const.java
    index a76e45a..83a2044 100644
    --- a/app/src/main/java/me/gensh/utils/Const.java
    +++ b/app/src/main/java/me/gensh/utils/Const.java
    @@ -5,6 +5,7 @@
      */
     final public class Const {
         public static final class Settings {
    +        public final static String KEY_STU_NO_NUMBER_ONLY = "stu_no_number_only";
             public final static String KEY_WEEK_START = " week_start";
             public static final String KEY_WEEK_NUM = "week_num";
             public static final String KEY_NET_AUTO_SIGN_IN_ENABLE = "net_auto_sign_in_enable";
    diff --git a/app/src/main/java/me/gensh/utils/LoginNetworkActivity.java b/app/src/main/java/me/gensh/utils/LoginNetworkActivity.java
    index 79afdd8..6bec09b 100644
    --- a/app/src/main/java/me/gensh/utils/LoginNetworkActivity.java
    +++ b/app/src/main/java/me/gensh/utils/LoginNetworkActivity.java
    @@ -1,7 +1,12 @@
     package me.gensh.utils;
     
     import android.content.DialogInterface;
    +import android.content.SharedPreferences;
    +import android.preference.PreferenceManager;
    +import android.support.design.widget.TextInputEditText;
     import android.support.v7.app.AlertDialog;
    +import android.text.InputType;
    +import android.text.method.DigitsKeyListener;
     import android.view.View;
     import android.widget.TextView;
     
    @@ -20,7 +25,15 @@ public void Login(final LoginDialog ld, final String tag, final int feedback) {
             passFileName = ld.passFileName;
             if (!SdCardPro.fileIsExists(ld.passFileName)) {
                 canWrite = true;
    -            final View enter = getLayoutInflater().inflate(R.layout.dialog_enter, null);
    +            SharedPreferences pre = PreferenceManager.getDefaultSharedPreferences(this);
    +            boolean numberOnly = pre.getBoolean(Const.Settings.KEY_STU_NO_NUMBER_ONLY, false);
    +            final View enter = getLayoutInflater().inflate(R.layout.dialog_sign_in, null);
    +            TextInputEditText account = enter.findViewById(R.id.account);
    +            if (numberOnly) {  //default is text type.
    +                //use different layout based on value of key KEY_STU_NO_NUMBER_ONLY
    +                account.setInputType(InputType.TYPE_CLASS_NUMBER);
    +            }
    +
                 new AlertDialog.Builder(this)
                         .setTitle(ld.dialog_title)
                         .setView(enter)
    diff --git a/app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml b/app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml
    deleted file mode 100644
    index 14f20f9..0000000
    --- a/app/src/main/res/drawable-v21/ic_notifications_black_24dp.xml
    +++ /dev/null
    @@ -1,9 +0,0 @@
    -
    -    
    -
    diff --git a/app/src/main/res/drawable-v21/ic_sync_black_24dp.xml b/app/src/main/res/drawable-v21/ic_sync_black_24dp.xml
    deleted file mode 100644
    index ab79101..0000000
    --- a/app/src/main/res/drawable-v21/ic_sync_black_24dp.xml
    +++ /dev/null
    @@ -1,9 +0,0 @@
    -
    -    
    -
    \ No newline at end of file
    diff --git a/app/src/main/res/drawable/ic_adjust_white_24dp.xml b/app/src/main/res/drawable/ic_adjust_white_24dp.xml
    new file mode 100644
    index 0000000..bdc6cef
    --- /dev/null
    +++ b/app/src/main/res/drawable/ic_adjust_white_24dp.xml
    @@ -0,0 +1,9 @@
    +
    +    
    +
    diff --git a/app/src/main/res/drawable-v21/ic_menu_account_box.xml b/app/src/main/res/drawable/ic_menu_account_box.xml
    similarity index 100%
    rename from app/src/main/res/drawable-v21/ic_menu_account_box.xml
    rename to app/src/main/res/drawable/ic_menu_account_box.xml
    diff --git a/app/src/main/res/drawable-v21/ic_menu_file_download.xml b/app/src/main/res/drawable/ic_menu_file_download.xml
    similarity index 100%
    rename from app/src/main/res/drawable-v21/ic_menu_file_download.xml
    rename to app/src/main/res/drawable/ic_menu_file_download.xml
    diff --git a/app/src/main/res/drawable-v21/ic_menu_github.xml b/app/src/main/res/drawable/ic_menu_github.xml
    similarity index 100%
    rename from app/src/main/res/drawable-v21/ic_menu_github.xml
    rename to app/src/main/res/drawable/ic_menu_github.xml
    diff --git a/app/src/main/res/drawable-v21/ic_menu_info.xml b/app/src/main/res/drawable/ic_menu_info.xml
    similarity index 100%
    rename from app/src/main/res/drawable-v21/ic_menu_info.xml
    rename to app/src/main/res/drawable/ic_menu_info.xml
    diff --git a/app/src/main/res/drawable-v21/ic_menu_manage.xml b/app/src/main/res/drawable/ic_menu_manage.xml
    similarity index 100%
    rename from app/src/main/res/drawable-v21/ic_menu_manage.xml
    rename to app/src/main/res/drawable/ic_menu_manage.xml
    diff --git a/app/src/main/res/drawable-v21/ic_menu_send.xml b/app/src/main/res/drawable/ic_menu_send.xml
    similarity index 100%
    rename from app/src/main/res/drawable-v21/ic_menu_send.xml
    rename to app/src/main/res/drawable/ic_menu_send.xml
    diff --git a/app/src/main/res/drawable-v21/ic_menu_share.xml b/app/src/main/res/drawable/ic_menu_share.xml
    similarity index 100%
    rename from app/src/main/res/drawable-v21/ic_menu_share.xml
    rename to app/src/main/res/drawable/ic_menu_share.xml
    diff --git a/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/app/src/main/res/drawable/ic_notifications_black_24dp.xml
    deleted file mode 100644
    index 0262382..0000000
    --- a/app/src/main/res/drawable/ic_notifications_black_24dp.xml
    +++ /dev/null
    @@ -1,9 +0,0 @@
    -
    -    
    -
    diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml
    index 3163014..017c100 100644
    --- a/app/src/main/res/layout/app_bar_main.xml
    +++ b/app/src/main/res/layout/app_bar_main.xml
    @@ -27,14 +27,15 @@
     
         
     
    -    
    +    
    +     
    +        
    +        
    +        
    +        
    +        
    +        
    +        
    +        
     
     
    diff --git a/app/src/main/res/layout/dialog_enter.xml b/app/src/main/res/layout/dialog_sign_in.xml
    similarity index 97%
    rename from app/src/main/res/layout/dialog_enter.xml
    rename to app/src/main/res/layout/dialog_sign_in.xml
    index 9bd5f4e..77c38d0 100644
    --- a/app/src/main/res/layout/dialog_enter.xml
    +++ b/app/src/main/res/layout/dialog_sign_in.xml
    @@ -17,7 +17,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:hint="@string/schnum"
    -            android:inputType="number"
    +            android:inputType="text"
                 android:textColorHint="@color/colorPrimary" />
         
     
    diff --git a/app/src/main/res/layout/preference_category_widget.xml b/app/src/main/res/layout/preference_category_widget.xml
    index 89d608c..82ec64d 100644
    --- a/app/src/main/res/layout/preference_category_widget.xml
    +++ b/app/src/main/res/layout/preference_category_widget.xml
    @@ -9,12 +9,10 @@
             android:id="@android:id/title"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
    -        android:paddingEnd="8dp"
    -        android:paddingLeft="8dp"
    -        android:paddingRight="8dp"
    -        android:paddingStart="8dp"
    +        android:paddingLeft="16dp"
    +        android:paddingRight="16dp"
             android:paddingTop="16dp"
    -        android:textColor="@color/green"
    +        android:textColor="@color/colorAccent"
             android:textSize="14sp" />
     
    -
    \ No newline at end of file
    +
    diff --git a/app/src/main/res/layout/preference_item.xml b/app/src/main/res/layout/preference_item.xml
    index ae19599..20f1a13 100644
    --- a/app/src/main/res/layout/preference_item.xml
    +++ b/app/src/main/res/layout/preference_item.xml
    @@ -20,7 +20,7 @@
                 android:layout_height="wrap_content"
                 android:ellipsize="marquee"
                 android:fadingEdge="horizontal"
    -            android:singleLine="true"
    +            android:maxLines="1"
                 android:textColor="@color/preference_item_title_color"
                 android:textSize="16sp" />
     
    diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
    index dedad17..eea67ee 100644
    Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
    diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
    index d69349b..5897de8 100644
    Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
    diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
    index 9b13f0b..18eb432 100644
    Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
    diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
    index 9e192ea..f724c04 100644
    Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
    diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
    index 7a1c7e7..f1298f3 100644
    Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
    diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
    index ff84c6a..654edeb 100644
    --- a/app/src/main/res/values/dimens.xml
    +++ b/app/src/main/res/values/dimens.xml
    @@ -8,7 +8,7 @@
     
         
         25dp
    -    
    +    0dp
     
         20dp
     
    diff --git a/app/src/main/res/values/drawables.xml b/app/src/main/res/values/drawables.xml
    index 52c6a6c..5db5fcc 100644
    --- a/app/src/main/res/values/drawables.xml
    +++ b/app/src/main/res/values/drawables.xml
    @@ -1,8 +1,8 @@
     
    -    @android:drawable/ic_menu_camera
    -    @android:drawable/ic_menu_gallery
    -    @android:drawable/ic_menu_slideshow
    -    @android:drawable/ic_menu_manage
    -    @android:drawable/ic_menu_share
    -    @android:drawable/ic_menu_send
    +    
    +    
    +    
    +    
    +    
    +    
     
    diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
    index a096335..ab87aee 100644
    --- a/app/src/main/res/values/strings.xml
    +++ b/app/src/main/res/values/strings.xml
    @@ -90,6 +90,7 @@
         
         学号
         密码
    +    0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
         请输入登录账号
         
     
    @@ -290,6 +291,7 @@
         课程表导入失败
         正在导入课程表,请稍后…
         分享课表
    +    当前第%d周
         
         
         你今天没有课哟~
    diff --git a/app/src/main/res/xml/general_preferences.xml b/app/src/main/res/xml/general_preferences.xml
    index 36db24b..9317d00 100644
    --- a/app/src/main/res/xml/general_preferences.xml
    +++ b/app/src/main/res/xml/general_preferences.xml
    @@ -1,6 +1,19 @@
     
     
    +
    +    
    +        
    +    
    +
         
    diff --git a/bugs.txt b/bugs.txt
    index 07b4fbe..9368500 100644
    --- a/bugs.txt
    +++ b/bugs.txt
    @@ -2,5 +2,6 @@
     课表的内容可以被首页的内容覆盖【网络延迟】
     
     //todo 浏览器和下载Activity的两个noticefication  ic_launcher图标换下
    +//todo 成绩分享生成图片
     //todo support fragment is still used in LibrarySearchFragment and NetWorkSignInFragment TimetableFragment
     // file first added to repository: https://stackoverflow.com/questions/11533199/find-commit-where-file-was-added
    \ No newline at end of file