|
1 | 1 | package com.blogspot.e_kanivets.moneytracker.activity.base; |
2 | 2 |
|
3 | 3 | import android.app.ProgressDialog; |
4 | | -import android.os.Bundle; |
5 | | -import androidx.annotation.LayoutRes; |
6 | 4 | import androidx.annotation.Nullable; |
7 | 5 | import androidx.annotation.StringRes; |
8 | 6 | import androidx.appcompat.app.AlertDialog; |
|
13 | 11 | import com.blogspot.e_kanivets.moneytracker.MtApp; |
14 | 12 | import com.blogspot.e_kanivets.moneytracker.di.AppComponent; |
15 | 13 |
|
16 | | -import butterknife.ButterKnife; |
17 | | - |
18 | | -/** |
19 | | - * Base implementation of {@link androidx.appcompat.app.AppCompatActivity} to describe some common |
20 | | - * methods. |
21 | | - * Created on 1/26/16. |
22 | | - * |
23 | | - * @author Evgenii Kanivets |
24 | | - */ |
25 | 14 | public abstract class BaseActivity extends AppCompatActivity { |
26 | 15 | @SuppressWarnings("unused") |
27 | 16 | private static final String TAG = "BaseActivity"; |
28 | 17 |
|
29 | 18 | private Toolbar toolbar; |
30 | 19 | protected ProgressDialog progressDialog; |
31 | 20 |
|
32 | | - @Override |
33 | | - protected void onCreate(@Nullable Bundle savedInstanceState) { |
34 | | - super.onCreate(savedInstanceState); |
35 | | - setContentView(getContentViewId()); |
36 | | - |
37 | | - if (initData()) initViews(); |
38 | | - else finish(); |
39 | | - } |
40 | | - |
41 | | - @LayoutRes |
42 | | - protected abstract int getContentViewId(); |
43 | | - |
44 | 21 | protected AppComponent getAppComponent() { |
45 | 22 | return MtApp.get().getAppComponent(); |
46 | 23 | } |
47 | 24 |
|
48 | | - protected boolean initData() { |
49 | | - return true; |
50 | | - } |
51 | | - |
52 | | - protected void initViews() { |
53 | | - ButterKnife.bind(BaseActivity.this); |
54 | | - toolbar = initToolbar(); |
55 | | - } |
56 | | - |
57 | 25 | public Toolbar getToolbar() { |
58 | 26 | return toolbar; |
59 | 27 | } |
|
0 commit comments