24 changed files with 425 additions and 18 deletions
@ -0,0 +1,19 @@ |
|||||||
|
package cc.niushuai.dididone.ui.base; |
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||||
|
|
||||||
|
public abstract class BaseActivity extends AppCompatActivity { |
||||||
|
|
||||||
|
/** |
||||||
|
* 初始化方法 |
||||||
|
* |
||||||
|
* @author niushuai |
||||||
|
* @date: 2022/10/19 15:54 |
||||||
|
*/ |
||||||
|
protected abstract void init(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 监听器 |
||||||
|
*/ |
||||||
|
protected abstract void setListeners(); |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package cc.niushuai.dididone.ui.setting.icon; |
||||||
|
|
||||||
|
import android.os.Bundle; |
||||||
|
import android.view.LayoutInflater; |
||||||
|
import android.view.View; |
||||||
|
import android.view.ViewGroup; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
import androidx.annotation.Nullable; |
||||||
|
import androidx.fragment.app.Fragment; |
||||||
|
|
||||||
|
import cc.niushuai.dididone.databinding.FragmentIconBinding; |
||||||
|
|
||||||
|
public class IconFragment extends Fragment { |
||||||
|
|
||||||
|
private FragmentIconBinding binding; |
||||||
|
|
||||||
|
@Override |
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
||||||
|
binding = FragmentIconBinding.inflate(inflater, container, false); |
||||||
|
View root = binding.getRoot(); |
||||||
|
|
||||||
|
return root; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
package cc.niushuai.dididone.util; |
||||||
|
|
||||||
|
import android.app.Activity; |
||||||
|
import android.content.Intent; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
import cc.niushuai.dididone.ui.base.BaseActivity; |
||||||
|
|
||||||
|
public class ActivityUtil { |
||||||
|
|
||||||
|
public static void startActivity(Activity sourceActivity, Class<? extends BaseActivity> targetActivity) { |
||||||
|
|
||||||
|
startActivity(sourceActivity, targetActivity, null); |
||||||
|
} |
||||||
|
|
||||||
|
public static void startActivity(Activity sourceActivity, Class<? extends BaseActivity> targetActivity, String[] keys, String[] values) { |
||||||
|
|
||||||
|
HashMap<String, String> map = new HashMap<>(); |
||||||
|
for (int i = 0; i < keys.length; i++) { |
||||||
|
map.put(keys[i], values[i]); |
||||||
|
} |
||||||
|
|
||||||
|
startActivity(sourceActivity, targetActivity, map); |
||||||
|
} |
||||||
|
|
||||||
|
public static void startActivity(Activity sourceActivity, Class<? extends BaseActivity> targetActivity, Map<String, String> withData) { |
||||||
|
Intent intent = new Intent(sourceActivity, targetActivity); |
||||||
|
if (null != withData) { |
||||||
|
for (String key : withData.keySet()) { |
||||||
|
intent.putExtra(key, withData.get(key)); |
||||||
|
} |
||||||
|
} |
||||||
|
sourceActivity.startActivity(intent); |
||||||
|
} |
||||||
|
|
||||||
|
public static void startActivityForResult(Activity sourceActivity, Class<? extends BaseActivity> targetActivity, Map<String, String> withData, Integer requestCode) { |
||||||
|
|
||||||
|
Intent intent = new Intent(sourceActivity, targetActivity); |
||||||
|
if (null != withData) { |
||||||
|
for (String key : withData.keySet()) { |
||||||
|
intent.putExtra(key, withData.get(key)); |
||||||
|
} |
||||||
|
} |
||||||
|
sourceActivity.startActivityForResult(intent, requestCode); |
||||||
|
} |
||||||
|
|
||||||
|
public static void startActivityForResult(Activity sourceActivity, Class<? extends BaseActivity> targetActivity, String[] keys, String[] values, Integer requestCode) { |
||||||
|
|
||||||
|
HashMap<String, String> map = new HashMap<>(); |
||||||
|
for (int i = 0; i < keys.length; i++) { |
||||||
|
map.put(keys[i], values[i]); |
||||||
|
} |
||||||
|
startActivityForResult(sourceActivity, targetActivity, map, requestCode); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:shape="rectangle"> |
||||||
|
<solid android:color="@android:color/white" /> |
||||||
|
<corners |
||||||
|
android:radius="15dp" /> |
||||||
|
<stroke |
||||||
|
android:width="1dp" |
||||||
|
android:color="@android:color/white" /> |
||||||
|
</shape> |
@ -0,0 +1,68 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
tools:context=".ui.setting.icon.IconFragment"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical" |
||||||
|
tools:ignore="MissingConstraints"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
|
||||||
|
|
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:text="@string/s_set_project" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -0,0 +1,81 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:background="@color/gray_light" |
||||||
|
tools:context=".ui.setting.SettingFragment"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical" |
||||||
|
> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginStart="10dp" |
||||||
|
android:layout_marginTop="10dp" |
||||||
|
android:text="@string/s_set_app" |
||||||
|
android:textAlignment="inherit" |
||||||
|
android:textColor="#CE21D873" |
||||||
|
android:textSize="30dp" /> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:id="@+id/s_set_app_icon" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/s_set_linear_layout_height" |
||||||
|
android:layout_marginTop="@dimen/s_set_linear_layout_marginTop" |
||||||
|
android:layout_marginLeft="@dimen/s_set_linear_layout_marginLeft" |
||||||
|
android:layout_marginRight="@dimen/s_set_linear_layout_marginRight" |
||||||
|
android:layout_gravity="center_vertical" |
||||||
|
android:background="@drawable/round_text_view_15dp" |
||||||
|
> |
||||||
|
|
||||||
|
<ImageView |
||||||
|
android:layout_width="@dimen/s_set_linear_image_view_size" |
||||||
|
android:layout_height="@dimen/s_set_linear_image_view_size" |
||||||
|
android:layout_marginLeft="@dimen/s_set_linear_image_view_marginLeft" |
||||||
|
android:layout_marginTop="@dimen/s_set_linear_image_view_marginTop" |
||||||
|
app:ico_color="@color/gray" |
||||||
|
app:ico_icon="faw_laugh" /> |
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_marginLeft="@dimen/s_set_linear_text_view_marginLeft" |
||||||
|
android:gravity="left|center" |
||||||
|
android:text="@string/s_set_icon" |
||||||
|
android:textSize="20dp" /> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:id="@+id/s_set_app_project" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/s_set_linear_layout_height" |
||||||
|
android:layout_marginTop="@dimen/s_set_linear_layout_marginTop" |
||||||
|
android:layout_marginLeft="@dimen/s_set_linear_layout_marginLeft" |
||||||
|
android:layout_marginRight="@dimen/s_set_linear_layout_marginRight" |
||||||
|
android:background="@drawable/round_text_view_15dp" |
||||||
|
> |
||||||
|
|
||||||
|
<ImageView |
||||||
|
android:layout_width="@dimen/s_set_linear_image_view_size" |
||||||
|
android:layout_height="@dimen/s_set_linear_image_view_size" |
||||||
|
android:layout_marginLeft="@dimen/s_set_linear_image_view_marginLeft" |
||||||
|
android:layout_marginTop="@dimen/s_set_linear_image_view_marginTop" |
||||||
|
app:ico_color="@color/gray" |
||||||
|
app:ico_icon="cmd_cards_variant" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_marginLeft="@dimen/s_set_linear_text_view_marginLeft" |
||||||
|
android:gravity="left|center" |
||||||
|
android:text="@string/s_set_project" |
||||||
|
android:textSize="20dp" /> |
||||||
|
</LinearLayout> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
|
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<item name="s_set_target_list" type="id" /> |
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<string name="s_set_target">目标</string> |
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
|
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<item name="s_set_target_list" type="id" /> |
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<string name="s_set_target">目标</string> |
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
|
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<item name="s_set_target_list" type="id" /> |
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<string name="s_set_target">目标</string> |
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
|
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<item name="s_set_target_list" type="id" /> |
||||||
|
</resources> |
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<string name="s_set_target">目标</string> |
||||||
|
</resources> |
Loading…
Reference in new issue