Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit 7a713aa

Browse files
Added thank author feature
1 parent 17d3f31 commit 7a713aa

File tree

12 files changed

+176
-13
lines changed

12 files changed

+176
-13
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
<category android:name="android.intent.category.LAUNCHER" />
2020
</intent-filter>
2121
</activity>
22-
<activity android:name=".activity.ReportActivity"></activity>
22+
<activity android:name=".activity.ReportActivity"/>
23+
<activity android:name=".activity.ThankAuthorActivity"/>
2324
</application>
2425

2526
</manifest>

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/MainActivity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ public class MainActivity extends Activity implements Observer{
4343
@Override
4444
protected void onCreate(Bundle savedInstanceState) {
4545
super.onCreate(savedInstanceState);
46-
4746
requestWindowFeature(Window.FEATURE_NO_TITLE);
48-
4947
setContentView(R.layout.activity_main);
5048

5149
activity = this;

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/ReportActivity.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package com.blogspot.e_kanivets.moneytracker.activity;
22

33
import android.app.Activity;
4+
import android.content.Intent;
45
import android.os.Bundle;
6+
import android.view.View;
57
import android.view.ViewTreeObserver;
68
import android.view.Window;
9+
import android.widget.Button;
710
import android.widget.ListView;
811
import android.widget.TextView;
912

@@ -19,25 +22,32 @@ public class ReportActivity extends Activity {
1922

2023
private Activity activity;
2124

22-
private TextView tvTitle;
2325
private ListView listView;
2426

2527
@Override
2628
protected void onCreate(Bundle savedInstanceState) {
2729
super.onCreate(savedInstanceState);
28-
2930
requestWindowFeature(Window.FEATURE_NO_TITLE);
30-
3131
setContentView(R.layout.activity_report);
3232

3333
activity = this;
3434

35-
tvTitle = (TextView) findViewById(R.id.tv_title);
35+
Button btnThankAuthor;
36+
37+
btnThankAuthor = (Button) findViewById(R.id.btn_thank_author);
3638
listView = (ListView) findViewById(R.id.listView);
3739

3840
/*tvTitle.setText("REPORT (" + MTHelper.getInstance().getFirstDay() + " - "
3941
+ MTHelper.getInstance().getLastDay() + ")");*/
4042

43+
btnThankAuthor.setOnClickListener(new View.OnClickListener() {
44+
@Override
45+
public void onClick(View view) {
46+
Intent intent = new Intent(ReportActivity.this, ThankAuthorActivity.class);
47+
startActivity(intent);
48+
}
49+
});
50+
4151
listView.setAdapter(new ReportItemAdapter(activity,
4252
new Report(MTHelper.getInstance().getRecords()).getReportList()));
4353

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.blogspot.e_kanivets.moneytracker.activity;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.view.View;
6+
import android.view.Window;
7+
import android.widget.Button;
8+
9+
import com.blogspot.e_kanivets.moneytracker.R;
10+
11+
/**
12+
* Created by fess on 16.11.2014.
13+
*/
14+
public class ThankAuthorActivity extends Activity {
15+
16+
private Activity activity;
17+
18+
@Override
19+
protected void onCreate(Bundle savedInstanceState) {
20+
super.onCreate(savedInstanceState);
21+
requestWindowFeature(Window.FEATURE_NO_TITLE);
22+
setContentView(R.layout.activity_thank_author);
23+
24+
activity = this;
25+
26+
Button btnWatchVideoAd = (Button) findViewById(R.id.btn_watch_video_ad);
27+
28+
btnWatchVideoAd.setOnClickListener(new View.OnClickListener() {
29+
@Override
30+
public void onClick(View view) {
31+
32+
}
33+
});
34+
}
35+
}

app/src/main/java/com/blogspot/e_kanivets/moneytracker/util/AppUtils.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,16 @@ public static void appRated(Context context) {
4444
editor.putBoolean(Constants.APP_RATED, true);
4545
editor.commit();
4646
}
47+
48+
public static void addContribution(Context context) {
49+
SharedPreferences preferences = context.getSharedPreferences(Constants.APP_NAME, Context.MODE_PRIVATE);
50+
SharedPreferences.Editor editor = preferences.edit();
51+
editor.putInt(Constants.CONTRIBUTION, preferences.getInt(Constants.CONTRIBUTION, 0) + 1);
52+
editor.commit();
53+
}
54+
55+
public static int getContribution(Context context) {
56+
SharedPreferences preferences = context.getSharedPreferences(Constants.APP_NAME, Context.MODE_PRIVATE);
57+
return preferences.getInt(Constants.CONTRIBUTION, 0);
58+
}
4759
}

app/src/main/java/com/blogspot/e_kanivets/moneytracker/util/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ public class Constants {
1717
public static final String APP_RATED = "app_rated";
1818
public static final String LAUNCH_COUNT = "launch_count";
1919
public static final int RATE_PERIOD = 5;
20+
public static final String CONTRIBUTION = "contribution";
2021
}
2.44 KB
Loading
2.56 KB
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:state_pressed="false" android:drawable="@drawable/ic_mood_grey600_48dp"/>
5+
<item android:state_pressed="true" android:drawable="@drawable/ic_mood_black_48dp"/>
6+
</selector>

app/src/main/res/layout/activity_report.xml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,45 @@
88
<LinearLayout
99
android:orientation="horizontal"
1010
android:layout_width="fill_parent"
11-
android:layout_height="wrap_content">
11+
android:layout_height="wrap_content"
12+
android:background="@color/yellow_light">
13+
14+
<Button
15+
android:layout_width="36dp"
16+
android:layout_height="36dp"
17+
android:background="@drawable/selector_thank_author"
18+
android:paddingTop="15dp"
19+
android:paddingBottom="15dp"
20+
android:visibility="invisible"
21+
android:layout_gravity="center_vertical"
22+
android:layout_marginLeft="10dp" />
1223

1324
<TextView
14-
android:layout_width="match_parent"
25+
android:layout_width="0dp"
1526
android:layout_height="match_parent"
1627
android:textAppearance="?android:attr/textAppearanceLarge"
17-
android:text="@string/report"
28+
android:text="@string/report_caps"
1829
android:background="@color/yellow_light"
1930
android:textColor="@color/white"
2031
android:gravity="center"
21-
android:textAllCaps="true"
2232
android:id="@+id/tv_title"
2333
android:layout_weight="1" />
2434

2535
<Button
2636
android:layout_width="0dp"
2737
android:layout_height="wrap_content"
28-
android:id="@+id/btn_report"
2938
android:background="@drawable/selector_report"
39+
android:padding="15dp" />
40+
41+
<Button
42+
android:layout_width="36dp"
43+
android:layout_height="36dp"
44+
android:id="@+id/btn_thank_author"
45+
android:background="@drawable/selector_thank_author"
3046
android:paddingTop="15dp"
31-
android:paddingBottom="15dp" />
47+
android:paddingBottom="15dp"
48+
android:layout_gravity="center_vertical"
49+
android:layout_marginRight="10dp" />
3250
</LinearLayout>
3351

3452
<ListView

0 commit comments

Comments
 (0)