Skip to content

Commit

Permalink
add account format settting and notification icon adaptation
Browse files Browse the repository at this point in the history
  • Loading branch information
genshen committed Sep 19, 2017
1 parent 0d6e781 commit 98fc17a
Show file tree
Hide file tree
Showing 43 changed files with 282 additions and 120 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
125 changes: 106 additions & 19 deletions app/src/main/assets/open_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
line-height: 1.45;
background-color: #f7f7f7
}






</style>
</head>
<body>
Expand All @@ -62,6 +68,26 @@ <h3>PermissionsDispatcher</h3>

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.</pre>
</li>
<li class="open-source-item">
<h3>butterknife</h3>
<p class="location">
<a href="https://github.com/JakeWharton/butterknife">https://github.com/JakeWharton/butterknife</a>
</p>
<pre class="licence">
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.
Expand Down Expand Up @@ -101,9 +127,7 @@ <h3>Material Dialogs</h3>
<li class="open-source-item">
<h3>williamchart</h3>
<p class="location">
<a href="https://github.com/diogobernardino/WilliamChart">
https://github.com/diogobernardino/WilliamChart
</a>
<a href="https://github.com/diogobernardino/WilliamChart">https://github.com/diogobernardino/WilliamChart</a>
</p>
<pre class="licence">
License
Expand All @@ -126,9 +150,7 @@ <h3>williamchart</h3>
<li class="open-source-item">
<h3>GoogleProgressBar</h3>
<p class="location">
<a href="https://github.com/jpardogo/GoogleProgressBar">
https://github.com/jpardogo/GoogleProgressBar
</a>
<a href="https://github.com/jpardogo/GoogleProgressBar">https://github.com/jpardogo/GoogleProgressBar</a>
</p>
<pre class="licence">
Licence
Expand All @@ -150,9 +172,7 @@ <h3>GoogleProgressBar</h3>
<li class="open-source-item">
<h3>SmartTabLayout</h3>
<p class="location">
<a href="https://github.com/ogaclejapan/SmartTabLayout">
https://github.com/ogaclejapan/SmartTabLayout
</a>
<a href="https://github.com/ogaclejapan/SmartTabLayout">https://github.com/ogaclejapan/SmartTabLayout</a>
</p>
<pre class="licence">
LICENSE
Expand All @@ -176,9 +196,7 @@ <h3>SmartTabLayout</h3>
<li class="open-source-item">
<h3>MaterialRefreshLayout</h3>
<p class="location">
<a href="https://github.com/android-cjj/Android-MaterialRefreshLayout">
https://github.com/android-cjj/Android-MaterialRefreshLayout
</a>
<a href="https://github.com/android-cjj/Android-MaterialRefreshLayout">https://github.com/android-cjj/Android-MaterialRefreshLayout</a>
</p>
<pre class="licence">
License
Expand All @@ -204,17 +222,65 @@ <h3>MaterialRefreshLayout</h3>
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.</pre>
</li>

<li class="open-source-item">
<h3>SearchView</h3>
<p class="location">
<a href="https://github.com/lapism/SearchView">https://github.com/lapism/SearchView</a>
</p>
<pre class="licence">
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.
</pre>
</li>

<li class="open-source-item">
<h3>flexbox-layout</h3>
<p class="location">
<a href="https://github.com/google/flexbox-layout">https://github.com/google/flexbox-layout</a>
</p>
<pre class="licence">
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.
</pre>
</li>

<li class="open-source-item">
<h3>CircleImageView</h3>
<p class="location">
<a href="https://github.com/hdodenhof/CircleImageView">
https://github.com/hdodenhof/CircleImageView
</a>
<a href="https://github.com/hdodenhof/CircleImageView">https://github.com/hdodenhof/CircleImageView</a>
</p>
<pre class="licence">
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.
Expand All @@ -232,9 +298,7 @@ <h3>CircleImageView</h3>
<li class="open-source-item">
<h3>FloatingActionButton</h3>
<p class="location">
<a href="https://github.com/Clans/FloatingActionButton">
https://github.com/Clans/FloatingActionButton
</a>
<a href="https://github.com/Clans/FloatingActionButton">https://github.com/Clans/FloatingActionButton</a>
</p>
<pre class="licence">
License
Expand All @@ -247,6 +311,29 @@ <h3>FloatingActionButton</h3>

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.</pre>
</li>

<li class="open-source-item">
<h3>StatusBarUtil</h3>
<p class="location">
<a href="https://github.com/laobie/StatusBarUtil">https://github.com/laobie/StatusBarUtil</a>
</p>
<pre class="licence">
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.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/me/gensh/fragment/DashboardFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
31 changes: 31 additions & 0 deletions app/src/main/java/me/gensh/fragment/InnovationCreditFragment.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand All @@ -93,6 +101,29 @@ public void onAttach(Context context) {
}
}

/**
* for pre-lollipop version
* see <a>https://stackoverflow.com/questions/32604552/onattach-not-called-in-fragment</a> 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
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/me/gensh/fragment/SettingsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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, "第一周");
}

Expand All @@ -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, "普通模式");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/me/gensh/helloustb/Account.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
13 changes: 10 additions & 3 deletions app/src/main/java/me/gensh/helloustb/Browser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -120,28 +121,34 @@ 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;
}
}
};


// 为发送通知的按钮的点击事件定义事件处理方法
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());
}

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/me/gensh/helloustb/ELearningCategory.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -240,5 +243,6 @@ public void changeSubtitle(@Nullable String subtitle) {
toolbar.setLayoutTransition(new LayoutTransition()); //animation
toolbar.setSubtitle(subtitle);
}

}
}
Loading

0 comments on commit 98fc17a

Please sign in to comment.