Skip to content

Commit

Permalink
BackupRestore: Add vcard library.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mao Jun committed Apr 9, 2018
1 parent c3587db commit 22716bb
Show file tree
Hide file tree
Showing 59 changed files with 10,848 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ freeline.py
freeline/
freeline_project_description.json

#Mac OS
# Mac OS
.DS_Store
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ dependencies {

implementation project(':loglibrary')
implementation project(':commonlibrary')
implementation project(':vcardlibrary')
implementation project(':modellibrary')

testImplementation "junit:junit:$rootProject.ext.junit_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
package com.koma.backuprestore;

import android.app.Application;
import android.os.StrictMode;

import com.bumptech.glide.Glide;
import com.koma.backuprestore.modellibrary.ApplicationModule;
import com.koma.backuprestore.modellibrary.BackupRestoreRepositoryComponent;
import com.koma.backuprestore.modellibrary.BackupRestoreRepositoryModule;
import com.koma.backuprestore.modellibrary.DaggerBackupRestoreRepositoryComponent;

import backup.koma.com.loglibrary.KomaLog;
import com.koma.loglibrary.KomaLog;

/**
* Created by koma on 2/28/18.
Expand All @@ -42,12 +42,29 @@ public void onCreate() {
.applicationModule(new ApplicationModule(this))
.backupRestoreRepositoryModule(new BackupRestoreRepositoryModule())
.build();

if (BuildConfig.DEBUG) {
setStrictMode();
}
}

public BackupRestoreRepositoryComponent getRepositoryComponent() {
return mRepositoryComponent;
}

private void setStrictMode() {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());

StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.penaltyLog()
.penaltyDeath()
.build());
}

@Override
public void onLowMemory() {
super.onLowMemory();
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/koma/backuprestore/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

import com.koma.backuprestore.commonlibrary.base.BaseActivity;

import java.io.File;

public class MainActivity extends BaseActivity
implements NavigationView.OnNavigationItemSelectedListener {
private static final String TAG = MainActivity.class.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
import com.koma.backuprestore.BackupRestoreApplication;
import com.koma.backuprestore.R;
import com.koma.backuprestore.commonlibrary.base.BaseActivity;
import com.koma.loglibrary.KomaLog;

import javax.inject.Inject;

import backup.koma.com.loglibrary.KomaLog;

public class BackupActivity extends BaseActivity {
private static final String TAG = BackupActivity.class.getSimpleName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

import com.koma.backuprestore.R;
import com.koma.backuprestore.commonlibrary.base.BaseFragment;

import backup.koma.com.loglibrary.KomaLog;
import com.koma.loglibrary.KomaLog;

public class BackupFragment extends BaseFragment implements BackupContract.View {
private static final String TAG = BackupFragment.class.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

import com.koma.backuprestore.modellibrary.BackupRestoreRepository;
import com.koma.backuprestore.modellibrary.entities.Apk;
import com.koma.loglibrary.KomaLog;

import java.util.List;

import javax.inject.Inject;

import backup.koma.com.loglibrary.KomaLog;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
Expand Down
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.restore.dialog;

import dagger.Component;

/**
* Created by koma on 4/8/18.
*/

@Component
public interface RestoreProgressComponent {
void inject(RestoreProgressDialogFragment dialogFragment);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.restore.dialog;

import com.koma.backuprestore.commonlibrary.base.BasePresenter;
import com.koma.backuprestore.commonlibrary.base.BaseView;

/**
* Created by koma on 4/8/18.
*/

public interface RestoreProgressContract {
interface View extends BaseView<Presenter> {
void showSuccessfulMessage();

void setMaxProgress(int maxProgress);

void setCurrentProgress(int progress);

void setMaxCount(int maxCount);

void setCurrentCount(int count);
}

interface Presenter extends BasePresenter {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.restore.dialog;

import android.os.Bundle;
import android.support.v4.widget.ContentLoadingProgressBar;
import android.view.View;
import android.widget.TextView;

import com.koma.backuprestore.R;
import com.koma.backuprestore.commonlibrary.base.BaseDialogFragment;
import com.koma.loglibrary.KomaLog;

import butterknife.BindView;

/**
* Created by koma on 4/8/18.
*/

public class RestoreProgressDialogFragment extends BaseDialogFragment {
private static final String TAG = RestoreProgressDialogFragment.class.getSimpleName();

@BindView(R.id.tv_title)
TextView mTitle;
@BindView(R.id.tv_current_count)
TextView mCurrentCount;
@BindView(R.id.tv_done)
TextView mDone;
@BindView(R.id.tv_total_count)
TextView mTotalCount;
@BindView(R.id.progress_bar)
ContentLoadingProgressBar mProgressBar;

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

KomaLog.i(TAG, "onViewCreated");
}

@Override
public void onDestroyView() {
super.onDestroyView();

KomaLog.i(TAG, "onDestroyView");
}

@Override
protected int getLayoutId() {
return R.layout.dialog_restore;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.restore.dialog;

import com.koma.backuprestore.restore.dialog.RestoreProgressContract.Presenter;

/**
* Created by koma on 4/8/18.
*/

public class RestoreProgressPresenter implements Presenter {
@Override
public void subscribe() {

}

@Override
public void unSubscribe() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.restore.dialog;

import dagger.Module;
import dagger.Provides;

/**
* Created by koma on 4/8/18.
*/

@Module
public class RestoreProgressPresenterModule {
private final RestoreProgressContract.View mView;

public RestoreProgressPresenterModule(RestoreProgressContract.View view) {
mView = view;
}

@Provides
RestoreProgressContract.View provideRestoreProgressContractView() {
return this.mView;
}
}
67 changes: 67 additions & 0 deletions app/src/main/res/layout/dialog_restore.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">

<TextView
android:id="@+id/tv_title"
style="@style/TextAppearance.AppCompat.Title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/nav_header_vertical_spacing"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<android.support.v4.widget.ContentLoadingProgressBar
android:id="@+id/progress_bar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/nav_header_vertical_spacing"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title" />

<TextView
android:id="@+id/tv_total_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/progress_bar" />

<TextView
android:id="@+id/tv_divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/divider_description"
app:layout_constraintBottom_toBottomOf="@id/tv_total_count"
app:layout_constraintEnd_toStartOf="@id/tv_total_count"
app:layout_constraintTop_toTopOf="@id/tv_total_count" />

<TextView
android:id="@+id/tv_current_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/tv_total_count"
app:layout_constraintEnd_toStartOf="@id/tv_divider"
app:layout_constraintTop_toTopOf="@id/tv_total_count" />

<TextView
android:id="@+id/tv_done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/done"
android:textColor="@color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_total_count" />

</android.support.constraint.ConstraintLayout>
15 changes: 15 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<resources>
<string name="app_name">"换机助手"</string>

<string name="navigation_drawer_open">"打开抽屉栏"</string>
<string name="navigation_drawer_close">"关闭抽屉栏"</string>

<string name="action_settings">"设置"</string>

<!--Restore-->
<!--AccessibilityService-->
<string name="accessibility_service_description">"应用自动安装服务"</string>

<!--DialogFragment-->
<string name="done">"完成"</string>
</resources>
Loading

0 comments on commit 22716bb

Please sign in to comment.