-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BackupRestore: Refactor model layer.
- Loading branch information
Mao Jun
committed
Apr 13, 2018
1 parent
fed3e18
commit 6a26470
Showing
47 changed files
with
579 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
app/src/main/java/com/koma/backuprestore/backup/category/CategoryActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright 2017 Koma | ||
* | ||
* 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. | ||
*/ | ||
package com.koma.backuprestore.backup.category; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.widget.Toolbar; | ||
|
||
import com.koma.backuprestore.R; | ||
import com.koma.backuprestore.commonlibrary.base.BaseActivity; | ||
import com.koma.backuprestore.commonlibrary.util.Constants; | ||
import com.koma.loglibrary.KomaLog; | ||
|
||
import butterknife.BindView; | ||
|
||
/** | ||
* Created by koma on 4/11/18. | ||
*/ | ||
|
||
public class CategoryActivity extends BaseActivity { | ||
private static final String TAG = CategoryActivity.class.getSimpleName(); | ||
|
||
@BindView(R.id.toolbar) | ||
Toolbar mToolbar; | ||
|
||
private int mCategory; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
KomaLog.i(TAG, "onCreate"); | ||
} | ||
|
||
@Override | ||
protected int getLayoutId() { | ||
return R.layout.activity_base; | ||
} | ||
|
||
@Override | ||
protected String[] getPermissions() { | ||
return new String[0]; | ||
} | ||
|
||
@Override | ||
protected void onPermissonGranted() { | ||
KomaLog.i(TAG, "onPermissionGranted"); | ||
|
||
mCategory = getIntent().getIntExtra(Constants.CATEGORY_TAG, Constants.CATEGORY_CANTACT); | ||
|
||
setSupportActionBar(mToolbar); | ||
} | ||
|
||
@Override | ||
protected void onNewIntent(Intent newIntent) { | ||
super.onNewIntent(newIntent); | ||
|
||
setIntent(newIntent); | ||
|
||
KomaLog.i(TAG, "onNewIntent"); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/koma/backuprestore/backup/category/CategoryContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2017 Koma | ||
* | ||
* 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. | ||
*/ | ||
package com.koma.backuprestore.backup.category; | ||
|
||
import com.koma.backuprestore.commonlibrary.base.BasePresenter; | ||
import com.koma.backuprestore.commonlibrary.base.BaseView; | ||
|
||
/** | ||
* Created by koma on 4/11/18. | ||
*/ | ||
|
||
public interface CategoryContract { | ||
interface View extends BaseView<Presenter> { | ||
void setLoadingIndicator(boolean isActive); | ||
} | ||
|
||
interface Presenter extends BasePresenter { | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
app/src/main/java/com/koma/backuprestore/backup/category/CategoryFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.koma.backuprestore.backup.category; | ||
|
||
import android.os.Bundle; | ||
import android.support.v4.widget.SwipeRefreshLayout; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.View; | ||
|
||
import com.koma.backuprestore.R; | ||
import com.koma.backuprestore.commonlibrary.base.BaseFragment; | ||
import com.koma.loglibrary.KomaLog; | ||
|
||
import butterknife.BindView; | ||
|
||
/** | ||
* Created by koma on 4/11/18. | ||
*/ | ||
|
||
public class CategoryFragment extends BaseFragment implements CategoryContract.View { | ||
private static final String TAG = CategoryFragment.class.getSimpleName(); | ||
|
||
@BindView(R.id.swipe_refresh_layout) | ||
SwipeRefreshLayout mSwipeRefreshLayout; | ||
@BindView(R.id.recycler_view) | ||
RecyclerView mRecyclerView; | ||
|
||
private CategoryContract.Presenter mPresenter; | ||
|
||
public static CategoryFragment newInstance() { | ||
return new CategoryFragment(); | ||
} | ||
|
||
public CategoryFragment() { | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
|
||
KomaLog.i(TAG, "onViewCreated"); | ||
|
||
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { | ||
@Override | ||
public void onRefresh() { | ||
|
||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void onDestroyView() { | ||
super.onDestroyView(); | ||
|
||
KomaLog.i(TAG, "onDestroyView"); | ||
|
||
if (mPresenter != null) { | ||
mPresenter.unSubscribe(); | ||
} | ||
} | ||
|
||
@Override | ||
public int getLayoutId() { | ||
return R.layout.fragment_base; | ||
} | ||
|
||
@Override | ||
public void setPresenter(CategoryContract.Presenter presenter) { | ||
mPresenter = presenter; | ||
} | ||
|
||
@Override | ||
public void setLoadingIndicator(final boolean isActive) { | ||
mSwipeRefreshLayout.post(new Runnable() { | ||
@Override | ||
public void run() { | ||
mSwipeRefreshLayout.setRefreshing(isActive); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/src/main/java/com/koma/backuprestore/backup/category/CategoryPresenterModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2017 Koma | ||
* | ||
* 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. | ||
*/ | ||
package com.koma.backuprestore.backup.category; | ||
|
||
import dagger.Module; | ||
|
||
/** | ||
* Created by koma on 4/11/18. | ||
*/ | ||
|
||
@Module | ||
public class CategoryPresenterModule { | ||
|
||
} |
25 changes: 0 additions & 25 deletions
25
app/src/main/java/com/koma/backuprestore/base/BaseSwipeRefreshFragment.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.